diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 50636fc397f..e30907d3acb 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -212,7 +212,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Module/SwayClientUpdate.h # Include/GameClient/Mouse.h Include/GameClient/ParabolicEase.h -# Include/GameClient/ParticleSys.h + Include/GameClient/ParticleSys.h # Include/GameClient/PlaceEventTranslator.h # Include/GameClient/ProcessAnimateWindow.h # Include/GameClient/RadiusDecal.h @@ -828,7 +828,7 @@ set(GAMEENGINE_SRC Source/GameClient/System/Debug/AudioDebugDisplay.cpp # Source/GameClient/System/DebugDisplay.cpp # Source/GameClient/System/Image.cpp -# Source/GameClient/System/ParticleSys.cpp + Source/GameClient/System/ParticleSys.cpp # Source/GameClient/System/RayEffect.cpp Source/GameClient/System/Smudge.cpp Source/GameClient/Terrain/TerrainRoads.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/Core/GameEngine/Include/GameClient/ParticleSys.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h rename to Core/GameEngine/Include/GameClient/ParticleSys.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp rename to Core/GameEngine/Source/GameClient/System/ParticleSys.cpp diff --git a/Core/Tools/CMakeLists.txt b/Core/Tools/CMakeLists.txt index f2e820ad74b..0175ddaf1c7 100644 --- a/Core/Tools/CMakeLists.txt +++ b/Core/Tools/CMakeLists.txt @@ -3,6 +3,7 @@ # Build useful tool binaries. if(RTS_BUILD_CORE_TOOLS) add_subdirectory(DebugWindow) + add_subdirectory(ParticleEditor) endif() # Build less useful tool/test binaries. diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.cpp b/Core/Tools/ParticleEditor/CButtonShowColor.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.cpp rename to Core/Tools/ParticleEditor/CButtonShowColor.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.h b/Core/Tools/ParticleEditor/CButtonShowColor.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CButtonShowColor.h rename to Core/Tools/ParticleEditor/CButtonShowColor.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp b/Core/Tools/ParticleEditor/CColorAlphaDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp rename to Core/Tools/ParticleEditor/CColorAlphaDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h b/Core/Tools/ParticleEditor/CColorAlphaDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CColorAlphaDialog.h rename to Core/Tools/ParticleEditor/CColorAlphaDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt b/Core/Tools/ParticleEditor/CMakeLists.txt similarity index 53% rename from GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt rename to Core/Tools/ParticleEditor/CMakeLists.txt index 7ddf4236472..61c879d51ff 100644 --- a/GeneralsMD/Code/Tools/ParticleEditor/CMakeLists.txt +++ b/Core/Tools/ParticleEditor/CMakeLists.txt @@ -26,32 +26,31 @@ set(PARTICLEED_SRC "VelocityTypePanels.h" ) -add_library(z_particleeditor SHARED) -set_target_properties(z_particleeditor PROPERTIES OUTPUT_NAME particleeditor PREFIX "") +add_library(core_particleeditor SHARED) +set_target_properties(core_particleeditor PROPERTIES OUTPUT_NAME particleeditor PREFIX "") -target_sources(z_particleeditor PRIVATE ${PARTICLEED_SRC}) +target_sources(core_particleeditor PRIVATE ${PARTICLEED_SRC}) -target_include_directories(z_particleeditor PRIVATE +target_include_directories(core_particleeditor PRIVATE include res ) -target_link_libraries(z_particleeditor PRIVATE +target_link_libraries(core_particleeditor PRIVATE core_debug core_profile + corei_always_no_pch + corei_gameengine_include corei_libraries_source_wwvegas corei_libraries_source_wwvegas_wwlib stlport - zi_always_no_pch - zi_gameengine_include - zi_libraries_source_wwvegas ) if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - target_link_options(z_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) - target_compile_definitions(z_particleeditor PRIVATE _AFXDLL) - target_sources(z_particleeditor PRIVATE ParticleEditor.rc) - set_target_properties(z_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) + target_link_options(core_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) + target_compile_definitions(core_particleeditor PRIVATE _AFXDLL) + target_sources(core_particleeditor PRIVATE ParticleEditor.rc) + set_target_properties(core_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) else() - set_target_properties(z_particleeditor PROPERTIES OUTPUT_NAME particleeditor) + set_target_properties(core_particleeditor PROPERTIES OUTPUT_NAME particleeditor) endif() diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h b/Core/Tools/ParticleEditor/CParticleEditorPage.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CParticleEditorPage.h rename to Core/Tools/ParticleEditor/CParticleEditorPage.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.cpp b/Core/Tools/ParticleEditor/CSwitchesDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.cpp rename to Core/Tools/ParticleEditor/CSwitchesDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h b/Core/Tools/ParticleEditor/CSwitchesDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/CSwitchesDialog.h rename to Core/Tools/ParticleEditor/CSwitchesDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.cpp b/Core/Tools/ParticleEditor/EmissionTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.cpp rename to Core/Tools/ParticleEditor/EmissionTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h b/Core/Tools/ParticleEditor/EmissionTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/EmissionTypePanels.h rename to Core/Tools/ParticleEditor/EmissionTypePanels.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h b/Core/Tools/ParticleEditor/ISwapablePanel.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ISwapablePanel.h rename to Core/Tools/ParticleEditor/ISwapablePanel.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.cpp b/Core/Tools/ParticleEditor/MoreParmsDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.cpp rename to Core/Tools/ParticleEditor/MoreParmsDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h b/Core/Tools/ParticleEditor/MoreParmsDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/MoreParmsDialog.h rename to Core/Tools/ParticleEditor/MoreParmsDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp b/Core/Tools/ParticleEditor/ParticleEditor.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.cpp rename to Core/Tools/ParticleEditor/ParticleEditor.cpp diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.def b/Core/Tools/ParticleEditor/ParticleEditor.def similarity index 100% rename from Generals/Code/Tools/ParticleEditor/ParticleEditor.def rename to Core/Tools/ParticleEditor/ParticleEditor.def diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.h b/Core/Tools/ParticleEditor/ParticleEditor.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.h rename to Core/Tools/ParticleEditor/ParticleEditor.h diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.rc b/Core/Tools/ParticleEditor/ParticleEditor.rc similarity index 100% rename from Generals/Code/Tools/ParticleEditor/ParticleEditor.rc rename to Core/Tools/ParticleEditor/ParticleEditor.rc diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Core/Tools/ParticleEditor/ParticleEditorDialog.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp rename to Core/Tools/ParticleEditor/ParticleEditorDialog.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h b/Core/Tools/ParticleEditor/ParticleEditorDialog.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorDialog.h rename to Core/Tools/ParticleEditor/ParticleEditorDialog.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h b/Core/Tools/ParticleEditor/ParticleEditorExport.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleEditorExport.h rename to Core/Tools/ParticleEditor/ParticleEditorExport.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.cpp b/Core/Tools/ParticleEditor/ParticleTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.cpp rename to Core/Tools/ParticleEditor/ParticleTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h b/Core/Tools/ParticleEditor/ParticleTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ParticleTypePanels.h rename to Core/Tools/ParticleEditor/ParticleTypePanels.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/Resource.h b/Core/Tools/ParticleEditor/Resource.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/Resource.h rename to Core/Tools/ParticleEditor/Resource.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.cpp b/Core/Tools/ParticleEditor/ShaderTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.cpp rename to Core/Tools/ParticleEditor/ShaderTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.h b/Core/Tools/ParticleEditor/ShaderTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/ShaderTypePanels.h rename to Core/Tools/ParticleEditor/ShaderTypePanels.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.cpp b/Core/Tools/ParticleEditor/StdAfx.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/StdAfx.cpp rename to Core/Tools/ParticleEditor/StdAfx.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h b/Core/Tools/ParticleEditor/StdAfx.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/StdAfx.h rename to Core/Tools/ParticleEditor/StdAfx.h diff --git a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp b/Core/Tools/ParticleEditor/VelocityTypePanels.cpp similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.cpp rename to Core/Tools/ParticleEditor/VelocityTypePanels.cpp diff --git a/GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h b/Core/Tools/ParticleEditor/VelocityTypePanels.h similarity index 100% rename from GeneralsMD/Code/Tools/ParticleEditor/VelocityTypePanels.h rename to Core/Tools/ParticleEditor/VelocityTypePanels.h diff --git a/Generals/Code/Tools/ParticleEditor/post-build-Release.bat b/Core/Tools/ParticleEditor/post-build-Release.bat similarity index 100% rename from Generals/Code/Tools/ParticleEditor/post-build-Release.bat rename to Core/Tools/ParticleEditor/post-build-Release.bat diff --git a/Generals/Code/Tools/ParticleEditor/post-build.bat b/Core/Tools/ParticleEditor/post-build.bat similarity index 100% rename from Generals/Code/Tools/ParticleEditor/post-build.bat rename to Core/Tools/ParticleEditor/post-build.bat diff --git a/Generals/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 b/Core/Tools/ParticleEditor/res/ParticleEditor.rc2 similarity index 100% rename from Generals/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 rename to Core/Tools/ParticleEditor/res/ParticleEditor.rc2 diff --git a/Generals/CMakeLists.txt b/Generals/CMakeLists.txt index 78f920244e6..bfacf3af3b6 100644 --- a/Generals/CMakeLists.txt +++ b/Generals/CMakeLists.txt @@ -48,14 +48,14 @@ if(RTS_INSTALL_PREFIX_GENERALS) install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) endif() - if(TARGET g_particleeditor) - install(TARGETS g_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) + if(TARGET core_particleeditor) + install(TARGETS core_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) endif() - if(TARGET g_debugwindow) - install(TARGETS g_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) + if(TARGET core_debugwindow) + install(TARGETS core_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_GENERALS}" OPTIONAL) endif() if(TARGET g_guiedit) diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 217d7dcecba..068df25e965 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -200,7 +200,7 @@ set(GAMEENGINE_SRC Include/GameClient/Module/BeaconClientUpdate.h Include/GameClient/Module/SwayClientUpdate.h Include/GameClient/Mouse.h - Include/GameClient/ParticleSys.h +# Include/GameClient/ParticleSys.h Include/GameClient/PlaceEventTranslator.h Include/GameClient/ProcessAnimateWindow.h Include/GameClient/RadiusDecal.h @@ -773,7 +773,7 @@ set(GAMEENGINE_SRC # "Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp" Source/GameClient/System/DebugDisplay.cpp Source/GameClient/System/Image.cpp - Source/GameClient/System/ParticleSys.cpp +# Source/GameClient/System/ParticleSys.cpp Source/GameClient/System/RayEffect.cpp # Source/GameClient/Terrain/TerrainRoads.cpp # Source/GameClient/Terrain/TerrainVisual.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h b/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h deleted file mode 100644 index 92cbe71e17c..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ParticleSys.h +++ /dev/null @@ -1,840 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// ParticleSys.h ////////////////////////////////////////////////////////////////////////////////// -// Particle System type definitions -// Author: Michael S. Booth, November 2001 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/AsciiString.h" -#include "Common/GameMemory.h" -#include "Common/GameType.h" -#include "Common/Snapshot.h" -#include "Common/SubsystemInterface.h" -#include "GameClient/ClientRandomValue.h" - -#include "WWMath/matrix3d.h" ///< @todo Replace with our own matrix library -#include "Common/STLTypedefs.h" - - -/// @todo Once the client framerate is decoupled, the frame counters within will have to become time-based - -class Particle; -class ParticleSystem; -class ParticleSystemManager; -class Drawable; -class Object; -struct FieldParse; -class INI; -class DebugWindowDialog; // really ParticleEditorDialog -class RenderInfoClass; // ick - -enum ParticleSystemID CPP_11(: Int) -{ - INVALID_PARTICLE_SYSTEM_ID = 0 -}; - -#define MAX_VOLUME_PARTICLE_DEPTH ( 16 ) -#define DEFAULT_VOLUME_PARTICLE_DEPTH ( 0 )//The Default is not to do the volume thing! -#define OPTIMUM_VOLUME_PARTICLE_DEPTH ( 6 ) - -// TheSuperHackers @info The X and Y angles are not necessary for particles because there are only 2 placement modes: -// Billboard (always facing camera) and Ground Aligned, which overwrite any rotations on the X and Y axis by design. -// Therefore particles can only be rotated on the Z axis. Zero Hour never had X and Y angles, but Generals did. -#define PARTICLE_USE_XY_ROTATION (0) - -//-------------------------------------------------------------------------------------------------------------- - -enum { MAX_KEYFRAMES=8 }; - -struct Keyframe -{ - Real value; - UnsignedInt frame; -}; - -struct RGBColorKeyframe -{ - RGBColor color; - UnsignedInt frame; -}; - -enum ParticlePriorityType CPP_11(: Int) -{ - INVALID_PRIORITY = 0, - PARTICLE_PRIORITY_LOWEST = 1, -// FLUFF = PARTICLE_PRIORITY_LOWEST, ///< total and absolute fluff -// DEBRIS, ///< debris related particles -// NATURE, ///< neato effects we just might see in the world -// WEAPON, ///< Weapons firing and flying in the air -// DAMAGE, ///< taking damage/dying explosions -// SPECIAL, ///< super special top priority like a superweapon - - WEAPON_EXPLOSION = PARTICLE_PRIORITY_LOWEST, - SCORCHMARK, - DUST_TRAIL, - BUILDUP, - DEBRIS_TRAIL, - UNIT_DAMAGE_FX, - DEATH_EXPLOSION, - SEMI_CONSTANT, - CONSTANT, - WEAPON_TRAIL, - AREA_EFFECT, - CRITICAL, ///< super special top priority like a superweapon - ALWAYS_RENDER, ///< used for logically important display (not just fluff), so must never be culled, regardless of particle cap, lod, etc - // !!! *Noting* goes here ... special is the top priority !!! - NUM_PARTICLE_PRIORITIES, - PARTICLE_PRIORITY_HIGHEST = NUM_PARTICLE_PRIORITIES - 1, -}; - -/** - * This structure is filled out and passed to the constructor of a Particle to initialize it - */ -class ParticleInfo : public Snapshot -{ - -public: - - ParticleInfo( void ); - - Coord3D m_vel; ///< initial velocity - Coord3D m_pos; ///< initial position - Coord3D m_emitterPos; ///< position of the emitter - Real m_velDamping; ///< velocity damping coefficient - -#if PARTICLE_USE_XY_ROTATION - Real m_angleX; ///< initial angle around X axis - Real m_angleY; ///< initial angle around Y axis -#endif - Real m_angleZ; ///< initial angle around Z axis -#if PARTICLE_USE_XY_ROTATION - Real m_angularRateX; ///< initial angle around X axis - Real m_angularRateY; ///< initial angle around Y axis -#endif - Real m_angularRateZ; ///< initial angle around Z axis - Real m_angularDamping; ///< angular velocity damping coefficient - - UnsignedInt m_lifetime; ///< lifetime of this particle - - Real m_size; ///< size of the particle - Real m_sizeRate; ///< rate of change of size - Real m_sizeRateDamping; ///< damping of size change rate - - Keyframe m_alphaKey[ MAX_KEYFRAMES ]; - RGBColorKeyframe m_colorKey[ MAX_KEYFRAMES ]; - - Real m_colorScale; ///< color "scaling" coefficient - - Real m_windRandomness; ///< multiplier for wind randomness per particle - - Bool m_particleUpTowardsEmitter; ///< if this is true, then the 0.0 Z rotation should actually - ///< correspond to the direction of the emitter. - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - -}; - - -/** - * An individual particle created by a ParticleSystem. - * NOTE: Particles cannot exist without a parent particle system. - */ -class Particle : public MemoryPoolObject, - public ParticleInfo -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( Particle, "ParticlePool" ) - -public: - - Particle( ParticleSystem *system, const ParticleInfo *data ); - - Bool update( void ); ///< update this particle's behavior - return false if dead - void doWindMotion( void ); ///< do wind motion (if present) from particle system - - void applyForce( const Coord3D *force ); ///< add the given acceleration - - const Coord3D *getPosition( void ) { return &m_pos; } - Real getSize( void ) { return m_size; } - Real getAngle( void ) { return m_angleZ; } - Real getAlpha( void ) { return m_alpha; } - const RGBColor *getColor( void ) { return &m_color; } - void setColor( RGBColor *color ) { m_color = *color; } - - Bool isInvisible( void ); ///< return true if this particle is invisible - Bool isCulled (void) {return m_isCulled;} ///< return true if the particle falls off the edge of the screen - void setIsCulled (Bool enable) { m_isCulled = enable;} ///< set particle to not visible because it's outside view frustum - - void controlParticleSystem( ParticleSystem *sys ) { m_systemUnderControl = sys; } - void detachControlledParticleSystem( void ) { m_systemUnderControl = nullptr; } - - // get priority of this particle ... which is the priority of the system it belongs to - ParticlePriorityType getPriority( void ); - - UnsignedInt getPersonality(void) { return m_personality; }; - void setPersonality(UnsignedInt p) { m_personality = p; }; - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - - void computeAlphaRate( void ); ///< compute alpha rate to get to next key - void computeColorRate( void ); ///< compute color change to get to next key - -public: - Particle * m_systemNext; - Particle * m_systemPrev; - Particle * m_overallNext; - Particle * m_overallPrev; - -protected: - ParticleSystem * m_system; ///< the particle system this particle belongs to - UnsignedInt m_personality; ///< each new particle assigned a number one higher than the previous - - // most of the particle data is derived from ParticleInfo - - Coord3D m_accel; ///< current acceleration - Coord3D m_lastPos; ///< previous position - UnsignedInt m_lifetimeLeft; ///< lifetime remaining, if zero -> destroy - UnsignedInt m_createTimestamp; ///< frame this particle was created - - Real m_alpha; ///< current alpha of this particle - Real m_alphaRate; ///< current rate of alpha change - Int m_alphaTargetKey; ///< next index into key array - - RGBColor m_color; ///< current color of this particle - RGBColor m_colorRate; ///< current rate of color change - Int m_colorTargetKey; ///< next index into key array - - - Bool m_isCulled; ///< status of particle relative to screen bounds -public: - Bool m_inSystemList; - Bool m_inOverallList; - - union - { - ParticleSystem * m_systemUnderControl; ///< the particle system attached to this particle (not the system that created us) - ParticleSystemID m_systemUnderControlID; ///< id of system attached to this particle (not the system that created us); - }; - -}; - -/** - * All of the properties of a particle system, used by both ParticleSystemTemplates - * and ParticleSystem classes. - */ -class ParticleSystemInfo : public Snapshot -{ - -public: - - ParticleSystemInfo(); ///< to set defaults. - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - - Bool m_isOneShot; ///< if true, destroy system after one burst has occurred - - enum ParticleShaderType - { - INVALID_SHADER=0, ADDITIVE, ALPHA, ALPHA_TEST, MULTIPLY, - PARTICLE_SHADER_TYPE_COUNT - } - m_shaderType; ///< how this particle is rendered - - enum ParticleType - { - INVALID_TYPE=0, PARTICLE, DRAWABLE, STREAK, VOLUME_PARTICLE, SMUDGE, ///< is a particle a 2D-screen-facing particle, or a Drawable, or a Segment in a streak? - PARTICLE_TYPE_COUNT - } - m_particleType; - - AsciiString m_particleTypeName; ///< if PARTICLE, texture filename, if DRAWABLE, Drawable name - -#if PARTICLE_USE_XY_ROTATION - GameClientRandomVariable m_angleX; ///< initial angle around X axis - GameClientRandomVariable m_angleY; ///< initial angle around Y axis -#endif - GameClientRandomVariable m_angleZ; ///< initial angle around Z axis -#if PARTICLE_USE_XY_ROTATION - GameClientRandomVariable m_angularRateX; ///< initial angle around X axis - GameClientRandomVariable m_angularRateY; ///< initial angle around Y axis -#endif - GameClientRandomVariable m_angularRateZ; ///< initial angle around Z axis - GameClientRandomVariable m_angularDamping; ///< angular velocity damping coefficient - - GameClientRandomVariable m_velDamping; ///< velocity damping factor - - GameClientRandomVariable m_lifetime; ///< lifetime of emitted particles - UnsignedInt m_systemLifetime; ///< lifetime of the particle system - - GameClientRandomVariable m_startSize; ///< initial size of emitted particles - GameClientRandomVariable m_startSizeRate; ///< change in start size of emitted particles - GameClientRandomVariable m_sizeRate; ///< rate of change of size - GameClientRandomVariable m_sizeRateDamping; ///< damping of size change - - - UnsignedInt m_volumeParticleDepth; ///< how many layers deep to draw the particle, if >1 - - struct RandomKeyframe - { - GameClientRandomVariable var; ///< the range of values at this keyframe - UnsignedInt frame; ///< the frame number - }; - - - RandomKeyframe m_alphaKey[ MAX_KEYFRAMES ]; - RGBColorKeyframe m_colorKey[ MAX_KEYFRAMES ]; ///< color of particle - - typedef Int Color; - - void tintAllColors( Color tintColor ); - - GameClientRandomVariable m_colorScale; ///< color coefficient - - GameClientRandomVariable m_burstDelay; ///< time between particle emissions - GameClientRandomVariable m_burstCount; ///< number of particles emitted per burst - - GameClientRandomVariable m_initialDelay; ///< delay before particles begin emitting - - Coord3D m_driftVelocity; ///< additional velocity added to all particles - Real m_gravity; ///< gravity acceleration (global Z) for particles in this system - - AsciiString m_slaveSystemName; ///< if non-empty, create a system whose particles track this system's - Coord3D m_slavePosOffset; ///< positional offset of slave particles relative to master's - - AsciiString m_attachedSystemName; ///< if non-empty, create a system attached to each particle of this system - - //------------------------------------------------------- - // The direction and speed at which particles are emitted - enum EmissionVelocityType - { - INVALID_VELOCITY=0, ORTHO, SPHERICAL, HEMISPHERICAL, CYLINDRICAL, OUTWARD, - EMISSION_VELOCITY_TYPE_COUNT - } - m_emissionVelocityType; - - ParticlePriorityType m_priority; - - union - { - struct - { - GameClientRandomVariable x; ///< initial speed of particle along X axis - GameClientRandomVariable y; ///< initial speed of particle along Y axis - GameClientRandomVariable z; ///< initial speed of particle along Z axis - } - ortho; - - struct - { - GameClientRandomVariable speed; ///< initial speed of particle along random radial direction - } - spherical, hemispherical; - - struct - { - GameClientRandomVariable radial; ///< initial speed of particle in the disk - GameClientRandomVariable normal; ///< initial speed of particle perpendicular to disk - } - cylindrical; - - struct - { - GameClientRandomVariable speed; ///< speed outward from emission volume - GameClientRandomVariable otherSpeed; ///< speed along "other" axis, such as cylinder length - } - outward; - } - m_emissionVelocity; - - //---------------------------------------------------------- - // The volume of space where particles are initially created - // Note that the volume is relative to the system's position and orientation - enum EmissionVolumeType - { - INVALID_VOLUME=0, POINT, LINE, BOX, SPHERE, CYLINDER, - EMISSION_VOLUME_TYPE_COUNT - } - m_emissionVolumeType; ///< the type of volume where particles are created - - union emissionVolumeUnion - { - // point just uses system's position - - // line - struct - { - Coord3D start, end; - } - line; - - // box - struct - { - Coord3D halfSize; - } - box; - - // sphere - struct - { - Real radius; - } - sphere; - - // cylinder - struct - { - Real radius; - Real length; - } - cylinder; - } - m_emissionVolume; ///< the dimensions of the emission volume - - Bool m_isEmissionVolumeHollow; ///< if true, only create particles at boundary of volume - Bool m_isGroundAligned; ///< if true, align with the ground. if false, then do the normal billboarding. - Bool m_isEmitAboveGroundOnly; ///< if true, only emit particles when the system is above ground. - Bool m_isParticleUpTowardsEmitter; ///< if true, align the up direction to be towards the emitter. - - enum WindMotion - { - WIND_MOTION_INVALID = 0, - WIND_MOTION_NOT_USED, - WIND_MOTION_PING_PONG, - WIND_MOTION_CIRCULAR, - - WIND_MOTION_COUNT - }; - WindMotion m_windMotion; ///< motion of the wind angle updating - Real m_windAngle; ///< angle of the "wind" associated with this system - Real m_windAngleChange; ///< current how fast the angle changes (higher=faster change) - Real m_windAngleChangeMin; ///< min for angle change - Real m_windAngleChangeMax; ///< max for angle change - Real m_windMotionStartAngle; ///< (for ping pong) angle 1 of the ping pong - Real m_windMotionStartAngleMin; ///< (for ping pong) min angle for angle 1 - Real m_windMotionStartAngleMax; ///< (for ping pong) max angle for angle 1 - Real m_windMotionEndAngle; ///< (for ping pong) angle 2 of the ping pong - Real m_windMotionEndAngleMin; ///< (for ping pong) min angle for angle 2 - Real m_windMotionEndAngleMax; ///< (for ping pong) max angel for angle 2 - Byte m_windMotionMovingToEndAngle; ///< (for ping pong) TRUE if we're moving "towards" the end angle - -}; - -//-------------------------------------------------------------------------------------------------------------- - -#ifdef DEFINE_PARTICLE_SYSTEM_NAMES - -/**** NOTE: These MUST be kept in sync with the enumerations above *****/ - -static const char *const ParticleShaderTypeNames[] = -{ - "NONE", "ADDITIVE", "ALPHA", "ALPHA_TEST", "MULTIPLY", nullptr -}; -static_assert(ARRAY_SIZE(ParticleShaderTypeNames) == ParticleSystemInfo::PARTICLE_SHADER_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const ParticleTypeNames[] = -{ - "NONE", "PARTICLE", "DRAWABLE", "STREAK", "VOLUME_PARTICLE", "SMUDGE", nullptr -}; -static_assert(ARRAY_SIZE(ParticleTypeNames) == ParticleSystemInfo::PARTICLE_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const EmissionVelocityTypeNames[] = -{ - "NONE", "ORTHO", "SPHERICAL", "HEMISPHERICAL", "CYLINDRICAL", "OUTWARD", nullptr -}; -static_assert(ARRAY_SIZE(EmissionVelocityTypeNames) == ParticleSystemInfo::EMISSION_VELOCITY_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const EmissionVolumeTypeNames[] = -{ - "NONE", "POINT", "LINE", "BOX", "SPHERE", "CYLINDER", nullptr -}; -static_assert(ARRAY_SIZE(EmissionVolumeTypeNames) == ParticleSystemInfo::EMISSION_VOLUME_TYPE_COUNT + 1, "Incorrect array size"); - -static const char *const ParticlePriorityNames[] = -{ - "NONE", "WEAPON_EXPLOSION","SCORCHMARK","DUST_TRAIL","BUILDUP","DEBRIS_TRAIL","UNIT_DAMAGE_FX","DEATH_EXPLOSION","SEMI_CONSTANT","CONSTANT","WEAPON_TRAIL","AREA_EFFECT","CRITICAL", "ALWAYS_RENDER", nullptr -}; -static_assert(ARRAY_SIZE(ParticlePriorityNames) == NUM_PARTICLE_PRIORITIES + 1, "Incorrect array size"); - -static const char *const WindMotionNames[] = -{ - "NONE", "Unused", "PingPong", "Circular", nullptr -}; -static_assert(ARRAY_SIZE(WindMotionNames) == ParticleSystemInfo::WIND_MOTION_COUNT + 1, "Incorrect array size"); - -#endif - -/** - * A ParticleSystemTemplate, used by the ParticleSystemManager to instantiate ParticleSystems. - */ -class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystemInfo -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystemTemplate, "ParticleSystemTemplatePool" ) - -public: - ParticleSystemTemplate( const AsciiString &name ); - - AsciiString getName( void ) const { return m_name; } - - // This function was made const because of update modules' module data being all const. - ParticleSystem *createSlaveSystem( Bool createSlaves = TRUE ) const ; ///< if returns non-null, it is a slave system for use - - const FieldParse *getFieldParse( void ) const { return m_fieldParseTable; } ///< Parsing from INI access - static void parseRGBColorKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseRandomKeyframe( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseRandomRGBColor( INI* ini, void *instance, void *store, const void* /*userData*/ ); - static void parseRandomRGBColorRate( INI* ini, void *instance, void *store, const void* /*userData*/ ); - -protected: - friend class ParticleSystemManager; ///< @todo remove this friendship - friend class ParticleSystem; ///< @todo remove this friendship - - // These friendships are naughty but necessary for particle editing. - friend class DebugWindowDialog; ///< @todo remove this friendship when no longer editing particles - friend void _updateAsciiStringParmsToSystem(ParticleSystemTemplate *particleTemplate); - friend void _updateAsciiStringParmsFromSystem(ParticleSystemTemplate *particleTemplate); - friend void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ); - - static const FieldParse m_fieldParseTable[]; ///< the parse table for INI definition - -protected: - AsciiString m_name; ///< the name of this template - - // This has to be mutable because of the delayed initialization thing in createSlaveSystem - mutable const ParticleSystemTemplate *m_slaveTemplate; ///< if non-null, use this to create a slave system - - // template attribute data inherited from ParticleSystemInfo class -}; - -/** - * A particle system, responsible for creating Particles. - * If a particle system has finished, but still has particles "in the air", it must wait - * before destroying itself in order to ensure everything can be cleaned up if the system - * is reset. - */ -class ParticleSystem : public MemoryPoolObject, - public ParticleSystemInfo -{ - - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystem, "ParticleSystemPool" ) - -public: - - ParticleSystem( const ParticleSystemTemplate *sysTemplate, - ParticleSystemID id, - Bool createSlaves ); ///< create a particle system from a template and assign it this ID - - ParticleSystemID getSystemID( void ) const { return m_systemID; } ///< get unique system ID - - void setPosition( const Coord3D *pos ); ///< set the position of the particle system - void getPosition( Coord3D *pos ); ///< get the position of the particle system - void setLocalTransform( const Matrix3D *matrix ); ///< set the system's local transform - void rotateLocalTransformX( Real x ); ///< rotate local transform matrix - void rotateLocalTransformY( Real y ); ///< rotate local transform matrix - void rotateLocalTransformZ( Real z ); ///< rotate local transform matrix - void setSkipParentXfrm(Bool enable) { m_skipParentXfrm = enable; } /// ParticleSystemList; - typedef std::list::iterator ParticleSystemListIt; - typedef std::hash_map, rts::equal_to > TemplateMap; - - ParticleSystemManager( void ); - virtual ~ParticleSystemManager(); - - virtual void init( void ); ///< initialize the manager - virtual void reset( void ); ///< reset the manager and all particle systems - virtual void update( void ); ///< update all particle systems - - virtual Int getOnScreenParticleCount( void ) = 0; ///< returns the number of particles on screen - virtual void setOnScreenParticleCount(int count); - - ParticleSystemTemplate *findTemplate( const AsciiString &name ) const; - ParticleSystemTemplate *findParentTemplate( const AsciiString &name, int parentNum ) const; - ParticleSystemTemplate *newTemplate( const AsciiString &name ); - - /// given a template, instantiate a particle system - ParticleSystem *createParticleSystem( const ParticleSystemTemplate *sysTemplate, - Bool createSlaves = TRUE ); - - /** given a template, instantiate a particle system. - if attachTo is not null, attach the particle system to the given object. - return the particle system's ID, NOT its pointer. - */ - ParticleSystemID createAttachedParticleSystemID( const ParticleSystemTemplate *sysTemplate, - Object* attachTo, - Bool createSlaves = TRUE ); - - /// find a particle system given a unique system identifier - ParticleSystem *findParticleSystem( ParticleSystemID id ); - - /// destroy the particle system with the given id (if it still exists) - void destroyParticleSystemByID(ParticleSystemID id); - - /// return iterators to the particle system template - TemplateMap::iterator beginParticleSystemTemplate() { return m_templateMap.begin(); } - TemplateMap::iterator endParticleSystemTemplate() { return m_templateMap.end(); } - TemplateMap::const_iterator beginParticleSystemTemplate() const { return m_templateMap.begin(); } - TemplateMap::const_iterator endParticleSystemTemplate() const { return m_templateMap.end(); } - - /// destroy attached systems to object - void destroyAttachedSystems( Object *obj ); - - void setLocalPlayerIndex(Int index) {m_localPlayerIndex=index;} - void addParticle( Particle *particleToAdd, ParticlePriorityType priority ); - void removeParticle( Particle *particleToRemove ); - Int removeOldestParticles( UnsignedInt count, ParticlePriorityType priorityCap ); - UnsignedInt getParticleCount( void ) const { return m_particleCount; } - - UnsignedInt getFieldParticleCount( void ) const { return m_fieldParticleCount; } - - UnsignedInt getParticleSystemCount( void ) const { return m_particleSystemCount; } - - // @todo const this jkmcd - ParticleSystemList &getAllParticleSystems( void ) { return m_allParticleSystemList; } - - virtual void doParticles(RenderInfoClass &rinfo) = 0; - virtual void queueParticleRender() = 0; - - virtual void preloadAssets( TimeOfDay timeOfDay ); - - // these are only for use by partcle systems to link and unlink themselves - void friend_addParticleSystem( ParticleSystem *particleSystemToAdd ); - void friend_removeParticleSystem( ParticleSystem *particleSystemToRemove ); - -protected: - - // snapshot methods - virtual void crc( Xfer *xfer ); - virtual void xfer( Xfer *xfer ); - virtual void loadPostProcess( void ); - - Particle *m_allParticlesHead[ NUM_PARTICLE_PRIORITIES ]; - Particle *m_allParticlesTail[ NUM_PARTICLE_PRIORITIES ]; - - ParticleSystemID m_uniqueSystemID; ///< unique system ID to assign to each system created - - ParticleSystemList m_allParticleSystemList; - - UnsignedInt m_particleCount; - UnsignedInt m_fieldParticleCount; ///< this does not need to be xfered, since it is evaluated every frame - UnsignedInt m_particleSystemCount; - Int m_onScreenParticleCount; ///< number of particles displayed on screen per frame - UnsignedInt m_lastLogicFrameUpdate; - Int m_localPlayerIndex; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// ParticleSys.cpp //////////////////////////////////////////////////////////////////////////////// -// Particle System implementation -// Author: Michael S. Booth, November 2001 -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#define DEFINE_PARTICLE_SYSTEM_NAMES - -#include "Common/GameState.h" -#include "Common/INI.h" -#include "Common/PerfTimer.h" -#include "Common/ThingFactory.h" -#include "Common/GameLOD.h" -#include "Common/Xfer.h" - -#include "GameClient/Drawable.h" -#include "GameClient/DebugDisplay.h" -#include "GameClient/Display.h" -#include "GameClient/GameClient.h" -#include "GameClient/InGameUI.h" -#include "GameClient/ParticleSys.h" - -#include "GameLogic/GameLogic.h" -#include "GameLogic/Object.h" -#include "GameLogic/TerrainLogic.h" - - -//------------------------------------------------------------------------------ Performance Timers -//#include "Common/PerfMetrics.h" -//#include "Common/PerfTimer.h" - -//static PerfTimer s_particleSys("ParticleSys::update", false, PERFMETRICS_LOGIC_STARTFRAME, PERFMETRICS_LOGIC_STOPFRAME); -//------------------------------------------------------------------------------------------------- - -// the singleton -ParticleSystemManager *TheParticleSystemManager = nullptr; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleInfo::ParticleInfo( void ) -{ -#if PARTICLE_USE_XY_ROTATION - m_angleX = 0.0f; - m_angleY = 0.0f; -#endif - m_angleZ = 0.0f; -#if PARTICLE_USE_XY_ROTATION - m_angularRateX = 0.0f; - m_angularRateY = 0.0f; -#endif - m_angularRateZ = 0.0f; - m_angularDamping = 0.0f; - m_colorScale =0.0f; - m_size = 0.0f; - m_sizeRate = 0.0f; - m_sizeRateDamping = 0.0f; - m_velDamping = 0.0f; - m_windRandomness = 0.0f; - - m_emitterPos.zero(); - m_pos.zero(); - m_vel.zero(); - - m_lifetime = 0; - m_particleUpTowardsEmitter = FALSE; - -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleInfo::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleInfo::xfer( Xfer *xfer ) -{ - Int i; - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // velocity - xfer->xferCoord3D( &m_vel ); - - // position - xfer->xferCoord3D( &m_pos ); - - // emitter position - xfer->xferCoord3D( &m_emitterPos ); - - // velocity damping - xfer->xferReal( &m_velDamping ); - - // angle -#if PARTICLE_USE_XY_ROTATION - xfer->xferReal( &m_angleX ); - xfer->xferReal( &m_angleY ); -#else - Real tempAngle=0; //temporary value to save out for backwards compatibility when we supported x,y - xfer->xferReal( &tempAngle ); - xfer->xferReal( &tempAngle ); -#endif - xfer->xferReal( &m_angleZ ); - - // angular rate -#if PARTICLE_USE_XY_ROTATION - xfer->xferReal( &m_angularRateX ); - xfer->xferReal( &m_angularRateY ); -#else - xfer->xferReal( &tempAngle ); - xfer->xferReal( &tempAngle ); -#endif - xfer->xferReal( &m_angularRateZ ); - - // lifetime - xfer->xferUnsignedInt( &m_lifetime ); - - // size - xfer->xferReal( &m_size ); - - // size rate - xfer->xferReal( &m_sizeRate ); - - // size rate damping - xfer->xferReal( &m_sizeRateDamping ); - - // alpha keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferReal( &m_alphaKey[ i ].value ); - xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - - } - - // color keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferRGBColor( &m_colorKey[ i ].color ); - xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - - } - - // color scale - xfer->xferReal( &m_colorScale ); - - // particle up towards emitter - xfer->xferBool( &m_particleUpTowardsEmitter ); - - // wind randomness - xfer->xferReal( &m_windRandomness ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleInfo::loadPostProcess( void ) -{ - -} - -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -enum -{ - MAX_SIZE_BONUS = 50 -}; - - -//todo move this somewhere more useful. -static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB); - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Particle /////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -/** Compute alpha rate to get to next key on given frame */ -// ------------------------------------------------------------------------------------------------ -void Particle::computeAlphaRate( void ) -{ - if (m_alphaKey[ m_alphaTargetKey ].frame == 0) - { - m_alphaRate = 0.0f; - return; - } - - Real delta = m_alphaKey[ m_alphaTargetKey ].value - m_alphaKey[ m_alphaTargetKey-1 ].value; - UnsignedInt time = m_alphaKey[ m_alphaTargetKey ].frame - m_alphaKey[ m_alphaTargetKey-1 ].frame; - - m_alphaRate = delta/time; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute color rate to get to next key on given frame */ -// ------------------------------------------------------------------------------------------------ -void Particle::computeColorRate( void ) -{ - if (m_colorKey[ m_colorTargetKey ].frame == 0) - { - m_colorRate.red = 0.0f; - m_colorRate.green = 0.0f; - m_colorRate.blue = 0.0f; - return; - } - - UnsignedInt time = m_colorKey[ m_colorTargetKey ].frame - m_colorKey[ m_colorTargetKey-1 ].frame; - Real delta = m_colorKey[ m_colorTargetKey ].color.red - m_colorKey[ m_colorTargetKey-1 ].color.red; - m_colorRate.red = delta/time; - - delta = m_colorKey[ m_colorTargetKey ].color.green - m_colorKey[ m_colorTargetKey-1 ].color.green; - m_colorRate.green = delta/time; - - delta = m_colorKey[ m_colorTargetKey ].color.blue - m_colorKey[ m_colorTargetKey-1 ].color.blue; - m_colorRate.blue = delta/time; -} - -// ------------------------------------------------------------------------------------------------ -/** Construct a particle from a particle template */ -// ------------------------------------------------------------------------------------------------ -Particle::Particle( ParticleSystem *system, const ParticleInfo *info ) -{ - m_system = system; - - m_isCulled = FALSE; - m_accel.x = 0.0f; - m_accel.y = 0.0f; - m_accel.z = 0.0f; - - m_vel = info->m_vel; - m_pos = info->m_pos; - -#if PARTICLE_USE_XY_ROTATION - m_angleX = info->m_angleX; - m_angleY = info->m_angleY; -#endif - m_angleZ = info->m_angleZ; - - m_lastPos.zero(); - m_windRandomness = info->m_windRandomness; - m_particleUpTowardsEmitter = info->m_particleUpTowardsEmitter; - m_emitterPos = info->m_emitterPos; - -#if PARTICLE_USE_XY_ROTATION - m_angularRateX = info->m_angularRateX; - m_angularRateY = info->m_angularRateY; -#endif - m_angularRateZ = info->m_angularRateZ; - m_angularDamping = info->m_angularDamping; - - m_velDamping = info->m_velDamping; - - m_lifetime = info->m_lifetime; - m_lifetimeLeft = info->m_lifetime; - m_createTimestamp = TheGameClient->getFrame(); - m_personality = 0; - - m_size = info->m_size; - m_sizeRate = info->m_sizeRate; - m_sizeRateDamping = info->m_sizeRateDamping; - - // set up alpha - int i=0; - for( ; im_alphaKey[i]; - - m_alpha = m_alphaKey[0].value; - m_alphaTargetKey = 1; - computeAlphaRate(); - - // set up colors - for( i=0; im_colorKey[i]; - - m_color = m_colorKey[0].color; - m_colorTargetKey = 1; - computeColorRate(); - - m_colorScale = info->m_colorScale; - - m_inSystemList = m_inOverallList = FALSE; - m_systemPrev = m_systemNext = m_overallPrev = m_overallNext = nullptr; - - // add this particle to the global list, retaining particle creation order - TheParticleSystemManager->addParticle(this, system->getPriority() ); - - // add this particle to the Particle System list, retaining local creation order - m_system->addParticle(this); - - //DEBUG_ASSERTLOG(!(totalParticleCount % 100 == 0), ( "TotalParticleCount = %d", m_totalParticleCount )); -} - -// ------------------------------------------------------------------------------------------------ -/** Destructor */ -// ------------------------------------------------------------------------------------------------ -Particle::~Particle() -{ - // tell the particle system that this particle is gone - m_system->removeParticle( this ); - - // if this particle was controlling another particle system, destroy that system - if (m_systemUnderControl) - { - m_systemUnderControl->detachControlParticle( this ); - m_systemUnderControl->destroy(); - } - m_systemUnderControl = nullptr; - - // remove from the global list - TheParticleSystemManager->removeParticle(this); - - //DEBUG_ASSERTLOG(!(totalParticleCount % 100 == 0), ( "TotalParticleCount = %d", m_totalParticleCount )); -} - -// ------------------------------------------------------------------------------------------------ -/** Add the given acceleration */ -// ------------------------------------------------------------------------------------------------ -void Particle::applyForce( const Coord3D *force ) -{ - m_accel.x += force->x; - m_accel.y += force->y; - m_accel.z += force->z; -} - -// ------------------------------------------------------------------------------------------------ -/** Update the behavior of an individual particle */ -// ------------------------------------------------------------------------------------------------ -Bool Particle::update( void ) -{ - // integrate acceleration into velocity - m_vel.x += m_accel.x; - m_vel.y += m_accel.y; - m_vel.z += m_accel.z; - - m_vel.x *= m_velDamping; - m_vel.y *= m_velDamping; - m_vel.z *= m_velDamping; - - // integrate velocity into position - const Coord3D *driftVel = m_system->getDriftVelocity(); - m_pos.x += m_vel.x + driftVel->x; - m_pos.y += m_vel.y + driftVel->y; - m_pos.z += m_vel.z + driftVel->z; - - // integrate the wind (if specified) into position - ParticleSystemInfo::WindMotion windMotion = m_system->getWindMotion(); - - // see if we should even do anything - if( windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED ) - doWindMotion(); - - // update orientation -#if PARTICLE_USE_XY_ROTATION - m_angleX += m_angularRateX; - m_angleY += m_angularRateY; -#endif - m_angleZ += m_angularRateZ; -#if PARTICLE_USE_XY_ROTATION - m_angularRateX *= m_angularDamping; - m_angularRateY *= m_angularDamping; -#endif - m_angularRateZ *= m_angularDamping; - - if (m_particleUpTowardsEmitter) { - // adjust the up position back towards the particle - static const Coord2D upVec = { 0.0f, 1.0f }; - Coord2D emitterDir; - emitterDir.x = m_pos.x - m_emitterPos.x; - emitterDir.y = m_pos.y - m_emitterPos.y; - m_angleZ = (angleBetween(&upVec, &emitterDir) + PI); - } - - // update size - m_size += m_sizeRate; - m_sizeRate *= m_sizeRateDamping; - - // - // Update alpha (if used) - // - - if (m_system->getShaderType() != ParticleSystemInfo::ADDITIVE) - { - m_alpha += m_alphaRate; - - if (m_alphaTargetKey < MAX_KEYFRAMES && m_alphaKey[ m_alphaTargetKey ].frame) - { - if (TheGameClient->getFrame() - m_createTimestamp >= m_alphaKey[ m_alphaTargetKey ].frame) - { - m_alpha = m_alphaKey[ m_alphaTargetKey ].value; - m_alphaTargetKey++; - computeAlphaRate(); - } - } - else - m_alphaRate = 0.0f; - - if (m_alpha < 0.0f) - m_alpha = 0.0f; - else if (m_alpha > 1.0f) - m_alpha = 1.0f; - } - - - // - // Update color - // - m_color.red += m_colorRate.red; - m_color.green += m_colorRate.green; - m_color.blue += m_colorRate.blue; - - if (m_colorTargetKey < MAX_KEYFRAMES && m_colorKey[ m_colorTargetKey ].frame) - { - if (TheGameClient->getFrame() - m_createTimestamp >= m_colorKey[ m_colorTargetKey ].frame) - { - // can't set, because of colorscale - // m_color = m_colorKey[ m_colorTargetKey ].color; - m_colorTargetKey++; - computeColorRate(); - } - } - else - { - m_colorRate.red = 0.0f; - m_colorRate.green = 0.0f; - m_colorRate.blue = 0.0f; - } - - /// @todo Rethink this - at least its name - m_color.red += m_colorScale; - m_color.green += m_colorScale; - m_color.blue += m_colorScale; - - if (m_color.red < 0.0f) - m_color.red = 0.0f; - else if (m_color.red > 1.0f) - m_color.red = 1.0f; - - if (m_color.red < 0.0f) - m_color.green = 0.0f; - else if (m_color.green > 1.0f) - m_color.green = 1.0f; - - if (m_color.blue < 0.0f) - m_color.blue = 0.0f; - else if (m_color.blue > 1.0f) - m_color.blue = 1.0f; - - - // reset the acceleration for accumulation next frame - m_accel.x = 0.0f; - m_accel.y = 0.0f; - m_accel.z = 0.0f; - - // monitor lifetime - if (m_lifetimeLeft && --m_lifetimeLeft == 0) - return false; - - DEBUG_ASSERTCRASH( m_lifetimeLeft, ( "A particle has an infinite lifetime..." )); - - // if we've gone totally invisible, destroy ourselves - if (isInvisible()) - return false; - return true; -} - -// ------------------------------------------------------------------------------------------------ -/** Do wind motion as specified by the particle system template, if present */ -// ------------------------------------------------------------------------------------------------ -void Particle::doWindMotion( void ) -{ - - // get the angle of the wind - Real windAngle = m_system->getWindAngle(); - - // get the system position - Coord3D systemPos; - m_system->getPosition( &systemPos ); - - // when we're attached objects and drawables we offset by that position as well - if( ObjectID attachedObj = m_system->getAttachedObject() ) - { - Object *obj = TheGameLogic->findObjectByID( attachedObj ); - - if( obj ) - { - const Coord3D *objPos = obj->getPosition(); - - systemPos.x += objPos->x; - systemPos.y += objPos->y; - systemPos.z += objPos->z; - - } - - } - else if( DrawableID attachedDraw = m_system->getAttachedDrawable() ) - { - Drawable *draw = TheGameClient->findDrawableByID( attachedDraw ); - - if( draw ) - { - const Coord3D *drawPos = draw->getPosition(); - - systemPos.x += drawPos->x; - systemPos.y += drawPos->y; - systemPos.z += drawPos->z; - - } - - } - - // - // compute a vector from the system position in the world to the particle ... we will use - // this to compute how much force we apply - // - Coord3D v; - v.x = m_pos.x - systemPos.x; - v.y = m_pos.y - systemPos.y; - v.z = m_pos.z - systemPos.z; - - // distance amounts for full force from wind and no force at all - Real fullForceDistance = 75.0f; - Real noForceDistance = 200.0f; - - // - // given the distance from the wind position to the particle ... figure out how much - // force we're going to apply to it. When it's further away (outside of the full force - // distance) we will apply only a fraction of the force - // - - Real distFromWind = v.length(); - if( distFromWind < noForceDistance ) - { - Real windForceStrength = 2.0f * m_windRandomness; - - // only apply force if still within the circle of influence - if( distFromWind > fullForceDistance ) - windForceStrength *= (1.0f - ((distFromWind - fullForceDistance) / - (noForceDistance - fullForceDistance))); - - // integrate the wind motion into the position - m_pos.x += (Cos( windAngle ) * windForceStrength); - m_pos.y += (Sin( windAngle ) * windForceStrength); - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Get priority of a particle ... which is the priority of it's attached system */ -// ------------------------------------------------------------------------------------------------ -ParticlePriorityType Particle::getPriority( void ) -{ - return m_system->getPriority(); -} - -// ------------------------------------------------------------------------------------------------ -/** Return true if this particle is invisible */ -// ------------------------------------------------------------------------------------------------ -Bool Particle::isInvisible( void ) -{ - switch (m_system->getShaderType()) - { - case ParticleSystemInfo::ADDITIVE: - // if color is black, this particle is invisible - - // check that we're not in the process of going to another color - if (m_colorKey[ m_colorTargetKey ].frame == 0) - { - if (m_color.red < 0.01f && m_color.green < 0.01f && m_color.blue < 0.01f) - return true; - } - return false; - - case ParticleSystemInfo::ALPHA: - // if alpha is zero, this particle is invisible - if (m_alpha < 0.01f) - return true; - return false; - - case ParticleSystemInfo::ALPHA_TEST: - // hmm... assume these particles are never invisible - return false; - - case ParticleSystemInfo::MULTIPLY: - // if color is white, this particle is invisible - - // check that we're not in the process of going to another color - if (m_colorKey[ m_colorTargetKey ].frame == 0) - { - if (m_color.red > 0.99f && m_color.green > 0.99f && m_color.blue > 0.99f) - return true; - } - return false; - } - - // should never get here - if we do, data is incorrect - return true; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void Particle::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void Particle::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // base class particle info - ParticleInfo::xfer( xfer ); - - // personality - xfer->xferUnsignedInt( &m_personality ); - - // acceleration - xfer->xferCoord3D( &m_accel ); - - // last position - xfer->xferCoord3D( &m_lastPos ); - - // lifetime left - xfer->xferUnsignedInt( &m_lifetimeLeft ); - - // creation timestamp - xfer->xferUnsignedInt( &m_createTimestamp ); - - // alpha - xfer->xferReal( &m_alpha ); - - // alpha rate - xfer->xferReal( &m_alphaRate ); - - // alpha target key - xfer->xferInt( &m_alphaTargetKey ); - - // color - xfer->xferRGBColor( &m_color ); - - // color rate - xfer->xferRGBColor( &m_colorRate ); - - // color target key - xfer->xferInt( &m_colorTargetKey ); - - // drawable - DrawableID drawableID = INVALID_DRAWABLE_ID; - xfer->xferDrawableID( &drawableID ); //saving for backwards compatibility when we supported drawables. - - // system under control as an id - ParticleSystemID systemUnderControlID = m_systemUnderControl ? m_systemUnderControl->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; - xfer->xferUser( &systemUnderControlID, sizeof( ParticleSystemID ) ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void Particle::loadPostProcess( void ) -{ - - // call base class post process - ParticleInfo::loadPostProcess(); - - // tidy up the m_systemUnderControl pointer - if( m_systemUnderControlID != INVALID_PARTICLE_SYSTEM_ID ) - { - ParticleSystem *system; - - // find system - system = TheParticleSystemManager->findParticleSystem( m_systemUnderControlID ); - - // set us as the control particle for this system - system->setControlParticle( this ); - controlParticleSystem( system ); - - // sanity - if( m_systemUnderControlID == INVALID_PARTICLE_SYSTEM_ID ) - { - - DEBUG_CRASH(( "Particle::loadPostProcess - Unable to find system under control pointer" )); - throw SC_INVALID_DATA; - - } - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemInfo::ParticleSystemInfo() -{ - m_priority = PARTICLE_PRIORITY_LOWEST; - m_isGroundAligned = false; - m_isEmitAboveGroundOnly = false; - m_isParticleUpTowardsEmitter = false; - - m_driftVelocity.zero(); - m_gravity = 0.0f; - m_isEmissionVolumeHollow = FALSE; - m_isOneShot = FALSE; - m_slavePosOffset.zero(); - m_systemLifetime = 0; - - // some default values for the wind motion values - m_windMotion = WIND_MOTION_NOT_USED; - m_windAngle = 0.0f; - m_windAngleChange = 0.15f; // higher is ping pong faster - m_windAngleChangeMin = 0.15f; - m_windAngleChangeMax = 0.45f; - m_windMotionStartAngleMin = 0.0f; - m_windMotionStartAngleMax = PI / 4.0f; - m_windMotionStartAngle = m_windMotionStartAngleMin; - m_windMotionEndAngleMin = TWO_PI - (PI / 4.0f); - m_windMotionEndAngleMax = TWO_PI; - m_windMotionEndAngle = m_windMotionEndAngleMin; - m_windMotionMovingToEndAngle = TRUE; - m_volumeParticleDepth = DEFAULT_VOLUME_PARTICLE_DEPTH; - -} - - -void ParticleSystemInfo::tintAllColors( Color tintColor ) -{ - RGBColor rgb; - rgb.setFromInt(tintColor); - - //This tints all but the first colorKey!!! - for (int key = 1; key < MAX_KEYFRAMES; ++key ) - { - m_colorKey[ key ].color.red *= (Real)(rgb.red ) / 255.0f; - m_colorKey[ key ].color.green *= (Real)(rgb.green) / 255.0f; - m_colorKey[ key ].color.blue *= (Real)(rgb.blue ) / 255.0f; - } - -} - - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemInfo::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemInfo::xfer( Xfer *xfer ) -{ - Int i; - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // is one shot - xfer->xferBool( &m_isOneShot ); - - // shader type - xfer->xferUser( &m_shaderType, sizeof( ParticleShaderType ) ); - - // particle type - xfer->xferUser( &m_particleType, sizeof( ParticleType ) ); - - // particle type name - xfer->xferAsciiString( &m_particleTypeName ); - - // angles -#if PARTICLE_USE_XY_ROTATION - xfer->xferUser( &m_angleX, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_angleY, sizeof( GameClientRandomVariable ) ); -#else - GameClientRandomVariable tempRandom; //for backwards compatibility when we supported x,y - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); -#endif - xfer->xferUser( &m_angleZ, sizeof( GameClientRandomVariable ) ); - - // angular rate -#if PARTICLE_USE_XY_ROTATION - xfer->xferUser( &m_angularRateX, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_angularRateY, sizeof( GameClientRandomVariable ) ); -#else - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &tempRandom, sizeof( GameClientRandomVariable ) ); -#endif - xfer->xferUser( &m_angularRateZ, sizeof( GameClientRandomVariable ) ); - - // angular damping - xfer->xferUser( &m_angularDamping, sizeof( GameClientRandomVariable ) ); - - // velocity damping - xfer->xferUser( &m_velDamping, sizeof( GameClientRandomVariable ) ); - - // lifetime - xfer->xferUser( &m_lifetime, sizeof( GameClientRandomVariable ) ); - - // system lifetime - xfer->xferUnsignedInt( &m_systemLifetime ); - - // start size - xfer->xferUser( &m_startSize, sizeof( GameClientRandomVariable ) ); - - // start size rate - xfer->xferUser( &m_startSizeRate, sizeof( GameClientRandomVariable ) ); - - // size rate - xfer->xferUser( &m_sizeRate, sizeof( GameClientRandomVariable ) ); - - // size rate damping - xfer->xferUser( &m_sizeRateDamping, sizeof( GameClientRandomVariable ) ); - - // alpha keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferUser( &m_alphaKey[ i ].var, sizeof( GameClientRandomVariable ) ); - xfer->xferUnsignedInt( &m_alphaKey[ i ].frame ); - - } - - // color keys - for( i = 0; i < MAX_KEYFRAMES; ++i ) - { - - xfer->xferRGBColor( &m_colorKey[ i ].color ); - xfer->xferUnsignedInt( &m_colorKey[ i ].frame ); - - } - - // color scale - xfer->xferUser( &m_colorScale, sizeof( GameClientRandomVariable ) ); - - // burst delay - xfer->xferUser( &m_burstDelay, sizeof( GameClientRandomVariable ) ); - - // burst count - xfer->xferUser( &m_burstCount, sizeof( GameClientRandomVariable ) ); - - // initial delay - xfer->xferUser( &m_initialDelay, sizeof( GameClientRandomVariable ) ); - - // drift velocity - xfer->xferCoord3D( &m_driftVelocity ); - - // gravity - xfer->xferReal( &m_gravity ); - - // slave system name - xfer->xferAsciiString( &m_slaveSystemName ); - - // slave position offset - xfer->xferCoord3D( &m_slavePosOffset ); - - // attached system name - xfer->xferAsciiString( &m_attachedSystemName ); - - // emission velocity type, this must come before m_emissionVelocity - xfer->xferUser( &m_emissionVelocityType, sizeof( EmissionVelocityType ) ); - - // particle priority - xfer->xferUser( &m_priority, sizeof( ParticlePriorityType ) ); - - // emission velocity - switch( m_emissionVelocityType ) - { - - // -------------------------------------------------------------------------------------------- - case ORTHO: - xfer->xferUser( &m_emissionVelocity.ortho.x, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.ortho.y, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.ortho.z, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case SPHERICAL: - xfer->xferUser( &m_emissionVelocity.spherical.speed, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case HEMISPHERICAL: - xfer->xferUser( &m_emissionVelocity.hemispherical.speed, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case CYLINDRICAL: - xfer->xferUser( &m_emissionVelocity.cylindrical.radial, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.cylindrical.normal, sizeof( GameClientRandomVariable ) ); - break; - - // -------------------------------------------------------------------------------------------- - case OUTWARD: - xfer->xferUser( &m_emissionVelocity.outward.speed, sizeof( GameClientRandomVariable ) ); - xfer->xferUser( &m_emissionVelocity.outward.otherSpeed, sizeof( GameClientRandomVariable ) ); - break; - - } - - // emission volume type - xfer->xferUser( &m_emissionVolumeType, sizeof( EmissionVolumeType ) ); - - // emission volume - switch( m_emissionVolumeType ) - { - - // -------------------------------------------------------------------------------------------- - case POINT: - // point has no data, it uses the systems position - break; - - // -------------------------------------------------------------------------------------------- - case LINE: - xfer->xferCoord3D( &m_emissionVolume.line.start ); - xfer->xferCoord3D( &m_emissionVolume.line.end ); - break; - - // -------------------------------------------------------------------------------------------- - case BOX: - xfer->xferCoord3D( &m_emissionVolume.box.halfSize ); - break; - - // -------------------------------------------------------------------------------------------- - case SPHERE: - xfer->xferReal( &m_emissionVolume.sphere.radius ); - break; - - // -------------------------------------------------------------------------------------------- - case CYLINDER: - xfer->xferReal( &m_emissionVolume.cylinder.radius ); - xfer->xferReal( &m_emissionVolume.cylinder.length ); - break; - - } - - // is emission volume hollow - xfer->xferBool( &m_isEmissionVolumeHollow ); - - // is ground aligned - xfer->xferBool( &m_isGroundAligned ); - - // emit above ground only - xfer->xferBool( &m_isEmitAboveGroundOnly ); - - // is particle up towards emitter - xfer->xferBool( &m_isParticleUpTowardsEmitter ); - - // wind motion - xfer->xferUser( &m_windMotion, sizeof( WindMotion ) ); - - // wind angle - xfer->xferReal( &m_windAngle ); - - // wind angle change - xfer->xferReal( &m_windAngleChange ); - - // wind angle change min - xfer->xferReal( &m_windAngleChangeMin ); - - // wind angle change max - xfer->xferReal( &m_windAngleChangeMax ); - - // wind motion start angle - xfer->xferReal( &m_windMotionStartAngle ); - - // wind motion start angle min - xfer->xferReal( &m_windMotionStartAngleMin ); - - // wind motion start angle max - xfer->xferReal( &m_windMotionStartAngleMax ); - - // wind motion end angle - xfer->xferReal( &m_windMotionEndAngle ); - - // wind motion end angle min - xfer->xferReal( &m_windMotionEndAngleMin ); - - // wind motion end angle max - xfer->xferReal( &m_windMotionEndAngleMax ); - - // wind motion moving to end angle - xfer->xferByte( &m_windMotionMovingToEndAngle ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemInfo::loadPostProcess( void ) -{ - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ParticleSystem ///////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -/** Read particle system properties from given file */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, - ParticleSystemID id, - Bool createSlaves ) -{ - m_systemParticlesHead = m_systemParticlesTail = nullptr; - - m_isFirstPos = true; - m_template = sysTemplate; - m_systemID = id; - - m_lastPos.zero(); - m_pos.zero(); - m_velCoeff.zero(); - - m_attachedToDrawableID = INVALID_DRAWABLE_ID; - m_attachedToObjectID = INVALID_ID; - - m_isLocalIdentity = true; - m_localTransform.Make_Identity(); - - m_isIdentity = true; - m_transform.Make_Identity(); - m_skipParentXfrm = false; - - m_isStopped = false; - m_isDestroyed = false; - m_isSaveable = true; - - m_slavePosOffset = sysTemplate->m_slavePosOffset; - - - ///@todo: further formalize this parameter with an UnsignedInt field in the editor - m_volumeParticleDepth = DEFAULT_VOLUME_PARTICLE_DEPTH; - - - m_driftVelocity = sysTemplate->m_driftVelocity; - - m_velCoeff.x = 1.0f; - m_velCoeff.y = 1.0f; - m_velCoeff.z = 1.0f; - m_countCoeff = 1.0f; - m_delayCoeff = 1.0f; - m_sizeCoeff = 1.0f; - - m_gravity = sysTemplate->m_gravity; - - m_lifetime = sysTemplate->m_lifetime; - m_startSize = sysTemplate->m_startSize; - m_startSizeRate = sysTemplate->m_startSizeRate; - m_sizeRate = sysTemplate->m_sizeRate; - m_sizeRateDamping = sysTemplate->m_sizeRateDamping; - - int i=0; - for( ; im_alphaKey[i]; - - for( i=0; im_colorKey[i]; - - /// @todo It is confusing to do this conversion here... - Real low = sysTemplate->m_colorScale.getMinimumValue(); - Real hi = sysTemplate->m_colorScale.getMaximumValue(); - m_colorScale.setRange( low / 255.0f, hi / 255.0f ); - - m_burstDelay = sysTemplate->m_burstDelay; - m_burstDelayLeft = 0; - - m_burstCount = sysTemplate->m_burstCount; - - m_isOneShot = sysTemplate->m_isOneShot; - - m_delayLeft = (UnsignedInt)sysTemplate->m_initialDelay.getValue(); - - m_startTimestamp = TheGameClient->getFrame(); - m_systemLifetimeLeft = sysTemplate->m_systemLifetime; - if (sysTemplate->m_systemLifetime) - m_isForever = false; - else - m_isForever = true; - - m_accumulatedSizeBonus = 0; - - m_velDamping = sysTemplate->m_velDamping; - -#if PARTICLE_USE_XY_ROTATION - m_angleX = sysTemplate->m_angleX; - m_angleY = sysTemplate->m_angleY; -#endif - m_angleZ = sysTemplate->m_angleZ; -#if PARTICLE_USE_XY_ROTATION - m_angularRateX = sysTemplate->m_angularRateX; - m_angularRateY = sysTemplate->m_angularRateY; -#endif - m_angularRateZ = sysTemplate->m_angularRateZ; - m_angularDamping = sysTemplate->m_angularDamping; - - m_priority = sysTemplate->m_priority; - - m_emissionVelocityType = sysTemplate->m_emissionVelocityType; - m_emissionVelocity = sysTemplate->m_emissionVelocity; - - m_emissionVolumeType = sysTemplate->m_emissionVolumeType; - m_emissionVolume = sysTemplate->m_emissionVolume; - - m_isEmissionVolumeHollow = sysTemplate->m_isEmissionVolumeHollow; - m_isGroundAligned = sysTemplate->m_isGroundAligned; - m_isEmitAboveGroundOnly = sysTemplate->m_isEmitAboveGroundOnly; - m_isParticleUpTowardsEmitter = sysTemplate->m_isParticleUpTowardsEmitter; - - m_windMotion = sysTemplate->m_windMotion; - m_windAngleChange = sysTemplate->m_windAngleChange; - m_windAngleChangeMin = sysTemplate->m_windAngleChangeMin; - m_windAngleChangeMax = sysTemplate->m_windAngleChangeMax; - m_windMotionStartAngleMin = sysTemplate->m_windMotionStartAngleMin; - m_windMotionStartAngleMax = sysTemplate->m_windMotionStartAngleMax; - m_windMotionEndAngleMin = sysTemplate->m_windMotionEndAngleMin; - m_windMotionEndAngleMax = sysTemplate->m_windMotionEndAngleMax; - m_windMotionMovingToEndAngle = sysTemplate->m_windMotionMovingToEndAngle; - m_windMotionStartAngle = GameClientRandomValueReal( m_windMotionStartAngleMin, m_windMotionStartAngleMax ); - m_windMotionEndAngle = GameClientRandomValueReal( m_windMotionEndAngleMin, m_windMotionEndAngleMax ); - m_windAngle = GameClientRandomValueReal( m_windMotionStartAngle, m_windMotionEndAngle ); - - m_shaderType = sysTemplate->m_shaderType; - - m_particleType = sysTemplate->m_particleType; - m_particleTypeName = sysTemplate->m_particleTypeName; - - m_isStopped = false; - - // set up slave particle system, if any - m_masterSystemID = INVALID_PARTICLE_SYSTEM_ID; - m_slaveSystemID = INVALID_PARTICLE_SYSTEM_ID; - m_masterSystem = nullptr; - m_slaveSystem = nullptr; - if( createSlaves ) - { - ParticleSystem *slaveSystem = sysTemplate->createSlaveSystem(); - - if( slaveSystem ) - { - - setSlave( slaveSystem ); - m_slaveSystem->setMaster( this ); - - } - - } - - m_attachedSystemName = sysTemplate->m_attachedSystemName; - m_particleCount = 0; - m_personalityStore = 0; - m_controlParticle = nullptr; - - TheParticleSystemManager->friend_addParticleSystem(this); - - //DEBUG_ASSERTLOG(!(m_totalParticleSystemCount % 10 == 0), ( "TotalParticleSystemCount = %d", m_totalParticleSystemCount )); -} - -// ------------------------------------------------------------------------------------------------ -/** Destroy particle system and all of its particles */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem::~ParticleSystem() -{ - - // tell any of our slave systems that we are going away - if( m_slaveSystem ) - { - - DEBUG_ASSERTCRASH( m_slaveSystem->getMaster() == this, ("~ParticleSystem: Our slave doesn't have us as a master!") ); - m_slaveSystem->setMaster( nullptr ); - setSlave( nullptr ); - - } - - // tell any master system that *we* are going away - if( m_masterSystem ) - { - - DEBUG_ASSERTCRASH( m_masterSystem->getSlave() == this, ("~ParticleSystem: Our master doesn't have us as a slave!") ); - m_masterSystem->setSlave( nullptr ); - setMaster( nullptr ); - - } - - - // destroy all particles "in the air" - while (m_systemParticlesHead) - deleteInstance(m_systemParticlesHead); - - m_attachedToDrawableID = INVALID_DRAWABLE_ID; - m_attachedToObjectID = INVALID_ID; - - // if this system was controlled by a particle, detach - if (m_controlParticle) - m_controlParticle->detachControlledParticleSystem(); - - m_controlParticle = nullptr; - - TheParticleSystemManager->friend_removeParticleSystem(this); - //DEBUG_ASSERTLOG(!(m_totalParticleSystemCount % 10 == 0), ( "TotalParticleSystemCount = %d", m_totalParticleSystemCount )); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setMaster( ParticleSystem *master ) -{ - - m_masterSystem = master; - m_masterSystemID = master ? master->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setSlave( ParticleSystem *slave ) -{ - - m_slaveSystem = slave; - m_slaveSystemID = slave ? slave->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setSaveable(Bool b) -{ - m_isSaveable = b; - if (m_slaveSystem) - m_slaveSystem->setSaveable(b); -} - -// ------------------------------------------------------------------------------------------------ -/** (Re)start a stopped particle system */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::start( void ) -{ - m_isStopped = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Stop a particle system from emitting */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::stop( void ) -{ - m_isStopped = true; -} - -// ------------------------------------------------------------------------------------------------ -/** Stop emitting, wait for all of our particles to die, then destroy self. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::destroy( void ) -{ - m_isDestroyed = true; - if( m_slaveSystem ) - { - m_slaveSystem->destroy(); // If we don't it will leak forever. We are solely responsible for it. - } -} - -// ------------------------------------------------------------------------------------------------ -/** Get the position of the particle system */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::getPosition( Coord3D *pos ) -{ - Vector3 vec; - m_localTransform.Get_Translation(&vec); - if (pos) - { pos->x=vec.X; - pos->y=vec.Y; - pos->z=vec.Z; - } -} - -// ------------------------------------------------------------------------------------------------ -/** Set the position of the particle system */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setPosition( const Coord3D *pos ) -{ - m_localTransform.Set_X_Translation( pos->x ); - m_localTransform.Set_Y_Translation( pos->y ); - m_localTransform.Set_Z_Translation( pos->z ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Set the system's local transform */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setLocalTransform( const Matrix3D *matrix ) -{ - m_localTransform = *matrix; - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Rotate local transform matrix */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::rotateLocalTransformX( Real x ) -{ - m_localTransform.Rotate_X( x ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Rotate local transform matrix */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::rotateLocalTransformY( Real y ) -{ - m_localTransform.Rotate_Y( y ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Rotate local transform matrix */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::rotateLocalTransformZ( Real z ) -{ - m_localTransform.Rotate_Z( z ); - m_isLocalIdentity = false; -} - -// ------------------------------------------------------------------------------------------------ -/** Attach this particle system to a Drawable */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::attachToDrawable( const Drawable *draw ) -{ - if (draw) - m_attachedToDrawableID = draw->getID(); - else - m_attachedToDrawableID = INVALID_DRAWABLE_ID; -} - -// ------------------------------------------------------------------------------------------------ -/** Attach this particle system to a Drawable */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::attachToObject( const Object *obj ) -{ - if (obj) - m_attachedToObjectID = obj->getID(); - else - m_attachedToObjectID = INVALID_ID; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute a random point on a unit sphere - * @todo The density of random points generated is not uniform within the sphere */ -// ------------------------------------------------------------------------------------------------ -const Coord3D *ParticleSystem::computePointOnUnitSphere( void ) -{ - static Coord3D point; - - do - { - point.x = GameClientRandomValueReal( -1.0f, 1.0f ); - point.y = GameClientRandomValueReal( -1.0f, 1.0f ); - point.z = GameClientRandomValueReal( -1.0f, 1.0f ); - } - while (point.x == 0.0f && point.y == 0.0f && point.z == 0.0f); - - point.normalize(); - - return &point; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute a velocity vector based on emission properties */ -// ------------------------------------------------------------------------------------------------ -const Coord3D *ParticleSystem::computeParticleVelocity( const Coord3D *pos ) -{ - static Coord3D newVel; - - switch( m_emissionVelocityType ) - { - case ORTHO: - newVel.x = m_emissionVelocity.ortho.x.getValue(); - newVel.y = m_emissionVelocity.ortho.y.getValue(); - newVel.z = m_emissionVelocity.ortho.z.getValue(); - break; - - case CYLINDRICAL: - { - Real radialSpeed, angle; - radialSpeed = m_emissionVelocity.cylindrical.radial.getValue(); - - angle = GameClientRandomValueReal( 0, 2.0f*PI ); - newVel.x = radialSpeed * cos( angle ); - newVel.y = radialSpeed * sin( angle ); - - newVel.z = m_emissionVelocity.cylindrical.normal.getValue(); - break; - } - - // "outward" velocity is directed along the surface normal of the emission volume - case OUTWARD: - { - Real speed = m_emissionVelocity.outward.speed.getValue(); - Real otherSpeed = m_emissionVelocity.outward.otherSpeed.getValue(); - Coord3D sysPos; - - /* - sysPos.x = m_localTransform.Get_X_Translation(); - sysPos.y = m_localTransform.Get_Y_Translation(); - sysPos.z = m_localTransform.Get_Z_Translation(); - */ - sysPos.x = 0.0f; - sysPos.y = 0.0f; - sysPos.z = 0.0f; - - switch( m_emissionVolumeType ) - { - case CYLINDER: - Coord2D disk; - - disk.x = pos->x - sysPos.x; - disk.y = pos->y - sysPos.y; - disk.normalize(); - - newVel.x = speed * disk.x; - newVel.y = speed * disk.y; - newVel.z = otherSpeed; - break; - - case BOX: ///< @todo Implement BOX OUTWARD velocity - case SPHERE: - { - newVel.x = pos->x - sysPos.x; - newVel.y = pos->y - sysPos.y; - newVel.z = pos->z - sysPos.z; - newVel.normalize(); - - newVel.x *= speed; - newVel.y *= speed; - newVel.z *= speed; - break; - } - - case LINE: - { - Coord3D along; // unit vector along line direction - - along.x = m_emissionVolume.line.end.x - m_emissionVolume.line.start.x; - along.y = m_emissionVolume.line.end.y - m_emissionVolume.line.start.y; - along.z = m_emissionVolume.line.end.z - m_emissionVolume.line.start.z; - along.normalize(); - - Coord3D perp; // unit vector perpendicular to the along/up plane - Coord3D up; // unit vector in the up direction (Z) - up.x = 0.0; - up.y = 0.0; - up.z = 1.0; - perp.crossProduct( &up, &along, &perp ); - up.crossProduct( &along, &perp, &up ); - - // "speed" is in 'horizontal' plane, and "otherSpeed" is 'vertical' - newVel.x = speed * perp.x + otherSpeed * up.x; - newVel.y = speed * perp.y + otherSpeed * up.y; - newVel.z = speed * perp.z + otherSpeed * up.z; - break; - } - - case POINT: - { - Coord3D vel = *computePointOnUnitSphere(); - - newVel.x = speed * vel.x; - newVel.y = speed * vel.y; - newVel.z = speed * vel.z; - break; - } - } - - break; - } - - case SPHERICAL: - { - Real speed = m_emissionVelocity.spherical.speed.getValue(); - Coord3D vel = *computePointOnUnitSphere(); - - newVel.x = speed * vel.x; - newVel.y = speed * vel.y; - newVel.z = speed * vel.z; - break; - } - - case HEMISPHERICAL: - { - Coord3D vel; - Real speed = m_emissionVelocity.spherical.speed.getValue(); - - do - { - vel.x = GameClientRandomValueReal( -1.0f, 1.0f ); - vel.y = GameClientRandomValueReal( -1.0f, 1.0f ); - vel.z = GameClientRandomValueReal( 0.0f, 1.0f ); - } - while (vel.x == 0.0f && vel.y == 0.0f && vel.z == 0.0f); - - vel.normalize(); - - newVel.x = speed * vel.x; - newVel.y = speed * vel.y; - newVel.z = speed * vel.z; - break; - } - - default: - newVel.x = 0.0f; - newVel.y = 0.0f; - newVel.z = 0.0f; - break; - } - - // scale the velocity by the velocity multiplier - newVel.x *= m_velCoeff.x*(0.5f+TheGlobalData->m_particleScale/2.0f); - newVel.y *= m_velCoeff.y*(0.5f+TheGlobalData->m_particleScale/2.0f); - newVel.z *= m_velCoeff.z*(0.5f+TheGlobalData->m_particleScale/2.0f); - - return &newVel; -} - -// ------------------------------------------------------------------------------------------------ -/** Compute a position based on emission properties */ -// ------------------------------------------------------------------------------------------------ -const Coord3D *ParticleSystem::computeParticlePosition( void ) -{ - static Coord3D newPos; - - switch( m_emissionVolumeType ) - { - case CYLINDER: - { - Real angle = GameClientRandomValueReal( 0, 2.0f*PI ); - Real radius; - - if (m_isEmissionVolumeHollow) - radius = m_emissionVolume.cylinder.radius; - else - radius = GameClientRandomValueReal( 0.0f, m_emissionVolume.cylinder.radius ); - - newPos.x = radius * cos( angle ); - newPos.y = radius * sin( angle ); - - Real halfLength = m_emissionVolume.cylinder.length/2.0f; - newPos.z = GameClientRandomValueReal( -halfLength, halfLength ); - - break; - } - - case SPHERE: - { - Real radius; - - if (m_isEmissionVolumeHollow) - radius = m_emissionVolume.sphere.radius; - else - radius = GameClientRandomValueReal( 0.0f, m_emissionVolume.sphere.radius ); - - newPos = *computePointOnUnitSphere(); - - newPos.x *= radius; - newPos.y *= radius; - newPos.z *= radius; - - break; - } - - case BOX: - { - if (m_isEmissionVolumeHollow) { - // determine which side to generate on. - // 0 is bottom, 3 is top, - // 1 is left , 4 is right - // 2 is front, 5 is right back - - int side = GameClientRandomValue(0, 6); - if (side % 3 == 0) { - // generate X, Y - newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x ); - newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y ); - if (side == 0) { - newPos.z = -m_emissionVolume.box.halfSize.z; - } else { - newPos.z = m_emissionVolume.box.halfSize.z; - } - - } else if (side % 3 == 1) { - // generate Y, Z - newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y ); - newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z ); - if (side == 1) { - newPos.x = -m_emissionVolume.box.halfSize.x; - } else { - newPos.x = m_emissionVolume.box.halfSize.y; - } - - } else if (side % 3 == 2) { - // generate X, Z - newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x ); - newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z ); - if (side == 2) { - newPos.y = -m_emissionVolume.box.halfSize.y; - } else { - newPos.y = m_emissionVolume.box.halfSize.y; - } - } - } else { - newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x ); - newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y ); - newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z ); - } - break; - } - - case LINE: - { - Coord3D delta, start, end; - - start = m_emissionVolume.line.start; - end = m_emissionVolume.line.end; - - delta.x = end.x - start.x; - delta.y = end.y - start.y; - delta.z = end.z - start.z; - - Real t = GameClientRandomValueReal( 0.0f, 1.0f ); - - newPos.x = start.x + t * delta.x; - newPos.y = start.y + t * delta.y; - newPos.z = start.z + t * delta.z; - break; - } - - case POINT: - default: - newPos.x = 0.0f; - newPos.y = 0.0f; - newPos.z = 0.0f; - break; - } - newPos.x *= (0.5f+TheGlobalData->m_particleScale/2.0f); - newPos.y *= (0.5f+TheGlobalData->m_particleScale/2.0f); - newPos.z *= (0.5f+TheGlobalData->m_particleScale/2.0f); - return &newPos; -} - -// ------------------------------------------------------------------------------------------------ -/** Factory method for particles. */ -// ------------------------------------------------------------------------------------------------ -Particle *ParticleSystem::createParticle( const ParticleInfo *info, - ParticlePriorityType priority, - Bool forceCreate ) -{ - - // - // if we aren't absolutely forcing this particle to be created (which is needed when - // loading and creating particle systems from the save games) we need to check a few - // restrictions before this particle can really be created - // - if( forceCreate == FALSE ) - { - - if (TheGlobalData->m_useFX == FALSE) - return nullptr; - - // - // Enforce particle limit. - // If we are at the limit, destroy the oldest particle in order - // to make room for this one. - // - - // - // Check if particle is below priorities we allow for this FPS or if it being skipped because - // all particesl are being skipped (excluding special fps independent particles at - // getMinDynamicParticleSkipPriority()) - // - if( priority < TheGameLODManager->getMinDynamicParticlePriority() || - (priority < TheGameLODManager->getMinDynamicParticleSkipPriority() && - TheGameLODManager->isParticleSkipped()) ) - return nullptr; - - if ( getParticleCount() > 0 && priority == AREA_EFFECT && m_isGroundAligned && TheParticleSystemManager->getFieldParticleCount() > (UnsignedInt)TheGlobalData->m_maxFieldParticleCount ) - return nullptr; - - // ALWAYS_RENDER particles are exempt from all count limits, and are always created, regardless of LOD issues. - if (priority != ALWAYS_RENDER) - { - int numInExcess = TheParticleSystemManager->getParticleCount() - (UnsignedInt)TheGlobalData->m_maxParticleCount; - if ( numInExcess > 0) - { - if( TheParticleSystemManager->removeOldestParticles((UnsignedInt) numInExcess, priority) != numInExcess ) - return nullptr; // could not remove enough particles, don't create new stuff - } - - if (TheGlobalData->m_maxParticleCount == 0) - return nullptr; - } - - } - - Particle *p = newInstance(Particle)( this, info ); - return p; - -} - -// ------------------------------------------------------------------------------------------------ -/** Generate a new, random set of ParticleInfo - * particleNum and particleCount are used to get 'tween frame particles emitted in the correct - * place. (jkmcd) */ -// ------------------------------------------------------------------------------------------------ -const ParticleInfo *ParticleSystem::generateParticleInfo( Int particleNum, Int particleCount ) -{ - static ParticleInfo info; - if (particleCount == 0) { - DEBUG_CRASH(("particleCount must NOT be 0. Set to 1 or greater.")); - return &info; - } - - // NOTE: position MUST be computed before velocity, in case OUTWARD velocity is - // specified, which must know where the particle is in space. - info.m_pos = *computeParticlePosition(); - info.m_vel = *computeParticleVelocity( &info.m_pos ); - - // transform the position and velocity, if necessary - /// @todo Avoid conversion from Coord3D to Vector3 somehow - if (m_isIdentity == false) - { - // transform particle position to world coordinates - Vector3 p, pr; - - Coord3D emissionAdjustment; // this is the adjustment for inter-frame emission - // @todo : This should work, if m_lastPos = m_pos is removed from here but it doesn't. - // @todo : Investigate why. jkmcd - if (m_isFirstPos) { - m_lastPos = m_pos; - m_isFirstPos = false; - } - - emissionAdjustment.x = (1 - (INT_TO_REAL(particleNum) / particleCount)) * (m_pos.x - m_lastPos.x); - emissionAdjustment.y = (1 - (INT_TO_REAL(particleNum) / particleCount)) * (m_pos.y - m_lastPos.y); - emissionAdjustment.z = (1 - (INT_TO_REAL(particleNum) / particleCount)) * (m_pos.z - m_lastPos.z); - - p.X = info.m_pos.x; - p.Y = info.m_pos.y; - p.Z = info.m_pos.z; - -#ifdef ALLOW_TEMPORARIES - pr = m_transform * p; -#else - m_transform.mulVector3(p, pr); -#endif - - info.m_pos.x = pr.X - emissionAdjustment.x; - info.m_pos.y = pr.Y - emissionAdjustment.y; - info.m_pos.z = pr.Z - emissionAdjustment.z; - - // transform particle velocity to world coordinates - Vector3 v, vr; - - v.X = info.m_vel.x; - v.Y = info.m_vel.y; - v.Z = info.m_vel.z; - - Matrix3D::Rotate_Vector( m_transform, v, &vr ); - - info.m_vel.x = vr.X; - info.m_vel.y = vr.Y; - info.m_vel.z = vr.Z; - } - - info.m_velDamping = m_velDamping.getValue(); - info.m_angularDamping = m_angularDamping.getValue(); - -#if PARTICLE_USE_XY_ROTATION - info.m_angleX = m_angleX.getValue(); - info.m_angleY = m_angleY.getValue(); -#endif - info.m_angleZ = m_angleZ.getValue(); -#if PARTICLE_USE_XY_ROTATION - info.m_angularRateX = m_angularRateX.getValue(); - info.m_angularRateY = m_angularRateY.getValue(); -#endif - info.m_angularRateZ = m_angularRateZ.getValue(); - - info.m_lifetime = (UnsignedInt)m_lifetime.getValue(); - - info.m_size = m_startSize.getValue()*m_sizeCoeff*TheGlobalData->m_particleScale; - info.m_sizeRate = m_sizeRate.getValue()*m_sizeCoeff*TheGlobalData->m_particleScale; - info.m_sizeRateDamping = m_sizeRateDamping.getValue(); - - // Keeping a running tally makes each successive particle spawned start a bit bigger (or smaller). - info.m_size += m_accumulatedSizeBonus; - m_accumulatedSizeBonus += m_startSizeRate.getValue(); - if( m_accumulatedSizeBonus ) - m_accumulatedSizeBonus = min( m_accumulatedSizeBonus, (float)MAX_SIZE_BONUS ); - - for( int i=0; im_useFX == FALSE) - return false; - - // do initial delay ... note, this currently delays the lifetime - if (m_delayLeft) - { - --m_delayLeft; - - // system actually "starts" once initial delay is over - /// @todo reset start time when system is stopped/started - if (m_delayLeft == 0) - m_startTimestamp = TheGameClient->getFrame(); - - return true; - } - - // update the wind motion - if (m_windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED ) - updateWindMotion(); - - // if this system is attached to a Drawable/Object, update the current transform - // matrix so generated particles' are relative to the parent Drawable's - // position and orientation - Bool transformSet = false; - const Matrix3D *parentXfrm = nullptr; - Bool isShrouded = false; - - if (m_attachedToDrawableID) - { - Drawable *attachedTo = TheGameClient->findDrawableByID( m_attachedToDrawableID ); - - if (attachedTo) - { - if (attachedTo->getFullyObscuredByShroud()) - isShrouded = true; - - parentXfrm = attachedTo->getTransformMatrix(); - m_lastPos = m_pos; - m_pos = *attachedTo->getPosition(); - } - else - { - // Drawable has been destroyed - lose our attachment to it - m_attachedToDrawableID = INVALID_DRAWABLE_ID; - - // destroy ourselves - destroy(); - } - } - else if (m_attachedToObjectID) - { - Object *objectAttachedTo = TheGameLogic->findObjectByID( m_attachedToObjectID ); - - if (objectAttachedTo) - { - if (!isShrouded) - isShrouded = (objectAttachedTo->getShroudedStatus(localPlayerIndex) >= OBJECTSHROUD_FOGGED); - - const Drawable * draw = objectAttachedTo->getDrawable(); - if ( draw ) - parentXfrm = draw->getTransformMatrix(); - else - parentXfrm = objectAttachedTo->getTransformMatrix(); - - m_lastPos = m_pos; - m_pos = *objectAttachedTo->getPosition(); - } - else - { - // Drawable has been destroyed - lose our attachment to it - m_attachedToObjectID = INVALID_ID; - - // destroy ourselves - destroy(); - } - } - - if (parentXfrm) - { - if (m_skipParentXfrm) - { - //this particle system is already in world space so no need to apply parent xform. - m_transform = m_localTransform; - } - else - { - // if system has its own local transform, concatenate them - if (m_isLocalIdentity == false) - #ifdef ALLOW_TEMPORARIES - m_transform = (*parentXfrm) * m_localTransform; - #else - m_transform.mul(*parentXfrm, m_localTransform); - #endif - else - m_transform = *parentXfrm; - } - - m_isIdentity = false; - transformSet = true; - } - - - if (transformSet == false) - { - if (m_isLocalIdentity == false) - { - m_transform = m_localTransform; - m_isIdentity = false; - } - else - { - m_isIdentity = true; - } - } - - // if we are controlled by a particle, its position is local origin - if (m_controlParticle) - { - const Coord3D *controlPos = m_controlParticle->getPosition(); - /// @todo Concatenate this, instead of overriding (MSB) - m_transform.Set_X_Translation( controlPos->x ); - m_transform.Set_Y_Translation( controlPos->y ); - m_transform.Set_Z_Translation( controlPos->z ); - m_isIdentity = false; - m_lastPos = m_pos; - m_pos = *controlPos; - } - - - // - // Generate new particles if the system hasn't been 'stopped' or 'destroyed' - // If we are a slave system, do not generate particles ourselves - our master will force us to - // - if (m_isDestroyed == false) - { - if (m_isForever || (m_isForever == false && m_systemLifetimeLeft > 0)) - { - if (!isShrouded && m_isStopped == false && m_masterSystem == nullptr) - { - if (m_burstDelayLeft == 0) - { - ParticlePriorityType priority = getPriority(); - - // emit a burst of particles - Int count = REAL_TO_INT(m_burstCount.getValue()); - - count *= m_countCoeff; - - for( Int i=0; im_pos.z >= TheTerrainLogic->getGroundHeight(info->m_pos.x, info->m_pos.y))) - { - // actually create a particle - Particle *p = createParticle( info, priority ); - if (p == nullptr) - continue; - - if (m_attachedSystemName.isEmpty() == false) - { - const ParticleSystemTemplate *tmp = TheParticleSystemManager->findTemplate( m_attachedSystemName ); - if (tmp) - { - ParticleSystem *sys = TheParticleSystemManager->createParticleSystem( tmp, TRUE ); - sys->setControlParticle( p ); - p->controlParticleSystem( sys ); - } - } - - // create a slave particle, if necessary - if (m_slaveSystem) - { - ParticleInfo mergeInfo = ParticleSystem::mergeRelatedParticleSystems(this, m_slaveSystem, false); - - // create slaved particle - m_slaveSystem->createParticle( &mergeInfo, priority ); - } - } - } - - // compute next burst delay - m_burstDelayLeft = (UnsignedInt)m_burstDelay.getValue(); - m_burstDelayLeft *= m_delayCoeff; - } - else - { - m_burstDelayLeft--; - } - - } - } - } - - // - // Update all particles in the system - // - Particle *p = m_systemParticlesHead; - Particle *oldParticle; - while (p) - { - - // apply 'gravity' force - if (m_gravity != 0.0f) - { - Coord3D force; - force.x = 0.0f; - force.y = 0.0f; - force.z = m_gravity; - p->applyForce( &force ); - } - - if (p->update() == false) - { - oldParticle = p; - p = p->m_systemNext; - deleteInstance(oldParticle); - } else { - p = p->m_systemNext; - } - } - - // - // If we have been "destroyed", wait for all of our particles to die off, - // then destroy ourselves (return false). - // - if (m_isDestroyed && !m_systemParticlesHead) - return false; - - - // monitor particle system lifetime - if (m_isForever == false) - { - // decrement lifetime if not zero - if (m_systemLifetimeLeft) - m_systemLifetimeLeft--; - - // if there are still particles "in the air", don't destroy yet - if (getParticleCount()) - return true; - - // check if time is up - if (m_systemLifetimeLeft == 0) - return false; - } - - return true; -} - -// ------------------------------------------------------------------------------------------------ -/** Update the wind motion */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::updateWindMotion( void ) -{ - - switch( m_windMotion ) - { - - // -------------------------------------------------------------------------------------------- - case ParticleSystemInfo::WIND_MOTION_PING_PONG: - { - Real startAngle = m_windMotionStartAngle; - Real endAngle = m_windMotionEndAngle; - - // this only works when start angle is less than end angle - DEBUG_ASSERTCRASH( startAngle < endAngle, ("updateWindMotion: startAngle must be < endAngle") ); - - // how big is the total angle span - Real totalSpan = endAngle - startAngle; - Real halfSpan = totalSpan / 2.0f; - - // given our current angle ... how far away from the "center" of the span are we - Real diffFromCenter = fabs( halfSpan - m_windAngle + startAngle ); - - // - // given our distance from the center ... we need to compute how much we will change - // the angle. When we are closer to the center we change it faster (more), and when - // we are near the edges we change is slower (less) - // - Real change = (1.0f - (diffFromCenter / halfSpan)) * m_windAngleChange; - - // we will always change a little bit - #define MINIMUM_CHANGE 0.005f // lower #'s have softer swings at the edge angles - if( change < MINIMUM_CHANGE ) - change = MINIMUM_CHANGE; - - // - // if we are moving toward the end angle we add the change, if we're moving away - // from it we subtract it - // - if( m_windMotionMovingToEndAngle ) - { - - // add angle - m_windAngle += change; - - // see if we're at the end and should switch directions - if( m_windAngle >= endAngle ) - { - - // change directions - m_windMotionMovingToEndAngle = FALSE; - - // pick a new change delta - m_windAngleChange = - GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); - - // pick new start and end angles - m_windMotionStartAngle = - GameClientRandomValueReal( m_windMotionStartAngleMin, - m_windMotionStartAngleMax ); - m_windMotionEndAngle = - GameClientRandomValueReal( m_windMotionEndAngleMin, - m_windMotionEndAngleMax ); - - } - - } - else - { - - // subtract angle - m_windAngle -= change; - - // see if we're at the end and should switch directions - if( m_windAngle <= startAngle ) - { - - // change directions - m_windMotionMovingToEndAngle = TRUE; - - // pick a new change delta - m_windAngleChange = - GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); - - // pick new start and end angles - m_windMotionStartAngle = - GameClientRandomValueReal( m_windMotionStartAngleMin, - m_windMotionStartAngleMax ); - m_windMotionEndAngle = - GameClientRandomValueReal( m_windMotionEndAngleMin, - m_windMotionEndAngleMax ); - - } - - } - - break; - - } - - // -------------------------------------------------------------------------------------------- - case ParticleSystemInfo::WIND_MOTION_CIRCULAR: - { - - // give us a wind angle change if one hasn't been specified (this plays nice with the particle editor) - if( m_windAngleChange == 0.0f ) - m_windAngleChange = GameClientRandomValueReal( m_windAngleChangeMin, m_windAngleChangeMax ); - - // add to our wind angle - m_windAngle += m_windAngleChange; - - // keep in 0 to 2PI range just to keep the numbers safe and sane - if( m_windAngle > TWO_PI ) - m_windAngle -= TWO_PI; - else if( m_windAngle < 0.0f ) - m_windAngle += TWO_PI; - - break; - - } - - // --------------------------------------------------------------------------------------------- - default: - { - - break; - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::addParticle( Particle *particleToAdd ) -{ - if (particleToAdd->m_inSystemList) - return; - - if (!m_systemParticlesHead) - { - m_systemParticlesHead = particleToAdd; - } - - if (m_systemParticlesTail) - { - m_systemParticlesTail->m_systemNext = particleToAdd; - particleToAdd->m_systemPrev = m_systemParticlesTail; - } - else - { - particleToAdd->m_systemPrev = nullptr; - } - - m_systemParticlesTail = particleToAdd; - particleToAdd->m_systemNext = nullptr; - particleToAdd->m_inSystemList = TRUE; - - ++m_particleCount; - - particleToAdd->setPersonality( m_personalityStore++ ); - -} - -// ------------------------------------------------------------------------------------------------ -/** Remove given particle from the list - ONLY FOR USE BY PARTICLE */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::removeParticle( Particle *particleToRemove ) -{ - if (!particleToRemove->m_inSystemList) - return; - - // remove links from prev & next objs - if (particleToRemove->m_systemNext) - particleToRemove->m_systemNext->m_systemPrev = particleToRemove->m_systemPrev; - if (particleToRemove->m_systemPrev) - particleToRemove->m_systemPrev->m_systemNext = particleToRemove->m_systemNext; - - // update head & tail if necessary - if (particleToRemove == m_systemParticlesHead) - m_systemParticlesHead = particleToRemove->m_systemNext; - if (particleToRemove == m_systemParticlesTail) - m_systemParticlesTail = particleToRemove->m_systemPrev; - - particleToRemove->m_systemNext = particleToRemove->m_systemPrev = nullptr; - particleToRemove->m_inSystemList = FALSE; - --m_particleCount; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleInfo ParticleSystem::mergeRelatedParticleSystems( ParticleSystem *masterParticleSystem, ParticleSystem *slaveParticleSystem, Bool slaveNeedsFullPromotion) -{ - if (!masterParticleSystem || !slaveParticleSystem) { - DEBUG_CRASH(("masterParticleSystem or slaveParticleSystem was null. Should not happen. JKMCD")); - ParticleInfo bogus; - return bogus; - } - - // copy info - ParticleInfo mergeInfo = *masterParticleSystem->generateParticleInfo(1, 1); - - // generate one from the slave system - const ParticleInfo *info = slaveParticleSystem->generateParticleInfo(1, 1); - - // override unique attributes of slave particle - mergeInfo.m_lifetime = info->m_lifetime; - - // size becomes a scale factor of master's particles - mergeInfo.m_size *= info->m_size; - mergeInfo.m_sizeRate *= info->m_sizeRate; - mergeInfo.m_sizeRateDamping *= info->m_sizeRateDamping; - -#if PARTICLE_USE_XY_ROTATION - mergeInfo.m_angleX = info->m_angleX; - mergeInfo.m_angleY = info->m_angleY; -#endif - mergeInfo.m_angleZ = info->m_angleZ; -#if PARTICLE_USE_XY_ROTATION - mergeInfo.m_angularRateX = info->m_angularRateX; - mergeInfo.m_angularRateY = info->m_angularRateY; -#endif - mergeInfo.m_angularRateZ = info->m_angularRateZ; - mergeInfo.m_angularDamping = info->m_angularDamping; - - int i=0; - for( ; im_alphaKey[i]; - - for( i=0; im_colorKey[i]; - - mergeInfo.m_colorScale = info->m_colorScale; - - // offset slave's position relative to master's - const Coord3D *offset = slaveParticleSystem->getSlavePositionOffset(); - mergeInfo.m_pos.x += offset->x; - mergeInfo.m_pos.y += offset->y; - mergeInfo.m_pos.z += offset->z; - - if (slaveNeedsFullPromotion) { - slaveParticleSystem->m_burstCount = masterParticleSystem->m_burstCount; - slaveParticleSystem->m_burstDelay = masterParticleSystem->m_burstDelay; - - slaveParticleSystem->m_priority = masterParticleSystem->m_priority; - slaveParticleSystem->m_emissionVelocity = masterParticleSystem->m_emissionVelocity; - slaveParticleSystem->m_emissionVelocityType = masterParticleSystem->m_emissionVelocityType; - slaveParticleSystem->m_emissionVolume = masterParticleSystem->m_emissionVolume; - slaveParticleSystem->m_emissionVolumeType = masterParticleSystem->m_emissionVolumeType; - slaveParticleSystem->m_isEmissionVolumeHollow = masterParticleSystem->m_isEmissionVolumeHollow; - - - slaveParticleSystem->m_startSize.setRange(masterParticleSystem->m_startSize.getMinimumValue() * slaveParticleSystem->m_startSize.getMinimumValue(), - masterParticleSystem->m_startSize.getMaximumValue() * slaveParticleSystem->m_startSize.getMaximumValue(), - masterParticleSystem->m_startSize.getDistributionType()); - - slaveParticleSystem->m_sizeRate.setRange(masterParticleSystem->m_sizeRate.getMinimumValue() * slaveParticleSystem->m_sizeRate.getMinimumValue(), - masterParticleSystem->m_sizeRate.getMaximumValue() * slaveParticleSystem->m_sizeRate.getMaximumValue(), - masterParticleSystem->m_sizeRate.getDistributionType()); - - slaveParticleSystem->m_sizeRateDamping.setRange(masterParticleSystem->m_sizeRateDamping.getMinimumValue() * slaveParticleSystem->m_sizeRateDamping.getMinimumValue(), - masterParticleSystem->m_sizeRateDamping.getMaximumValue() * slaveParticleSystem->m_sizeRateDamping.getMaximumValue(), - masterParticleSystem->m_sizeRateDamping.getDistributionType()); - -// slaveParticleSystem->m_burstCount.setRange(masterParticleSystem->m_burstCount.getMinimumValue() / 2, -// masterParticleSystem->m_burstCount.getMaximumValue() / 2, -// masterParticleSystem->m_burstCount.getDistributionType()); - - } - - return mergeInfo; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setLifetimeRange( Real min, Real max ) -{ - m_lifetime.setRange( min, max ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::setControlParticle( Particle *p ) -{ - m_controlParticle = p; -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // base class info - ParticleSystemInfo::xfer( xfer ); - - // particle system ID - xfer->xferUser( &m_systemID, sizeof( ParticleSystemID ) ); - - // attached to drawable id - xfer->xferDrawableID( &m_attachedToDrawableID ); - - // attached to object id - xfer->xferObjectID( &m_attachedToObjectID ); - - // is local identity - xfer->xferBool( &m_isLocalIdentity ); - - // local transform - xfer->xferUser( &m_localTransform, sizeof( Matrix3D ) ); - - // is identity - xfer->xferBool( &m_isIdentity ); - - // transform - xfer->xferUser( &m_transform, sizeof( Matrix3D ) ); - - // burst delay left - xfer->xferUnsignedInt( &m_burstDelayLeft ); - - // delay left - xfer->xferUnsignedInt( &m_delayLeft ); - - // start timestamp - xfer->xferUnsignedInt( &m_startTimestamp ); - - // system lifetime left - xfer->xferUnsignedInt( &m_systemLifetimeLeft ); - - // personality store - xfer->xferUnsignedInt( &m_personalityStore ); - - // is forever - xfer->xferBool( &m_isForever ); - - // accumulated size bonus - xfer->xferReal( &m_accumulatedSizeBonus ); - - // is stopped - xfer->xferBool( &m_isStopped ); - - // we never save destroyed particle systems so there is no need to consider m_isDestroyed - // m_isDestroyed <-- do nothing with me - - // ditto for m_isSaveable - // m_isSaveable <-- do nothing with me - - // velCoeff - xfer->xferCoord3D( &m_velCoeff ); - - // count coeff - xfer->xferReal( &m_countCoeff ); - - // delay coeff - xfer->xferReal( &m_delayCoeff ); - - // size coeff - xfer->xferReal( &m_sizeCoeff ); - - // position - xfer->xferCoord3D( &m_pos ); - - // last position - xfer->xferCoord3D( &m_lastPos ); - - // is first pos - xfer->xferBool( &m_isFirstPos ); - - // slave system id - xfer->xferUser( &m_slaveSystemID, sizeof( ParticleSystemID ) ); - - // master system - xfer->xferUser( &m_masterSystemID, sizeof( ParticleSystemID ) ); - - // particle count - UnsignedInt particleCount = m_particleCount; - xfer->xferUnsignedInt( &particleCount ); - - // particles - if( xfer->getXferMode() == XFER_SAVE ) - { - Particle *particle; - - // go through all particles in this system - for( particle = m_systemParticlesHead; particle; particle = particle->m_systemNext ) - { - - // write particle information - xfer->xferSnapshot( particle ); - - } - - } - else - { - ParticlePriorityType priority = getPriority(); - const ParticleInfo *info = generateParticleInfo( 0, 1 ); - Particle *particle; - - // read each particle data block - for( UnsignedInt i = 0; i < particleCount; ++i ) - { - - // create a new particle - particle = createParticle( info, priority, TRUE ); - - // sanity - DEBUG_ASSERTCRASH( particle, ("ParticleSystem::xfer - Unable to create particle for loading") ); - - // read in the particle data - xfer->xferSnapshot( particle ); - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystem::loadPostProcess( void ) -{ - - // call base class post process - ParticleSystemInfo::loadPostProcess(); - - // reconnect slave pointers if needed - if( m_slaveSystemID != INVALID_PARTICLE_SYSTEM_ID ) - { - - // sanity - if( m_slaveSystem != nullptr ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is not null but should be" )); - throw SC_INVALID_DATA; - - } - - // assign system - m_slaveSystem = TheParticleSystemManager->findParticleSystem( m_slaveSystemID ); - - // sanity - if( m_slaveSystem == nullptr || m_slaveSystem->isDestroyed() == TRUE ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_slaveSystem is null or destroyed" )); - throw SC_INVALID_DATA; - - } - - } - - // reconnect master pointers if needed - if( m_masterSystemID != INVALID_PARTICLE_SYSTEM_ID ) - { - - // sanity - if( m_masterSystem != nullptr ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is not null but should be" )); - throw SC_INVALID_DATA; - - } - - // assign system - m_masterSystem = TheParticleSystemManager->findParticleSystem( m_masterSystemID ); - - // sanity - if( m_masterSystem == nullptr || m_masterSystem->isDestroyed() == TRUE ) - { - - DEBUG_CRASH(( "ParticleSystem::loadPostProcess - m_masterSystem is null or destroyed" )); - throw SC_INVALID_DATA; - - } - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ParticleSystemTemplate ///////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -/** INI parse data */ -// ------------------------------------------------------------------------------------------------ -const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = -{ - { "Priority", INI::parseIndexList, ParticlePriorityNames, offsetof( ParticleSystemTemplate, m_priority ) }, - { "IsOneShot", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isOneShot ) }, - { "Shader", INI::parseIndexList, ParticleShaderTypeNames, offsetof( ParticleSystemTemplate, m_shaderType ) }, - { "Type", INI::parseIndexList, ParticleTypeNames, offsetof( ParticleSystemTemplate, m_particleType ) }, - { "ParticleName", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_particleTypeName ) }, -#if PARTICLE_USE_XY_ROTATION - { "AngleX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleX ) }, - { "AngleY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleY ) }, -#endif - { "AngleZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angleZ ) }, -#if PARTICLE_USE_XY_ROTATION - { "AngularRateX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateX ) }, - { "AngularRateY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateY ) }, -#endif - { "AngularRateZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularRateZ ) }, - { "AngularDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_angularDamping ) }, - - { "VelocityDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_velDamping ) }, - { "Gravity", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_gravity ) }, - { "SlaveSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_slaveSystemName ) }, - { "SlavePosOffset", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_slavePosOffset ) }, - { "PerParticleAttachedSystem", INI::parseAsciiString, nullptr, offsetof( ParticleSystemTemplate, m_attachedSystemName ) }, - - { "Lifetime", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_lifetime ) }, - { "SystemLifetime", INI::parseUnsignedInt, nullptr, offsetof( ParticleSystemTemplate, m_systemLifetime ) }, - - { "Size", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSize ) }, - { "StartSizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_startSizeRate ) }, - { "SizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRate ) }, - { "SizeRateDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, - - { "Alpha1", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[0] ) }, - { "Alpha2", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[1] ) }, - { "Alpha3", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[2] ) }, - { "Alpha4", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[3] ) }, - { "Alpha5", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[4] ) }, - { "Alpha6", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[5] ) }, - { "Alpha7", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[6] ) }, - { "Alpha8", ParticleSystemTemplate::parseRandomKeyframe, nullptr, offsetof( ParticleSystemTemplate, m_alphaKey[7] ) }, - - { "Color1", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[0] ) }, - { "Color2", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[1] ) }, - { "Color3", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[2] ) }, - { "Color4", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[3] ) }, - { "Color5", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[4] ) }, - { "Color6", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[5] ) }, - { "Color7", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[6] ) }, - { "Color8", ParticleSystemTemplate::parseRGBColorKeyframe,nullptr, offsetof( ParticleSystemTemplate, m_colorKey[7] ) }, - -// { "COLOR", ParticleSystemTemplate::parseRandomRGBColor, nullptr, offsetof( ParticleSystemTemplate, m_color ) }, - { "ColorScale", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_colorScale ) }, - - { "BurstDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstDelay ) }, - { "BurstCount", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_burstCount ) }, - - { "InitialDelay", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_initialDelay ) }, - - { "DriftVelocity", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_driftVelocity ) }, - { "VelocityType", INI::parseIndexList, EmissionVelocityTypeNames, offsetof( ParticleSystemTemplate, m_emissionVelocityType ) }, - { "VelOrthoX", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.x ) }, - { "VelOrthoY", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.y ) }, - { "VelOrthoZ", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.ortho.z ) }, - - { "VelSpherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.spherical.speed ) }, - { "VelHemispherical", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.hemispherical.speed ) }, - - { "VelCylindricalRadial", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.radial ) }, - { "VelCylindricalNormal", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.cylindrical.normal ) }, - - { "VelOutward", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.speed ) }, - { "VelOutwardOther", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_emissionVelocity.outward.otherSpeed ) }, - - { "VolumeType", INI::parseIndexList, EmissionVolumeTypeNames, offsetof( ParticleSystemTemplate, m_emissionVolumeType ) }, - { "VolLineStart", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.start ) }, - { "VolLineEnd", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.line.end ) }, - - { "VolBoxHalfSize", INI::parseCoord3D, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.box.halfSize ) }, - - { "VolSphereRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.sphere.radius ) }, - - { "VolCylinderRadius", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.radius ) }, - { "VolCylinderLength", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_emissionVolume.cylinder.length ) }, - - { "IsHollow", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmissionVolumeHollow ) }, - { "IsGroundAligned", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isGroundAligned ) }, - { "IsEmitAboveGroundOnly", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isEmitAboveGroundOnly) }, - { "IsParticleUpTowardsEmitter", INI::parseBool, nullptr, offsetof( ParticleSystemTemplate, m_isParticleUpTowardsEmitter) }, - - { "WindMotion", INI::parseIndexList, WindMotionNames, offsetof( ParticleSystemTemplate, m_windMotion ) }, - - { "WindAngleChangeMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMin ) }, - { "WindAngleChangeMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windAngleChangeMax ) }, - - { "WindPingPongStartAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMin ) }, - { "WindPingPongStartAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionStartAngleMax ) }, - - { "WindPingPongEndAngleMin", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMin ) }, - { "WindPingPongEndAngleMax", INI::parseReal, nullptr, offsetof( ParticleSystemTemplate, m_windMotionEndAngleMax ) }, - - - { nullptr, nullptr, nullptr, 0 }, -}; - -// ------------------------------------------------------------------------------------------------ -/** Parse a "random keyframe". - * The format is "FIELD = low high frame". */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemTemplate::parseRandomKeyframe( INI* ini, void *instance, - void *store, const void* /*userData*/ ) -{ - RandomKeyframe *key = static_cast(store); - - Real low = ini->scanReal(ini->getNextToken()); - Real high = ini->scanReal(ini->getNextToken()); - key->frame = ini->scanUnsignedInt(ini->getNextToken()); - - // set the range of the random variable - key->var.setRange( low, high ); -} - -// ------------------------------------------------------------------------------------------------ -/** Parse a "color keyframe". - * The format is "FIELD = R:r G:g B:b frame". */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemTemplate::parseRGBColorKeyframe( INI* ini, void *instance, - void *store, const void* /*userData*/ ) -{ - RGBColorKeyframe *key = static_cast(store); - - INI::parseRGBColor( ini, instance, &key->color, nullptr ); - INI::parseUnsignedInt( ini, instance, &key->frame, nullptr ); -} - -// ------------------------------------------------------------------------------------------------ -/** Parse a RandomVariable RGB color. - * Note that the components may be negative, as this is used for rates, as well. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemTemplate::parseRandomRGBColor( INI* ini, void *instance, - void *store, const void* /*userData*/ ) -{ -#if 0 - char seps[] = " \n\r\t=:RGB,"; - const char *token; - Int colors[2][3]; - Int result; - - enum { LO = 0, HI = 1 }; - enum { RED = 0, GREEN = 1, BLUE = 2 }; - - // initialize to invalid values - colors[ LO ][ RED ] = -1; - colors[ LO ][ GREEN ] = -1; - colors[ LO ][ BLUE ] = -1; - colors[ HI ][ RED ] = -1; - colors[ HI ][ GREEN ] = -1; - colors[ HI ][ BLUE ] = -1; - - // do each color part - for( Int i = 0; i < 3; i++ ) - { - for( Int j = 0; j < 2; j++ ) - { - // get the color number - token = ini->getNextToken(seps); - - // convert to number - colors[j][i] = ini->scanInt(token); - - // check to see if it's within range - if( colors[j][i] < -255 || colors[j][i] > 255 ) - throw INI_INVALID_DATA; - - } - } - - // assign the color components to the "RGBColor" pointer at 'store' - ParticleSystemInfo::RandomRGBColor *theColor = (ParticleSystemInfo::RandomRGBColor *)store; - - theColor->red.setRange( (Real)colors[ LO ][ RED ] / 255.0f, (Real)colors[ HI ][ RED ] / 255.0f ); - theColor->green.setRange( (Real)colors[ LO ][ GREEN ] / 255.0f, (Real)colors[ HI ][ GREEN ] / 255.0f ); - theColor->blue.setRange( (Real)colors[ LO ][ BLUE ] / 255.0f, (Real)colors[ HI ][ BLUE ] / 255.0f ); -#endif -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate::ParticleSystemTemplate( const AsciiString &name ) : - m_name(name) -{ - m_slaveTemplate = nullptr; -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate::~ParticleSystemTemplate() -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** If returns non-null, it is a slave system for use ... the create slaves parameter - * tells *this* slave system whether or not it should create any slaves itself - * automatically during its own constructor */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem *ParticleSystemTemplate::createSlaveSystem( Bool createSlaves ) const -{ - if (m_slaveTemplate == nullptr && m_slaveSystemName.isEmpty() == false) - m_slaveTemplate = TheParticleSystemManager->findTemplate( m_slaveSystemName ); - - ParticleSystem *slave = nullptr; - if (m_slaveTemplate) - slave = TheParticleSystemManager->createParticleSystem( m_slaveTemplate, createSlaves ); - - return slave; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// ParticleSystemManager ////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemManager::ParticleSystemManager( void ) -{ - - m_uniqueSystemID = INVALID_PARTICLE_SYSTEM_ID; - - m_onScreenParticleCount = 0; - m_localPlayerIndex = 0; - - m_lastLogicFrameUpdate = 0; - m_particleCount = 0; - m_fieldParticleCount = 0; - m_particleSystemCount = 0; - - for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) - { - - m_allParticlesHead[ i ] = nullptr; - m_allParticlesTail[ i ] = nullptr; - - } - -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -ParticleSystemManager::~ParticleSystemManager() -{ - reset(); - - TemplateMap::iterator begin(m_templateMap.begin()); - TemplateMap::iterator end(m_templateMap.end()); - for (; begin != end; ++begin) { - deleteInstance((*begin).second); - } -} - -// ------------------------------------------------------------------------------------------------ -/** Initialize the manager */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::init( void ) -{ - /// Read INI data and build templates - INI ini; - ini.loadFileDirectory( "Data\\INI\\ParticleSystem", INI_LOAD_OVERWRITE, nullptr ); - - // sanity, our lists must be empty!! - for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) - { - - // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("INIT: ParticleSystem all particles head[%d] is not null!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("INIT: ParticleSystem all particles tail[%d] is not null!", i) ); - - // just to be clean set them to nullptr - m_allParticlesHead[ i ] = nullptr; - m_allParticlesTail[ i ] = nullptr; - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Reset the manager and all particle systems */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::reset( void ) -{ - while (!m_allParticleSystemList.empty()) - { - DEBUG_ASSERTCRASH(m_allParticleSystemList.front() != nullptr, ("ParticleSystemManager::reset: ParticleSystem is null")); - deleteInstance(m_allParticleSystemList.front()); - } - DEBUG_ASSERTCRASH(m_particleSystemCount == 0, ("ParticleSystemManager::reset: m_particleSystemCount is %u, not 0", m_particleSystemCount)); - - // sanity, our lists must be empty!! - for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i ) - { - - // sanity - DEBUG_ASSERTCRASH( m_allParticlesHead[ i ] == nullptr, ("RESET: ParticleSystem all particles head[%d] is not null!", i) ); - DEBUG_ASSERTCRASH( m_allParticlesTail[ i ] == nullptr, ("RESET: ParticleSystem all particles tail[%d] is not null!", i) ); - - // just to be clean set them to nullptr - m_allParticlesHead[ i ] = nullptr; - m_allParticlesTail[ i ] = nullptr; - - } - - m_particleCount = 0; - m_fieldParticleCount = 0; - m_particleSystemCount = 0; - - m_uniqueSystemID = INVALID_PARTICLE_SYSTEM_ID; - - m_lastLogicFrameUpdate = -1; - // leave templates as-is -} - -// ------------------------------------------------------------------------------------------------ -/** Update all particle systems */ -// ------------------------------------------------------------------------------------------------ -//DECLARE_PERF_TIMER(ParticleSystemManager) -void ParticleSystemManager::update( void ) -{ - if (m_lastLogicFrameUpdate == TheGameLogic->getFrame()) { - return; - } - - // update the last logic frame. - m_lastLogicFrameUpdate = TheGameLogic->getFrame(); - - //USE_PERF_TIMER(ParticleSystemManager) - ParticleSystemListIt it = m_allParticleSystemList.begin(); - while( it != m_allParticleSystemList.end() ) - { - // TheSuperHackers @info Must increment the list iterator before potential element erasure from the list. - ParticleSystem* sys = *it++; - DEBUG_ASSERTCRASH(sys != nullptr, ("ParticleSystemManager::update: ParticleSystem is null")); - - if (sys->update(m_localPlayerIndex) == false) - { - deleteInstance(sys); - } - } -} - -// ------------------------------------------------------------------------------------------------ -/** sets the count of the particles on screen after each frame */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::setOnScreenParticleCount(int count) -{ - m_onScreenParticleCount = count; -} - -// ------------------------------------------------------------------------------------------------ -/** Given a file containing particle system properties, create a new instance of it */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem *ParticleSystemManager::createParticleSystem( const ParticleSystemTemplate *sysTemplate, Bool createSlaves ) -{ - // sanity - if (sysTemplate == nullptr) - return nullptr; - - m_uniqueSystemID = (ParticleSystemID)((UnsignedInt)m_uniqueSystemID + 1); - ParticleSystem *sys = newInstance(ParticleSystem)( sysTemplate, m_uniqueSystemID, createSlaves ); - return sys; -} - -// ------------------------------------------------------------------------------------------------ -/// given a template, instantiate a particle system attached to the given object, and return its ID -// ------------------------------------------------------------------------------------------------ -ParticleSystemID ParticleSystemManager::createAttachedParticleSystemID( - const ParticleSystemTemplate *sysTemplate, - Object* attachTo, - Bool createSlaves ) -{ - ParticleSystem* pSystem = createParticleSystem(sysTemplate, createSlaves); - if (pSystem && attachTo) - pSystem->attachToObject(attachTo); - return pSystem ? pSystem->getSystemID() : INVALID_PARTICLE_SYSTEM_ID; -} - -// ------------------------------------------------------------------------------------------------ -/** Find a particle system with the matching system id */ -// ------------------------------------------------------------------------------------------------ -ParticleSystem *ParticleSystemManager::findParticleSystem( ParticleSystemID id ) -{ - if (id == INVALID_PARTICLE_SYSTEM_ID) - return nullptr; // my, that was easy - - ParticleSystem *system = nullptr; - - for( ParticleSystemListIt it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); ++it ) { - system = *it; - DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::findParticleSystem: ParticleSystem is null")); - - if( system->getSystemID() == id ) { - return system; - } - } - - return nullptr; - -} - -// ------------------------------------------------------------------------------------------------ -/** destroy the particle system with the given id (if it still exists) */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::destroyParticleSystemByID(ParticleSystemID id) -{ - ParticleSystem* pSystem = findParticleSystem(id); - if( pSystem ) - pSystem->destroy(); -} - -// ------------------------------------------------------------------------------------------------ -/** Locate an existing ParticleSystemTemplate */ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate *ParticleSystemManager::findTemplate( const AsciiString &name ) const -{ - ParticleSystemTemplate *sysTemplate = nullptr; - - TemplateMap::const_iterator find(m_templateMap.find(name)); - if (find != m_templateMap.end()) { - sysTemplate = (*find).second; - } - - return sysTemplate; -} - -// ------------------------------------------------------------------------------------------------ -/** Create a new ParticleSystemTemplate */ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate *ParticleSystemManager::newTemplate( const AsciiString &name ) -{ - ParticleSystemTemplate *sysTemplate = findTemplate(name); - if (sysTemplate == nullptr) { - sysTemplate = newInstance(ParticleSystemTemplate)( name ); - - if (! m_templateMap.insert(std::make_pair(name, sysTemplate)).second) { - deleteInstance(sysTemplate); - sysTemplate = nullptr; - } - } - - return sysTemplate; -} - -// ------------------------------------------------------------------------------------------------ -/** Find a particle system's parent. Should really only be called by TheScriptEngine */ -// ------------------------------------------------------------------------------------------------ -ParticleSystemTemplate *ParticleSystemManager::findParentTemplate( const AsciiString &name, Int parentNum ) const -{ - if (name.isEmpty()) { - return nullptr; - } - - TemplateMap::const_iterator begin(m_templateMap.begin()); - TemplateMap::const_iterator end(m_templateMap.end()); - for(; begin != end; ++begin) { - ParticleSystemTemplate *sysTemplate = (*begin).second; - if (name.compare(sysTemplate->m_slaveSystemName) == 0) { - if (! parentNum--) { - return sysTemplate; - } - } - } - - return nullptr; -} - -// ------------------------------------------------------------------------------------------------ -/** Destroy any particle systems that are attached to this object */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::destroyAttachedSystems( Object *obj ) -{ - - // sanity - if( obj == nullptr ) - return; - - // iterate through all systems - for( ParticleSystemListIt it = m_allParticleSystemList.begin(); - it != m_allParticleSystemList.end(); - ++it ) - { - - ParticleSystem *system = *it; - DEBUG_ASSERTCRASH(system != nullptr, ("ParticleSystemManager::destroyAttachedSystems: ParticleSystem is null")); - - if( system->getAttachedObject() == obj->getID() ) - system->destroy(); - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Add a particle to the global particle list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::addParticle( Particle *particleToAdd, ParticlePriorityType priority ) -{ - if (particleToAdd->m_inOverallList) - return; - - if (!m_allParticlesHead[ priority ]) - { - m_allParticlesHead[ priority ] = particleToAdd; - } - - if (m_allParticlesTail[ priority ]) - { - m_allParticlesTail[ priority ]->m_overallNext = particleToAdd; - particleToAdd->m_overallPrev = m_allParticlesTail[ priority ]; - } - else - { - particleToAdd->m_overallPrev = nullptr; - } - - m_allParticlesTail[ priority ] = particleToAdd; - particleToAdd->m_overallNext = nullptr; - particleToAdd->m_inOverallList = TRUE; - - ++m_particleCount; - - -} - -// ------------------------------------------------------------------------------------------------ -/** Remove a particle from the global particle list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::removeParticle( Particle *particleToRemove) -{ - if (!particleToRemove->m_inOverallList) - return; - - // get priority of the particle we're removing - ParticlePriorityType priority = particleToRemove->getPriority(); - - // remove links from prev & next objs - if (particleToRemove->m_overallNext) - particleToRemove->m_overallNext->m_overallPrev = particleToRemove->m_overallPrev; - if (particleToRemove->m_overallPrev) - particleToRemove->m_overallPrev->m_overallNext = particleToRemove->m_overallNext; - - // update head & tail if necessary - if (particleToRemove == m_allParticlesHead[ priority ]) - m_allParticlesHead[ priority ] = particleToRemove->m_overallNext; - if (particleToRemove == m_allParticlesTail[ priority ]) - m_allParticlesTail[ priority ] = particleToRemove->m_overallPrev; - - particleToRemove->m_overallNext = particleToRemove->m_overallPrev = nullptr; - particleToRemove->m_inOverallList = FALSE; - --m_particleCount; - - -} - -// ------------------------------------------------------------------------------------------------ -/** Add a particle system to the master particle system list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::friend_addParticleSystem( ParticleSystem *particleSystemToAdd ) -{ - DEBUG_ASSERTCRASH(particleSystemToAdd != nullptr, ("ParticleSystemManager::friend_addParticleSystem: ParticleSystem is null")); - m_allParticleSystemList.push_back(particleSystemToAdd); - ++m_particleSystemCount; -} - -// ------------------------------------------------------------------------------------------------ -/** Remove a particle system from the master particle system list. */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::friend_removeParticleSystem( ParticleSystem *particleSystemToRemove ) -{ - ParticleSystemListIt it = std::find(m_allParticleSystemList.begin(), m_allParticleSystemList.end(), particleSystemToRemove); - if (it != m_allParticleSystemList.end()) { - m_allParticleSystemList.erase(it); - --m_particleSystemCount; - } else { - DEBUG_CRASH(("ParticleSystemManager::friend_removeParticleSystem: ParticleSystem to remove was not recognized")); - } -} - -// ------------------------------------------------------------------------------------------------ -/** Remove the oldest N number of particles from the lowest priority lists first. We will - * not remove particles from any priorities higher or equal to the priorityCap parameter. */ -// ------------------------------------------------------------------------------------------------ -Int ParticleSystemManager::removeOldestParticles( UnsignedInt count, - ParticlePriorityType priorityCap ) -{ - Int countToRemove = count; - - while (count-- && getParticleCount()) - { - for( Int i = PARTICLE_PRIORITY_LOWEST; - i < priorityCap; - ++i ) - { - if( m_allParticlesHead[ i ] ) - { - deleteInstance(m_allParticlesHead[ i ]); - break; // exit for - } - } - } - - // return the number of particles actually removed - return countToRemove - count; - -} - -// ------------------------------------------------------------------------------------------------ -/** Preload particle system textures */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::preloadAssets( TimeOfDay timeOfDay ) -{ - TemplateMap::iterator begin(m_templateMap.begin()); - TemplateMap::iterator end(m_templateMap.end()); - - for (; begin != end; ++begin) { - const ParticleSystemTemplate *tmplate = (*begin).second; - if (tmplate->m_particleType == ParticleSystemInfo::PARTICLE && - (! tmplate->m_particleTypeName.isEmpty())) - { - TheDisplay->preloadTextureAssets(tmplate->m_particleTypeName); - } - } -} - -// ------------------------------------------------------------------------------------------------ -/** CRC */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::crc( Xfer *xfer ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Xfer method - * Version Info: - * 1: Initial version */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::xfer( Xfer *xfer ) -{ - - // version - XferVersion currentVersion = 1; - XferVersion version = currentVersion; - xfer->xferVersion( &version, currentVersion ); - - // unique system ID counter - xfer->xferUser( &m_uniqueSystemID, sizeof( ParticleSystemID ) ); - - // count of particle systems in the world - UnsignedInt systemCount = m_particleSystemCount; - xfer->xferUnsignedInt( &systemCount ); - - // particle systems data - AsciiString systemName; - ParticleSystem *system; - if( xfer->getXferMode() == XFER_SAVE ) - { - - // iterate each particle system - ParticleSystemListIt it; - for( it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end(); ++it ) - { - systemCount--; - // get system - system = *it; - - // ignore destroyed systems and non-saveable systems - if( system->isDestroyed() == TRUE || system->isSaveable() == FALSE ) { - AsciiString mtString; - xfer->xferAsciiString(&mtString); // write null string as key for destroyed system. - continue; - } - - // write template name - systemName = system->getTemplate()->getName(); - xfer->xferAsciiString( &systemName ); - - // write system data - xfer->xferSnapshot( system ); - - } - DEBUG_ASSERTCRASH(systemCount==0, ("Mismatch in write count.")); - - } - else - { - const ParticleSystemTemplate *systemTemplate; - - // read each particle system - for( UnsignedInt i = 0; i < systemCount; ++i ) - { - - // read system name and find template - xfer->xferAsciiString( &systemName ); - if (systemName.isEmpty()) { - continue; // destroyed particle system. - } - systemTemplate = findTemplate( systemName ); - - // sanity - if( systemTemplate == nullptr ) - { - - DEBUG_CRASH(( "ParticleSystemManager::xfer - Unknown particle system template '%s'", - systemName.str() )); - throw SC_INVALID_DATA; - - } - - // create system - system = createParticleSystem( systemTemplate, FALSE ); - - if( system == nullptr ) - { - - DEBUG_CRASH(( "ParticleSystemManager::xfer - Unable to allocate particle system '%s'", - systemName.str() )); - throw SC_INVALID_DATA; - - } - - // read system data - xfer->xferSnapshot( system ); - - } - - } - -} - -// ------------------------------------------------------------------------------------------------ -/** Load post process */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemManager::loadPostProcess( void ) -{ - -} - -// ------------------------------------------------------------------------------------------------ -/** Output particle system statistics to the screen - * @todo Implement a real console (MSB) */ -// ------------------------------------------------------------------------------------------------ -void ParticleSystemDebugDisplay( DebugDisplayInterface *dd, void *, FILE *fp ) -{ - if (!dd) - return; - - dd->setCursorPos( 0, 0 ); - dd->setRightMargin( 2 ); - - dd->printf( "Total Particles: %d\n", TheParticleSystemManager->getParticleCount() ); - dd->printf( "Total Particles (On Screen): %d\n", TheParticleSystemManager->getOnScreenParticleCount()); - dd->printf( "Total Particle Systems: %d\n", TheParticleSystemManager->getParticleSystemCount() ); - - ParticleSystemManager::ParticleSystemList list = TheParticleSystemManager->getAllParticleSystems(); - ParticleSystemManager::ParticleSystemList::iterator it; - - std::map templateMap; - std::map templateMapParticleCount; - - std::map::iterator templateMapIt; - std::map::iterator templateMapParticleCountIt; - - for ( it = list.begin(); it != list.end(); ++it ) - { - AsciiString templateName = (*it)->getTemplate()->getName(); - templateMapIt = templateMap.find(templateName); - if (templateMapIt == templateMap.end()) - { - templateMap.insert(std::make_pair(templateName, 1)); - templateMapParticleCount.insert(std::make_pair(templateName, (*it)->getParticleCount())); - } - else - { - ++templateMapIt->second; - - templateMapParticleCountIt = templateMapParticleCount.find(templateName); - if (templateMapParticleCountIt != templateMapParticleCount.end()) - templateMapParticleCountIt->second += (*it)->getParticleCount(); - } - } - - for (templateMapIt = templateMap.begin(); templateMapIt != templateMap.end(); ++templateMapIt) - { - templateMapParticleCountIt = templateMapParticleCount.find(templateMapIt->first); - - dd->printf(" %s: %d instances", templateMapIt->first.str(), templateMapIt->second); - if (templateMapParticleCountIt != templateMapParticleCount.end()) - dd->printf(" (Avg per system %.2f)", INT_TO_REAL(templateMapParticleCountIt->second) / templateMapIt->second); - dd->printf("\n"); - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -static Real angleBetween(const Coord2D *vecA, const Coord2D *vecB) -{ - if (!(vecA && vecA->length() && vecB && vecB->length())) { - return 0.0; - } - - Real lengthA = vecA->length(); - Real lengthB = vecB->length(); - Real dotProduct = (vecA->x * vecB->x + vecA->y * vecB->y); - Real cosTheta = dotProduct / (lengthA * lengthB); - - // If the dotproduct is 0.0, then they are orthogonal - if (dotProduct == 0.0f) { - if (vecB->x > 0) { - return PI; - } - - return 0.0f; - } - - Real theta = ACos( cosTheta ); - - if (vecB->x > 0) { - return theta; - } - - return -theta; -} - diff --git a/Generals/Code/Tools/CMakeLists.txt b/Generals/Code/Tools/CMakeLists.txt index e1d0da9bd4d..73404b55a63 100644 --- a/Generals/Code/Tools/CMakeLists.txt +++ b/Generals/Code/Tools/CMakeLists.txt @@ -5,7 +5,6 @@ if(RTS_BUILD_GENERALS_TOOLS) add_subdirectory(GUIEdit) add_subdirectory(ImagePacker) add_subdirectory(MapCacheBuilder) - add_subdirectory(ParticleEditor) add_subdirectory(W3DView) add_subdirectory(WorldBuilder) endif() diff --git a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp b/Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp deleted file mode 100644 index 590c8ef381d..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" - -#include "GameClient/ParticleSys.h" -#include "CButtonShowColor.h" - -// CButtonShowColor /////////////////////////////////////////////////////////////////////////////// -void CButtonShowColor::OnPaint() -{ - try { - CPaintDC paintDC(this); - - CPen pen(PS_SOLID, 1, 0xFFFFFF00); - CBrush brush(RGBtoBGR(m_color.getAsInt())); - // Select my stuff - CPen *oldPen = paintDC.SelectObject(&pen); - - CRect rect; - GetWindowRect(&rect); - ScreenToClient(&rect); - - paintDC.FillRect(&rect, &brush); - paintDC.MoveTo(rect.left, rect.top); - paintDC.LineTo(rect.right, rect.top); - paintDC.LineTo(rect.right, rect.bottom); - paintDC.LineTo(rect.left, rect.bottom); - paintDC.LineTo(rect.left, rect.top); - - // Restore the states. - paintDC.SelectObject(oldPen); - - } catch (...) { - // Unlikely, but possible. - return; - } -} - -CButtonShowColor::~CButtonShowColor() -{ - DestroyWindow(); -} - -// Convert from 0x00RRGGBB to 0x00BBGGRR -COLORREF CButtonShowColor::RGBtoBGR(Int color) -{ - return ((color & 0x00FF0000) >> 16 | - (color & 0x0000FF00) << 0 | - (color & 0x000000FF) << 16); -} - -// Convert from 0x00BBGGRR to 0x00RRGGBB -Int CButtonShowColor::BGRtoRGB(COLORREF color) -{ - return RGBtoBGR(color); -} - -BEGIN_MESSAGE_MAP(CButtonShowColor, CButton) - ON_WM_PAINT() -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.h b/Generals/Code/Tools/ParticleEditor/CButtonShowColor.h deleted file mode 100644 index b11567c6253..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CButtonShowColor.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "Lib/BaseType.h" - -class CButtonShowColor : public CButton -{ - protected: - RGBColor m_color; - - public: - const RGBColor& getColor(void) const { return m_color; } - void setColor(Int color) { m_color.setFromInt(color); } - void setColor(const RGBColor& color) { m_color = color; } - ~CButtonShowColor(); - - - static COLORREF RGBtoBGR(Int color); - static Int BGRtoRGB(COLORREF color); - - - protected: - afx_msg void OnPaint(); - - DECLARE_MESSAGE_MAP(); -}; diff --git a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp b/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp deleted file mode 100644 index f37ac48b493..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.cpp +++ /dev/null @@ -1,327 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" -#include "Resource.h" -#include "CColorAlphaDialog.h" - -#include "GameClient/ParticleSys.h" - -#include "CParticleEditorPage.h" -#include "EmissionTypePanels.h" -#include "ParticleEditorDialog.h" -#include "ParticleEditorExport.h" -#include "ParticleTypePanels.h" -#include "VelocityTypePanels.h" - -#define ARBITRARY_BUFF_SIZE 128 - -static const UINT colorControls[][2] = -{ - {IDC_PSEd_Color1, IDC_PSEd_CF1_Frame}, - {IDC_PSEd_Color2, IDC_PSEd_CF2_Frame}, - {IDC_PSEd_Color3, IDC_PSEd_CF3_Frame}, - {IDC_PSEd_Color4, IDC_PSEd_CF4_Frame}, - {IDC_PSEd_Color5, IDC_PSEd_CF5_Frame}, - {IDC_PSEd_Color6, IDC_PSEd_CF6_Frame}, - {IDC_PSEd_Color7, IDC_PSEd_CF7_Frame}, - {IDC_PSEd_Color8, IDC_PSEd_CF8_Frame} -}; - -static const UINT alphaControls[][3] = -{ - {IDC_PSEd_AF1_Min, IDC_PSEd_AF1_Max, IDC_PSEd_AF1_Frame}, - {IDC_PSEd_AF2_Min, IDC_PSEd_AF2_Max, IDC_PSEd_AF2_Frame}, - {IDC_PSEd_AF3_Min, IDC_PSEd_AF3_Max, IDC_PSEd_AF3_Frame}, - {IDC_PSEd_AF4_Min, IDC_PSEd_AF4_Max, IDC_PSEd_AF4_Frame}, - {IDC_PSEd_AF5_Min, IDC_PSEd_AF5_Max, IDC_PSEd_AF5_Frame}, - {IDC_PSEd_AF6_Min, IDC_PSEd_AF6_Max, IDC_PSEd_AF6_Frame}, - {IDC_PSEd_AF7_Min, IDC_PSEd_AF7_Max, IDC_PSEd_AF7_Frame}, - {IDC_PSEd_AF8_Min, IDC_PSEd_AF8_Max, IDC_PSEd_AF8_Frame} -}; - - - -CColorAlphaDialog::CColorAlphaDialog(UINT nIDTemplate, CWnd* pParentWnd) : - CDialog(nIDTemplate, pParentWnd) -{} - -void CColorAlphaDialog::InitPanel( void ) -{ - CString custColor; - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color1", "0"); - m_customColors[0] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color2", "0"); - m_customColors[1] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color3", "0"); - m_customColors[2] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color4", "0"); - m_customColors[3] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color5", "0"); - m_customColors[4] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color6", "0"); - m_customColors[5] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color7", "0"); - m_customColors[6] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color8", "0"); - m_customColors[7] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color9", "0"); - m_customColors[8] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color10", "0"); - m_customColors[9] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color11", "0"); - m_customColors[10] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color12", "0"); - m_customColors[11] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color13", "0"); - m_customColors[12] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color14", "0"); - m_customColors[13] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color15", "0"); - m_customColors[14] = atol(custColor.GetBuffer(0)); - custColor = AfxGetApp()->GetProfileString("Custom Colors", "Color16", "0"); - m_customColors[15] = atol(custColor.GetBuffer(0)); -} - -void CColorAlphaDialog::performUpdate(IN Bool toUI) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update the colors - for (int i = 0; i < MAX_KEYFRAMES; ++i) { - // update the color swatch - CButtonShowColor *pSwatch = (CButtonShowColor*) GetDlgItem(colorControls[i][0]); - CWnd *pFrame = GetDlgItem(colorControls[i][1]); - RGBColorKeyframe colorFrame; - - if (pSwatch && pFrame) { - if (toUI) { - pParent->getColorValueFromSystem(i, colorFrame); - - pSwatch->setColor(colorFrame.color); - pSwatch->Invalidate(TRUE); - - sprintf(buff, "%u", colorFrame.frame); - pFrame->SetWindowText(buff); - } else { - colorFrame.color = pSwatch->getColor(); - - pFrame->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - colorFrame.frame = atoi(buff); - pParent->updateColorValueToSystem(i, colorFrame); - } - } - } - } - - { // update the values - for (int i = 0; i < MAX_KEYFRAMES; ++i) { - ParticleSystemInfo::RandomKeyframe keyFrame; - - pParent->getAlphaRangeFromSystem(i, keyFrame); - - { // Minimum first - CWnd *pMin = GetDlgItem(alphaControls[i][0]); - if (pMin) { - if (toUI) { - sprintf(buff, FORMAT_STRING, keyFrame.var.getMinimumValue()); - pMin->SetWindowText(buff); - } else { - pMin->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - keyFrame.var.m_low = atof(buff); - } - } - } - - { // then maximum - CWnd *pMax = GetDlgItem(alphaControls[i][1]); - if (pMax) { - if (toUI) { - sprintf(buff, FORMAT_STRING, keyFrame.var.getMaximumValue()); - pMax->SetWindowText(buff); - } else { - pMax->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - keyFrame.var.m_high = atof(buff); - } - } - } - - { // then the frame - CWnd *pFrame = GetDlgItem(alphaControls[i][2]); - if (pFrame) { - if (toUI) { - // Unsigned int - sprintf(buff, "%u", keyFrame.frame); - pFrame->SetWindowText(buff); - } else { - pFrame->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - keyFrame.frame = (unsigned) atoi(buff); - } - } - } - - if (toUI) { - // We're all done. - } else { - pParent->updateAlphaRangeToSystem(i, keyFrame); - } - } - } -} - -void CColorAlphaDialog::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BOOL CColorAlphaDialog::OnInitDialog() -{ - // replace all the buttons with our buttons. - for (int i = 0; i < MAX_KEYFRAMES; ++i) { - CRect rect; - CWnd *item = GetDlgItem(colorControls[i][0]); - if (!item) { - continue; - } - - item->GetWindowRect(&rect); - ScreenToClient(&rect); - DWORD style = item->GetStyle(); - m_colorButton[i].Create("", style, rect, this, colorControls[i][0]); - - item->DestroyWindow(); - } - - return CDialog::OnInitDialog(); -} - -#define ONCOLORDLG(x) void CColorAlphaDialog::OnColor##x() { onColorPress( x ); } -ONCOLORDLG(1) -ONCOLORDLG(2) -ONCOLORDLG(3) -ONCOLORDLG(4) -ONCOLORDLG(5) -ONCOLORDLG(6) -ONCOLORDLG(7) -ONCOLORDLG(8) -#undef ONCOLORDLG - -void CColorAlphaDialog::onColorPress(Int colorPressed) -{ - CColorDialog dlg(CButtonShowColor::RGBtoBGR(m_colorButton[colorPressed - 1].getColor().getAsInt())); - dlg.m_cc.Flags |= (CC_FULLOPEN | CC_ANYCOLOR); - dlg.m_cc.lpCustColors = m_customColors; - if (dlg.DoModal() == IDOK) { - - m_colorButton[colorPressed - 1].setColor(CButtonShowColor::BGRtoRGB(dlg.GetColor())); - static char buff[ARBITRARY_BUFF_SIZE]; - - ltoa(m_customColors[0], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color1", buff); - ltoa(m_customColors[1], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color2", buff); - ltoa(m_customColors[2], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color3", buff); - ltoa(m_customColors[3], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color4", buff); - ltoa(m_customColors[4], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color5", buff); - ltoa(m_customColors[5], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color6", buff); - ltoa(m_customColors[6], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color7", buff); - ltoa(m_customColors[7], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color8", buff); - ltoa(m_customColors[8], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color9", buff); - ltoa(m_customColors[9], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color10", buff); - ltoa(m_customColors[10], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color11", buff); - ltoa(m_customColors[11], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color12", buff); - ltoa(m_customColors[12], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color13", buff); - ltoa(m_customColors[13], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color14", buff); - ltoa(m_customColors[14], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color15", buff); - ltoa(m_customColors[15], buff, 10); - AfxGetApp()->WriteProfileString("Custom Colors", "Color16", buff); - - - - OnParticleSystemEdit(); - } -} - -BEGIN_MESSAGE_MAP(CColorAlphaDialog, CDialog) - ON_BN_CLICKED(IDC_PSEd_Color1, OnColor1) - ON_BN_CLICKED(IDC_PSEd_Color2, OnColor2) - ON_BN_CLICKED(IDC_PSEd_Color3, OnColor3) - ON_BN_CLICKED(IDC_PSEd_Color4, OnColor4) - ON_BN_CLICKED(IDC_PSEd_Color5, OnColor5) - ON_BN_CLICKED(IDC_PSEd_Color6, OnColor6) - ON_BN_CLICKED(IDC_PSEd_Color7, OnColor7) - ON_BN_CLICKED(IDC_PSEd_Color8, OnColor8) - - ON_EN_KILLFOCUS(IDC_PSEd_CF1_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF2_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF3_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF4_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF5_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF6_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF7_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CF8_Frame, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AF1_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF2_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF3_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF4_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF5_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF6_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF7_Min, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF8_Min, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AF1_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF2_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF3_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF4_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF5_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF6_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF7_Max, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF8_Max, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AF1_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF2_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF3_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF4_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF5_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF6_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF7_Frame, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AF8_Frame, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h b/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h deleted file mode 100644 index f1a4fe80d63..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CColorAlphaDialog.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "CButtonShowColor.h" -#include "GameClient/ParticleSys.h" - -class CColorAlphaDialog : public CDialog -{ - protected: - DWORD m_customColors[16]; - CButtonShowColor m_colorButton[MAX_KEYFRAMES]; - - void onColorPress( Int colorPressed ); - public: - enum {IDD = IDD_PSEd_EditColorAndAlpha}; - CColorAlphaDialog(UINT nIDTemplate = CColorAlphaDialog::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - - - protected: - virtual BOOL OnInitDialog(); - - afx_msg void OnColor1(); - afx_msg void OnColor2(); - afx_msg void OnColor3(); - afx_msg void OnColor4(); - afx_msg void OnColor5(); - afx_msg void OnColor6(); - afx_msg void OnColor7(); - afx_msg void OnColor8(); - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - diff --git a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt b/Generals/Code/Tools/ParticleEditor/CMakeLists.txt deleted file mode 100644 index e15405e12b6..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -set(PARTICLEED_SRC - "CButtonShowColor.cpp" - "CButtonShowColor.h" - "CColorAlphaDialog.cpp" - "CColorAlphaDialog.h" - "CSwitchesDialog.cpp" - "CSwitchesDialog.h" - "EmissionTypePanels.cpp" - "EmissionTypePanels.h" - "ISwapablePanel.h" - "MoreParmsDialog.cpp" - "MoreParmsDialog.h" - "ParticleEditor.cpp" - "ParticleEditor.h" - "ParticleEditorDialog.cpp" - "ParticleEditorDialog.h" - "ParticleEditorExport.h" - "ParticleTypePanels.cpp" - "ParticleTypePanels.h" - "Resource.h" - "ShaderTypePanels.cpp" - "ShaderTypePanels.h" - "StdAfx.cpp" - "StdAfx.h" - "VelocityTypePanels.cpp" - "VelocityTypePanels.h" -) - -add_library(g_particleeditor SHARED) -set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME particleeditor PREFIX "") - -target_sources(g_particleeditor PRIVATE ${PARTICLEED_SRC}) - -target_include_directories(g_particleeditor PRIVATE - include - res -) - -target_link_libraries(g_particleeditor PRIVATE - corei_libraries_source_wwvegas - corei_libraries_source_wwvegas_wwlib - gi_always_no_pch - gi_gameengine_include - gi_libraries_source_wwvegas - stlport -) - -if(WIN32 OR "${CMAKE_SYSTEM}" MATCHES "Windows") - target_link_options(g_particleeditor PRIVATE /NODEFAULTLIB:libci.lib /NODEFAULTLIB:libc.lib) - target_compile_definitions(g_particleeditor PRIVATE _AFXDLL) - target_sources(g_particleeditor PRIVATE ParticleEditor.rc) - set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME ParticleEditor) -else() - set_target_properties(g_particleeditor PROPERTIES OUTPUT_NAME particleeditor) -endif() diff --git a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h b/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h deleted file mode 100644 index b2458f3002d..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CParticleEditorPage.h +++ /dev/null @@ -1,33 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -struct CParticleEditorPage : public CDialog -{ - UINT m_templateID; - public: - CParticleEditorPage(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr); - void InitPanel( int templateID ); - - - protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - DECLARE_MESSAGE_MAP() -}; - diff --git a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp b/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp deleted file mode 100644 index 4839ed89743..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.cpp +++ /dev/null @@ -1,136 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" -#include "Resource.h" -#include "CSwitchesDialog.h" - -#include "ParticleEditorDialog.h" - -CSwitchesDialog::CSwitchesDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd) -{ - -} - -void CSwitchesDialog::InitPanel( void ) -{ - -} - -// if true, updates the UI from the Particle System. -// if false, updates the Particle System from the UI -void CSwitchesDialog::performUpdate( IN Bool toUI ) -{ - DebugWindowDialog *parent = GetDWDParent(); - if (!parent) { - return; - } - - { // update hollowness - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_Hollow); - if (pWnd) { - Bool hollow; - if (toUI) { - parent->getSwitchFromSystem(ST_HOLLOW, hollow); - pWnd->SetCheck(hollow); - } else { - hollow = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_HOLLOW, hollow); - } - } - } - - { // update one shot - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_OneShot); - if (pWnd) { - Bool oneShot; - if (toUI) { - parent->getSwitchFromSystem(ST_ONESHOT, oneShot); - pWnd->SetCheck(oneShot); - } else { - oneShot = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_ONESHOT, oneShot); - } - } - } - - { // update Ground Aligned - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_GroundAligned); - if (pWnd) { - Bool groundAlign; - if (toUI) { - parent->getSwitchFromSystem(ST_ALIGNXY, groundAlign); - pWnd->SetCheck(groundAlign); - } else { - groundAlign = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_ALIGNXY, groundAlign); - } - } - } - - { // update Emit above ground only - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_EmitAboveGroundOnly); - if (pWnd) { - Bool aboveGroundOnly; - if (toUI) { - parent->getSwitchFromSystem(ST_EMITABOVEGROUNDONLY, aboveGroundOnly); - pWnd->SetCheck(aboveGroundOnly); - } else { - aboveGroundOnly = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_EMITABOVEGROUNDONLY, aboveGroundOnly); - } - } - } - - { // update Particle Up towards emitter - CButton *pWnd; - pWnd = (CButton*)GetDlgItem(IDC_PSEd_ParticleUpTowardsEmitter); - if (pWnd) { - Bool upTowardsEmitter; - if (toUI) { - parent->getSwitchFromSystem(ST_PARTICLEUPTOWARDSEMITTER, upTowardsEmitter); - pWnd->SetCheck(upTowardsEmitter); - } else { - upTowardsEmitter = pWnd->GetCheck(); - parent->updateSwitchToSystem(ST_PARTICLEUPTOWARDSEMITTER, upTowardsEmitter); - } - } - } -} - -void CSwitchesDialog::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = GetDWDParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(CSwitchesDialog, CDialog) - ON_BN_CLICKED(IDC_PSEd_OneShot, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_Hollow, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_GroundAligned, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_EmitAboveGroundOnly, OnParticleSystemEdit) - ON_BN_CLICKED(IDC_PSEd_ParticleUpTowardsEmitter, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h b/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h deleted file mode 100644 index 6a3f2d30373..00000000000 --- a/Generals/Code/Tools/ParticleEditor/CSwitchesDialog.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "Lib/BaseType.h" - -class DebugWindowDialog; - -class CSwitchesDialog : public CDialog -{ - public: - enum {IDD = IDD_PSEd_EditSwitchesDialog}; - CSwitchesDialog(UINT nIDTemplate = CSwitchesDialog::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - DebugWindowDialog* GetDWDParent(void) { return (DebugWindowDialog*) GetParent(); } - - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - diff --git a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp deleted file mode 100644 index 4de83a2a1ec..00000000000 --- a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: EmissionTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: EmissionTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "EmissionTypePanels.h" -#include "ParticleEditorDialog.h" - -// Defines //////////////////////////////////////////////////////////////////// -#define ARBITRARY_BUFF_SIZE 128 - - -// EmissionPanelLine ////////////////////////////////////////////////////////// -EmissionPanelPoint::EmissionPanelPoint(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelPoint::InitPanel( void ) -{ - -} - -void EmissionPanelPoint::performUpdate( IN Bool toUI ) -{ - -} - -void EmissionPanelPoint::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelPoint, ISwapablePanel) -END_MESSAGE_MAP() - - -// Defines //////////////////////////////////////////////////////////////////// -#define ARBITRARY_BUFF_SIZE 128 - -// EmissionPanelLine ////////////////////////////////////////////////////////// -EmissionPanelLine::EmissionPanelLine(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelLine::InitPanel( void ) -{ - -} - -void EmissionPanelLine::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update line parameters - Real linePoint; - CWnd *pWnd; - - // first X1 - pWnd = GetDlgItem(IDC_PSEd_LineStartX); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(0, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(0, linePoint); - } - } - - // now the Y1 - pWnd = GetDlgItem(IDC_PSEd_LineStartY); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(1, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(1, linePoint); - } - } - - // now the Z1 - pWnd = GetDlgItem(IDC_PSEd_LineStartZ); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(2, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(2, linePoint); - } - } - - // first the X2 - pWnd = GetDlgItem(IDC_PSEd_LineEndX); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(3, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(3, linePoint); - } - } - - // now the Y2 - pWnd = GetDlgItem(IDC_PSEd_LineEndY); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(4, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(4, linePoint); - } - } - - // the Z2 - pWnd = GetDlgItem(IDC_PSEd_LineEndZ); - if (pWnd) { - if (toUI) { - pParent->getLineFromSystem(5, linePoint); - - sprintf(buff, FORMAT_STRING, linePoint); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - linePoint = atof(buff); - pParent->updateLineToSystem(5, linePoint); - } - } - } - -} - -void EmissionPanelLine::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelLine, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_LineStartX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineStartY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineStartZ, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineEndX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineEndY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_LineEndZ, OnParticleSystemEdit) - -END_MESSAGE_MAP() - - -// EmissionPanelBox /////////////////////////////////////////////////////////// -EmissionPanelBox::EmissionPanelBox(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelBox::InitPanel( void ) -{ - -} - -void EmissionPanelBox::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update half size of box - Real halfSize; - CWnd *pWnd; - - // first the X - pWnd = GetDlgItem(IDC_PSEd_BoxHalfSizeX); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(0, halfSize); - - sprintf(buff, FORMAT_STRING, halfSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - halfSize = atof(buff); - pParent->updateHalfSizeToSystem(0, halfSize); - } - } - - // now the Y - pWnd = GetDlgItem(IDC_PSEd_BoxHalfSizeY); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(1, halfSize); - - sprintf(buff, FORMAT_STRING, halfSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - halfSize = atof(buff); - pParent->updateHalfSizeToSystem(1, halfSize); - } - } - - // finally, the Z - pWnd = GetDlgItem(IDC_PSEd_BoxHalfSizeZ); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(2, halfSize); - - sprintf(buff, FORMAT_STRING, halfSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - halfSize = atof(buff); - pParent->updateHalfSizeToSystem(2, halfSize); - } - } - } -} - -void EmissionPanelBox::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelBox, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_BoxHalfSizeX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BoxHalfSizeY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BoxHalfSizeZ, OnParticleSystemEdit) -END_MESSAGE_MAP() - - -// EmissionPanelSphere //////////////////////////////////////////////////////// -EmissionPanelSphere::EmissionPanelSphere(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelSphere::InitPanel( void ) -{ - -} - -void EmissionPanelSphere::performUpdate( IN Bool toUI ) -{ - - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update sphere radius - Real radius; - CWnd *pWnd; - - // first the X - pWnd = GetDlgItem(IDC_PSEd_SphereRadius); - if (pWnd) { - if (toUI) { - pParent->getHalfSizeFromSystem(0, radius); - - sprintf(buff, FORMAT_STRING, radius); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radius = atof(buff); - pParent->updateHalfSizeToSystem(0, radius); - } - } - } -} - -void EmissionPanelSphere::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelSphere, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_SphereRadius, OnParticleSystemEdit) -END_MESSAGE_MAP() - - - -// EmissionPanelCylinder ////////////////////////////////////////////////////// -EmissionPanelCylinder::EmissionPanelCylinder(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void EmissionPanelCylinder::InitPanel( void ) -{ - -} - -void EmissionPanelCylinder::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update cylinder parameters - CWnd *pWnd; - - // first the Radius - pWnd = GetDlgItem(IDC_PSEd_CylRadius); - if (pWnd) { - Real radius; - if (toUI) { - pParent->getCylinderRadiusFromSystem(radius); - - sprintf(buff, FORMAT_STRING, radius); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radius = atof(buff); - pParent->updateCylinderRadiusToSystem(radius); - } - } - - // now the Length - pWnd = GetDlgItem(IDC_PSEd_CylLength); - if (pWnd) { - Real length; - if (toUI) { - - pParent->getCylinderLengthFromSystem(length); - - sprintf(buff, FORMAT_STRING, length); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - length = atof(buff); - pParent->updateCylinderLengthToSystem(length); - } - } - } -} - -void EmissionPanelCylinder::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(EmissionPanelCylinder, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_CylRadius, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylLength, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h b/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h deleted file mode 100644 index 3082593c715..00000000000 --- a/Generals/Code/Tools/ParticleEditor/EmissionTypePanels.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: EmissionTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: EmissionTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: Emission panels are pretty similar, they all go here. */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -#include "Resource.h" -#include "ISwapablePanel.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// EmissionPanelPoint ////////////////////////////////////////////////////////// -class EmissionPanelPoint : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelPoint}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelPoint(UINT nIDTemplate = EmissionPanelPoint::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelLine ////////////////////////////////////////////////////////// -class EmissionPanelLine : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelLine}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelLine(UINT nIDTemplate = EmissionPanelLine::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelBox /////////////////////////////////////////////////////////// -class EmissionPanelBox : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelBox}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelBox(UINT nIDTemplate = EmissionPanelBox::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelSphere //////////////////////////////////////////////////////// -class EmissionPanelSphere : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelSphere}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelSphere(UINT nIDTemplate = EmissionPanelSphere::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// EmissionPanelCylinder ////////////////////////////////////////////////////// -class EmissionPanelCylinder : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_EmissionPanelCylinder}; - virtual DWORD GetIDD( void ) { return IDD; } - EmissionPanelCylinder(UINT nIDTemplate = EmissionPanelCylinder::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h b/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h deleted file mode 100644 index fc8e38cd2bd..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ISwapablePanel.h +++ /dev/null @@ -1,50 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ISwapablePanel.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ISwapablePanel.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: Swapable panels derive from this so that we can easily call */ -/* the update function */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -#include "Lib/BaseType.h" - -// INCLUDES /////////////////////////////////////////////////////////////////// -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -interface ISwapablePanel : public CDialog -{ - ISwapablePanel(UINT nIDTemplate = 0, CWnd* pParentWnd = nullptr) : CDialog(nIDTemplate, pParentWnd) {} - virtual DWORD GetIDD( void ) = 0; - virtual void performUpdate( IN Bool toUI ) = 0; - virtual void InitPanel( void ) = 0; -}; diff --git a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp b/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp deleted file mode 100644 index 38f8c687dbf..00000000000 --- a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.cpp +++ /dev/null @@ -1,677 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: MoreParmsDialog.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: MoreParmsDialog.cpp */ -/* Created: John K. McDonald, Jr., 3/23/2002 */ -/* Desc: Additional particle system parameters */ -/* Revision History: */ -/* 3/23/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ -#include "StdAfx.h" -#include "MoreParmsDialog.h" -#include "ParticleEditorDialog.h" - -#define ARBITRARY_BUFF_SIZE 128 - -MoreParmsDialog::MoreParmsDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd) -{ - -} - -MoreParmsDialog::~MoreParmsDialog() -{ - -} - -void MoreParmsDialog::InitPanel( void ) -{ - CComboBox* pCombo; - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_WindMotion); - if (pCombo) { - for (int i = 1; WindMotionNames[i]; ++i) { - pCombo->AddString(WindMotionNames[i]); - } - pCombo->SetCurSel(0); - } - -} - -void MoreParmsDialog::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - - { // Update all fields on this panel. - CWnd *pWnd; - - { // initial delay - Real initialDelay; - - pWnd = GetDlgItem(IDC_PSEd_InitialDelayMin); - if (pWnd) { - if (toUI) { - pParent->getInitialDelayFromSystem(0, initialDelay); - sprintf(buff, FORMAT_STRING, initialDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - initialDelay = atof(buff); - pParent->updateInitialDelayToSystem(0, initialDelay); - } - } - - pWnd = GetDlgItem(IDC_PSEd_InitialDelayMax); - if (pWnd) { - if (toUI) { - pParent->getInitialDelayFromSystem(1, initialDelay); - sprintf(buff, FORMAT_STRING, initialDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - initialDelay = atof(buff); - pParent->updateInitialDelayToSystem(1, initialDelay); - } - } - } - - { // burst delay - Real burstDelay; - - pWnd = GetDlgItem(IDC_PSEd_BurstDelayMin); - if (pWnd) { - if (toUI) { - pParent->getBurstDelayFromSystem(0, burstDelay); - sprintf(buff, FORMAT_STRING, burstDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstDelay = atof(buff); - pParent->updateBurstDelayToSystem(0, burstDelay); - } - } - - pWnd = GetDlgItem(IDC_PSEd_BurstDelayMax); - if (pWnd) { - if (toUI) { - pParent->getBurstDelayFromSystem(1, burstDelay); - sprintf(buff, FORMAT_STRING, burstDelay); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstDelay = atof(buff); - pParent->updateBurstDelayToSystem(1, burstDelay); - } - } - } - - { // burst count - Real burstCount; - - pWnd = GetDlgItem(IDC_PSEd_BurstCountMin); - if (pWnd) { - if (toUI) { - pParent->getBurstCountFromSystem(0, burstCount); - sprintf(buff, FORMAT_STRING, burstCount); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstCount = atof(buff); - pParent->updateBurstCountToSystem(0, burstCount); - } - } - - pWnd = GetDlgItem(IDC_PSEd_BurstCountMax); - if (pWnd) { - if (toUI) { - pParent->getBurstCountFromSystem(1, burstCount); - sprintf(buff, FORMAT_STRING, burstCount); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - burstCount = atof(buff); - pParent->updateBurstCountToSystem(1, burstCount); - } - } - } - - { // color scale - Real colorScale; - - pWnd = GetDlgItem(IDC_PSEd_ColorScaleMin); - if (pWnd) { - if (toUI) { - pParent->getColorScaleFromSystem(0, colorScale); - sprintf(buff, FORMAT_STRING, colorScale); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - colorScale = atof(buff); - pParent->updateColorScaleToSystem(0, colorScale); - } - } - - pWnd = GetDlgItem(IDC_PSEd_ColorScaleMax); - if (pWnd) { - if (toUI) { - pParent->getColorScaleFromSystem(1, colorScale); - sprintf(buff, FORMAT_STRING, colorScale); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - colorScale = atof(buff); - pParent->updateColorScaleToSystem(1, colorScale); - } - } - } - - { // particle lifetime - Real particleLifetime; - - pWnd = GetDlgItem(IDC_PSEd_ParticleLifetimeMin); - if (pWnd) { - if (toUI) { - pParent->getParticleLifetimeFromSystem(0, particleLifetime); - sprintf(buff, FORMAT_STRING, particleLifetime); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleLifetime = atof(buff); - pParent->updateParticleLifetimeToSystem(0, particleLifetime); - } - } - - pWnd = GetDlgItem(IDC_PSEd_ParticleLifetimeMax); - if (pWnd) { - if (toUI) { - pParent->getParticleLifetimeFromSystem(1, particleLifetime); - sprintf(buff, FORMAT_STRING, particleLifetime); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleLifetime = atof(buff); - pParent->updateParticleLifetimeToSystem(1, particleLifetime); - } - } - } - - { // particle size - Real particleSize; - - pWnd = GetDlgItem(IDC_PSEd_SizeMin); - if (pWnd) { - if (toUI) { - pParent->getParticleSizeFromSystem(0, particleSize); - sprintf(buff, FORMAT_STRING, particleSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleSize = atof(buff); - pParent->updateParticleSizeToSystem(0, particleSize); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SizeMax); - if (pWnd) { - if (toUI) { - pParent->getParticleSizeFromSystem(1, particleSize); - sprintf(buff, FORMAT_STRING, particleSize); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - particleSize = atof(buff); - pParent->updateParticleSizeToSystem(1, particleSize); - } - } - } - - { // start size rate - Real startSizeRate; - - pWnd = GetDlgItem(IDC_PSEd_StartSizeRateMin); - if (pWnd) { - if (toUI) { - pParent->getStartSizeRateFromSystem(0, startSizeRate); - sprintf(buff, FORMAT_STRING, startSizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - startSizeRate = atof(buff); - pParent->updateStartSizeRateToSystem(0, startSizeRate); - } - } - - pWnd = GetDlgItem(IDC_PSEd_StartSizeRateMax); - if (pWnd) { - if (toUI) { - pParent->getStartSizeRateFromSystem(1, startSizeRate); - sprintf(buff, FORMAT_STRING, startSizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - startSizeRate = atof(buff); - pParent->updateStartSizeRateToSystem(1, startSizeRate); - } - } - } - - { // size rate - Real sizeRate; - - pWnd = GetDlgItem(IDC_PSEd_SizeRateMin); - if (pWnd) { - if (toUI) { - pParent->getSizeRateFromSystem(0, sizeRate); - sprintf(buff, FORMAT_STRING, sizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeRate = atof(buff); - pParent->updateSizeRateToSystem(0, sizeRate); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SizeRateMax); - if (pWnd) { - if (toUI) { - pParent->getSizeRateFromSystem(1, sizeRate); - sprintf(buff, FORMAT_STRING, sizeRate); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeRate = atof(buff); - pParent->updateSizeRateToSystem(1, sizeRate); - } - } - } - - { // size damping - Real sizeDamping; - - pWnd = GetDlgItem(IDC_PSEd_SizeDampingMin); - if (pWnd) { - if (toUI) { - pParent->getSizeDampingFromSystem(0, sizeDamping); - sprintf(buff, FORMAT_STRING, sizeDamping); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeDamping = atof(buff); - pParent->updateSizeDampingToSystem(0, sizeDamping); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SizeDampingMax); - if (pWnd) { - if (toUI) { - pParent->getSizeDampingFromSystem(1, sizeDamping); - sprintf(buff, FORMAT_STRING, sizeDamping); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - sizeDamping = atof(buff); - pParent->updateSizeDampingToSystem(1, sizeDamping); - } - } - } - - { // system lifetime - Real systemLifetime; - - pWnd = GetDlgItem(IDC_PSEd_SystemLifetime); - if (pWnd) { - if (toUI) { - pParent->getSystemLifetimeFromSystem(systemLifetime); - sprintf(buff, FORMAT_STRING, systemLifetime); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - systemLifetime = atof(buff); - pParent->updateSystemLifetimeToSystem(systemLifetime); - } - } - } - - { // slave position offset - Real slaveOffset; - - pWnd = GetDlgItem(IDC_PSEd_SlaveOffsetX); - if (pWnd) { - if (toUI) { - pParent->getSlaveOffsetFromSystem(0, slaveOffset); - sprintf(buff, FORMAT_STRING, slaveOffset); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - slaveOffset = atof(buff); - pParent->updateSlaveOffsetToSystem(0, slaveOffset); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SlaveOffsetY); - if (pWnd) { - if (toUI) { - pParent->getSlaveOffsetFromSystem(1, slaveOffset); - sprintf(buff, FORMAT_STRING, slaveOffset); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - slaveOffset = atof(buff); - pParent->updateSlaveOffsetToSystem(1, slaveOffset); - } - } - - pWnd = GetDlgItem(IDC_PSEd_SlaveOffsetZ); - if (pWnd) { - if (toUI) { - pParent->getSlaveOffsetFromSystem(2, slaveOffset); - sprintf(buff, FORMAT_STRING, slaveOffset); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - slaveOffset = atof(buff); - pParent->updateSlaveOffsetToSystem(2, slaveOffset); - } - } - } - - { // drift velocity - Real driftVelocity; - - pWnd = GetDlgItem(IDC_PSEd_DriftVelocityX); - if (pWnd) { - if (toUI) { - pParent->getDriftVelocityFromSystem(0, driftVelocity); - sprintf(buff, FORMAT_STRING, driftVelocity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - driftVelocity = atof(buff); - pParent->updateDriftVelocityToSystem(0, driftVelocity); - } - } - - pWnd = GetDlgItem(IDC_PSEd_DriftVelocityY); - if (pWnd) { - if (toUI) { - pParent->getDriftVelocityFromSystem(1, driftVelocity); - sprintf(buff, FORMAT_STRING, driftVelocity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - driftVelocity = atof(buff); - pParent->updateDriftVelocityToSystem(1, driftVelocity); - } - } - - pWnd = GetDlgItem(IDC_PSEd_DriftVelocityZ); - if (pWnd) { - if (toUI) { - pParent->getDriftVelocityFromSystem(2, driftVelocity); - sprintf(buff, FORMAT_STRING, driftVelocity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - driftVelocity = atof(buff); - pParent->updateDriftVelocityToSystem(2, driftVelocity); - } - } - } - - { // slave system - CComboBox *pCombo; - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_SlaveSystem); - if (pCombo->GetCount() == 0) { - // This is done here because InitPanel is called before Particle Systems have been sent over. - pCombo->AddString(NONE_STRING); - std::list::const_iterator cit; - const std::list &r = pParent->getAllParticleSystems(); - for (cit = r.begin(); cit != r.end(); ++cit) { - pCombo->AddString(cit->c_str()); - } - } - - if (pCombo) { - if (toUI) { - pParent->getSlaveSystemFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - if (buff[0] == 0) { - pCombo->SelectString(-1, NONE_STRING); - } else { - pCombo->SelectString(-1, buff); - } - } else { - int selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - pCombo->GetLBText(selndx, buff); - if (strcmp(buff, NONE_STRING) == 0) { - pParent->updateSlaveSystemToSystem(""); - } else { - pParent->updateSlaveSystemToSystem(buff); - } - } - } - } - } - - { // slave system - CComboBox *pCombo; - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_PerParticleSystem); - if (pCombo->GetCount() == 0) { - // This is done here because InitPanel is called before Particle Systems have been sent over. - pCombo->AddString(NONE_STRING); - std::list::const_iterator cit; - const std::list &r = pParent->getAllParticleSystems(); - for (cit = r.begin(); cit != r.end(); ++cit) { - pCombo->AddString(cit->c_str()); - } - } - - if (pCombo) { - if (toUI) { - pParent->getPerParticleSystemFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - if (buff[0] == 0) { - pCombo->SelectString(-1, NONE_STRING); - } else { - pCombo->SelectString(-1, buff); - } - } else { - int selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - pCombo->GetLBText(selndx, buff); - if (strcmp(buff, NONE_STRING) == 0) { - pParent->updatePerParticleSystemToSystem(""); - } else { - pParent->updatePerParticleSystemToSystem(buff); - } - } - } - } - } - - { // ping pong wind start angle - Real angle; - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongStartAngleMin); - if (pWnd) { - if (toUI) { - pParent->getPingPongStartAngleFromSystem(0, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongStartAngleToSystem(0, angle); - } - } - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongStartAngleMax); - if (pWnd) { - if (toUI) { - pParent->getPingPongStartAngleFromSystem(1, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongStartAngleToSystem(1, angle); - } - } - } - - { // ping pong wind end angle - Real angle; - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongEndAngleMin); - if (pWnd) { - if (toUI) { - pParent->getPingPongEndAngleFromSystem(0, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongEndAngleToSystem(0, angle); - } - } - - pWnd = GetDlgItem(IDC_PSEd_WindPingPongEndAngleMax); - if (pWnd) { - if (toUI) { - pParent->getPingPongEndAngleFromSystem(1, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updatePingPongEndAngleToSystem(1, angle); - } - } - } - - { // wind angle change - Real angle; - - pWnd = GetDlgItem(IDC_PSEd_WindAngleChangeMin); - if (pWnd) { - if (toUI) { - pParent->getWindAngleChangeFromSystem(0, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updateWindAngleChangeToSystem(0, angle); - } - } - - pWnd = GetDlgItem(IDC_PSEd_WindAngleChangeMax); - if (pWnd) { - if (toUI) { - pParent->getWindAngleChangeFromSystem(1, angle); - sprintf(buff, FORMAT_STRING, angle); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - angle = atof(buff); - pParent->updateWindAngleChangeToSystem(1, angle); - } - } - } - - { // wind motion - CComboBox *pCombo; - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_WindMotion); - - if (pCombo) { - int selndx; - if (toUI) { - ParticleSystemInfo::WindMotion windMotion; - - pParent->getWindMotionFromSystem( windMotion ); - selndx = pCombo->SelectString(-1, WindMotionNames[(long) windMotion]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - pParent->updateWindMotionToSystem( (ParticleSystemInfo::WindMotion)(selndx + 1) ); - } - } - } - } - - - } -} - -void MoreParmsDialog::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(MoreParmsDialog, CDialog) - ON_EN_KILLFOCUS(IDC_PSEd_InitialDelayMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_InitialDelayMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstDelayMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstDelayMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstCountMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_BurstCountMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ColorScaleMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ColorScaleMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ParticleLifetimeMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_ParticleLifetimeMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_StartSizeRateMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_StartSizeRateMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeRateMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeRateMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeDampingMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SizeDampingMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SystemLifetime, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SlaveOffsetX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SlaveOffsetY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SlaveOffsetZ, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_DriftVelocityX, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_DriftVelocityY, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_DriftVelocityZ, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_SlaveSystem, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_PerParticleSystem, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindAngleChangeMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindAngleChangeMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongStartAngleMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongStartAngleMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongEndAngleMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_WindPingPongEndAngleMax, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_WindMotion, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h b/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h deleted file mode 100644 index f7f3dc0d13e..00000000000 --- a/Generals/Code/Tools/ParticleEditor/MoreParmsDialog.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: MoreParmsDialog.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: MoreParmsDialog.h */ -/* Created: John K. McDonald, Jr., 3/23/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/23/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -#include "Resource.h" -#include "Lib/BaseType.h" - -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -class MoreParmsDialog : public CDialog -{ - public: - enum { IDD = IDD_PSEd_EditMoreParms }; - MoreParmsDialog(UINT nIDTemplate = MoreParmsDialog::IDD, CWnd* pParentWnd = nullptr); - virtual ~MoreParmsDialog(); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp deleted file mode 100644 index bd4b45e05d0..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditor.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// DebugWindow.cpp : Defines the initialization routines for the DLL. -// - -#include "StdAfx.h" -#include "ParticleEditor.h" -#include "ParticleEditorDialog.h" - -#ifdef RTS_DEBUG -#define new DEBUG_NEW -#undef THIS_FILE -static char THIS_FILE[] = __FILE__; -#endif - -// -// Note! -// -// If this DLL is dynamically linked against the MFC -// DLLs, any functions exported from this DLL which -// call into MFC must have the AFX_MANAGE_STATE macro -// added at the very beginning of the function. -// -// For example: -// -// extern "C" BOOL PASCAL EXPORT ExportedFunction() -// { -// AFX_MANAGE_STATE(AfxGetStaticModuleState()); -// // normal function body here -// } -// -// It is very important that this macro appear in each -// function, prior to any calls into MFC. This means that -// it must appear as the first statement within the -// function, even before any object variable declarations -// as their constructors may generate calls into the MFC -// DLL. -// -// Please see MFC Technical Notes 33 and 58 for additional -// details. -// - -///////////////////////////////////////////////////////////////////////////// -// CDebugWindowApp - -BEGIN_MESSAGE_MAP(CDebugWindowApp, CWinApp) - //{{AFX_MSG_MAP(CDebugWindowApp) - // NOTE - the ClassWizard will add and remove mapping macros here. - // DO NOT EDIT what you see in these blocks of generated code! - //}}AFX_MSG_MAP -END_MESSAGE_MAP() - -///////////////////////////////////////////////////////////////////////////// -// CDebugWindowApp construction - -CDebugWindowApp::CDebugWindowApp() -{ - AfxInitialize(true); - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - m_DialogWindow = nullptr; - -} - -DebugWindowDialog* CDebugWindowApp::GetDialogWindow(void) -{ - return m_DialogWindow; -} - -void CDebugWindowApp::SetDialogWindow(DebugWindowDialog* pWnd) -{ - m_DialogWindow = pWnd; -} - -CDebugWindowApp::~CDebugWindowApp() -{ -} - - -///////////////////////////////////////////////////////////////////////////// -// The one and only CDebugWindowApp object - -CDebugWindowApp theApp; - -void __declspec(dllexport) CreateParticleSystemDialog(void) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - - DebugWindowDialog* tmpWnd; - tmpWnd = new DebugWindowDialog; - tmpWnd->Create(DebugWindowDialog::IDD, nullptr); - - tmpWnd->SetWindowPos(nullptr, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER); - tmpWnd->InitPanel(); - tmpWnd->ShowWindow(SW_SHOW); - if (tmpWnd->GetMainWndHWND()) { - SetFocus(tmpWnd->GetMainWndHWND()); - } - - theApp.SetDialogWindow(tmpWnd); - } catch (...) { } -} - -void __declspec(dllexport) DestroyParticleSystemDialog(void) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->DestroyWindow(); - delete tmpWnd; - theApp.SetDialogWindow(nullptr); - } - } catch (...) { } -} - -void __declspec(dllexport) RemoveAllParticleSystems(void) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->clearAllParticleSystems(); - } - } catch (...) { } -} - -void __declspec(dllexport) AppendParticleSystem(const char* particleSystemName) -{ - try{ - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->addParticleSystem(particleSystemName); - } - } catch (...) { } -} - -void __declspec(dllexport) RemoveAllThingTemplates( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->clearAllThingTemplates(); - } - } catch (...) { } -} - - -void __declspec(dllexport) AppendThingTemplate( const char* thingTemplateName ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->addThingTemplate(thingTemplateName); - } - } catch (...) { } -} - - -Bool __declspec(dllexport) HasUpdatedSelectedParticleSystem( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->hasSelectionChanged(); - } - } catch (...) { } - - return false; -} - -void __declspec(dllexport) GetSelectedParticleSystemName( char *bufferToCopyInto ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->getSelectedSystemName(bufferToCopyInto); - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateCurrentParticleCap( int currentParticleCap ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateCurrentParticleCap(currentParticleCap); - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateCurrentNumParticles( int currentParticleCount ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateCurrentNumParticles(currentParticleCount); - } - } catch (...) { } -} - -int __declspec(dllexport) GetNewParticleCap( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->getNewParticleCap(); - } - } catch (...) { } - return -1; -} - - -void __declspec(dllexport) GetSelectedParticleAsciiStringParm( int parmNum, char *bufferToCopyInto, ParticleSystemTemplate **whichTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->getSelectedParticleAsciiStringParm(parmNum, bufferToCopyInto); - if (whichTemplate) { - (*whichTemplate) = tmpWnd->getCurrentParticleSystem(); - } - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateParticleAsciiStringParm( int parmNum, const char *bufferToCopyFrom, ParticleSystemTemplate **whichTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateParticleAsciiStringParm(parmNum, bufferToCopyFrom); - if (whichTemplate) { - (*whichTemplate) = tmpWnd->getCurrentParticleSystem(); - } - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateCurrentParticleSystem( ParticleSystemTemplate *particleTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateCurrentParticleSystem(particleTemplate); - } - } catch (...) { } -} - -void __declspec(dllexport) UpdateSystemUseParameters( ParticleSystemTemplate *particleTemplate) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - tmpWnd->updateSystemUseParameters(particleTemplate); - } - } catch(...) { } -} - -Bool __declspec(dllexport) ShouldWriteINI( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldWriteINI(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) HasRequestedReload( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->hasRequestedReload(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) ShouldBusyWait( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldBusyWait(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) ShouldUpdateParticleCap( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldUpdateParticleCap(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) ShouldReloadTextures( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldReloadTextures(); - } - } catch (...) { } - - return false; -} - -Bool __declspec(dllexport) HasRequestedKillAllSystems( void ) -{ - try { - AFX_MANAGE_STATE(AfxGetStaticModuleState( )); - DebugWindowDialog* tmpWnd = theApp.GetDialogWindow(); - - if (tmpWnd) { - return tmpWnd->shouldKillAllParticleSystems(); - } - } catch (...) { } - - return false; -} - -int __declspec(dllexport) NextParticleEditorBehavior( void ) -{ - try { - if (HasUpdatedSelectedParticleSystem()) { - return PEB_UpdateCurrentSystem; - } - - if (ShouldWriteINI()) { - return PEB_SaveAllSystems; - } - - if (HasRequestedReload()) { - return PEB_ReloadCurrentSystem; - } - - if (ShouldBusyWait()) { - return PEB_BusyWait; - } - - if (ShouldUpdateParticleCap()) { - return PEB_SetParticleCap; - } - - if (ShouldReloadTextures()) { - return PEB_ReloadTextures; - } - - if (HasRequestedKillAllSystems()) { - return PEB_KillAllSystems; - } - - return PEB_Continue; - } catch (...) { } - return PEB_Error; -} - - diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditor.h b/Generals/Code/Tools/ParticleEditor/ParticleEditor.h deleted file mode 100644 index 5c2b350047a..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditor.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// DebugWindow.h : main header file for the DEBUGWINDOW DLL -// - -#pragma once - -#ifndef __AFXWIN_H__ - #error include 'stdafx.h' before including this file for PCH -#endif - -#include "Resource.h" // main symbols -#include "ParticleEditorExport.h" -///////////////////////////////////////////////////////////////////////////// -// CDebugWindowApp -// See DebugWindow.cpp for the implementation of this class -// - -class DebugWindowDialog; - -class CDebugWindowApp : public CWinApp -{ - public: - CDebugWindowApp(); - ~CDebugWindowApp(); - DebugWindowDialog* GetDialogWindow(void); - void SetDialogWindow(DebugWindowDialog* pWnd); - - protected: - DebugWindowDialog* m_DialogWindow; - - -// Overrides - // ClassWizard generated virtual function overrides - //{{AFX_VIRTUAL(CDebugWindowApp) - //}}AFX_VIRTUAL - - //{{AFX_MSG(CDebugWindowApp) - // NOTE - the ClassWizard will add and remove member functions here. - // DO NOT EDIT what you see in these blocks of generated code ! - //}}AFX_MSG - DECLARE_MESSAGE_MAP() -}; - - -///////////////////////////////////////////////////////////////////////////// - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp deleted file mode 100644 index 3f5b16ef72b..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.cpp +++ /dev/null @@ -1,1837 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#include "StdAfx.h" -#include "Resource.h" -#include "ParticleEditorDialog.h" - -#include "CParticleEditorPage.h" -#include "EmissionTypePanels.h" -#include "GameClient/ParticleSys.h" -#include "ParticleEditorExport.h" -#include "ParticleTypePanels.h" -#include "VelocityTypePanels.h" - - -#define ARBITRARY_BUFF_SIZE 128 - -DebugWindowDialog::DebugWindowDialog(UINT nIDTemplate, CWnd* pParentWnd) : CDialog(nIDTemplate, pParentWnd), -m_colorAlphaDialog(CColorAlphaDialog::IDD, this), -m_switchesDialog(CSwitchesDialog::IDD, this), -m_moreParmsDialog(MoreParmsDialog::IDD, this) -{ - mMainWndHWND = ::FindWindow(nullptr, "Command & Conquer: Generals"); - m_activeEmissionPage = 0; - m_activeVelocityPage = 0; - m_activeParticlePage = 0; - m_particleSystem = nullptr; - - - m_changeHasOcurred = false; - m_shouldWriteINI = false; - m_showColorDlg = false; - m_showSwitchesDlg = false; - m_showMoreParmsDlg = false; - m_shouldBusyWait = false; - m_shouldReload = false; - m_shouldUpdateParticleCap = false; - m_shouldReloadTextures = false; - m_shouldKillAllParticleSystems = false; - - m_emissionTypePanels[0] = new EmissionPanelPoint; - m_emissionTypePanels[1] = new EmissionPanelLine; - m_emissionTypePanels[2] = new EmissionPanelBox; - m_emissionTypePanels[3] = new EmissionPanelSphere; - m_emissionTypePanels[4] = new EmissionPanelCylinder; - - m_velocityTypePanels[0] = new VelocityPanelOrtho; - m_velocityTypePanels[1] = new VelocityPanelSphere; - m_velocityTypePanels[2] = new VelocityPanelHemisphere; - m_velocityTypePanels[3] = new VelocityPanelCylinder; - m_velocityTypePanels[4] = new VelocityPanelOutward; - - m_particleTypePanels[0] = new ParticlePanelParticle; - m_particleTypePanels[1] = new ParticlePanelDrawable; - m_particleTypePanels[2] = new ParticlePanelStreak; - m_particleParmValues.resize(PARM_NumParms); -} - -DebugWindowDialog::~DebugWindowDialog() -{ - int i; - for (i = 0; i < NUM_EMISSION_TYPES; ++i) { - delete m_emissionTypePanels[i]; - } - - for (i = 0; i < NUM_VELOCITY_TYPES; ++i) { - delete m_velocityTypePanels[i]; - } - - for (i = 0; i < NUM_PARTICLE_TYPES; ++i) { - delete m_particleTypePanels[i]; - } -} - -int DebugWindowDialog::OnCreate(LPCREATESTRUCT lpCreateStruct) -{ - return CDialog::OnCreate(lpCreateStruct); -} - -void DebugWindowDialog::InitPanel( void ) -{ - CComboBox* pCombo; - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_Priority); - if (pCombo) { - for (int i = 1; ParticlePriorityNames[i]; ++i) { - pCombo->AddString(ParticlePriorityNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_EmissionType); - if (pCombo) { - for (int i = 1; EmissionVolumeTypeNames[i]; ++i) { - pCombo->AddString(EmissionVolumeTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_VelocityType); - if (pCombo) { - for (int i = 1; EmissionVelocityTypeNames[i]; ++i) { - pCombo->AddString(EmissionVelocityTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleType); - if (pCombo) { - for (int i = 1; ParticleTypeNames[i]; ++i) { - pCombo->AddString(ParticleTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ShaderType); - if (pCombo) { - for (int i = 1; ParticleShaderTypeNames[i]; ++i) { - pCombo->AddString(ParticleShaderTypeNames[i]); - } - pCombo->SetCurSel(0); - } - - m_colorAlphaDialog.Create(CColorAlphaDialog::IDD, this); - m_colorAlphaDialog.InitPanel(); - - m_switchesDialog.Create(CSwitchesDialog::IDD, this); - m_switchesDialog.InitPanel(); - - m_moreParmsDialog.Create(MoreParmsDialog::IDD, this); - m_moreParmsDialog.InitPanel(); - - CWnd *pWnd; - int j; - - pWnd = GetDlgItem(IDC_PSEd_EmissionPanel); - if (pWnd) { - CRect rect; - pWnd->GetWindowRect(&rect); - ScreenToClient(&rect); - for (j = 0; j < NUM_EMISSION_TYPES; ++j) { - m_emissionTypePanels[j]->Create(m_emissionTypePanels[j]->GetIDD(), this); - m_emissionTypePanels[j]->InitPanel(); - m_emissionTypePanels[j]->ShowWindow(SW_HIDE); - m_emissionTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); - } - pWnd->ShowWindow(SW_HIDE); - m_emissionTypePanels[0]->ShowWindow(SW_SHOW); - } - - pWnd = GetDlgItem(IDC_PSEd_VelocityPanel); - if (pWnd) { - CRect rect; - pWnd->GetWindowRect(&rect); - ScreenToClient(&rect); - for (j = 0; j < NUM_VELOCITY_TYPES; ++j) { - m_velocityTypePanels[j]->Create(m_velocityTypePanels[j]->GetIDD(), this); - m_velocityTypePanels[j]->InitPanel(); - m_velocityTypePanels[j]->ShowWindow(SW_HIDE); - m_velocityTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); - } - pWnd->ShowWindow(SW_HIDE); - m_velocityTypePanels[0]->ShowWindow(SW_SHOW); - } - - pWnd = GetDlgItem(IDC_PSEd_ParticlePanel); - if (pWnd) { - CRect rect; - pWnd->GetWindowRect(&rect); - ScreenToClient(&rect); - for (j = 0; j < NUM_PARTICLE_TYPES; ++j) { - m_particleTypePanels[j]->Create(m_particleTypePanels[j]->GetIDD(), this); - m_particleTypePanels[j]->InitPanel(); - m_particleTypePanels[j]->ShowWindow(SW_HIDE); - m_particleTypePanels[j]->SetWindowPos(nullptr, rect.left, rect.top, rect.Width(), rect.Height(), SWP_NOZORDER); - } - pWnd->ShowWindow(SW_HIDE); - m_particleTypePanels[0]->ShowWindow(SW_SHOW); - } -} - -HWND DebugWindowDialog::GetMainWndHWND(void) -{ - return mMainWndHWND; -} - -void DebugWindowDialog::addParticleSystem(const char *particleSystem) -{ - if (!particleSystem) { - return; - } - - std::string particleSystemName = particleSystem; - appendParticleSystemToList(particleSystemName); -} - -void DebugWindowDialog::addThingTemplate(const char *thingTemplate) -{ - if (!thingTemplate) { - return; - } - - std::string thingTemplateName = thingTemplate; - appendThingTemplateToList(thingTemplateName); -} - -void DebugWindowDialog::OnClose() -{ - ShowWindow(SW_MINIMIZE); -} - -void DebugWindowDialog::OnSize(UINT nType, int cx, int cy) -{ - CDialog::OnSize(nType, cx, cy); - if (nType == SIZE_MINIMIZED) { - if (mMainWndHWND) { - ::SetFocus(mMainWndHWND); - } - } -} - -void DebugWindowDialog::clearAllParticleSystems(void) -{ - CComboBox* combo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleSystem); - if (!combo) { - return; - } - - m_listOfParticleSystems.clear(); - combo->ResetContent(); -} - -void DebugWindowDialog::clearAllThingTemplates( void ) -{ - m_listOfThingTemplates.clear(); - // this is a kindof(dirty_hack), because there's no way at runtime to verify that - // particleTypePanels[1] is actually a PArticlePanelDrawable - ((ParticlePanelDrawable*)m_particleTypePanels[1])->clearAllThingTemplates(); -} - -void DebugWindowDialog::appendParticleSystemToList( const std::string &rString ) -{ - CComboBox* combo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleSystem); - if (!combo) { - return; - } - - m_listOfParticleSystems.push_front(rString); - combo->AddString(rString.c_str()); -} - -void DebugWindowDialog::appendThingTemplateToList( IN const std::string &rString ) -{ - m_listOfThingTemplates.push_back(rString); -} - -void DebugWindowDialog::OnParticleSystemChange() -{ - m_changeHasOcurred = true; -} - -void DebugWindowDialog::OnPushSave() -{ - m_shouldWriteINI = true; -} - -void DebugWindowDialog::OnReloadTextures() -{ - // First, reload the textures - ParticlePanelParticle* pParticle = (ParticlePanelParticle*) m_particleTypePanels[0]; - if (!pParticle) { - return; - } - - pParticle->InitPanel(); - - // Then, force an update to the ui, to repick the appropriate texture. - performUpdate(true); - - // Finally, signal a flag to the asset manager to reload the actual textures. - m_shouldReloadTextures = true; -} - -Bool DebugWindowDialog::hasSelectionChanged(void) -{ - if (m_changeHasOcurred) { - m_changeHasOcurred = false; - return true; - } - - return false; -} - -void DebugWindowDialog::getSelectedSystemName(char *bufferToCopyInto) const -{ - if (!bufferToCopyInto) { - return; - } - - CComboBox* combo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleSystem); - if (!combo) { - bufferToCopyInto[0] = '\0'; - return; - } - - int ndx = combo->GetCurSel(); - CString string; - - if (ndx > -1) { - combo->GetLBText(ndx, string); - strcpy(bufferToCopyInto, string.GetBuffer(0)); - } else { - combo->GetWindowText(string); - strcpy(bufferToCopyInto, string.GetBuffer(0)); - } -} - -void DebugWindowDialog::getSelectedParticleAsciiStringParm( IN int parmNum, OUT char *bufferToCopyInto ) const -{ - if (parmNum < 0 || parmNum >= PARM_NumParms || !bufferToCopyInto || !m_particleSystem) { - return; - } - - if (!m_particleParmValues[parmNum].empty()) { - strcpy(bufferToCopyInto, m_particleParmValues[parmNum].c_str()); - } else { - bufferToCopyInto[0] = 0; - } -} - -void DebugWindowDialog::updateParticleAsciiStringParm( IN int parmNum, OUT const char *bufferToCopyFrom ) -{ - if (parmNum < 0 || parmNum >= PARM_NumParms || !bufferToCopyFrom) { - return; - } - - m_particleParmValues[parmNum] = bufferToCopyFrom; -} - -void DebugWindowDialog::getColorValueFromSystem(IN Int systemNum, OUT RGBColorKeyframe &colorFrame) const -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - colorFrame = m_particleSystem->m_colorKey[systemNum]; -} - -void DebugWindowDialog::updateColorValueToSystem(IN Int systemNum, IN const RGBColorKeyframe &colorFrame) -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - m_particleSystem->m_colorKey[systemNum] = colorFrame; -} - -void DebugWindowDialog::getAlphaRangeFromSystem(IN Int systemNum, OUT ParticleSystemInfo::RandomKeyframe &randomVar) const -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - randomVar = m_particleSystem->m_alphaKey[systemNum]; -} - -void DebugWindowDialog::updateAlphaRangeToSystem(IN Int systemNum, IN const ParticleSystemInfo::RandomKeyframe &randomVar) -{ - if (systemNum >= MAX_KEYFRAMES || systemNum < 0 || !m_particleSystem) { - return; - } - - m_particleSystem->m_alphaKey[systemNum] = randomVar; -} - -void DebugWindowDialog::getHalfSizeFromSystem( IN Int coordNum, OUT Real& halfSize) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: halfSize = m_particleSystem->m_emissionVolume.box.halfSize.x; return; - case 1: halfSize = m_particleSystem->m_emissionVolume.box.halfSize.y; return; - case 2: halfSize = m_particleSystem->m_emissionVolume.box.halfSize.z; return; - default: return; - }; -} - -void DebugWindowDialog::updateHalfSizeToSystem( IN Int coordNum, IN const Real& halfSize) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVolume.box.halfSize.x = halfSize; return; - case 1: m_particleSystem->m_emissionVolume.box.halfSize.y = halfSize; return; - case 2: m_particleSystem->m_emissionVolume.box.halfSize.z = halfSize; return; - default: return; - }; -} - -void DebugWindowDialog::getSphereRadiusFromSystem( OUT Real &radius ) const -{ - if (!m_particleSystem) { - return; - } - - radius = m_particleSystem->m_emissionVolume.sphere.radius; -} - -void DebugWindowDialog::updateSphereRadiusToSystem( IN const Real &radius ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_emissionVolume.sphere.radius = radius; -} - -void DebugWindowDialog::getCylinderRadiusFromSystem( OUT Real &radius ) const -{ - if (!m_particleSystem) { - return; - } - - radius = m_particleSystem->m_emissionVolume.cylinder.radius; -} - -void DebugWindowDialog::updateCylinderRadiusToSystem( IN const Real &radius ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_emissionVolume.cylinder.radius = radius; -} - -void DebugWindowDialog::getCylinderLengthFromSystem( OUT Real &length ) const -{ - if (!m_particleSystem) { - return; - } - - length = m_particleSystem->m_emissionVolume.cylinder.length; -} - -void DebugWindowDialog::updateCylinderLengthToSystem( IN const Real &length ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_emissionVolume.cylinder.length = length; -} - -void DebugWindowDialog::getLineFromSystem( IN Int coordNum, OUT Real& linePoint) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: linePoint = m_particleSystem->m_emissionVolume.line.start.x; return; - case 1: linePoint = m_particleSystem->m_emissionVolume.line.start.y; return; - case 2: linePoint = m_particleSystem->m_emissionVolume.line.start.z; return; - case 3: linePoint = m_particleSystem->m_emissionVolume.line.end.x; return; - case 4: linePoint = m_particleSystem->m_emissionVolume.line.end.y; return; - case 5: linePoint = m_particleSystem->m_emissionVolume.line.end.z; return; - default: return; - }; -} - - -void DebugWindowDialog::updateLineToSystem( IN Int coordNum, IN const Real& linePoint) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVolume.line.start.x = linePoint; return; - case 1: m_particleSystem->m_emissionVolume.line.start.y = linePoint; return; - case 2: m_particleSystem->m_emissionVolume.line.start.z = linePoint; return; - case 3: m_particleSystem->m_emissionVolume.line.end.x = linePoint; return; - case 4: m_particleSystem->m_emissionVolume.line.end.y = linePoint; return; - case 5: m_particleSystem->m_emissionVolume.line.end.z = linePoint; return; - default: return; - }; -} - -void DebugWindowDialog::getVelSphereFromSystem( IN Int velNum, OUT Real &radius) const -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: radius = m_particleSystem->m_emissionVelocity.spherical.speed.m_low; return; - case 1: radius = m_particleSystem->m_emissionVelocity.spherical.speed.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateVelSphereToSystem( IN Int velNum, IN const Real &radius) -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: m_particleSystem->m_emissionVelocity.spherical.speed.m_low = radius; return; - case 1: m_particleSystem->m_emissionVelocity.spherical.speed.m_high = radius; return; - default: return; - }; -} - -void DebugWindowDialog::getVelHemisphereFromSystem( IN Int velNum, OUT Real &radius) const -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: radius = m_particleSystem->m_emissionVelocity.hemispherical.speed.m_low; return; - case 1: radius = m_particleSystem->m_emissionVelocity.hemispherical.speed.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateVelHemisphereToSystem( IN Int velNum, IN const Real &radius) -{ - if (!m_particleSystem) { - return; - } - - switch (velNum) - { - case 0: m_particleSystem->m_emissionVelocity.hemispherical.speed.m_low = radius; return; - case 1: m_particleSystem->m_emissionVelocity.hemispherical.speed.m_high = radius; return; - default: return; - }; -} - -void DebugWindowDialog::getVelOrthoFromSystem( IN Int coordNum, OUT Real& ortho) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: ortho = m_particleSystem->m_emissionVelocity.ortho.x.m_low; return; - case 1: ortho = m_particleSystem->m_emissionVelocity.ortho.y.m_low; return; - case 2: ortho = m_particleSystem->m_emissionVelocity.ortho.z.m_low; return; - case 3: ortho = m_particleSystem->m_emissionVelocity.ortho.x.m_high; return; - case 4: ortho = m_particleSystem->m_emissionVelocity.ortho.y.m_high; return; - case 5: ortho = m_particleSystem->m_emissionVelocity.ortho.z.m_high; return; - default: return; - }; -} - - -void DebugWindowDialog::updateVelOrthoToSystem( IN Int coordNum, IN const Real& ortho) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVelocity.ortho.x.m_low = ortho; return; - case 1: m_particleSystem->m_emissionVelocity.ortho.y.m_low = ortho; return; - case 2: m_particleSystem->m_emissionVelocity.ortho.z.m_low = ortho; return; - case 3: m_particleSystem->m_emissionVelocity.ortho.x.m_high = ortho; return; - case 4: m_particleSystem->m_emissionVelocity.ortho.y.m_high = ortho; return; - case 5: m_particleSystem->m_emissionVelocity.ortho.z.m_high = ortho; return; - default: return; - }; -} - -void DebugWindowDialog::getVelCylinderFromSystem( IN Int coordNum, OUT Real& cylinder) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.radial.m_low; return; - case 1: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.normal.m_low; return; - case 2: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.radial.m_high; return; - case 3: cylinder = m_particleSystem->m_emissionVelocity.cylindrical.normal.m_high; return; - default: return; - }; -} - - -void DebugWindowDialog::updateVelCylinderToSystem( IN Int coordNum, IN const Real& cylinder) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVelocity.cylindrical.radial.m_low = cylinder; return; - case 1: m_particleSystem->m_emissionVelocity.cylindrical.normal.m_low = cylinder; return; - case 2: m_particleSystem->m_emissionVelocity.cylindrical.radial.m_high = cylinder; return; - case 3: m_particleSystem->m_emissionVelocity.cylindrical.normal.m_high = cylinder; return; - default: return; - }; -} - -void DebugWindowDialog::getVelOutwardFromSystem( IN Int coordNum, OUT Real& cylinder) const -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: cylinder = m_particleSystem->m_emissionVelocity.outward.speed.m_low; return; - case 1: cylinder = m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_low; return; - case 2: cylinder = m_particleSystem->m_emissionVelocity.outward.speed.m_high; return; - case 3: cylinder = m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_high; return; - default: return; - }; -} - - -void DebugWindowDialog::updateVelOutwardToSystem( IN Int coordNum, IN const Real& cylinder) -{ - if (!m_particleSystem) { - return; - } - - switch (coordNum) - { - case 0: m_particleSystem->m_emissionVelocity.outward.speed.m_low = cylinder; return; - case 1: m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_low = cylinder; return; - case 2: m_particleSystem->m_emissionVelocity.outward.speed.m_high = cylinder; return; - case 3: m_particleSystem->m_emissionVelocity.outward.otherSpeed.m_high = cylinder; return; - default: return; - }; -} - -void DebugWindowDialog::getParticleNameFromSystem( OUT char *buffer, IN int buffLen ) const -{ - if (!m_particleSystem) { - return; - } - - if (!buffer) { - return; - } - - getSelectedParticleAsciiStringParm( PARM_ParticleTypeName, buffer); -} - -void DebugWindowDialog::updateParticleNameToSystem( IN const char *buffer ) -{ - if (!m_particleSystem) { - return; - } - - if (!buffer) { - return; - } - - updateParticleAsciiStringParm( PARM_ParticleTypeName, buffer); -} - -void DebugWindowDialog::getDrawableNameFromSystem( OUT char *buffer, IN int buffLen ) const -{ - getParticleNameFromSystem(buffer, buffLen); -} - -void DebugWindowDialog::updateDrawableNameToSystem( IN const char* buffer ) -{ - updateParticleNameToSystem(buffer); -} - -void DebugWindowDialog::updateCurrentParticleSystem(ParticleSystemTemplate *particleTemplate ) -{ - m_particleSystem = particleTemplate; - performUpdate(true); -} - -void DebugWindowDialog::updateSystemUseParameters(IN ParticleSystemTemplate *particleTemplate ) -{ - m_particleSystem = particleTemplate; - performUpdate(false); -} - -void DebugWindowDialog::getInitialDelayFromSystem( IN Int parmNum, OUT Real& initialDelay ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: initialDelay = m_particleSystem->m_initialDelay.m_low; return; - case 1: initialDelay = m_particleSystem->m_initialDelay.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateInitialDelayToSystem( IN Int parmNum, IN const Real& initialDelay ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_initialDelay.m_low = initialDelay; return; - case 1: m_particleSystem->m_initialDelay.m_high = initialDelay; return; - default: return; - }; -} - -void DebugWindowDialog::getBurstDelayFromSystem( IN Int parmNum, OUT Real& burstDelay ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: burstDelay = m_particleSystem->m_burstDelay.m_low; return; - case 1: burstDelay = m_particleSystem->m_burstDelay.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateBurstDelayToSystem( IN Int parmNum, IN const Real& burstDelay ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_burstDelay.m_low = burstDelay; return; - case 1: m_particleSystem->m_burstDelay.m_high = burstDelay; return; - default: return; - }; -} - -void DebugWindowDialog::getBurstCountFromSystem( IN Int parmNum, OUT Real& burstCount ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: burstCount = m_particleSystem->m_burstCount.m_low; return; - case 1: burstCount = m_particleSystem->m_burstCount.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateBurstCountToSystem( IN Int parmNum, IN const Real& burstCount ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_burstCount.m_low = burstCount; return; - case 1: m_particleSystem->m_burstCount.m_high = burstCount; return; - default: return; - }; -} - -void DebugWindowDialog::getColorScaleFromSystem( IN Int parmNum, OUT Real& colorScale ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: colorScale = m_particleSystem->m_colorScale.m_low; return; - case 1: colorScale = m_particleSystem->m_colorScale.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateColorScaleToSystem( IN Int parmNum, IN const Real& colorScale ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_colorScale.m_low = colorScale; return; - case 1: m_particleSystem->m_colorScale.m_high = colorScale; return; - default: return; - }; -} - -void DebugWindowDialog::getParticleLifetimeFromSystem( IN Int parmNum, OUT Real& particleLifetime ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: particleLifetime = m_particleSystem->m_lifetime.m_low; return; - case 1: particleLifetime = m_particleSystem->m_lifetime.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateParticleLifetimeToSystem( IN Int parmNum, IN const Real& particleLifetime ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_lifetime.m_low = particleLifetime; return; - case 1: m_particleSystem->m_lifetime.m_high = particleLifetime; return; - default: return; - }; -} - -void DebugWindowDialog::getParticleSizeFromSystem( IN Int parmNum, OUT Real& particleSize ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: particleSize = m_particleSystem->m_startSize.m_low; return; - case 1: particleSize = m_particleSystem->m_startSize.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateParticleSizeToSystem( IN Int parmNum, IN const Real& particleSize ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_startSize.m_low = particleSize; return; - case 1: m_particleSystem->m_startSize.m_high = particleSize; return; - default: return; - }; -} - -void DebugWindowDialog::getStartSizeRateFromSystem( IN Int parmNum, OUT Real& startSizeRate ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: startSizeRate = m_particleSystem->m_startSizeRate.m_low; return; - case 1: startSizeRate = m_particleSystem->m_startSizeRate.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateStartSizeRateToSystem( IN Int parmNum, IN const Real& startSizeRate ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_startSizeRate.m_low = startSizeRate; return; - case 1: m_particleSystem->m_startSizeRate.m_high = startSizeRate; return; - default: return; - }; -} - -void DebugWindowDialog::getSizeRateFromSystem( IN Int parmNum, OUT Real& sizeRate ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: sizeRate = m_particleSystem->m_sizeRate.m_low; return; - case 1: sizeRate = m_particleSystem->m_sizeRate.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateSizeRateToSystem( IN Int parmNum, IN const Real& sizeRate ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_sizeRate.m_low = sizeRate; return; - case 1: m_particleSystem->m_sizeRate.m_high = sizeRate; return; - default: return; - }; -} - -void DebugWindowDialog::getSizeDampingFromSystem( IN Int parmNum, OUT Real& sizeDamping ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: sizeDamping = m_particleSystem->m_sizeRateDamping.m_low; return; - case 1: sizeDamping = m_particleSystem->m_sizeRateDamping.m_high; return; - default: return; - }; -} - -void DebugWindowDialog::updateSizeDampingToSystem( IN Int parmNum, IN const Real& sizeDamping ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_sizeRateDamping.m_low = sizeDamping; return; - case 1: m_particleSystem->m_sizeRateDamping.m_high = sizeDamping; return; - default: return; - }; -} - -void DebugWindowDialog::getSystemLifetimeFromSystem( OUT Real& systemLifetime ) const -{ - if (!m_particleSystem) { - return; - } - - systemLifetime = m_particleSystem->m_systemLifetime; -} - -void DebugWindowDialog::updateSystemLifetimeToSystem( IN const Real& systemLifetime ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_systemLifetime = systemLifetime; -} - -void DebugWindowDialog::getSlaveOffsetFromSystem( IN Int parmNum, OUT Real& slaveOffset ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: slaveOffset = m_particleSystem->m_slavePosOffset.x; return; - case 1: slaveOffset = m_particleSystem->m_slavePosOffset.y; return; - case 2: slaveOffset = m_particleSystem->m_slavePosOffset.z; return; - default: return; - }; -} - -void DebugWindowDialog::updateSlaveOffsetToSystem( IN Int parmNum, IN const Real& slaveOffset ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_slavePosOffset.x = slaveOffset; return; - case 1: m_particleSystem->m_slavePosOffset.y = slaveOffset; return; - case 2: m_particleSystem->m_slavePosOffset.z = slaveOffset; return; - default: return; - }; -} - -void DebugWindowDialog::getDriftVelocityFromSystem( IN Int parmNum, OUT Real& driftVelocity ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: driftVelocity = m_particleSystem->m_driftVelocity.x; return; - case 1: driftVelocity = m_particleSystem->m_driftVelocity.y; return; - case 2: driftVelocity = m_particleSystem->m_driftVelocity.z; return; - default: return; - }; -} - -void DebugWindowDialog::updateDriftVelocityToSystem( IN Int parmNum, IN const Real& driftVelocity ) -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: m_particleSystem->m_driftVelocity.x = driftVelocity; return; - case 1: m_particleSystem->m_driftVelocity.y = driftVelocity; return; - case 2: m_particleSystem->m_driftVelocity.z = driftVelocity; return; - default: return; - }; -} - -void DebugWindowDialog::getSlaveSystemFromSystem( OUT char *buffer, IN Int bufferSize) const -{ - if (!m_particleSystem) { - return; - } - - getSelectedParticleAsciiStringParm(PARM_SlaveSystemName, buffer); -} - -void DebugWindowDialog::updateSlaveSystemToSystem( IN const char *buffer ) -{ - if (!m_particleSystem) { - return; - } - - updateParticleAsciiStringParm(PARM_SlaveSystemName, buffer); -} - -void DebugWindowDialog::getPerParticleSystemFromSystem( OUT char *buffer, IN Int bufferSize) const -{ - if (!m_particleSystem) { - return; - } - - getSelectedParticleAsciiStringParm(PARM_AttachedSystemName, buffer); -} - -void DebugWindowDialog::updatePerParticleSystemToSystem( IN const char *buffer ) -{ - if (!m_particleSystem) { - return; - } - - updateParticleAsciiStringParm(PARM_AttachedSystemName, buffer); -} - -void DebugWindowDialog::getSwitchFromSystem( IN SwitchType switchType, OUT Bool& switchVal) const -{ - if (!m_particleSystem) { - return; - } - - switch (switchType) - { - case ST_HOLLOW: switchVal = m_particleSystem->m_isEmissionVolumeHollow; break; - case ST_ONESHOT: switchVal = m_particleSystem->m_isOneShot; break; - case ST_ALIGNXY: switchVal = m_particleSystem->m_isGroundAligned; break; - case ST_EMITABOVEGROUNDONLY: switchVal = m_particleSystem->m_isEmitAboveGroundOnly; break; - case ST_PARTICLEUPTOWARDSEMITTER: switchVal = m_particleSystem->m_isParticleUpTowardsEmitter; break; - }; -} - -void DebugWindowDialog::updateSwitchToSystem( IN SwitchType switchType, IN const Bool& switchVal) -{ - if (!m_particleSystem) { - return; - } - - switch (switchType) - { - case ST_HOLLOW: m_particleSystem->m_isEmissionVolumeHollow = switchVal; break; - case ST_ONESHOT: m_particleSystem->m_isOneShot = switchVal; break; - case ST_ALIGNXY: m_particleSystem->m_isGroundAligned = switchVal; break; - case ST_EMITABOVEGROUNDONLY: m_particleSystem->m_isEmitAboveGroundOnly = switchVal; break; - case ST_PARTICLEUPTOWARDSEMITTER: m_particleSystem->m_isParticleUpTowardsEmitter = switchVal; break; - }; -} - -// ------------------------------------------------------------------------------------------------ -static Real degreeToRadian( Real degree ) { return (degree / 180.0f) * PI; } -static Real radianToDegree( Real radian ) { return (180.0f * radian) / PI; } - -void DebugWindowDialog::getPingPongStartAngleFromSystem( IN Int parmNum, OUT Real& angle ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: angle = m_particleSystem->m_windMotionStartAngleMin; break; - case 1: angle = m_particleSystem->m_windMotionStartAngleMax; break; - default: return; - }; - - angle = radianToDegree( angle ); - -} - -void DebugWindowDialog::updatePingPongStartAngleToSystem( IN Int parmNum, IN const Real& angle ) -{ - if (!m_particleSystem) { - return; - } - - Real radian = degreeToRadian( angle ); - - switch (parmNum) - { - case 0: m_particleSystem->m_windMotionStartAngleMin = radian; return; - case 1: m_particleSystem->m_windMotionStartAngleMax = radian; return; - default: return; - }; -} - -void DebugWindowDialog::getPingPongEndAngleFromSystem( IN Int parmNum, OUT Real& angle ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: angle = m_particleSystem->m_windMotionEndAngleMin; break; - case 1: angle = m_particleSystem->m_windMotionEndAngleMax; break; - default: return; - }; - - angle = radianToDegree( angle ); - -} - -void DebugWindowDialog::updatePingPongEndAngleToSystem( IN Int parmNum, IN const Real& angle ) -{ - if (!m_particleSystem) { - return; - } - - Real radian = degreeToRadian( angle ); - - switch (parmNum) - { - case 0: m_particleSystem->m_windMotionEndAngleMin = radian; return; - case 1: m_particleSystem->m_windMotionEndAngleMax = radian; return; - default: return; - }; -} - -void DebugWindowDialog::getWindAngleChangeFromSystem( IN Int parmNum, OUT Real& angle ) const -{ - if (!m_particleSystem) { - return; - } - - switch (parmNum) - { - case 0: angle = m_particleSystem->m_windAngleChangeMin; break; - case 1: angle = m_particleSystem->m_windAngleChangeMax; break; - default: return; - }; - - angle = radianToDegree( angle ); - -} - -void DebugWindowDialog::updateWindAngleChangeToSystem( IN Int parmNum, IN const Real& angle ) -{ - if (!m_particleSystem) { - return; - } - - Real radian = degreeToRadian( angle ); - - switch (parmNum) - { - case 0: m_particleSystem->m_windAngleChangeMin = radian; return; - case 1: m_particleSystem->m_windAngleChangeMax = radian; return; - default: return; - }; -} - -void DebugWindowDialog::getWindMotionFromSystem( OUT ParticleSystemInfo::WindMotion& windMotion ) const -{ - if (!m_particleSystem) { - return; - } - - windMotion = m_particleSystem->m_windMotion; -} - -void DebugWindowDialog::updateWindMotionToSystem( IN const ParticleSystemInfo::WindMotion& windMotion ) -{ - if (!m_particleSystem) { - return; - } - - m_particleSystem->m_windMotion = windMotion; -} - -// The reason I'm using this function is to prohibit me from forgetting to add an update -// one way or the other. The idea is that when you implement one, you might as well implement -// the other, and this way they're in one place. -void DebugWindowDialog::performUpdate( IN Bool toUI ) -{ - if (!m_particleSystem) { - return; - } - - static char buff[ARBITRARY_BUFF_SIZE]; - - { // Update the emission type, velocity type, particle type and shader type. - - CComboBox *pCombo; - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_Priority); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, ParticlePriorityNames[(long) m_particleSystem->m_priority]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_priority = (ParticlePriorityType)(selndx + 1); - } - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_EmissionType); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, EmissionVolumeTypeNames[(long) m_particleSystem->m_emissionVolumeType]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_emissionVolumeType = (ParticleSystemInfo::EmissionVolumeType) (selndx + 1); - } - } - - // do the page swap - if (selndx != m_activeEmissionPage && selndx >= 0) { - m_emissionTypePanels[m_activeEmissionPage]->ShowWindow(SW_HIDE); - m_activeEmissionPage = selndx; - m_emissionTypePanels[m_activeEmissionPage]->ShowWindow(SW_SHOW); - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_VelocityType); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, EmissionVelocityTypeNames[(long) m_particleSystem->m_emissionVelocityType]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_emissionVelocityType = (ParticleSystemInfo::EmissionVelocityType) (selndx + 1); - } - } - - // do the page swap - if (selndx != m_activeVelocityPage && selndx >= 0) { - m_velocityTypePanels[m_activeVelocityPage]->ShowWindow(SW_HIDE); - m_activeVelocityPage = selndx; - m_velocityTypePanels[m_activeVelocityPage]->ShowWindow(SW_SHOW); - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleType); - if (pCombo) { - int selndx; - if (toUI) { - selndx = pCombo->SelectString(-1, ParticleTypeNames[(long) m_particleSystem->m_particleType]); - } else { - selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_particleType = (ParticleSystemInfo::ParticleType) (selndx + 1); - } - } - - // do the swap - if (selndx != m_activeParticlePage && selndx >= 0) { - m_particleTypePanels[m_activeParticlePage]->ShowWindow(SW_HIDE); - m_activeParticlePage = selndx; - m_particleTypePanels[m_activeParticlePage]->ShowWindow(SW_SHOW); - } - } - - pCombo = (CComboBox*) GetDlgItem(IDC_PSEd_ShaderType); - if (pCombo) { - if (toUI) { - pCombo->SelectString(-1, ParticleShaderTypeNames[(long) m_particleSystem->m_shaderType]); - } else { - int selndx = pCombo->GetCurSel(); - if (selndx >= 0) { - m_particleSystem->m_shaderType = (ParticleSystemInfo::ParticleShaderType) (selndx + 1); - } - } - } - } - - { // update the minimum and maximum for Angle X, Y and Z, and Angular X, Y, and Z - - CWnd *pWnd; - pWnd = GetDlgItem(IDC_PSEd_AngleXMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleX.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleYMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleY.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleZMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleZ.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleZ.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleXMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleX.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleX.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleYMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleY.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleY.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleZMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angleZ.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angleZ.m_high = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateXMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateX.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateYMin); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMinimumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateY.m_low = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateZMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateZ.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateZ.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateXMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateX.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateX.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateYMax); - if (pWnd) { - if (toUI) { -#if PARTICLE_USE_XY_ROTATION - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateY.getMaximumValue()); -#else - sprintf(buff, FORMAT_STRING, 0.0f); -#endif - pWnd->SetWindowText(buff); - } else { -#if PARTICLE_USE_XY_ROTATION - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateY.m_high = atof(buff); -#endif - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngularRateZMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularRateZ.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularRateZ.m_high = atof(buff); - } - } - } - - { // update the damping values. - CWnd *pWnd; - pWnd = GetDlgItem(IDC_PSEd_AngleDampingMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularDamping.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularDamping.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_AngleDampingMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_angularDamping.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_angularDamping.m_high = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_VelocityDampingMin); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_velDamping.getMinimumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_velDamping.m_low = atof(buff); - } - } - - pWnd = GetDlgItem(IDC_PSEd_VelocityDampingMax); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_velDamping.getMaximumValue()); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_velDamping.m_high = atof(buff); - } - } - } - - { // update gravity - CWnd *pWnd; - pWnd = GetDlgItem(IDC_PSEd_Gravity); - if (pWnd) { - if (toUI) { - sprintf(buff, FORMAT_STRING, m_particleSystem->m_gravity); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - m_particleSystem->m_gravity = atof(buff); - } - } - } - - { // all the kids need to update too. - m_colorAlphaDialog.performUpdate(toUI); - m_switchesDialog.performUpdate(toUI); - m_moreParmsDialog.performUpdate(toUI); - m_emissionTypePanels[m_activeEmissionPage]->performUpdate(toUI); - m_velocityTypePanels[m_activeVelocityPage]->performUpdate(toUI); - m_particleTypePanels[m_activeParticlePage]->performUpdate(toUI); - } -} - -void DebugWindowDialog::OnParticleSystemEdit() -{ - signalParticleSystemEdit(); -} - -void DebugWindowDialog::signalParticleSystemEdit( void ) -{ - performUpdate(false); -} - -void DebugWindowDialog::OnEditColorAlpha() -{ - CButton *pButton = (CButton*) GetDlgItem(IDC_PSEd_EditColorButton); - if (!pButton) { - return; - } - - m_showColorDlg = !m_showColorDlg; - - if (m_showColorDlg) { - m_colorAlphaDialog.ShowWindow(SW_SHOW); - pButton->SetCheck(TRUE); - } else { - m_colorAlphaDialog.ShowWindow(SW_HIDE); - pButton->SetCheck(FALSE); - } -} - -void DebugWindowDialog::OnEditSwitches() -{ - CButton *pButton = (CButton*) GetDlgItem(IDC_PSEd_EditSwitchesButton); - if (!pButton) { - return; - } - - m_showSwitchesDlg = !m_showSwitchesDlg ; - - if (m_showSwitchesDlg) { - m_switchesDialog.ShowWindow(SW_SHOW); - pButton->SetCheck(TRUE); - } else { - m_switchesDialog.ShowWindow(SW_HIDE); - pButton->SetCheck(FALSE); - } -} - -// kill all particle systems in the world -- one time effect -void DebugWindowDialog::OnKillAllParticleSystems() -{ - m_shouldKillAllParticleSystems = true; -} - - -void DebugWindowDialog::OnEditMoreParms() -{ - CButton *pButton = (CButton*) GetDlgItem(IDC_PSEd_Continued); - if (!pButton) { - return; - } - - m_showMoreParmsDlg = !m_showMoreParmsDlg ; - - if (m_showMoreParmsDlg ) { - m_moreParmsDialog.ShowWindow(SW_SHOW); - pButton->SetCheck(TRUE); - } else { - m_moreParmsDialog.ShowWindow(SW_HIDE); - pButton->SetCheck(FALSE); - } -} - -Bool DebugWindowDialog::shouldWriteINI( void ) -{ - if (m_shouldWriteINI) { - m_shouldWriteINI = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::hasRequestedReload( void ) -{ - if (m_shouldReload) { - m_shouldReload = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::shouldBusyWait( void ) -{ - return m_shouldBusyWait; -} - -Bool DebugWindowDialog::shouldUpdateParticleCap( void ) -{ - if (m_shouldUpdateParticleCap) { - m_shouldUpdateParticleCap = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::shouldReloadTextures( void ) -{ - if (m_shouldReloadTextures) { - m_shouldReloadTextures = false; - return true; - } - - return false; -} - -Bool DebugWindowDialog::shouldKillAllParticleSystems( void ) -{ - if (m_shouldKillAllParticleSystems) { - m_shouldKillAllParticleSystems = false; - return true; - } - - return false; -} - -void DebugWindowDialog::OnSysCommand(UINT nID, LPARAM lParam) -{ - CDialog::OnSysCommand(nID, lParam); -} - -void DebugWindowDialog::OnReloadSystem( void ) -{ - m_shouldReload = true; -} - -void DebugWindowDialog::OnReloadCurrent() -{ - OnReloadSystem(); -} - -void DebugWindowDialog::OnReloadAll() -{ - OnReloadSystem(); -} - -void DebugWindowDialog::OnSaveCurrent() -{ - OnPushSave(); -} - -void DebugWindowDialog::OnSaveAll() -{ - OnPushSave(); -} - -void DebugWindowDialog::OnParticleCapEdit() -{ - m_shouldUpdateParticleCap = true; -} - -void DebugWindowDialog::updateCurrentParticleCap( IN int particleCap ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - CWnd *pWnd = GetDlgItem(IDC_PSEd_CurrentParticleCap); - if (!pWnd) { - return; - } - - sprintf(buff, "%d", particleCap); - pWnd->SetWindowText(buff); -} - -void DebugWindowDialog::updateCurrentNumParticles( IN int particleCount ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - CWnd *pWnd = GetDlgItem(IDC_PSEd_CurrentParticleCount); - if (!pWnd) { - return; - } - - sprintf(buff, "%d", particleCount); - pWnd->SetWindowText(buff); -} - -int DebugWindowDialog::getNewParticleCap( void ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - CWnd *pWnd = GetDlgItem(IDC_PSEd_CurrentParticleCap); - if (!pWnd) { - return -1; - } - - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - - return atoi(buff); -} - -BEGIN_MESSAGE_MAP(DebugWindowDialog, CDialog) - ON_WM_CREATE() - ON_WM_CLOSE() - ON_WM_SIZE() - ON_WM_SYSCOMMAND() - ON_CBN_SELCHANGE(IDC_PSEd_ParticleSystem, OnParticleSystemChange) - ON_BN_CLICKED(IDC_PSEd_Go, OnParticleSystemChange) - ON_BN_CLICKED(IDC_PSEd_EditColorButton, OnEditColorAlpha) - ON_BN_CLICKED(IDC_PSEd_Continued, OnEditMoreParms) - ON_BN_CLICKED(IDC_PSEd_Save, OnPushSave) - ON_BN_CLICKED(IDC_PSEd_EditSwitchesButton, OnEditSwitches) - ON_BN_CLICKED(IDC_PSEd_KillAll, OnKillAllParticleSystems) - - ON_CBN_SELCHANGE(IDC_PSEd_Priority, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_EmissionType, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_VelocityType, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleType, OnParticleSystemEdit) - ON_CBN_SELCHANGE(IDC_PSEd_ShaderType, OnParticleSystemEdit) - ON_COMMAND(ID_FILE_RELOADCURRENT, OnReloadCurrent) - ON_COMMAND(ID_FILE_RELOADALL, OnReloadAll) - ON_COMMAND(ID_FILE_SAVECURRENT, OnSaveCurrent) - ON_COMMAND(ID_FILE_SAVEALL, OnSaveAll) - ON_COMMAND(ID_FILE_RELOADTEXTURES, OnReloadTextures) - - - ON_EN_KILLFOCUS(IDC_PSEd_CurrentParticleCap, OnParticleCapEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleXMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleYMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleZMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleXMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleYMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleZMax, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateXMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateYMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateZMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateXMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateYMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngularRateZMax, OnParticleSystemEdit) - - ON_EN_KILLFOCUS(IDC_PSEd_AngleDampingMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_AngleDampingMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_VelocityDampingMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_VelocityDampingMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_Gravity, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h b/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h deleted file mode 100644 index 0b1e474b4d5..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorDialog.h +++ /dev/null @@ -1,317 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include // for std::pair -#include // for std::string -#include // for std::vector -#include // for std::list - -#define DEFINE_PARTICLE_SYSTEM_NAMES 1 -#include "GameClient/ParticleSys.h" - -#include "CColorAlphaDialog.h" -#include "CSwitchesDialog.h" -#include "MoreParmsDialog.h" - -#define FORMAT_STRING "%.2f" -#define NONE_STRING "(None)" -struct RGBColorKeyframe; -struct RandomKeyframe; -interface ISwapablePanel; - -#define NUM_EMISSION_TYPES 5 -#define NUM_VELOCITY_TYPES 5 -#define NUM_PARTICLE_TYPES 3 -#define NUM_SHADER_TYPES 3 - -enum SwitchType -{ - ST_HOLLOW = 0, - ST_ONESHOT, - ST_ALIGNXY, - ST_EMITABOVEGROUNDONLY, - ST_PARTICLEUPTOWARDSEMITTER, -}; - -class DebugWindowDialog : public CDialog -{ - public: - enum {IDD = IDD_PSEd}; - DebugWindowDialog(UINT nIDTemplate = DebugWindowDialog::IDD, CWnd* pParentWnd = nullptr); - virtual ~DebugWindowDialog(); - - void InitPanel( void ); - HWND GetMainWndHWND( void ); - void addParticleSystem( IN const char *particleSystem ); - void addThingTemplate( IN const char *thingTemplate ); - void clearAllParticleSystems( void ); - void clearAllThingTemplates( void ); - Bool hasSelectionChanged( void ); - void getSelectedSystemName( OUT char *bufferToCopyInto ) const; - void getSelectedParticleAsciiStringParm( IN int parmNum, OUT char *bufferToCopyInto ) const; - void updateParticleAsciiStringParm( IN int parmNum, IN const char *bufferToCopyFrom ); - void updateCurrentParticleCap( IN int particleCap ); - void updateCurrentNumParticles( IN int particleCount ); - int getNewParticleCap( void ); - - void updateCurrentParticleSystem( IN ParticleSystemTemplate *particleTemplate ); - void updateSystemUseParameters( IN ParticleSystemTemplate *particleTemplate ); - void signalParticleSystemEdit( void ); - - - // The purpose of these is to add as few friends as possible to the particle system classes. - // Therefore, this class has ALL the access to ParticleSystems, and dances on the data directly. - // Child panels make calls here - void getColorValueFromSystem( IN Int systemNum, - OUT RGBColorKeyframe &colorFrame ) const; - - void updateColorValueToSystem( IN Int systemNum, - IN const RGBColorKeyframe &colorFrame ); - - void getAlphaRangeFromSystem( IN Int systemNum, - OUT ParticleSystemInfo::RandomKeyframe &randomVar ) const; - - void updateAlphaRangeToSystem( IN Int systemNum, - IN const ParticleSystemInfo::RandomKeyframe &randomVar ); - - void getHalfSizeFromSystem( IN Int coordNum, // 0:X, 1:Y, 2:Z - OUT Real& halfSize ) const; - - void updateHalfSizeToSystem( IN Int coordNum, // 0:X, 1:Y, 2:Z - IN const Real &halfSize ); - - void getSphereRadiusFromSystem( OUT Real &radius ) const; - void updateSphereRadiusToSystem( IN const Real &radius ); - - void getCylinderRadiusFromSystem( OUT Real &radius ) const; - void updateCylinderRadiusToSystem( IN const Real &radius ); - - void getCylinderLengthFromSystem( OUT Real &length ) const; - void updateCylinderLengthToSystem( IN const Real &length ); - - void getLineFromSystem( IN Int coordNum, // 0:X1, 1:Y1, 2:Z1, 3:X2, 4:Y2, 5:Z2 - OUT Real& linePoint ) const; - - void updateLineToSystem( IN Int coordNum, // 0:X, 1:Y, 2:Z, 3:X2, 4:Y2, 5:Z2 - IN const Real &linePoint ); - - void getVelSphereFromSystem( IN Int velNum, // 0:min 1:max - OUT Real &radius ) const; - - void updateVelSphereToSystem( IN Int velNum, // 0:min 1:max - IN const Real &radius ); - - void getVelHemisphereFromSystem( IN Int velNum, // 0:min 1:max - OUT Real &radius ) const; - - void updateVelHemisphereToSystem( IN Int velNum, // 0:min 1:max - IN const Real &radius ); - - void getVelOrthoFromSystem( IN Int coordNum, // 0:Xmin, 1:Ymin, 2:Zmin, 3:Xmax, 4:Ymax, 5:Zmax - OUT Real& ortho ) const; - - void updateVelOrthoToSystem( IN Int coordNum, // 0:Xmin, 1:Ymin, 2:Zmin, 3:Xmax, 4:Ymax, 5:Zmax - IN const Real& ortho ); - - void getVelCylinderFromSystem( IN Int coordNum, // 0:Radialmin, 1:Lengthmin, 2:Radialmax, 3:Lengthmax - OUT Real& ortho ) const; - - void updateVelCylinderToSystem( IN Int coordNum, // 0:Radialmin, 1:Lengthmin, 2:Radialmax, 3:Lengthmax - IN const Real& ortho ); - - void getVelOutwardFromSystem( IN Int coordNum, // 0:Outwardmin, 1:Othermin, 2:Outwardmax, 3:Othermax - OUT Real& ortho ) const; - - void updateVelOutwardToSystem( IN Int coordNum, // 0:Outwardmin, 1:Othermin, 2:Outwardmax, 3:Othermax - IN const Real& ortho ); - - void getParticleNameFromSystem( OUT char *buffer, IN int buffLen ) const; - void updateParticleNameToSystem( IN const char *buffer ); - void getDrawableNameFromSystem( OUT char *buffer, IN int buffLen ) const; - void updateDrawableNameToSystem( IN const char *buffer ); - - void getInitialDelayFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& initialDelay ) const; - - void updateInitialDelayToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& initialDelay ); - - void getBurstDelayFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& burstDelay ) const; - - void updateBurstDelayToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& burstDelay ); - - void getBurstCountFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& burstCount ) const; - - void updateBurstCountToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& burstCount ); - - void getColorScaleFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& colorScale ) const; - - void updateColorScaleToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& colorScale ); - - void getParticleLifetimeFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& particleLifetime ) const; - - void updateParticleLifetimeToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& particleLifetime ); - - void getParticleSizeFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& particleSize ) const; - - void updateParticleSizeToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& particleSize ); - - void getStartSizeRateFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& startSizeRate ) const; - - void updateStartSizeRateToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& startSizeRate ); - - void getSizeRateFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& sizeRate ) const; - - void updateSizeRateToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& sizeRate ); - - void getSizeDampingFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& sizeDamping ) const; - - void updateSizeDampingToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& sizeDamping ); - - void getSystemLifetimeFromSystem( OUT Real& systemLifetime ) const; - - void updateSystemLifetimeToSystem( IN const Real& systemLifetime ); - - void getSlaveOffsetFromSystem( IN Int parmNum, // 0:min, 1:min - OUT Real& slaveOffset ) const; - - void updateSlaveOffsetToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& slaveOffset ); - - void getDriftVelocityFromSystem( IN Int parmNum, // 0:X, 1:Y, 2:Z - OUT Real& driftVelocity ) const; - - void updateDriftVelocityToSystem( IN Int parmNum, // 0:min, 1:min - IN const Real& driftVelocity ); - - void getSwitchFromSystem( IN SwitchType switchType, - OUT Bool& switchVal ) const; - - void updateSwitchToSystem( IN SwitchType switchType, - IN const Bool& switchVal ); - - void getSlaveSystemFromSystem( OUT char *buffer, IN Int bufferSize) const; - void updateSlaveSystemToSystem( IN const char *buffer ); - - void getPerParticleSystemFromSystem( OUT char *buffer, IN Int bufferSize) const; - void updatePerParticleSystemToSystem( IN const char *buffer ); - - void getWindMotionFromSystem( OUT ParticleSystemInfo::WindMotion& windMotion ) const; - void updateWindMotionToSystem( IN const ParticleSystemInfo::WindMotion& windMotion ); - - void getPingPongStartAngleFromSystem( IN Int parmNum, OUT Real& angle ) const; - void updatePingPongStartAngleToSystem( IN Int parmNum, IN const Real& angle ); - - void getPingPongEndAngleFromSystem( IN Int parmNum, OUT Real& angle ) const; - void updatePingPongEndAngleToSystem( IN Int parmNum, IN const Real& angle ); - - void getWindAngleChangeFromSystem( IN Int parmNum, OUT Real& angle ) const; - void updateWindAngleChangeToSystem( IN Int parmNum, IN const Real& angle ); - - Bool shouldWriteINI( void ); - Bool hasRequestedReload( void ); - Bool shouldBusyWait( void ); - Bool shouldUpdateParticleCap( void ); - Bool shouldReloadTextures( void ); - Bool shouldKillAllParticleSystems( void ); - - - - const std::list &getAllThingTemplates( void ) const { return m_listOfThingTemplates; } - const std::list &getAllParticleSystems( void ) const { return m_listOfParticleSystems; } - - ParticleSystemTemplate *getCurrentParticleSystem( void ) { return m_particleSystem; } - - protected: - HWND mMainWndHWND; - Bool m_changeHasOcurred; - ParticleSystemTemplate *m_particleSystem; - std::list m_listOfThingTemplates; - std::vector m_particleParmValues; - std::list m_listOfParticleSystems; - - Bool m_shouldWriteINI; - Bool m_showColorDlg; - Bool m_showSwitchesDlg; - Bool m_showMoreParmsDlg; - Bool m_shouldReload; - Bool m_shouldBusyWait; - Bool m_shouldUpdateParticleCap; - Bool m_shouldReloadTextures; - Bool m_shouldKillAllParticleSystems; - - CColorAlphaDialog m_colorAlphaDialog; - CSwitchesDialog m_switchesDialog; - MoreParmsDialog m_moreParmsDialog; - - - int m_activeEmissionPage; - int m_activeVelocityPage; - int m_activeParticlePage; - - ISwapablePanel *m_emissionTypePanels[NUM_EMISSION_TYPES]; - ISwapablePanel *m_velocityTypePanels[NUM_VELOCITY_TYPES]; - ISwapablePanel *m_particleTypePanels[NUM_PARTICLE_TYPES]; - - void appendParticleSystemToList( IN const std::string &rString ); - void appendThingTemplateToList( IN const std::string &rString ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - - - protected: - afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); - afx_msg void OnSize(UINT nType, int cx, int cy); - afx_msg void OnClose(); - afx_msg void OnParticleSystemChange(); // the current particle system isn't the same as the previous system - afx_msg void OnParticleSystemEdit(); // this system has been edited - afx_msg void OnKillAllParticleSystems(); // kill all particle systems in the world - afx_msg void OnEditColorAlpha(); - afx_msg void OnEditMoreParms(); - afx_msg void OnEditSwitches(); - afx_msg void OnPushSave(); - afx_msg void OnReloadTextures(); - afx_msg void OnReloadSystem(); - afx_msg void OnSysCommand(UINT nID, LPARAM lParam); - afx_msg void OnReloadCurrent(); - afx_msg void OnReloadAll(); - afx_msg void OnSaveCurrent(); - afx_msg void OnSaveAll(); - afx_msg void OnParticleCapEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h b/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h deleted file mode 100644 index dfcaf5fef4d..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleEditorExport.h +++ /dev/null @@ -1,82 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -#pragma once - -#include "Lib/BaseType.h" - -class ParticleSystemTemplate; - -// Declared extern C to prevent name mangling, which makes life very unhappy -extern "C" { - // Called to create the dialog - void __declspec(dllexport) CreateParticleSystemDialog( void ); - - // Called to (not surprisingly) destroy the dialog (and free the resources) - void __declspec(dllexport) DestroyParticleSystemDialog( void ); - - void __declspec(dllexport) RemoveAllParticleSystems( void ); - void __declspec(dllexport) AppendParticleSystem( const char* particleSystemName ); - void __declspec(dllexport) RemoveAllThingTemplates( void ); - void __declspec(dllexport) AppendThingTemplate( const char* thingTemplateName ); - - Bool __declspec(dllexport) HasUpdatedSelectedParticleSystem( void ); - - void __declspec(dllexport) GetSelectedParticleSystemName( char *bufferToCopyInto ); - - void __declspec(dllexport) UpdateCurrentParticleCap( int currentParticleCap ); - void __declspec(dllexport) UpdateCurrentNumParticles( int currentParticleCount ); - int __declspec(dllexport) GetNewParticleCap( void ); - - -# define PARM_ParticleTypeName 0x00 -# define PARM_SlaveSystemName 0x01 -# define PARM_AttachedSystemName 0x02 -# define PARM_NumParms 0x03 - - // parmNum can be exactly one of the above defines (PARM_*) - void __declspec(dllexport) GetSelectedParticleAsciiStringParm( int parmNum, char *bufferToCopyInto, ParticleSystemTemplate **whichTemplate ); - void __declspec(dllexport) UpdateParticleAsciiStringParm( int parmNum, const char *bufferToCopyFrom, ParticleSystemTemplate **whichTemplate ); - - - void __declspec(dllexport) UpdateCurrentParticleSystem( ParticleSystemTemplate *particleTemplate ); - void __declspec(dllexport) UpdateSystemUseParameters( ParticleSystemTemplate *particleTemplate ); - - Bool __declspec(dllexport) ShouldWriteINI( void ); - Bool __declspec(dllexport) ShouldBusyWait( void ); - Bool __declspec(dllexport) ShouldUpdateParticleCap( void ); - Bool __declspec(dllexport) ShouldReloadTextures( void ); - - -# define PEB_Continue 0x00 -# define PEB_UpdateCurrentSystem 0x01 -# define PEB_ChangeToAnotherSystem 0x02 -# define PEB_SaveCurrentSystem 0x03 -# define PEB_SaveAllSystems 0x03 -# define PEB_ReloadCurrentSystem 0x04 -# define PEB_SetParticleCap 0x05 -# define PEB_ReloadTextures 0x06 -# define PEB_KillAllSystems 0x07 -# define PEB_BusyWait 0xFE -# define PEB_Error 0xFF - - - int __declspec(dllexport) NextParticleEditorBehavior( void ); - - -} diff --git a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp deleted file mode 100644 index ed7ed1750c3..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.cpp +++ /dev/null @@ -1,212 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ParticleTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ParticleTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "ParticleTypePanels.h" -#include "ParticleEditorDialog.h" -#include - -#define ARBITRARY_BUFF_SIZE 128 -static const char *PATH = "Art\\Textures\\"; -//static const char *PATH = "..\\FinalArt\\Textures\\"; -static const char *PREFIX = "EX"; -static const char *POSTFIX = "*.*"; - -// ParticlePanelParticle ////////////////////////////////////////////////////////// -ParticlePanelParticle::ParticlePanelParticle(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void ParticlePanelParticle::InitPanel( void ) -{ - CFileFind finder; - - CComboBox *pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeParticle); - if (!pWnd) { - return; - } - - // first, clear out any items. - pWnd->ResetContent(); - - std::string findString; - findString = PATH; - findString += PREFIX; - findString += POSTFIX; -// DEBUG_LOG(("ParticlePanedParticle::InitPanel - looking for textures, search string is '%s'", findString.begin())); - BOOL bWorkin = finder.FindFile(findString.c_str()); - while (bWorkin) { - bWorkin = finder.FindNextFile(); - pWnd->AddString(finder.GetFileName()); - } - pWnd->AddString("SMUDGE RESERVED"); //smudges don't use textures so we're hardcoding one to tell them apart. -} - -void ParticlePanelParticle::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Particle parameters - CComboBox *pWnd; - - // first Xmin - pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeParticle); - if (pWnd) { - if (toUI) { - pParent->getParticleNameFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - pWnd->SelectString(-1, buff); - } else { - int curSel = pWnd->GetCurSel(); - if (curSel >= 0) { - pWnd->GetLBText(curSel, buff); - pParent->updateParticleNameToSystem(buff); - } - } - } - } -} - -void ParticlePanelParticle::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(ParticlePanelParticle, ISwapablePanel) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleTypeParticle, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// ParticlePanelDrawable ////////////////////////////////////////////////////////// -ParticlePanelDrawable::ParticlePanelDrawable(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void ParticlePanelDrawable::InitPanel( void ) -{ - -} - -void ParticlePanelDrawable::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Drawable parameters - CComboBox *pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeDrawable); - if (pWnd) { - if (pWnd->GetCount() == 0) { - // This is done here because InitPanel is called before ThingTemplates have been sent over. - std::list::const_iterator cit; - pWnd->AddString(NONE_STRING); - const std::list &r = pParent->getAllThingTemplates(); - for (cit = r.begin(); cit != r.end(); ++cit) { - pWnd->AddString(cit->c_str()); - } - } - - - if (toUI) { - pParent->getDrawableNameFromSystem(buff, ARBITRARY_BUFF_SIZE - 1); - pWnd->SelectString(-1, buff); - } else { - int curSel = pWnd->GetCurSel(); - if (curSel >= 0) { - pWnd->GetLBText(curSel, buff); - pParent->updateDrawableNameToSystem(buff); - } - } - } - } -} - -void ParticlePanelDrawable::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -void ParticlePanelDrawable::clearAllThingTemplates( void ) -{ - CComboBox *pWnd = (CComboBox*) GetDlgItem(IDC_PSEd_ParticleTypeDrawable); - if (!pWnd) { - return; - } - - pWnd->Clear(); -} - -BEGIN_MESSAGE_MAP(ParticlePanelDrawable, ISwapablePanel) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleTypeDrawable, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// ParticlePanelStreak ////////////////////////////////////////////////////////// -ParticlePanelStreak::ParticlePanelStreak(UINT nIDTemplate, CWnd* pParentWnd) : ParticlePanelParticle(nIDTemplate, pParentWnd) -{ - -} - -void ParticlePanelStreak::InitPanel( void ) -{ - ParticlePanelParticle::InitPanel(); -} - -void ParticlePanelStreak::performUpdate( IN Bool toUI ) -{ - ParticlePanelParticle::performUpdate(toUI); -} - -void ParticlePanelStreak::OnParticleSystemEdit() -{ - ParticlePanelParticle::OnParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(ParticlePanelStreak, ParticlePanelParticle) - ON_CBN_SELCHANGE(IDC_PSEd_ParticleTypeParticle, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h b/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h deleted file mode 100644 index 5dc146d78cb..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ParticleTypePanels.h +++ /dev/null @@ -1,98 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ParticleTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ParticleTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -#include "Resource.h" -#include "ISwapablePanel.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// ParticlePanelParticle ////////////////////////////////////////////////////////// -class ParticlePanelParticle : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_ParticlePanelParticle}; - virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelParticle(UINT nIDTemplate = ParticlePanelParticle::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// ParticlePanelDrawable ////////////////////////////////////////////////////////// -class ParticlePanelDrawable : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_ParticlePanelDrawable}; - virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelDrawable(UINT nIDTemplate = ParticlePanelDrawable::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - void clearAllThingTemplates( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// ParticlePanelStreak ////////////////////////////////////////////////////////// -class ParticlePanelStreak : public ParticlePanelParticle -{ - public: - enum {IDD = IDD_PSEd_ParticlePanelStreak}; - virtual DWORD GetIDD( void ) { return IDD; } - ParticlePanelStreak(UINT nIDTemplate = ParticlePanelStreak::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/Generals/Code/Tools/ParticleEditor/Resource.h b/Generals/Code/Tools/ParticleEditor/Resource.h deleted file mode 100644 index bf7d6396bb6..00000000000 --- a/Generals/Code/Tools/ParticleEditor/Resource.h +++ /dev/null @@ -1,205 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by ParticleEditor.rc -// -#define IDD_PSEd 1000 -#define IDC_PSEd_ParticleSystem 1000 -#define IDC_PSEd_Go 1001 -#define IDC_PSEd_ParentSystem 1002 -#define IDD_PSEd_EditColorAndAlpha 1002 -#define IDC_PSEd_EmissionType 1003 -#define IDD_PSEd_EmissionPanelLine 1003 -#define IDC_PSEd_AngleXMin 1004 -#define IDD_PSEd_EmissionPanelSphere 1004 -#define IDC_PSEd_VelocityType 1005 -#define IDD_PSEd_EmissionPanelBox 1005 -#define IDC_PSEd_LineStartY 1005 -#define IDC_PSEd_DriftVelocityX 1005 -#define IDC_PSEd_ParticleType 1006 -#define IDD_PSEd_EmissionPanelCylinder 1006 -#define IDC_PSEd_LineStartZ 1006 -#define IDC_PSEd_SlaveOffsetX 1006 -#define IDC_PSEd_ShaderType 1007 -#define IDC_PSEd_LineEndX 1007 -#define IDC_PSEd_AngleYMin 1008 -#define IDC_PSEd_LineEndY 1008 -#define IDD_PSEd_EmissionPanelPoint 1008 -#define IDC_PSEd_AngleZMin 1009 -#define IDC_PSEd_LineEndZ 1009 -#define IDD_PSEd_VelocityPanelOrtho 1009 -#define IDC_PSEd_AngularRateXMin 1010 -#define IDD_PSEd_VelocityPanelSphere 1010 -#define IDC_PSEd_AngularRateYMin 1011 -#define IDD_PSEd_VelocityPanelHemisphere 1011 -#define IDC_PSEd_AngularRateZMin 1012 -#define IDD_PSEd_VelocityPanelCylinder 1012 -#define IDC_PSEd_AngleXMax 1013 -#define IDD_PSEd_VelocityPanelOutward 1013 -#define IDC_PSEd_AngleYMax 1014 -#define IDD_PSEd_ParticlePanelDrawable 1014 -#define IDC_PSEd_AngleZMax 1015 -#define IDD_PSEd_ParticlePanelParticle 1015 -#define IDC_PSEd_AngularRateXMax 1016 -#define IDD_PSEd_EditMoreParms 1016 -#define IDR_FileMenu 1016 -#define IDC_PSEd_AngularRateYMax 1017 -#define IDD_PSEd_EditSwitchesDialog 1017 -#define IDC_PSEd_AngularRateZMax 1018 -#define IDD_PSEd_ParticlePanelStreak 1018 -#define IDC_PSEd_AngleDampingMin 1019 -#define IDC_PSEd_DriftVelocityY 1019 -#define IDC_PSEd_AngleDampingMax 1020 -#define IDC_PSEd_DriftVelocityZ 1020 -#define IDC_PSEd_VelocityDampingMin 1021 -#define IDC_PSEd_VelocityDampingMax 1022 -#define IDC_PSEd_SlaveOffsetY 1023 -#define IDC_PSEd_Save 1023 -#define IDC_PSEd_Priority 1023 -#define IDC_PSEd_Gravity 1024 -#define IDC_PSEd_SlaveOffsetZ 1025 -#define IDC_PSEd_Reload 1025 -#define IDC_PSEd_KillAll 1025 -#define IDC_PSEd_SystemLifetime 1026 -#define IDC_PSEd_ParticleLifetimeMin 1027 -#define IDC_PSEd_ParticleLifetimeMax 1028 -#define IDC_PSEd_SizeRateMin 1029 -#define IDC_PSEd_SizeRateMax 1030 -#define IDC_PSEd_Color1 1031 -#define IDC_PSEd_Color2 1032 -#define IDC_PSEd_Color3 1033 -#define IDC_PSEd_Color4 1034 -#define IDC_PSEd_Color5 1035 -#define IDC_PSEd_Color6 1036 -#define IDC_PSEd_Color7 1037 -#define IDC_PSEd_Color8 1038 -#define IDC_PSEd_EditColorButton 1039 -#define IDC_PSEd_Continued 1040 -#define IDC_PSEd_EditSwitchesButton 1041 -#define IDC_EmissionProperties 1045 -#define IDC_PSEd_CylRadius 1046 -#define IDC_PSEd_CylLength 1047 -#define IDC_PSEd_BoxHalfSizeX 1048 -#define IDC_PSEd_BoxHalfSizeY 1049 -#define IDC_PSEd_BoxHalfSizeZ 1050 -#define IDC_PSEd_LineStartX 1051 -#define IDC_PSEd_SphereRadius 1052 -#define IDC_PSEd_EmissionPanel 1053 -#define IDC_PSEd_CylinderRadialMax 1053 -#define IDC_PSEd_VelocityPanel 1054 -#define IDC_PSEd_CylinderNormalMin 1054 -#define IDC_PSEd_ParticlePanel 1055 -#define IDC_PSEd_CylinderNormalMax 1055 -#define IDC_VelocityProperties 1057 -#define IDC_PSEd_CylinderRadialMin 1059 -#define IDC_PSEd_HemisphereRadialMin 1060 -#define IDC_PSEd_HemisphereRadialMax 1061 -#define IDC_PSEd_SphereRadialMin 1062 -#define IDC_PSEd_SphereRadialMax 1063 -#define IDC_PSEd_OutwardOtherMin 1064 -#define IDC_PSEd_OutwardOtherMax 1065 -#define IDC_PSEd_OutwardSpeedMin 1066 -#define IDC_PSEd_OutwardSpeedMax 1067 -#define IDC_PSEd_CF1_Frame 1068 -#define IDC_PSEd_OrthoZMin 1068 -#define IDC_PSEd_CF2_Frame 1069 -#define IDC_PSEd_OrthoZMax 1069 -#define IDC_PSEd_CF3_Frame 1070 -#define IDC_PSEd_OrthoXMin 1070 -#define IDC_PSEd_CF4_Frame 1071 -#define IDC_PSEd_OrthoXMax 1071 -#define IDC_PSEd_CF5_Frame 1072 -#define IDC_PSEd_OrthoYMin 1072 -#define IDC_PSEd_CF6_Frame 1073 -#define IDC_PSEd_OrthoYMax 1073 -#define IDC_PSEd_CF7_Frame 1074 -#define IDC_PSEd_OneShot 1074 -#define IDC_PSEd_CF8_Frame 1075 -#define IDC_PSEd_Hollow 1075 -#define IDC_PSEd_AF1_Min 1076 -#define IDC_PSEd_ParticleTypeDrawable 1076 -#define IDC_PSEd_AF2_Min 1077 -#define IDC_PSEd_ParticleTypeParticle 1077 -#define IDC_PSEd_AF3_Min 1078 -#define IDC_PSEd_BurstDelayMin 1078 -#define IDC_PSEd_AF1_Max 1079 -#define IDC_PSEd_BurstDelayMax 1079 -#define IDC_PSEd_AF2_Max 1080 -#define IDC_PSEd_InitialDelayMin 1080 -#define IDC_PSEd_AF3_Max 1081 -#define IDC_PSEd_InitialDelayMax 1081 -#define IDC_PSEd_AF4_Min 1082 -#define IDC_PSEd_BurstCountMin 1082 -#define IDC_PSEd_AF5_Min 1083 -#define IDC_PSEd_BurstCountMax 1083 -#define IDC_PSEd_AF6_Min 1084 -#define IDC_PSEd_ColorScaleMin 1084 -#define IDC_PSEd_AF4_Max 1085 -#define IDC_PSEd_ColorScaleMax 1085 -#define IDC_PSEd_AF5_Max 1086 -#define IDC_PSEd_AF6_Max 1087 -#define IDC_PSEd_SlaveSystem 1087 -#define IDC_PSEd_AF7_Min 1088 -#define IDC_PSEd_PerParticleSystem 1088 -#define IDC_PSEd_AF8_Min 1089 -#define IDC_PSEd_SizeMin 1089 -#define IDC_PSEd_AF7_Max 1090 -#define IDC_PSEd_SizeMax 1090 -#define IDC_PSEd_AF8_Max 1091 -#define IDC_PSEd_SizeDampingMin 1091 -#define IDC_PSEd_CurrentParticleCap 1091 -#define IDC_PSEd_AF1_Frame 1092 -#define IDC_PSEd_SizeDampingMax 1092 -#define IDC_PSEd_CurrentParticleCount 1092 -#define IDC_PSEd_AF2_Frame 1093 -#define IDC_PSEd_GroundAligned 1093 -#define IDC_PSEd_StartSizeRateMin 1093 -#define IDC_PSEd_AF3_Frame 1094 -#define IDC_PSEd_EmitAboveGroundOnly 1094 -#define IDC_PSEd_StartSizeRateMax 1094 -#define IDC_PSEd_AF4_Frame 1095 -#define IDC_PSEd_ParticleUpTowardsEmitter 1095 -#define IDC_PSEd_AF5_Frame 1096 -#define IDC_PSEd_AF6_Frame 1097 -#define IDC_PSEd_AF7_Frame 1098 -#define IDC_PSEd_WindAngleChangeMin 1098 -#define IDC_PSEd_AF8_Frame 1099 -#define IDC_PSEd_WindPingPongStartAngleMin 1099 -#define IDC_PSEd_WindPingPongStartAngleMax 1100 -#define IDC_PSEd_WindMotion 1101 -#define IDC_PSEd_WindAngleChangeMax 1102 -#define IDC_PSEd_WindPingPongEndAngleMin 1103 -#define IDC_PSEd_WindPingPongEndAngleMax 1104 -#define ID_FILE_SAVEALL 32771 -#define ID_FILE_SAVECURRENT 32772 -#define ID_FILE_RELOADCURRENT 32773 -#define ID_FILE_RELOADALL 32775 -#define ID_FILE_RELOADTEXTURES 32776 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 1019 -#define _APS_NEXT_COMMAND_VALUE 32777 -#define _APS_NEXT_CONTROL_VALUE 1102 -#define _APS_NEXT_SYMED_VALUE 1000 -#endif -#endif diff --git a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp deleted file mode 100644 index 3092ee2aef4..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ShaderTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ShaderTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "ShaderTypePanels.h" diff --git a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h b/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h deleted file mode 100644 index f3d5ffe6f62..00000000000 --- a/Generals/Code/Tools/ParticleEditor/ShaderTypePanels.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: ShaderTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: ShaderTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -// DEFINES //////////////////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// diff --git a/Generals/Code/Tools/ParticleEditor/StdAfx.cpp b/Generals/Code/Tools/ParticleEditor/StdAfx.cpp deleted file mode 100644 index 7e214580f01..00000000000 --- a/Generals/Code/Tools/ParticleEditor/StdAfx.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// stdafx.cpp : source file that includes just the standard includes -// DebugWindow.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "StdAfx.h" - - - diff --git a/Generals/Code/Tools/ParticleEditor/StdAfx.h b/Generals/Code/Tools/ParticleEditor/StdAfx.h deleted file mode 100644 index 31a9a456d21..00000000000 --- a/Generals/Code/Tools/ParticleEditor/StdAfx.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers - -// TheSuperHackers @build xezon 24/03/2025 Prevent afxwin.h from loading d3d9types.h, colliding with our own DirectX library. -#define _d3d9TYPES_H_ - -#include // MFC core and standard components -#include // MFC extensions - -#ifndef _AFX_NO_OLE_SUPPORT -#include // MFC OLE classes -#include // MFC OLE dialog classes -#include // MFC Automation classes -#endif // _AFX_NO_OLE_SUPPORT - - -#ifndef _AFX_NO_DB_SUPPORT -#include // MFC ODBC database classes -#endif // _AFX_NO_DB_SUPPORT - -#ifndef _AFX_NO_DAO_SUPPORT -#include // MFC DAO database classes -#endif // _AFX_NO_DAO_SUPPORT - -#include // MFC support for Internet Explorer 4 Common Controls -#ifndef _AFX_NO_AFXCMN_SUPPORT -#include // MFC support for Windows Common Controls -#endif // _AFX_NO_AFXCMN_SUPPORT - -// I don't care that debug symbols are longer than 255, I won't read them anyways. -#pragma warning (disable : 4786) - -// Define IN and OUT. Use them for sementic emphasis. -#ifndef IN -# define IN -#endif - -#ifndef OUT -# define OUT -#endif - -#ifndef interface -# define interface struct -#endif - - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#include diff --git a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp deleted file mode 100644 index 5adc1e5ea25..00000000000 --- a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.cpp +++ /dev/null @@ -1,517 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: VelocityTypePanels.cpp -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: VelocityTypePanels.cpp */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#include "StdAfx.h" -#include "VelocityTypePanels.h" -#include "ParticleEditorDialog.h" - -#define ARBITRARY_BUFF_SIZE 128 - -// VelocityPanelOrtho ////////////////////////////////////////////////////////// -VelocityPanelOrtho::VelocityPanelOrtho(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelOrtho::InitPanel( void ) -{ - -} - -void VelocityPanelOrtho::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update ortho parameters - Real ortho; - CWnd *pWnd; - - // first Xmin - pWnd = GetDlgItem(IDC_PSEd_OrthoXMin); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(0, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(0, ortho); - } - } - - // now the Ymin - pWnd = GetDlgItem(IDC_PSEd_OrthoYMin); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(1, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(1, ortho); - } - } - - // now the Zmin - pWnd = GetDlgItem(IDC_PSEd_OrthoZMin); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(2, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(2, ortho); - } - } - - // first the Xmax - pWnd = GetDlgItem(IDC_PSEd_OrthoXMax); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(3, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(3, ortho); - } - } - - // now the Ymax - pWnd = GetDlgItem(IDC_PSEd_OrthoYMax); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(4, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(4, ortho); - } - } - - // the Zmax - pWnd = GetDlgItem(IDC_PSEd_OrthoZMax); - if (pWnd) { - if (toUI) { - pParent->getVelOrthoFromSystem(5, ortho); - - sprintf(buff, FORMAT_STRING, ortho); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - ortho = atof(buff); - pParent->updateVelOrthoToSystem(5, ortho); - } - } - } -} - -void VelocityPanelOrtho::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelOrtho, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoXMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoYMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoZMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoXMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoYMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OrthoZMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// VelocityPanelSphere //////////////////////////////////////////////////////// -VelocityPanelSphere::VelocityPanelSphere(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelSphere::InitPanel( void ) -{ - -} - -void VelocityPanelSphere::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Sphere Velocity Parameters - Real radial; - CWnd *pWnd; - - // radial min - pWnd = GetDlgItem(IDC_PSEd_SphereRadialMin); - if (pWnd) { - if (toUI) { - pParent->getVelSphereFromSystem(0, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelSphereToSystem(0, radial); - } - } - - // radial max - pWnd = GetDlgItem(IDC_PSEd_SphereRadialMax); - if (pWnd) { - if (toUI) { - pParent->getVelSphereFromSystem(1, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelSphereToSystem(1, radial); - } - } - } -} - -void VelocityPanelSphere::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelSphere, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_SphereRadialMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_SphereRadialMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - - -// VelocityPanelHemisphere ////////////////////////////////////////////////////////// -VelocityPanelHemisphere::VelocityPanelHemisphere(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelHemisphere::InitPanel( void ) -{ - -} - -void VelocityPanelHemisphere::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update Sphere Velocity Parameters - Real radial; - CWnd *pWnd; - - // radial min - pWnd = GetDlgItem(IDC_PSEd_HemisphereRadialMin); - if (pWnd) { - if (toUI) { - pParent->getVelHemisphereFromSystem(0, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelHemisphereToSystem(0, radial); - } - } - - // radial max - pWnd = GetDlgItem(IDC_PSEd_HemisphereRadialMax); - if (pWnd) { - if (toUI) { - pParent->getVelHemisphereFromSystem(1, radial); - - sprintf(buff, FORMAT_STRING, radial); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - radial = atof(buff); - pParent->updateVelHemisphereToSystem(1, radial); - } - } - } -} - -void VelocityPanelHemisphere::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelHemisphere, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_HemisphereRadialMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_HemisphereRadialMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// VelocityPanelCylinder ////////////////////////////////////////////////////// -VelocityPanelCylinder::VelocityPanelCylinder(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelCylinder::InitPanel( void ) -{ - -} - -void VelocityPanelCylinder::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update cylinder parameters - Real cylinder; - CWnd *pWnd; - - // first radial min - pWnd = GetDlgItem(IDC_PSEd_CylinderRadialMin); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(0, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(0, cylinder); - } - } - - // now the normal min - pWnd = GetDlgItem(IDC_PSEd_CylinderNormalMin); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(1, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(1, cylinder); - } - } - - // now the radial max - pWnd = GetDlgItem(IDC_PSEd_CylinderRadialMax); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(2, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(2, cylinder); - } - } - - // now normal max - pWnd = GetDlgItem(IDC_PSEd_CylinderNormalMax); - if (pWnd) { - if (toUI) { - pParent->getVelCylinderFromSystem(3, cylinder); - - sprintf(buff, FORMAT_STRING, cylinder); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - cylinder = atof(buff); - pParent->updateVelCylinderToSystem(3, cylinder); - } - } - } -} - -void VelocityPanelCylinder::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelCylinder, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderRadialMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderNormalMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderRadialMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_CylinderNormalMax, OnParticleSystemEdit) -END_MESSAGE_MAP() - -// VelocityPanelOutward /////////////////////////////////////////////////////////// -VelocityPanelOutward::VelocityPanelOutward(UINT nIDTemplate, CWnd* pParentWnd) : ISwapablePanel(nIDTemplate, pParentWnd) -{ - -} - -void VelocityPanelOutward::InitPanel( void ) -{ - -} - -void VelocityPanelOutward::performUpdate( IN Bool toUI ) -{ - static char buff[ARBITRARY_BUFF_SIZE]; - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - { // update outward parameters - Real outward; - CWnd *pWnd; - - // first radial min - pWnd = GetDlgItem(IDC_PSEd_OutwardSpeedMin); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(0, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(0, outward); - } - } - - // now the normal min - pWnd = GetDlgItem(IDC_PSEd_OutwardOtherMin); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(1, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(1, outward); - } - } - - // now the radial max - pWnd = GetDlgItem(IDC_PSEd_OutwardSpeedMax); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(2, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(2, outward); - } - } - - // first the normal max - pWnd = GetDlgItem(IDC_PSEd_OutwardOtherMax); - if (pWnd) { - if (toUI) { - pParent->getVelOutwardFromSystem(3, outward); - - sprintf(buff, FORMAT_STRING, outward); - pWnd->SetWindowText(buff); - } else { - pWnd->GetWindowText(buff, ARBITRARY_BUFF_SIZE - 1); - outward = atof(buff); - pParent->updateVelOutwardToSystem(3, outward); - } - } - } -} - -void VelocityPanelOutward::OnParticleSystemEdit() -{ - DebugWindowDialog *pParent = (DebugWindowDialog*) GetParent(); - if (!pParent) { - return; - } - - pParent->signalParticleSystemEdit(); -} - -BEGIN_MESSAGE_MAP(VelocityPanelOutward, ISwapablePanel) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardSpeedMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardOtherMin, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardSpeedMax, OnParticleSystemEdit) - ON_EN_KILLFOCUS(IDC_PSEd_OutwardOtherMax, OnParticleSystemEdit) -END_MESSAGE_MAP() diff --git a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h b/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h deleted file mode 100644 index 4568438d940..00000000000 --- a/Generals/Code/Tools/ParticleEditor/VelocityTypePanels.h +++ /dev/null @@ -1,134 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -// FILE: VelocityTypePanels.h -/*---------------------------------------------------------------------------*/ -/* EA Pacific */ -/* Confidential Information */ -/* Copyright (C) 2001 - All Rights Reserved */ -/* DO NOT DISTRIBUTE */ -/*---------------------------------------------------------------------------*/ -/* Project: RTS3 */ -/* File name: VelocityTypePanels.h */ -/* Created: John K. McDonald, Jr., 3/21/2002 */ -/* Desc: // @todo */ -/* Revision History: */ -/* 3/21/2002 : Initial creation */ -/*---------------------------------------------------------------------------*/ - -#pragma once - -// INCLUDES /////////////////////////////////////////////////////////////////// -#include "Resource.h" -#include "ISwapablePanel.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -// FORWARD DECLARATIONS /////////////////////////////////////////////////////// - -// VelocityPanelOrtho ////////////////////////////////////////////////////////// -class VelocityPanelOrtho : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelOrtho}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOrtho(UINT nIDTemplate = VelocityPanelOrtho::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelSphere //////////////////////////////////////////////////////// -class VelocityPanelSphere : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelSphere}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelSphere(UINT nIDTemplate = VelocityPanelSphere::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelHemisphere ////////////////////////////////////////////////////////// -class VelocityPanelHemisphere : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelHemisphere}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelHemisphere(UINT nIDTemplate = VelocityPanelHemisphere::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelCylinder ////////////////////////////////////////////////////// -class VelocityPanelCylinder : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelCylinder}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelCylinder(UINT nIDTemplate = VelocityPanelCylinder::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; - -// VelocityPanelOutward /////////////////////////////////////////////////////////// -class VelocityPanelOutward : public ISwapablePanel -{ - public: - enum {IDD = IDD_PSEd_VelocityPanelOutward}; - virtual DWORD GetIDD( void ) { return IDD; } - VelocityPanelOutward(UINT nIDTemplate = VelocityPanelOutward::IDD, CWnd* pParentWnd = nullptr); - - void InitPanel( void ); - - // if true, updates the UI from the Particle System. - // if false, updates the Particle System from the UI - void performUpdate( IN Bool toUI ); - protected: - afx_msg void OnParticleSystemEdit(); - DECLARE_MESSAGE_MAP() -}; diff --git a/GeneralsMD/CMakeLists.txt b/GeneralsMD/CMakeLists.txt index 2a9a65fb780..1285409e7fc 100644 --- a/GeneralsMD/CMakeLists.txt +++ b/GeneralsMD/CMakeLists.txt @@ -48,14 +48,14 @@ if(RTS_INSTALL_PREFIX_ZEROHOUR) install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) endif() - if(TARGET z_particleeditor) - install(TARGETS z_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) + if(TARGET core_particleeditor) + install(TARGETS core_particleeditor RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) endif() - if(TARGET z_debugwindow) - install(TARGETS z_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") - install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) + if(TARGET core_debugwindow) + install(TARGETS core_debugwindow RUNTIME DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}") + install(FILES $ DESTINATION "${RTS_INSTALL_PREFIX_ZEROHOUR}" OPTIONAL) endif() if(TARGET z_guiedit) diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index d6990fc097c..4cccb799075 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -207,7 +207,7 @@ set(GAMEENGINE_SRC Include/GameClient/Module/SwayClientUpdate.h Include/GameClient/Mouse.h # Include/GameClient/ParabolicEase.h - Include/GameClient/ParticleSys.h +# Include/GameClient/ParticleSys.h Include/GameClient/PlaceEventTranslator.h Include/GameClient/ProcessAnimateWindow.h Include/GameClient/RadiusDecal.h @@ -817,7 +817,7 @@ set(GAMEENGINE_SRC # "Source/GameClient/System/Debug Displayers/AudioDebugDisplay.cpp" Source/GameClient/System/DebugDisplay.cpp Source/GameClient/System/Image.cpp - Source/GameClient/System/ParticleSys.cpp +# Source/GameClient/System/ParticleSys.cpp Source/GameClient/System/RayEffect.cpp # Source/GameClient/System/Smudge.cpp # Source/GameClient/Terrain/TerrainRoads.cpp diff --git a/GeneralsMD/Code/Tools/CMakeLists.txt b/GeneralsMD/Code/Tools/CMakeLists.txt index b5d2b2a878d..eb85f07f4b8 100644 --- a/GeneralsMD/Code/Tools/CMakeLists.txt +++ b/GeneralsMD/Code/Tools/CMakeLists.txt @@ -5,7 +5,6 @@ if(RTS_BUILD_ZEROHOUR_TOOLS) add_subdirectory(GUIEdit) add_subdirectory(ImagePacker) add_subdirectory(MapCacheBuilder) - add_subdirectory(ParticleEditor) add_subdirectory(W3DView) add_subdirectory(wdump) add_subdirectory(WorldBuilder) diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def deleted file mode 100644 index c35776d57d7..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.def +++ /dev/null @@ -1,6 +0,0 @@ -; ParticleEditor.def : Declares the module parameters for the DLL. - -LIBRARY "ParticleEditor" -DESCRIPTION 'ParticleEditor Windows Dynamic Link Library' - -EXPORTS diff --git a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc b/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc deleted file mode 100644 index 8010aaa685e..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/ParticleEditor.rc +++ /dev/null @@ -1,648 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif //_WIN32\r\n" - "#include ""res\\ParticleEditor.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef RTS_DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "\0" - VALUE "FileDescription", "DebugWindow DLL\0" - VALUE "FileVersion", "1, 0, 0, 1\0" - VALUE "InternalName", "DebugWindow\0" - VALUE "LegalCopyright", "Copyright (C) 2002\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "DebugWindow.DLL\0" - VALUE "ProductName", "DebugWindow Dynamic Link Library\0" - VALUE "ProductVersion", "1, 0, 0, 1\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_PSEd DIALOGEX 0, 0, 215, 441 -STYLE DS_MODALFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_POPUP | - WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT -CAPTION "Particle Editor" -MENU IDR_FileMenu -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - COMBOBOX IDC_PSEd_ParticleSystem,38,19,137,419,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP - COMBOBOX IDC_PSEd_ParentSystem,38,35,137,403,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_EmissionType,77,78,103,189,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_VelocityType,77,94,103,206,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_ParticleType,77,110,103,205,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_ShaderType,77,126,103,186,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - EDITTEXT IDC_PSEd_AngleXMin,25,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleXMax,53,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleYMin,25,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleYMax,53,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleZMin,25,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleZMax,53,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateXMin,98,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateXMax,127,161,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateYMin,98,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateYMax,127,177,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateZMin,98,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngularRateZMax,127,193,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_Gravity,164,156,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleDampingMin,18,230,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AngleDampingMax,46,230,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_VelocityDampingMin,93,230,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_VelocityDampingMax,121,230,26,14,ES_AUTOHSCROLL - CONTROL "",IDC_PSEd_EmissionPanel,"Static",SS_BLACKRECT | - WS_TABSTOP,12,258,186,55 - CONTROL "",IDC_PSEd_VelocityPanel,"Static",SS_BLACKRECT | - WS_TABSTOP,12,317,186,55 - CONTROL "",IDC_PSEd_ParticlePanel,"Static",SS_BLACKRECT | - WS_TABSTOP,12,376,186,39 - CONTROL "Colors/Alpha",IDC_PSEd_EditColorButton,"Button", - BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,12,421,50,14 - CONTROL "Continued...",IDC_PSEd_Continued,"Button", - BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,148,421,50,14 - PUSHBUTTON "Go",IDC_PSEd_Go,188,19,20,14 - LTEXT "System:",IDC_STATIC,7,21,26,8 - LTEXT "Parent:",IDC_STATIC,8,37,24,8 - GROUPBOX "System Parameters",IDC_STATIC,7,52,201,386 - LTEXT "Emission Type:",IDC_STATIC,19,81,48,8 - LTEXT "Velocity Type:",IDC_STATIC,19,97,46,8 - LTEXT "Particle Type:",IDC_STATIC,19,113,44,8 - LTEXT "Shader Type:",IDC_STATIC,19,129,44,8 - LTEXT "X:",IDC_STATIC,15,164,8,8 - LTEXT "Y:",IDC_STATIC,15,180,8,8 - LTEXT "Z:",IDC_STATIC,15,196,8,8 - LTEXT "X:",IDC_STATIC,88,164,8,8 - LTEXT "Y:",IDC_STATIC,88,180,8,8 - LTEXT "Z:",IDC_STATIC,88,196,8,8 - LTEXT "Min",IDC_STATIC,31,153,12,8 - LTEXT "Max",IDC_STATIC,59,153,14,8 - LTEXT "Min",IDC_STATIC,105,153,12,8 - LTEXT "Max",IDC_STATIC,133,153,14,8 - LTEXT "Min",IDC_STATIC,24,222,12,8 - LTEXT "Max",IDC_STATIC,52,222,14,8 - LTEXT "Min",IDC_STATIC,99,222,12,8 - LTEXT "Max",IDC_STATIC,127,222,14,8 - GROUPBOX "Angle",IDC_STATIC,12,145,70,65 - GROUPBOX "Angular Rate",IDC_STATIC,85,145,70,65 - GROUPBOX "Angular Damping",IDC_STATIC,12,212,70,35 - GROUPBOX "Velocity Damping",IDC_STATIC,85,212,70,35 - GROUPBOX "Gravity",IDC_STATIC,158,145,39,27 - LTEXT "Particle Cap:",IDC_STATIC,7,5,41,8 - EDITTEXT IDC_PSEd_CurrentParticleCap,50,2,25,14,ES_AUTOHSCROLL | - ES_NUMBER - LTEXT "Current Count:",IDC_STATIC,133,5,46,8 - EDITTEXT IDC_PSEd_CurrentParticleCount,182,2,25,14,ES_AUTOHSCROLL | - ES_READONLY | ES_NUMBER - CONTROL "Switches",IDC_PSEd_EditSwitchesButton,"Button", - BS_AUTOCHECKBOX | BS_PUSHLIKE | WS_TABSTOP,92,421,50,14 - COMBOBOX IDC_PSEd_Priority,77,63,103,198,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - LTEXT "Priority",IDC_STATIC,19,67,22,8 - PUSHBUTTON "Kill All",IDC_PSEd_KillAll,181,36,27,14 -END - -IDD_PSEd_EditColorAndAlpha DIALOGEX 0, 0, 199, 186 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_CONTROLPARENT -CAPTION "Color and Alpha" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - LTEXT "1",IDC_STATIC,16,30,8,8 - LTEXT "2",IDC_STATIC,16,45,8,8 - LTEXT "3",IDC_STATIC,16,61,8,8 - GROUPBOX "Color Keyframes",IDC_STATIC,12,11,67,163 - LTEXT "4",IDC_STATIC,15,79,8,8 - LTEXT "5",IDC_STATIC,15,94,8,8 - LTEXT "6",IDC_STATIC,15,110,8,8 - LTEXT "7",IDC_STATIC,15,126,8,8 - LTEXT "8",IDC_STATIC,15,142,8,8 - EDITTEXT IDC_PSEd_CF1_Frame,48,27,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF2_Frame,48,43,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF3_Frame,48,59,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF4_Frame,48,75,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF5_Frame,48,91,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF6_Frame,48,107,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF7_Frame,48,123,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CF8_Frame,48,139,26,14,ES_AUTOHSCROLL - LTEXT "Frame",IDC_STATIC,51,19,20,8 - EDITTEXT IDC_PSEd_AF1_Min,97,27,26,14,ES_AUTOHSCROLL - LTEXT "1",IDC_STATIC,87,30,8,8 - EDITTEXT IDC_PSEd_AF2_Min,97,43,26,14,ES_AUTOHSCROLL - LTEXT "2",IDC_STATIC,87,45,8,8 - EDITTEXT IDC_PSEd_AF3_Min,97,59,26,14,ES_AUTOHSCROLL - LTEXT "3",IDC_STATIC,87,61,8,8 - EDITTEXT IDC_PSEd_AF1_Max,125,27,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF2_Max,125,43,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF3_Max,125,59,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,103,19,12,8 - LTEXT "Max",IDC_STATIC,131,19,14,8 - GROUPBOX "Alpha Keyframes",IDC_STATIC,83,11,105,163 - EDITTEXT IDC_PSEd_AF4_Min,97,75,26,14,ES_AUTOHSCROLL - LTEXT "4",IDC_STATIC,87,78,8,8 - EDITTEXT IDC_PSEd_AF5_Min,97,91,26,14,ES_AUTOHSCROLL - LTEXT "5",IDC_STATIC,87,94,8,8 - EDITTEXT IDC_PSEd_AF6_Min,97,107,26,14,ES_AUTOHSCROLL - LTEXT "6",IDC_STATIC,87,110,8,8 - EDITTEXT IDC_PSEd_AF4_Max,125,75,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF5_Max,125,91,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF6_Max,125,107,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF7_Min,97,123,26,14,ES_AUTOHSCROLL - LTEXT "7",IDC_STATIC,87,126,8,8 - EDITTEXT IDC_PSEd_AF8_Min,97,139,26,14,ES_AUTOHSCROLL - LTEXT "8",IDC_STATIC,87,142,8,8 - EDITTEXT IDC_PSEd_AF7_Max,125,123,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF8_Max,125,139,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF1_Frame,153,27,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF2_Frame,153,43,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF3_Frame,153,59,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF4_Frame,153,75,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF5_Frame,153,91,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF6_Frame,153,107,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF7_Frame,153,123,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_AF8_Frame,153,139,26,14,ES_AUTOHSCROLL - LTEXT "Frame",IDC_STATIC,155,19,20,8 - PUSHBUTTON "",IDC_PSEd_Color1,25,28,14,12 - PUSHBUTTON "",IDC_PSEd_Color2,25,44,14,12 - PUSHBUTTON "",IDC_PSEd_Color3,25,60,14,12 - PUSHBUTTON "",IDC_PSEd_Color4,25,76,14,12 - PUSHBUTTON "",IDC_PSEd_Color5,25,92,14,12 - PUSHBUTTON "",IDC_PSEd_Color6,25,108,14,12 - PUSHBUTTON "",IDC_PSEd_Color7,25,124,14,12 - PUSHBUTTON "",IDC_PSEd_Color8,25,140,14,12 -END - -IDD_PSEd_EmissionPanelLine DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Line Properties",IDC_EmissionProperties,0,0, - 185,54 - LTEXT "X",IDC_STATIC,49,10,8,8 - LTEXT "Y",IDC_STATIC,75,10,8,8 - LTEXT "Z",IDC_STATIC,100,10,8,8 - EDITTEXT IDC_PSEd_LineStartX,38,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineStartY,65,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineStartZ,92,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineEndX,38,35,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineEndY,65,35,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_LineEndZ,92,35,26,14,ES_AUTOHSCROLL - LTEXT "Start",IDC_STATIC,17,23,16,8 - LTEXT "End",IDC_STATIC,17,36,14,8 -END - -IDD_PSEd_EmissionPanelSphere DIALOG DISCARDABLE 0, 0, 185, 54 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Sphere Properties",IDC_EmissionProperties,0,0, - 185,54 - EDITTEXT IDC_PSEd_SphereRadius,41,12,26,14,ES_AUTOHSCROLL - LTEXT "Radius",IDC_STATIC,16,16,23,8 -END - -IDD_PSEd_EmissionPanelBox DIALOG DISCARDABLE 0, 0, 185, 54 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Box Properties",IDC_EmissionProperties,0,0,185, - 54 - LTEXT "X",IDC_STATIC,49,10,8,8 - LTEXT "Y",IDC_STATIC,75,10,8,8 - LTEXT "Z",IDC_STATIC,100,10,8,8 - EDITTEXT IDC_PSEd_BoxHalfSizeX,38,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_BoxHalfSizeY,65,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_BoxHalfSizeZ,92,19,26,14,ES_AUTOHSCROLL - LTEXT "Half-Size",IDC_STATIC,5,23,29,8 -END - -IDD_PSEd_EmissionPanelCylinder DIALOG DISCARDABLE 0, 0, 186, 54 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Cylinder Properties",IDC_EmissionProperties,0, - 0,185,54 - EDITTEXT IDC_PSEd_CylRadius,38,19,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CylLength,38,35,26,14,ES_AUTOHSCROLL - LTEXT "Radius",IDC_STATIC,13,23,23,8 - LTEXT "Length",IDC_STATIC,13,36,23,8 -END - -IDD_PSEd_EmissionPanelPoint DIALOG DISCARDABLE 0, 0, 185, 54 -STYLE WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Emission Point Properties",IDC_EmissionProperties,0,0, - 185,54 - LTEXT "No parameters to edit",IDC_STATIC,38,22,68,8 -END - -IDD_PSEd_VelocityPanelOrtho DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Ortho Velocity Properties",IDC_VelocityProperties,0,0, - 185,54 - EDITTEXT IDC_PSEd_OrthoXMin,22,20,26,14,ES_AUTOHSCROLL - LTEXT "X",IDC_STATIC,11,24,8,8 - EDITTEXT IDC_PSEd_OrthoXMax,51,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,29,10,12,8 - LTEXT "Max",IDC_STATIC,57,10,14,8 - LTEXT "Y",IDC_STATIC,11,39,8,8 - EDITTEXT IDC_PSEd_OrthoYMin,22,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_OrthoYMax,51,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_OrthoZMin,113,20,26,14,ES_AUTOHSCROLL - LTEXT "Z",IDC_STATIC,102,24,8,8 - EDITTEXT IDC_PSEd_OrthoZMax,142,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,120,10,12,8 - LTEXT "Max",IDC_STATIC,148,10,14,8 -END - -IDD_PSEd_VelocityPanelSphere DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Spherical Velocity Properties",IDC_VelocityProperties,0, - 0,185,54 - EDITTEXT IDC_PSEd_SphereRadialMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Radial",IDC_STATIC,21,24,21,8 - EDITTEXT IDC_PSEd_SphereRadialMax,76,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 -END - -IDD_PSEd_VelocityPanelHemisphere DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Hemispherical Velocity Properties", - IDC_VelocityProperties,0,0,185,54 - EDITTEXT IDC_PSEd_HemisphereRadialMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Radial",IDC_STATIC,21,24,21,8 - EDITTEXT IDC_PSEd_HemisphereRadialMax,76,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 -END - -IDD_PSEd_VelocityPanelCylinder DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Cylindrical Velocity Properties",IDC_VelocityProperties, - 0,0,185,54 - EDITTEXT IDC_PSEd_CylinderRadialMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Radial",IDC_STATIC,23,24,21,8 - LTEXT "Orthogonal",IDC_STATIC,8,40,36,8 - EDITTEXT IDC_PSEd_CylinderRadialMax,76,20,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CylinderNormalMin,47,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_CylinderNormalMax,76,36,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 -END - -IDD_PSEd_VelocityPanelOutward DIALOG DISCARDABLE 0, 0, 186, 55 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Outward Velocity Properties",IDC_VelocityProperties,0,0, - 185,54 - EDITTEXT IDC_PSEd_OutwardSpeedMin,47,20,26,14,ES_AUTOHSCROLL - LTEXT "Major Axis",IDC_STATIC,12,24,33,8 - EDITTEXT IDC_PSEd_OutwardSpeedMax,76,20,26,14,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,54,10,12,8 - LTEXT "Max",IDC_STATIC,82,10,14,8 - LTEXT "Minor Axis",IDC_STATIC,12,39,33,8 - EDITTEXT IDC_PSEd_OutwardOtherMin,47,36,26,14,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_OutwardOtherMax,76,36,26,14,ES_AUTOHSCROLL -END - -IDD_PSEd_ParticlePanelDrawable DIALOG DISCARDABLE 0, 0, 186, 39 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - COMBOBOX IDC_PSEd_ParticleTypeDrawable,44,14,130,409,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Particle:",IDC_STATIC,12,16,26,8 - GROUPBOX "3-D Particle Parameters",IDC_STATIC,0,0,185,38 -END - -IDD_PSEd_ParticlePanelParticle DIALOG DISCARDABLE 0, 0, 186, 39 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - COMBOBOX IDC_PSEd_ParticleTypeParticle,44,14,130,409, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Particle:",IDC_STATIC,12,16,26,8 - GROUPBOX "2-D Particle Parameters",IDC_STATIC,0,0,185,38 -END - -IDD_PSEd_EditMoreParms DIALOGEX 0, 0, 265, 204 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT -CAPTION "More Parameters" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - EDITTEXT IDC_PSEd_SizeMin,5,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SizeMax,33,92,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,13,84,12,8 - LTEXT "Max",IDC_STATIC,41,84,14,8 - GROUPBOX "Start Size",IDC_STATIC,3,76,57,32 - EDITTEXT IDC_PSEd_BurstDelayMin,66,20,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_BurstDelayMax,94,20,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,72,12,12,8 - LTEXT "Max",IDC_STATIC,100,12,14,8 - GROUPBOX "Burst Delay",IDC_STATIC,63,3,60,33 - EDITTEXT IDC_PSEd_InitialDelayMin,6,20,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_InitialDelayMax,34,20,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,12,12,12,8 - LTEXT "Max",IDC_STATIC,40,12,14,8 - GROUPBOX "Initial Delay",IDC_STATIC,3,3,60,33 - EDITTEXT IDC_PSEd_BurstCountMin,129,56,26,12,ES_AUTOHSCROLL | - WS_GROUP - EDITTEXT IDC_PSEd_BurstCountMax,157,56,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,135,48,12,8 - LTEXT "Max",IDC_STATIC,163,48,14,8 - GROUPBOX "Burst Count",IDC_STATIC,126,39,60,33 - EDITTEXT IDC_PSEd_DriftVelocityX,131,21,24,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_DriftVelocityY,159,21,24,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_DriftVelocityZ,188,21,24,12,ES_AUTOHSCROLL - CTEXT "X",IDC_STATIC,139,12,8,8 - CTEXT "Y",IDC_STATIC,166,12,8,8 - CTEXT "Z",IDC_STATIC,195,12,8,8 - GROUPBOX "Drift Velocity",IDC_STATIC,126,3,90,33 - EDITTEXT IDC_PSEd_ColorScaleMin,68,56,24,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_ColorScaleMax,94,56,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,75,48,12,8 - LTEXT "Max",IDC_STATIC,100,48,14,8 - GROUPBOX "Color Scale",IDC_STATIC,66,39,57,33 - COMBOBOX IDC_PSEd_SlaveSystem,136,117,111,263,CBS_DROPDOWN | - CBS_SORT | WS_VSCROLL | WS_TABSTOP - COMBOBOX IDC_PSEd_PerParticleSystem,136,131,111,245, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Slave",IDC_STATIC,115,121,19,8 - LTEXT "Per-Particle",IDC_STATIC,97,134,37,8 - EDITTEXT IDC_PSEd_SlaveOffsetX,7,128,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SlaveOffsetY,34,128,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SlaveOffsetZ,61,128,26,12,ES_AUTOHSCROLL - CTEXT "X",IDC_STATIC,16,119,8,8 - CTEXT "Y",IDC_STATIC,43,119,8,8 - CTEXT "Z",IDC_STATIC,70,119,8,8 - GROUPBOX "Slave Offset",IDC_STATIC,3,111,87,36 - EDITTEXT IDC_PSEd_SystemLifetime,195,56,33,12,ES_AUTOHSCROLL - GROUPBOX "System Life",IDC_STATIC,189,39,60,33 - EDITTEXT IDC_PSEd_ParticleLifetimeMin,6,56,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_ParticleLifetimeMax,34,56,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,12,48,12,8 - LTEXT "Max",IDC_STATIC,40,48,14,8 - GROUPBOX "Particle Lifetime",IDC_STATIC,3,39,60,33 - EDITTEXT IDC_PSEd_SizeDampingMin,191,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SizeDampingMax,220,93,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,199,84,12,8 - LTEXT "Max",IDC_STATIC,227,84,14,8 - GROUPBOX "Size Damping",IDC_STATIC,189,75,60,33 - EDITTEXT IDC_PSEd_SizeRateMin,66,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_SizeRateMax,94,92,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,72,84,12,8 - LTEXT "Max",IDC_STATIC,100,84,14,8 - GROUPBOX "Size Rate",IDC_STATIC,63,75,60,33 - EDITTEXT IDC_PSEd_StartSizeRateMin,128,92,26,12,ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_StartSizeRateMax,156,92,26,12,ES_AUTOHSCROLL - LTEXT "Min",IDC_STATIC,135,84,12,8 - LTEXT "Max",IDC_STATIC,163,84,14,8 - GROUPBOX "Start Size Rate",IDC_STATIC,126,75,60,33 - GROUPBOX "Wind",IDC_STATIC,3,147,261,54 - EDITTEXT IDC_PSEd_WindAngleChangeMin,58,171,26,12,ES_AUTOHSCROLL - LTEXT "Angle Rate Min",IDC_STATIC,6,174,50,8 - GROUPBOX "Ping Pong Wind",IDC_STATIC,87,156,174,36 - LTEXT "Start Angle Min",IDC_STATIC,89,167,51,8 - LTEXT "Start Angle Max",IDC_STATIC,89,179,51,8 - EDITTEXT IDC_PSEd_WindPingPongStartAngleMin,143,165,28,12, - ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_WindPingPongStartAngleMax,143,177,28,12, - ES_AUTOHSCROLL - LTEXT "End Angle Min",IDC_STATIC,174,167,51,8 - LTEXT "End Angle Max",IDC_STATIC,174,179,49,8 - EDITTEXT IDC_PSEd_WindPingPongEndAngleMin,227,165,27,12, - ES_AUTOHSCROLL - EDITTEXT IDC_PSEd_WindPingPongEndAngleMax,227,177,27,12, - ES_AUTOHSCROLL - COMBOBOX IDC_PSEd_WindMotion,30,156,48,141,CBS_DROPDOWNLIST | - WS_VSCROLL | WS_TABSTOP - GROUPBOX "Systems",IDC_STATIC,93,111,156,36 - LTEXT "Motion",IDC_STATIC,6,159,22,8 - EDITTEXT IDC_PSEd_WindAngleChangeMax,57,186,27,12,ES_AUTOHSCROLL - LTEXT "Angle Rate Max",IDC_STATIC,6,188,52,8 -END - -IDD_PSEd_EditSwitchesDialog DIALOG DISCARDABLE 0, 0, 191, 102 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION -CAPTION "Emission Switches" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "One Shot Emitter",IDC_PSEd_OneShot,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,27,166,10 - CONTROL "Hollow Emitter",IDC_PSEd_Hollow,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,40,166,10 - CONTROL "Align on XY plane",IDC_PSEd_GroundAligned,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,53,166,10 - CONTROL "Emit above ground only",IDC_PSEd_EmitAboveGroundOnly, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,67,166,10 - GROUPBOX "Emitter Properties",IDC_STATIC,7,8,177,87 - CONTROL "Particle Up towards emitter", - IDC_PSEd_ParticleUpTowardsEmitter,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,12,80,166,10 -END - -IDD_PSEd_ParticlePanelStreak DIALOG DISCARDABLE 0, 0, 185, 39 -STYLE DS_3DLOOK | DS_CONTROL | WS_CHILD -FONT 8, "MS Sans Serif" -BEGIN - GROUPBOX "Streak Particle Parameters",IDC_STATIC,0,0,185,39 - COMBOBOX IDC_PSEd_ParticleTypeParticle,44,14,130,409, - CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP - LTEXT "Streak:",IDC_STATIC,12,16,24,8 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_PSEd, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 208 - TOPMARGIN, 1 - BOTTOMMARGIN, 434 - END - - IDD_PSEd_EditColorAndAlpha, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 192 - TOPMARGIN, 7 - BOTTOMMARGIN, 179 - END - - IDD_PSEd_EditMoreParms, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 258 - TOPMARGIN, 8 - BOTTOMMARGIN, 197 - END - - IDD_PSEd_EditSwitchesDialog, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 184 - TOPMARGIN, 7 - BOTTOMMARGIN, 95 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Menu -// - -IDR_FileMenu MENU DISCARDABLE -BEGIN - POPUP "File" - BEGIN - MENUITEM "Reload Current System", ID_FILE_RELOADCURRENT - MENUITEM "Reload All", ID_FILE_RELOADALL, GRAYED - MENUITEM SEPARATOR - MENUITEM "Save Current", ID_FILE_SAVECURRENT, GRAYED - MENUITEM "Save All", ID_FILE_SAVEALL - MENUITEM SEPARATOR - MENUITEM "Reload Textures", ID_FILE_RELOADTEXTURES - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif //_WIN32 -#include "res\ParticleEditor.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat b/GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat deleted file mode 100644 index a6f4a3cd544..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/post-build-Release.bat +++ /dev/null @@ -1 +0,0 @@ -@copy release\particleEditor.dll ..\..\..\Run \ No newline at end of file diff --git a/GeneralsMD/Code/Tools/ParticleEditor/post-build.bat b/GeneralsMD/Code/Tools/ParticleEditor/post-build.bat deleted file mode 100644 index 9e10f7a3981..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/post-build.bat +++ /dev/null @@ -1 +0,0 @@ -@copy debug\particleEditor.dll ..\..\..\Run \ No newline at end of file diff --git a/GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 b/GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 deleted file mode 100644 index a9778297b91..00000000000 --- a/GeneralsMD/Code/Tools/ParticleEditor/res/ParticleEditor.rc2 +++ /dev/null @@ -1,13 +0,0 @@ -// -// DEBUGWINDOW.RC2 - resources Microsoft Visual C++ does not edit directly -// - -#ifdef APSTUDIO_INVOKED - #error this file is not editable by Microsoft Visual C++ -#endif //APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// Add manually edited resources here... - -///////////////////////////////////////////////////////////////////////////// diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 458d51e38e1..bed8377715c 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -277,6 +277,40 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Source/Common/System/SubsystemInterface.cpp", Game.CORE, "GameEngine/Source/Common/System/SubsystemInterface.cpp") #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ChallengeGenerals.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ParticleSys.h", Game.CORE, "GameEngine/Include/GameClient/ParticleSys.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/System/ParticleSys.cpp", Game.CORE, "GameEngine/Source/GameClient/System/ParticleSys.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/res/ParticleEditor.rc2", Game.CORE, "Tools/ParticleEditor/res/ParticleEditor.rc2") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CButtonShowColor.cpp", Game.CORE, "Tools/ParticleEditor/CButtonShowColor.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CButtonShowColor.h", Game.CORE, "Tools/ParticleEditor/CButtonShowColor.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CColorAlphaDialog.cpp", Game.CORE, "Tools/ParticleEditor/CColorAlphaDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CColorAlphaDialog.h", Game.CORE, "Tools/ParticleEditor/CColorAlphaDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CParticleEditorPage.h", Game.CORE, "Tools/ParticleEditor/CParticleEditorPage.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CSwitchesDialog.cpp", Game.CORE, "Tools/ParticleEditor/CSwitchesDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/CSwitchesDialog.h", Game.CORE, "Tools/ParticleEditor/CSwitchesDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/EmissionTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/EmissionTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/EmissionTypePanels.h", Game.CORE, "Tools/ParticleEditor/EmissionTypePanels.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ISwapablePanel.h", Game.CORE, "Tools/ParticleEditor/ISwapablePanel.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/MoreParmsDialog.cpp", Game.CORE, "Tools/ParticleEditor/MoreParmsDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/MoreParmsDialog.h", Game.CORE, "Tools/ParticleEditor/MoreParmsDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.cpp", Game.CORE, "Tools/ParticleEditor/ParticleEditor.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.def", Game.CORE, "Tools/ParticleEditor/ParticleEditor.def") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.h", Game.CORE, "Tools/ParticleEditor/ParticleEditor.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditor.rc", Game.CORE, "Tools/ParticleEditor/ParticleEditor.rc") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditorDialog.cpp", Game.CORE, "Tools/ParticleEditor/ParticleEditorDialog.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditorDialog.h", Game.CORE, "Tools/ParticleEditor/ParticleEditorDialog.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleEditorExport.h", Game.CORE, "Tools/ParticleEditor/ParticleEditorExport.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/ParticleTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ParticleTypePanels.h", Game.CORE, "Tools/ParticleEditor/ParticleTypePanels.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/post-build-Release.bat", Game.CORE, "Tools/ParticleEditor/post-build-Release.bat") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/post-build.bat", Game.CORE, "Tools/ParticleEditor/post-build.bat") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/Resource.h", Game.CORE, "Tools/ParticleEditor/Resource.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ShaderTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/ShaderTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/ShaderTypePanels.h", Game.CORE, "Tools/ParticleEditor/ShaderTypePanels.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/StdAfx.cpp", Game.CORE, "Tools/ParticleEditor/StdAfx.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/StdAfx.h", Game.CORE, "Tools/ParticleEditor/StdAfx.h") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/VelocityTypePanels.cpp", Game.CORE, "Tools/ParticleEditor/VelocityTypePanels.cpp") + #unify_file(Game.ZEROHOUR, "Tools/ParticleEditor/VelocityTypePanels.h", Game.CORE, "Tools/ParticleEditor/VelocityTypePanels.h") + return