Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.
C++ cmakecnccommand-and-conquercppdirectx11game-enginegame-preservationgeneralsrtssage-enginex64zero-hour
fix(gamelogic): the Battle Bus second life and multiple death modules
Olcay Seyganfd44c68ac9a4
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cppindex fa7829e5a..90edfd5f3 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/InstantDeathBehavior.cpp@@ -125,15 +125,6 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )if (!isDieApplicable(damageInfo))return;- AIUpdateInterface* ai = getObject()->getAIUpdateInterface();- if (ai)- {- // has another AI already handled us. (hopefully another InstantDeathBehavior)- if (ai->isAiInDeadState())- return;- ai->markAsDead();- }-const InstantDeathBehaviorModuleData* d = getInstantDeathBehaviorModuleData();Int idx, listSize;@@ -175,6 +166,20 @@ void InstantDeathBehavior::onDie( const DamageInfo *damageInfo )}}+ /* The dead-state check used to be the first thing this function did, which meant the first+ InstantDeathBehavior to run claimed the object and every other one on it was skipped. Every+ other death module - FXListDie, CreateObjectDie, FireWeaponWhenDeadBehavior - already lets you+ have several. Asking here instead lets each of them do its own effect, and still leaves only+ one of them destroying the object. */+ AIUpdateInterface* ai = getObject()->getAIUpdateInterface();+ if (ai)+ {+ // has another AI already handled us. (hopefully another InstantDeathBehavior)+ if (ai->isAiInDeadState())+ return;+ ai->markAsDead();+ }+TheGameLogic->destroyObject(getObject());}diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cppindex aca3d6ef4..cf5af0d6f 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/UndeadBody.cpp@@ -79,9 +79,13 @@ void UndeadBody::attemptDamage( DamageInfo *damageInfo )// remaining, then go ahead and take it.Bool shouldStartSecondLife = FALSE;- if( damageInfo->in.m_damageType != DAMAGE_UNRESISTABLE+ /* Whether this hit is lethal has to be asked of the damage that will actually land, not of the+ number the weapon carries. Armour, damage type multipliers and the veterancy bonus all sit+ between the two, so a Battle Bus took its second life off shots that its armour would have+ shrugged off, and survived ones that were going to kill it. */+ if( damageInfo->in.m_damageType != DAMAGE_UNRESISTABLE&& !m_isSecondLife- && damageInfo->in.m_amount >= getHealth()+ && estimateDamage( damageInfo->in ) >= getHealth()&& IsHealthDamagingDamage(damageInfo->in.m_damageType)){