diff --git a/Core/GameEngine/Include/GameClient/ParticleSys.h b/Core/GameEngine/Include/GameClient/ParticleSys.h index acd504f6838..93d1232efb8 100644 --- a/Core/GameEngine/Include/GameClient/ParticleSys.h +++ b/Core/GameEngine/Include/GameClient/ParticleSys.h @@ -508,6 +508,10 @@ class ParticleSystemTemplate : public MemoryPoolObject, protected ParticleSystem { MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE( ParticleSystemTemplate, "ParticleSystemTemplatePool" ) +#if PRESERVE_RETAIL_PARTICLES + friend INI; +#endif + public: ParticleSystemTemplate( const AsciiString &name ); @@ -606,7 +610,7 @@ class ParticleSystem : public MemoryPoolObject, Bool isUsingDrawables() { return (m_particleType == DRAWABLE) ? true : false; } Bool isUsingStreak() { return (m_particleType == STREAK) ? true : false; } Bool isUsingSmudge() { return (m_particleType == SMUDGE) ? true : false; } - UnsignedInt getVolumeParticleDepth() { return ( m_particleType == VOLUME_PARTICLE ) ? OPTIMUM_VOLUME_PARTICLE_DEPTH : 0; } + UnsignedInt getVolumeParticleDepth() { return ( m_particleType == VOLUME_PARTICLE ) ? m_volumeParticleDepth : DEFAULT_VOLUME_PARTICLE_DEPTH; } Bool shouldBillboard() { return !m_isGroundAligned; } diff --git a/Core/GameEngine/Source/Common/INI/INIParticleSys.cpp b/Core/GameEngine/Source/Common/INI/INIParticleSys.cpp index fd0b84d5182..e4bc891ee6b 100644 --- a/Core/GameEngine/Source/Common/INI/INIParticleSys.cpp +++ b/Core/GameEngine/Source/Common/INI/INIParticleSys.cpp @@ -54,4 +54,19 @@ void INI::parseParticleSystemDefinition( INI* ini ) // parse the ini definition ini->initFromINI( sysTemplate, sysTemplate->getFieldParse() ); + +#if PRESERVE_RETAIL_PARTICLES + // TheSuperHackers @info Hack to allow isUsingSmudge() functionality with retail smudge particles + // The retail data template for smudge particles is not correctly configured with the smudge particle type + if (sysTemplate->m_particleType != ParticleSystemInfo::SMUDGE && sysTemplate->m_particleTypeName.startsWithNoCase("SMUDGE.")) + { + sysTemplate->m_particleType = ParticleSystemInfo::SMUDGE; + } + + // In retail, volume particle depth was not setup through ini and was hard coded to a particle depth of 6 + if (sysTemplate->m_particleType == ParticleSystemInfo::VOLUME_PARTICLE && sysTemplate->m_volumeParticleDepth == DEFAULT_VOLUME_PARTICLE_DEPTH) + { + sysTemplate->m_volumeParticleDepth = OPTIMUM_VOLUME_PARTICLE_DEPTH; + } +#endif } diff --git a/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp index 4d6441d3855..05b6e95d199 100644 --- a/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -1095,7 +1095,7 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, ///@todo: further formalize this parameter with an UnsignedInt field in the editor - m_volumeParticleDepth = DEFAULT_VOLUME_PARTICLE_DEPTH; + m_volumeParticleDepth = sysTemplate->m_volumeParticleDepth; m_driftVelocity = sysTemplate->m_driftVelocity; @@ -1190,15 +1190,6 @@ ParticleSystem::ParticleSystem( const ParticleSystemTemplate *sysTemplate, m_particleType = sysTemplate->m_particleType; m_particleTypeName = sysTemplate->m_particleTypeName; -#if PRESERVE_RETAIL_PARTICLES - // TheSuperHackers @info Hack to allow isUsingSmudge() functionality with retail smudge particles - // The retail data template for smudge particles is not correctly configured with the smudge particle type - if (m_particleType != ParticleType::SMUDGE && m_particleTypeName.startsWithNoCase("SMUDGE.")) - { - m_particleType = ParticleType::SMUDGE; - } -#endif - m_isStopped = false; // set up slave particle system, if any @@ -2698,6 +2689,9 @@ const FieldParse ParticleSystemTemplate::m_fieldParseTable[] = { "SizeRate", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRate ) }, { "SizeRateDamping", INI::parseGameClientRandomVariable, nullptr, offsetof( ParticleSystemTemplate, m_sizeRateDamping ) }, + // TheSuperHackers @feature Volume particle depth is now exposed for configuration + { "VolParticleDepth", INI::parseUnsignedInt, nullptr, offsetof(ParticleSystemTemplate, m_volumeParticleDepth) }, + { "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] ) }, diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp index d10dff653a1..8bb3f96537e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/ScriptEngine/ScriptEngine.cpp @@ -9725,6 +9725,7 @@ static const std::string F_SIZE = "Size"; static const std::string F_STARTSIZERATE ="StartSizeRate"; static const std::string F_SIZERATE = "SizeRate"; static const std::string F_SIZERATEDAMP = "SizeRateDamping"; +static const std::string F_VOLPARTICLEDEPTH = "VolParticleDepth"; static const std::string F_ALPHA1 = "Alpha1"; static const std::string F_ALPHA2 = "Alpha2"; @@ -9887,6 +9888,9 @@ void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ ) sprintf(buff2, FORMAT_STRING, templ->m_sizeRateDamping.getMaximumValue()); thisEntry.append(SEP_HEAD).append(F_SIZERATEDAMP).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL); + sprintf(buff1, "%d", templ->m_volumeParticleDepth); + thisEntry.append(SEP_HEAD).append(F_VOLPARTICLEDEPTH).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL); + sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[0].var.getMinimumValue()); sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[0].var.getMaximumValue()); sprintf(buff3, "%d", templ->m_alphaKey[0].frame);