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.

feat(gameengine): flares and hard-kill charges replace point defense lasers

Olcay Seygan1f4dfa3324b5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 38af39190..d23e9af23 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -56,6 +56,14 @@ found and fixed — EA's own, not port damage.**
- The Gattling cannon on an Overlord's back turns at the Gattling Tank's 180 degrees a second instead of 60 and opens fire the same way. A target appearing behind the Overlord is under fire 22 frames sooner and took 66 hits where it took 41.
- A replay recorded before this change plays back differently.
+## Flares and hard-kill charges instead of lasers
+
+- The Air Force General's King Raptor, Aurora, Stealth Fighter, B-3 and Chinooks carried a laser that burned every missile out of the air as it came near. They drop flares now. A Stinger fired at a King Raptor sees the flares leave its tail, turns onto one and burns out behind the plane. The flares come fitted from the factory with no upgrade to buy: three volleys, then six seconds to reload. Two King Raptors making seven passes over a Stinger Site took 180 and 150 damage of 480 in the two measured runs, where the lasers let through 150 and 270.
+- Flares cannot do everything the laser did. A Chinook sitting on the ground has no missile defence at all, an Aurora on its supersonic run is too fast to throw them, and no flare fools a SCUD or a Tomahawk, which the laser used to shoot down near these aircraft. Bought anyway, Countermeasures still gives the Air Force General's planes its armor.
+- The Paladin and the Avenger fire a small charge from the hull that bursts an incoming missile short of the tank. You see a puff and hear a bang at the hull, and the missile goes up in a blast. A Paladin holds two charges and reloads in four seconds, and each of the Avenger's two launchers holds four and reloads in three. Under five Tank Hunters an Avenger bursts 8 missiles where the laser stopped 14 or 16, but it dies on the same frame, because fifteen hits kill it either way. A Paladin under four Rocket Buggies stops 4 rockets of 36, as it did before.
+- The Paladin's laser also hit infantry that came within 65 of the tank. A second launcher with its own two charges does that now, so shooting at a soldier never leaves the tank without a charge for a missile. The blast throws a soldier where the laser burned him.
+- A replay recorded before this change plays back differently.
+
## Helicopters fly like helicopters
- Every helicopter in the game, on every side and for every general, used to drive like a tank with rotors. Told to go somewhere behind it, a Comanche swung its nose all the way round on the spot and only then flew off nose first. Now it flies where it is sent, backwards or sideways, with its nose left where it was. Sent 300 behind itself, a Comanche turned 178 degrees before it went and was 30 out after a second and a half; now it goes tail first, never turns, and is 30 out after one second. On a long flight the nose comes round into the direction of travel while the helicopter is already on its way.
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index 5074e69ec..c6346a695 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -58,6 +58,7 @@ Data/Scenarios/mappers.txt
Data/Scenarios/mass420x2.txt
Data/Scenarios/mass840.txt
Data/Scenarios/massmove.txt
+Data/Scenarios/missiledefence.txt
Data/Scenarios/mob100.txt
Data/Scenarios/mob250.txt
Data/Scenarios/mob400.txt
diff --git a/GeneralsMD/Code/Data/INI/BalanceReforged.ini b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
index 18cd5615a..2fe479840 100644
--- a/GeneralsMD/Code/Data/INI/BalanceReforged.ini
+++ b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
@@ -294,15 +294,6 @@ Object Tank_ChinaTankDragon
End
End
-; The Paladin's point defense laser shot down every Patriot missile: Paladins killed a Patriot four
-; times of four and lost 0.28 of its price, where Crusaders lost 1.35 and never killed it. Firing
-; every two seconds it still thins a volley, and the Patriot stands two times of four at 0.55.
-; Its duels do not move, the laser only meets missiles.
-
-Weapon PaladinPointDefenseLaser
- DelayBetweenShots = 2000 ; EA: 1000
-End
-
; The Rocket Buggy reached 300 and every defence but the Fire Base reaches 225, so buggies took any
; tower and lost nothing. At 250 and 275 that stayed true. At 225 the tower always won. At 235 the
; buggies still take a Patriot, a Gattling Cannon or a Bunker most of the time and lose 0.2 to 0.8
@@ -827,3 +818,285 @@ End
Locomotor ListeningOutpostLocomotor
Braking = 57
End
+
+; ---- missile defence: flares on the Air Force General's aircraft, a hard-kill charge on the tanks ---
+;
+; EA gave these units a point defense laser that ran all the time and burned down every missile it
+; reached. Measured with Scenarios/missiledefence.txt, seeds 7 and 8, before this change: two King
+; Raptors flying seven passes over a Stinger Site shot down 113 of 117 Stingers and took 150 and 270
+; damage of 480; an Avenger under five Tank Hunters shot down 14 and 16 of 29 and 30 missiles and
+; died on frame 261 and 265; a Paladin under four Rocket Buggies shot down 4 of 36 and died on frame
+; 376 and 380.
+;
+; The aircraft now drop flares instead. They are fitted from birth (StartsActive, no Countermeasures
+; upgrade needed), and a Stinger that rolls the evasion turns onto the newest flare and burns out
+; harmlessly. EA's upgrade decoys 30%; at 90%, with three volleys of four and a six second reload,
+; the King Raptors took 180 and 150 damage, about what the lasers let through. Flares only work in
+; the air, so a Chinook sitting on its pad has no missile defence at all; an Aurora on its supersonic
+; run gets none (Weapon.cpp skips a supersonic victim); and they do nothing against a SCUD or a
+; Tomahawk, which the lasers used to shoot down near these aircraft. A Countermeasures upgrade bought
+; by an Air Force General still brings its armor.
+
+Object AirF_AmericaJetRaptor
+ RemoveModule ModuleTag_22
+ RemoveModule ModuleTag_Laser_One
+ ReplaceModule ModuleTag_26
+ Behavior = CountermeasuresBehavior ModuleTag_26_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+Object Boss_JetRaptor
+ RemoveModule ModuleTag_22
+ AddModule
+ Behavior = CountermeasuresBehavior ModuleTag_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+Object AirF_AmericaJetAurora
+ RemoveModule ModuleTag_Laser_One
+ ReplaceModule ModuleTag_10
+ Behavior = CountermeasuresBehavior ModuleTag_10_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+Object AirF_AmericaJetStealthFighter
+ RemoveModule ModuleTag_Laser_One
+ ReplaceModule ModuleTag_10
+ Behavior = CountermeasuresBehavior ModuleTag_10_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+Object AirF_AmericaJetB3
+ RemoveModule ModuleTag_Laser_One
+ ReplaceModule ModuleTag_12
+ Behavior = CountermeasuresBehavior ModuleTag_12_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+Object AirF_AmericaVehicleChinook
+ RemoveModule ModuleTag_Laser_One
+ AddModule
+ Behavior = CountermeasuresBehavior ModuleTag_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+Object AFG_AmericaVehicleChinook
+ RemoveModule ModuleTag_Laser_One
+ AddModule
+ Behavior = CountermeasuresBehavior ModuleTag_Flares
+ StartsActive = Yes
+ FlareTemplateName = CountermeasureFlare
+ VolleySize = 4
+ VolleyArcAngle = 90.0
+ VolleyVelocityFactor = 2.0
+ DelayBetweenVolleys = 1000
+ NumberOfVolleys = 3
+ ReloadTime = 6000
+ EvasionRate = 90%
+ ReactionLaunchLatency = 100
+ MissileDecoyDelay = 200
+ End
+ End
+End
+
+; The Paladin and the Avenger fire a small charge from the hull instead, which bursts the missile
+; short of the tank: a puff and a bang at the hull, a blast at the missile. The weapons keep their
+; reach and the laser's damage, which a missile cannot survive, but they come in clips now. The
+; point defense module counts the clip itself (PointDefenseLaserUpdate), since it fires a fresh
+; copy of its weapon every shot. The Paladin's laser also burned down infantry that came within 65;
+; that is a second launcher on the same charge with its own clip, so a Tank Hunter's missile and the
+; Tank Hunter himself no longer share one gun. DeathType EXPLODED throws the infantry instead of
+; burning it.
+;
+; The Paladin's laser had already been slowed to one shot in two seconds, because at EA's one a
+; second it shot down every Patriot missile: Paladins killed a Patriot four times of four for 0.28
+; of its price. Two charges a quarter second apart and a four second reload is 0.47 shots a second
+; against the laser's 0.5, spent in a pair; the Patriot duel was not run again. The numbers after the
+; change are in Scenarios/missiledefence.txt: the flares let through about what the lasers did, the
+; Avenger bursts fewer missiles and dies on the same frame, the Paladin's two fights did not move.
+
+Weapon PaladinPointDefenseLaser
+ DelayBetweenShots = 250 ; EA: 1000
+ ClipSize = 2 ; EA: 0
+ ClipReloadTime = 4000
+ DeathType = EXPLODED
+ LaserName =
+ FireFX = FX_ActiveProtectionLaunch
+ ProjectileDetonationFX = FX_ActiveProtectionBlast
+End
+
+Weapon AvengerPointDefenseLaserOne
+ DelayBetweenShots = 250 ; EA: 500
+ ClipSize = 4 ; EA: 0
+ ClipReloadTime = 3000
+ DeathType = EXPLODED
+ LaserName =
+ FireFX = FX_ActiveProtectionLaunch
+ ProjectileDetonationFX = FX_ActiveProtectionBlast
+End
+
+Weapon AvengerPointDefenseLaserTwo
+ DelayBetweenShots = 250 ; EA: 500
+ ClipSize = 4 ; EA: 0
+ ClipReloadTime = 3000
+ DeathType = EXPLODED
+ LaserName =
+ FireFX = FX_ActiveProtectionLaunch
+ ProjectileDetonationFX = FX_ActiveProtectionBlast
+End
+
+Object AmericaTankPaladin
+ ReplaceModule ModuleTag_07
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Missiles
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = BALLISTIC_MISSILE SMALL_MISSILE
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+ AddModule
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Infantry
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = INFANTRY
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+End
+
+Object Boss_TankPaladin
+ ReplaceModule ModuleTag_07
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Missiles
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = BALLISTIC_MISSILE SMALL_MISSILE
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+ AddModule
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Infantry
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = INFANTRY
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+End
+
+Object Lazr_AmericaTankPaladin
+ ReplaceModule ModuleTag_07
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Missiles
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = BALLISTIC_MISSILE SMALL_MISSILE
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+ AddModule
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Infantry
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = INFANTRY
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+End
+
+Object SupW_AmericaTankPaladin
+ ReplaceModule ModuleTag_07
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Missiles
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = BALLISTIC_MISSILE SMALL_MISSILE
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+ AddModule
+ Behavior = PointDefenseLaserUpdate ModuleTag_07_Infantry
+ WeaponTemplate = PaladinPointDefenseLaser
+ PrimaryTargetTypes = INFANTRY
+ ScanRate = 500
+ ScanRange = 120.0
+ PredictTargetVelocityFactor = 3.0
+ End
+ End
+End
diff --git a/GeneralsMD/Code/Data/INI/FXListReforged.ini b/GeneralsMD/Code/Data/INI/FXListReforged.ini
index 2c1bba916..1a0cf7360 100644
--- a/GeneralsMD/Code/Data/INI/FXListReforged.ini
+++ b/GeneralsMD/Code/Data/INI/FXListReforged.ini
@@ -2608,6 +2608,50 @@ FXList SupW_FX_ParticleUplinkDeathInitial
End
End
+; ----------------------------------------------
+; The Paladin's and the Avenger's hard-kill charge leaving the hull (the weapon's FireFX). The tanks
+; have no bone for it, so it plays at the tank's own position and the offset lifts it to the deck.
+FXList FX_ActiveProtectionLaunch
+ Sound
+ Name = RangerFlashBangWeapon
+ End
+ ParticleSystem
+ Name = TankSmallMuzzleFlare
+ Offset = X:0 Y:0 Z:12
+ End
+ ParticleSystem
+ Name = MissileBackblastClouds
+ Offset = X:0 Y:0 Z:12
+ End
+ LightPulse
+ Color = R:255 G:200 B:140
+ Radius = 30
+ IncreaseTime = 0
+ DecreaseTime = 150
+ End
+End
+
+; ----------------------------------------------
+; The charge bursting at the missile, or at the infantryman the Paladin fires it at
+; (ProjectileDetonationFX, played by PointDefenseLaserUpdate where the target was).
+FXList FX_ActiveProtectionBlast
+ Sound
+ Name = ExplosionFlashBang
+ End
+ ParticleSystem
+ Name = BuggyMissileExplosion
+ End
+ ParticleSystem
+ Name = FlashBangNormalSpark
+ End
+ LightPulse
+ Color = R:255 G:190 B:120
+ Radius = 50
+ IncreaseTime = 0
+ DecreaseTime = 250
+ End
+End
+
; ----------------------------------------------
FXList WeaponFX_DemoSuicideDynamitePackDetonationPlusFire
Sound
diff --git a/GeneralsMD/Code/Data/Scenarios/missiledefence.txt b/GeneralsMD/Code/Data/Scenarios/missiledefence.txt
new file mode 100644
index 000000000..ef2515094
--- /dev/null
+++ b/GeneralsMD/Code/Data/Scenarios/missiledefence.txt
@@ -0,0 +1,73 @@
+# Missile defence, four fights at once, far enough apart not to meet: two King Raptors flying seven
+# passes over a Stinger Site, an Avenger under five Tank Hunters, a Paladin under four Rocket Buggies
+# and a Paladin rushed by six Terrorists.
+#
+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit
+# -map "Maps\Twilight Flame\Twilight Flame.map" -autoskirmish 2 -takeover
+# -side 0 FactionAmerica -side 1 FactionGLA -seed 7 -maxframes 2400
+# -scenario missiledefence -logPrefix missiledefence_
+#
+# Measured 2026-10-03, seeds 7 and 8, with a temporary log of every missile fired, every hit and
+# every missile shot down or decoyed, when the point defense lasers gave way to flares on the Air
+# Force General's aircraft and a hard-kill charge on the Paladin and the Avenger. Before, after:
+#
+# King Raptors: 54 and 63 Stingers, 53 and 60 shot down, 5 and 9 hits, 150 and 270 damage of 480,
+# one Raptor down on frame 2396 of seed 8. After: 54 and 54 Stingers, 48 and 49 turned onto a
+# flare, 6 and 5 hits, 180 and 150 damage, none down.
+# Avenger: 29 and 30 missiles, 14 and 16 shot down, dead on frame 261 and 265. After: 29 and 29,
+# 8 and 8 shot down (both clips go in the first volleys, the reload is still running when it
+# dies), dead on 261 and 261. Fifteen hits kill it either way.
+# Paladin and buggies: 36 rockets, 4 shot down, dead on 376 and 380. After: 36, 4, dead on 380
+# and 381. The buggies outrange it and it never reaches them.
+# Paladin and Terrorists: one Terrorist gets through and kills it, frame 378 and 397, the other
+# five left on 540 and 398 health of 600. After: frame 397 and 398, 380 and 422.
+#
+# Worth filming: flares come off a Raptor and Stingers turn onto them around 2620,3005 at about 95
+# high on frames 250 to 256 (seed 7); the Avenger at 2195,3906 bursts Tank Hunter missiles about 90
+# north of it on frames 150 to 190, and the Paladin at 3300,3800 a buggy rocket 60 north on 146.
+
+30 spawn 1 GLAStingerSite 1 2600 3000
+30 spawn 0 AirF_AmericaJetRaptor 2 1700 3000 40
+60 move 0 AirF_AmericaJetRaptor 3500 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 1700 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 3500 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 1700 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 3500 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 1700 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 3500 3000
+60 shiftmove 0 AirF_AmericaJetRaptor 1700 3000
+
+30 spawn 0 AmericaTankAvenger 1 2200 3900
+30 spawn 1 ChinaInfantryTankHunter 5 2200 4150 18
+60 attack 1 ChinaInfantryTankHunter 0 AmericaTankAvenger
+
+30 spawn 0 AmericaTankPaladin 1 3300 3800
+30 spawn 1 GLAVehicleRocketBuggy 4 3300 4100 30
+60 attackmove 1 GLAVehicleRocketBuggy 3300 3800
+
+30 spawn 0 AmericaTankPaladin 1 1100 3700
+30 spawn 1 GLAInfantryTerrorist 6 1100 3950 18
+60 attackmove 1 GLAInfantryTerrorist 1100 3700
+
+60 tally 0 AirF_AmericaJetRaptor
+60 tally 0 AmericaTankAvenger
+60 tally 0 AmericaTankPaladin
+600 tally 0 AirF_AmericaJetRaptor
+600 tally 0 AmericaTankAvenger
+600 tally 0 AmericaTankPaladin
+600 tally 1 GLAVehicleRocketBuggy
+600 tally 1 GLAInfantryTerrorist
+600 tally 1 ChinaInfantryTankHunter
+1200 tally 0 AirF_AmericaJetRaptor
+1200 tally 0 AmericaTankAvenger
+1200 tally 0 AmericaTankPaladin
+1200 tally 1 GLAVehicleRocketBuggy
+1200 tally 1 GLAInfantryTerrorist
+1200 tally 1 ChinaInfantryTankHunter
+2350 tally 0 AirF_AmericaJetRaptor
+2350 tally 0 AmericaTankAvenger
+2350 tally 0 AmericaTankPaladin
+2350 tally 1 GLAVehicleRocketBuggy
+2350 tally 1 GLAInfantryTerrorist
+2350 tally 1 ChinaInfantryTankHunter
+2350 tally 1 GLAStingerSite
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h
index fbc2b1eed..00280472d 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/CountermeasuresBehavior.h
@@ -61,9 +61,11 @@ public:
UnsignedInt m_missileDecoyFrames;
UnsignedInt m_countermeasureReactionFrames;
Bool m_mustReloadAtAirfield;
+ Bool m_startsActive; ///< fitted from birth: no upgrade, and no decoy on the ground where no flare can fly
CountermeasuresBehaviorModuleData()
{
+ m_startsActive = FALSE;
m_volleySize = 0;
m_volleyArcAngle = 0.0f;
m_framesBetweenVolleys = 0;
@@ -91,6 +93,7 @@ public:
{ "MustReloadAtAirfield", INI::parseBool, NULL, offsetof( CountermeasuresBehaviorModuleData, m_mustReloadAtAirfield ) },
{ "MissileDecoyDelay", INI::parseDurationUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_missileDecoyFrames ) },
{ "ReactionLaunchLatency", INI::parseDurationUnsignedInt, NULL, offsetof( CountermeasuresBehaviorModuleData, m_countermeasureReactionFrames ) },
+ { "StartsActive", INI::parseBool, NULL, offsetof( CountermeasuresBehaviorModuleData, m_startsActive ) },
{ 0, 0, 0, 0 }
};
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PointDefenseLaserUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PointDefenseLaserUpdate.h
index 64d28e1cb..c69148301 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PointDefenseLaserUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/PointDefenseLaserUpdate.h
@@ -86,6 +86,7 @@ protected:
Bool m_inRange;
Int m_nextScanFrames;
Int m_nextShotAvailableInFrames;
+ Int m_shotsFiredFromClip; ///< against the weapon's ClipSize; EA's point defense has none and never counts
};
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp
index a97c039a8..39907c89b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/CountermeasuresBehavior.cpp
@@ -97,7 +97,8 @@ CountermeasuresBehavior::CountermeasuresBehavior( Thing *thing, const ModuleData
m_divertedMissiles = 0;
m_incomingMissiles = 0;
m_nextVolleyFrame = 0;
-
+ m_reloadFrame = 0; // EA left it to the memory pool, whose reused blocks hold another object's bytes
+
setWakeFrame( getObject(), UPDATE_SLEEP_NONE );
}
@@ -118,11 +119,17 @@ void CountermeasuresBehavior::reportMissileForCountermeasures( Object *missile )
//Record the number of missiles that have been fired at us
m_incomingMissiles++;
+ const CountermeasuresBehaviorModuleData *data = getCountermeasuresBehaviorModuleData();
+
+ // Flares fitted from birth are flares and nothing else. EA's upgrade decoys a missile fired at a
+ // parked aircraft too, and with no flare in the air to turn onto it flies on and does no damage.
+ if( data->m_startsActive && !getObject()->isAirborneTarget() )
+ return;
+
if( m_availableCountermeasures + m_activeCountermeasures > 0 )
{
- //We have countermeasures we can use. Determine now whether or not the incoming missile will
+ //We have countermeasures we can use. Determine now whether or not the incoming missile will
//be diverted.
- const CountermeasuresBehaviorModuleData *data = getCountermeasuresBehaviorModuleData();
if( GameLogicRandomValueReal( 0.0f, 1.0f ) < data->m_evasionRate )
{
@@ -203,8 +210,8 @@ ObjectID CountermeasuresBehavior::calculateCountermeasureToDivertTo( const Objec
//-------------------------------------------------------------------------------------------------
Bool CountermeasuresBehavior::isActive() const
{
- return isUpgradeActive();
-}
+ return getCountermeasuresBehaviorModuleData()->m_startsActive || isUpgradeActive();
+}
//-------------------------------------------------------------------------------------------------
/** The update callback. */
@@ -219,7 +226,7 @@ UpdateSleepTime CountermeasuresBehavior::update( void )
{
return UPDATE_SLEEP_FOREVER;
}
- if( !isUpgradeActive() )
+ if( !isActive() )
{
return UPDATE_SLEEP_FOREVER;
}
@@ -266,6 +273,13 @@ UpdateSleepTime CountermeasuresBehavior::update( void )
}
}
}
+ else if( m_reactionFrame && m_reactionFrame <= now )
+ {
+ // The reaction came due on the ground and no flare went up. Left set, it would never match
+ // the clock again and would keep every later reaction from starting, so the aircraft would
+ // never fire another flare.
+ m_reactionFrame = 0;
+ }
//Handle auto-reloading (data->m_reloadFrames of zero means it's not possible to auto-reload).
//Aircraft that don't auto-reload require landing at an airfield for resupply.
@@ -376,13 +390,15 @@ void CountermeasuresBehavior::crc( Xfer *xfer )
//------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
- * 1: Initial version */
+ * 1: Initial version
+ * 2: the flares, their counts and the volley frames
+ * 3: the reload frame */
//------------------------------------------------------------------------------------------------
void CountermeasuresBehavior::xfer( Xfer *xfer )
{
// version
- XferVersion currentVersion = 2;
+ XferVersion currentVersion = 3;
XferVersion version = currentVersion;
xfer->xferVersion( &version, currentVersion );
@@ -403,6 +419,9 @@ void CountermeasuresBehavior::xfer( Xfer *xfer )
xfer->xferUnsignedInt( &m_nextVolleyFrame );
}
+ if( version >= 3 )
+ xfer->xferUnsignedInt( &m_reloadFrame );
+
} // end xfer
//------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp
index c35ebcc03..8e099d731 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PointDefenseLaserUpdate.cpp
@@ -38,6 +38,7 @@
#include "Common/Xfer.h"
#include "GameClient/Drawable.h"
+#include "GameClient/FXList.h"
#include "GameLogic/GameLogic.h"
#include "GameLogic/PartitionManager.h"
@@ -83,6 +84,7 @@ PointDefenseLaserUpdate::PointDefenseLaserUpdate( Thing *thing, const ModuleData
m_bestTargetID = INVALID_ID;
m_nextScanFrames = 0;
m_nextShotAvailableInFrames = 0;
+ m_shotsFiredFromClip = 0;
m_inRange = false;
setWakeFrame(getObject(), UPDATE_SLEEP_NONE);// No starting sleep, but we want to sleep later.
}
@@ -216,13 +218,25 @@ void PointDefenseLaserUpdate::fireWhenReady()
{
if( !target->isEffectivelyDead() )
{
+ // The shot lands where the target is now: a weapon with no laser and no projectile shows
+ // the hit with its ProjectileDetonationFX there, which nothing else would play.
+ Coord3D hitPos = *target->getPosition();
+
Weapon* w = TheWeaponStore->allocateNewWeapon( wt, TERTIARY_WEAPON );
w->loadAmmoNow( getObject() );
w->fireWeapon( getObject(), target );
w->deleteInstance();
- // And now that we have shot, set our internal reload timer.
+ FXList::doFXPos( wt->getProjectileDetonateFX( getObject()->getVeterancyLevel() ), &hitPos );
+
+ // And now that we have shot, set our internal reload timer. A weapon a fresh copy of is
+ // fired every time never empties its clip, so the clip is counted here.
m_nextShotAvailableInFrames = wt->getDelayBetweenShots( bonus );
+ if( wt->getClipSize() > 0 && ++m_shotsFiredFromClip >= wt->getClipSize() )
+ {
+ m_shotsFiredFromClip = 0;
+ m_nextShotAvailableInFrames = wt->getClipReloadTime( bonus );
+ }
}
if( target->isEffectivelyDead() )
@@ -385,13 +399,14 @@ void PointDefenseLaserUpdate::crc( Xfer *xfer )
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
- * 1: Initial version */
+ * 1: Initial version
+ * 2: shots fired from the clip */
// ------------------------------------------------------------------------------------------------
void PointDefenseLaserUpdate::xfer( Xfer *xfer )
{
// version
- XferVersion currentVersion = 1;
+ XferVersion currentVersion = 2;
XferVersion version = currentVersion;
xfer->xferVersion( &version, currentVersion );
@@ -410,6 +425,9 @@ void PointDefenseLaserUpdate::xfer( Xfer *xfer )
// next shot available in frames
xfer->xferInt( &m_nextShotAvailableInFrames );
+ if( version >= 2 )
+ xfer->xferInt( &m_shotsFiredFromClip );
+
} // end xfer
// ------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index ff6dd2f2a..585225f60 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -637,7 +637,8 @@ TEST(balance_patch_edits_a_weapon_in_place)
a regeneration that loses the LightPulse ships a file that lights nothing and still refuses
every player who does not have that exact copy. Since then the file also carries fixes that
are not lights: the Artillery Barrage's sound, with EA's own light, and the Superweapon uplink's
- pink death, which has none and is the one block the count leaves out. */
+ pink death, which has none and is the one block the count leaves out. The Paladin's and the
+ Avenger's hard-kill charge added two of the fork's own, its launch and its blast, lit too. */
static const char *const s_unlitReforgedFXList = "FXList SupW_FX_ParticleUplinkDeathInitial";
TEST(fxlist_reforged_ini_parses_and_keeps_its_light)
@@ -686,7 +687,7 @@ TEST(fxlist_reforged_ini_parses_and_keeps_its_light)
}
fclose( fp );
- CHECK_EQ( blocks, 90 );
+ CHECK_EQ( blocks, 92 );
CHECK_EQ( lit, blocks );
}