Skip to content

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.

fix(gamelogic): side weapons no longer reset a shared weapon reload

Olcay Seygan7aa42c54d401
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36c295ef2..ef7c30673 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,6 +47,7 @@ found and fixed — EA's own, not port damage.**
- Contra's units have their attack move, guard and stop buttons again, and A, G and S press them. Contra draws its command bar with eighteen buttons and keeps those three in the last row, which our fourteen-button bar does not have, so they went missing on every Contra unit, the Cybernetic general's cyborgs among them. A button a mod puts past the end of our bar now moves to an empty one, the three orders to the places Zero Hour gives them.
- Contra's cyborgs no longer stand on black squares. Their little ground shadow is drawn the way Zero Hour draws it again, darkening the ground by the shape painted in the picture, so it comes out as a soft patch under the feet. We had been reading the shape from the picture's transparency instead, and Contra's shadow picture has none: it filled its whole square. Zero Hour's own shadows look as they did.
- A computer opponent on ShockWave's Armor, Special Weapons or Salvage general plays on every map now. Those are the three generals ShockWave adds to Zero Hour's nine, and Shockwave Chaos renames two of them the Scumbag Artillery and Bandana generals. A map made before they existed, every one Zero Hour ships among them, has no computer player for them, so the seat started with no AI at all: its base sat idle, and clicking it with nothing selected handed it to you, which is how a player found himself running the enemy's base. The seat now takes the mod's skirmish AI for that general and builds like any other; on Tournament Desert it had three buildings up in forty seconds where it used to have none.
+- ShockWave's EMP Patriot fires its missiles again. ShockWave switched on a short-range field around the battery that EA had left commented out, and every time the field pulsed, every 0.75 seconds, the battery's missiles had to wait their turn again from the start. The turret kept tracking its target and nothing left the rails: a lone EMP Patriot fired 0 missiles in 6 seconds at rocket soldiers 200 away, where Zero Hour's fires 12. The field now keeps its own clock, so the battery fires 12 like Zero Hour's and the field still pulses. ShockWave's Superweapon Humvee, its Reaper tank and its Salvage SA-2 site carried the same pairing.
- A `-mod` path with `.` or `..` in it is refused. An archive counts as your mod's only when it was loaded for that mod. Two mods under `-modfactions` that define a command set with the same name both load now, and the later one wins.
## One interface
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
index 91e392ceb..9f836b1cd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Weapon.cpp
@@ -2195,8 +2195,8 @@ void Weapon::reloadWithBonus(const Object *sourceObj, const WeaponBonus& bonus,
// go through other weapons in weapon set
// set their m_whenWeCanFireAgain to this guy's delay
// set their m_status to this guy's status
- if (sourceObj->isReloadTimeShared())
- {
+ if (sourceObj->isReloadTimeShared() && sourceObj->getWeaponInWeaponSlot( m_wslot ) == this) // a weapon of the set, as in privateFireWeapon
+ {
for (Int wt = 0; wt<WEAPONSLOT_COUNT; wt++)
{
Weapon *weapon = sourceObj->getWeaponInWeaponSlot((WeaponSlotType)wt);
@@ -2998,9 +2998,11 @@ Bool Weapon::privateFireWeapon(
// go through other weapons in weapon set
// set their m_whenWeCanFireAgain to this guy's delay
// set their m_status to this guy's status
+ // Only a weapon of the set itself: a FireWeaponUpdate gun is not one, and ShockWave's EMP Patriot
+ // emitter firing every 750 ms held the battery's missiles in their wait for good.
- if ( sourceObj->isReloadTimeShared() )
- {
+ if ( sourceObj->isReloadTimeShared() && sourceObj->getWeaponInWeaponSlot( m_wslot ) == this )
+ {
for (Int wt = 0; wt<WEAPONSLOT_COUNT; wt++)
{
Weapon *weapon = sourceObj->getWeaponInWeaponSlot((WeaponSlotType)wt);