diff --git a/Core/GameEngine/Include/Common/GameDefines.h b/Core/GameEngine/Include/Common/GameDefines.h index d783c359c4c..be20d29c292 100644 --- a/Core/GameEngine/Include/Common/GameDefines.h +++ b/Core/GameEngine/Include/Common/GameDefines.h @@ -87,6 +87,10 @@ #define PRESERVE_RETAIL_SCRIPTED_CAMERA (1) // Retain scripted camera behavior present in retail Generals 1.08 and Zero Hour 1.04 #endif +#ifndef PRESERVE_RETAIL_PARTICLES +#define PRESERVE_RETAIL_PARTICLES (1) // Preserve original look of particles present in retail Generals 1.08 and Zero Hour 1.04 +#endif + #ifndef RETAIL_COMPATIBLE_CRC #define RETAIL_COMPATIBLE_CRC (1) // Game is expected to be CRC compatible with retail Generals 1.08, Zero Hour 1.04 #endif diff --git a/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp b/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp index 1a79b3c2b6d..4d6441d3855 100644 --- a/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp +++ b/Core/GameEngine/Source/GameClient/System/ParticleSys.cpp @@ -1190,6 +1190,15 @@ 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 @@ -3023,8 +3032,8 @@ void ParticleSystemManager::update() if (sys->isUsingDrawables()) continue; - // temporary hack that checks if texture name starts with "SMUD" - if so, we can assume it's a smudge type - if (/*sys->isUsingSmudge()*/ *((DWORD *)sys->getParticleTypeName().str()) == 0x44554D53) + // Handle smudge type particles + if (sys->isUsingSmudge()) { for (Particle *p = sys->getFirstParticle(); p; p = p->m_systemNext) { diff --git a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp index b1b792b3ac9..c2a1b9c6fc4 100644 --- a/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp +++ b/Core/GameEngineDevice/Source/W3DDevice/GameClient/W3DParticleSys.cpp @@ -156,31 +156,31 @@ void W3DParticleSystemManager::doParticles(RenderInfoClass &rinfo) if (sys->isUsingDrawables()) continue; - //temporary hack that checks if texture name starts with "SMUD" - if so, we can assume it's a smudge type - if (/*sys->isUsingSmudge()*/ *((DWORD *)sys->getParticleTypeName().str()) == 0x44554D53) + // Handle smudge type particles + if (sys->isUsingSmudge()) { - if (drawSmudge) + if (!drawSmudge) + continue; + + for (Particle *p = sys->getFirstParticle(); p; p = p->m_systemNext) { - for (Particle *p = sys->getFirstParticle(); p; p = p->m_systemNext) - { - const Coord3D *pos = p->getPosition(); - Real psize = p->getSize(); + const Coord3D *pos = p->getPosition(); + Real psize = p->getSize(); - //Cull particle to edges of screen and terrain. - if (WWMath::Fabs( pos->x - bcX ) > ( beX + psize ) ) - continue; + //Cull particle to edges of screen and terrain. + if (WWMath::Fabs( pos->x - bcX ) > ( beX + psize ) ) + continue; - if (WWMath::Fabs( pos->y - bcY ) > ( beY + psize ) ) - continue; + if (WWMath::Fabs( pos->y - bcY ) > ( beY + psize ) ) + continue; - if (WWMath::Fabs( pos->z - bcZ ) > ( beZ + psize ) ) - continue; + if (WWMath::Fabs( pos->z - bcZ ) > ( beZ + psize ) ) + continue; - if (Smudge *smudge = TheSmudgeManager->findSmudge(p)) - { - // The particle is in view. Draw the smudge! - smudge->m_draw = true; - } + if (Smudge *smudge = TheSmudgeManager->findSmudge(p)) + { + // The particle is in view. Draw the smudge! + smudge->m_draw = true; } } continue;