Skip to content

Commit 68e17c0

Browse files
committed
unify(particlesys): Merge optimization for wind motion particle update when disabled from Zero Hour (TheSuperHackers#2153)
1 parent 13cce53 commit 68e17c0

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Generals/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ Bool Particle::update( void )
413413
m_pos.z += m_vel.z + driftVel->z;
414414

415415
// integrate the wind (if specified) into position
416-
doWindMotion();
416+
ParticleSystemInfo::WindMotion windMotion = m_system->getWindMotion();
417+
418+
// see if we should even do anything
419+
if( windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED )
420+
doWindMotion();
417421

418422
// update orientation
419423
#if PARTICLE_USE_XY_ROTATION
@@ -548,11 +552,6 @@ Bool Particle::update( void )
548552
// ------------------------------------------------------------------------------------------------
549553
void Particle::doWindMotion( void )
550554
{
551-
ParticleSystemInfo::WindMotion windMotion = m_system->getWindMotion();
552-
553-
// see if we should even do anything
554-
if( windMotion == ParticleSystemInfo::WIND_MOTION_NOT_USED )
555-
return;
556555

557556
// get the angle of the wind
558557
Real windAngle = m_system->getWindAngle();
@@ -622,7 +621,7 @@ void Particle::doWindMotion( void )
622621
windForceStrength *= (1.0f - ((distFromWind - fullForceDistance) /
623622
(noForceDistance - fullForceDistance)));
624623

625-
// integate the wind motion into the position
624+
// integrate the wind motion into the position
626625
m_pos.x += (Cos( windAngle ) * windForceStrength);
627626
m_pos.y += (Sin( windAngle ) * windForceStrength);
628627

@@ -1954,7 +1953,8 @@ Bool ParticleSystem::update( Int localPlayerIndex )
19541953
}
19551954

19561955
// update the wind motion
1957-
updateWindMotion();
1956+
if (m_windMotion != ParticleSystemInfo::WIND_MOTION_NOT_USED )
1957+
updateWindMotion();
19581958

19591959
// if this system is attached to a Drawable/Object, update the current transform
19601960
// matrix so generated particles' are relative to the parent Drawable's

0 commit comments

Comments
 (0)