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(turkiye): kargu drone base superweapon

Olcay Seygane0d30e5d99ef
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3120bce25..bb6211052 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -145,6 +145,7 @@ found and fixed — EA's own, not port damage.**
- The Korkut is air defense and nothing else. Its cannons reach 350 into the air and no longer fire at the ground, where they used to outrange the Altay; three Korkut that cut down eight Rangers without a scratch now lose to them, and still shoot down three Comanches untouched. The Kizilelma's missiles hit the ground as well as the air, and it costs 1800 instead of 2200. It carried 380 health on a Raptor's frame and shot a Raptor down in 29 seconds while the Raptor needed 86 for it; at the Raptor's 160 the duel is even and the dearer jet loses on price. The Akinci drops its own bomb, one a sortie; it had been dropping the Aurora's. With 420 health no ground air defense paid for itself against it. At 200 a Gattling Tank or a Missile Defender beats it for the money and a Quad Cannon breaks even.
- Every Turkish unit has its own command bar with only buttons that work: no drone buttons on the Altay and the Cobra, no TOW on the Cobra, no rocket pods on the Bayraktar, no flash-bang switch on the Mehmetcik. The Barracks sells Capture Building, so the Mehmetcik's capture button works.
- Turkiye's first rank buys its own power, a Minefield a cargo plane sows wherever you point, beside the Spy Drone and Fuel Resupply, which keeps the drones over the target longer. Rank 3 offers a loitering munition that dives on whatever it is pointed at, Electronic Blinding, which shuts every enemy radar in the area off for 30 seconds, and Rapid Deployment, six Mehmetcik and two Sungur gunners by parachute. The top rank buys the Swarm Strike: ten munitions over a wide circle, each on a different target and the most expensive first, so a column of tanks loses its tanks and the riflemen walking beside them are left standing. Beside it sit the Fire Mission, 36 heavy shells from off the map, and the Commando Raid, a Maroon Beret and two spotter teams dropped behind the enemy's lines. The American Paradrop, Leaflet Drop, Spectre gunship and CIA intelligence are gone from the Headquarters and the power bar.
+- Turkiye has a superweapon: the Kargu Drone Base. It costs 5000, draws 10 power, opens once you have a Factory and a Radar Tower, counts against the lobby's superweapon limit like the Particle Cannon, the nuke and the Scud Storm, and every player watches its five-minute countdown. Fire it and twelve kamikaze drones lift off the hangar's roof, fly across the map where everyone can see them coming and split up over the target circle, each one diving into one of the twelve most expensive things inside it for 700. With fewer targets than drones the spares go round again, dearest first. Fired across Twilight Flame into an American base, it killed four of eight Crusaders and three of six Humvees and took a third off the Command Center, the War Factory and both power plants. The Turkish computer builds and fires it on every difficulty: Hard as soon as it can pay, about fifteen minutes in on that map, Medium after seventeen minutes and Easy after thirty, the same clock America's plans keep for their Particle Cannon. The building is the Particle Cannon on loan and the announcer calls it a Scud Storm until Turkiye has art and voices of its own.
- Two engineers on one building put it up in half the time, three in a third.
- The Koral electronic warfare vehicle jams everything within 400 of it. Enemy drones and spotters inside the field go nearly blind, and guided missiles fired into it lose their lock and fly wide.
- The Maroon Beret is a hero against every side. He is camouflaged, sees 350 for the artillery from inside the camouflage, and carries Burton's knife and timed and remote charges. He no longer hijacks supply trucks, which used him up for good and found nothing to take from America.
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index 48589592b..d5fc1e7ea 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -252,7 +252,9 @@ Data/Scenarios/explreel.txt
Data/Scenarios/firelook.txt
Data/Scenarios/fogleak.txt
Data/Scenarios/geproto_alpine.txt
+Data/Scenarios/geproto_fogedge.txt
Data/Scenarios/geproto_glow.txt
+Data/Scenarios/geproto_hazefog.txt
Data/Scenarios/geproto_hazemove.txt
Data/Scenarios/geproto_oasis.txt
Data/Scenarios/givemoney.txt
@@ -288,6 +290,7 @@ Data/Scenarios/jetpass.txt
Data/Scenarios/jetrunway.txt
Data/Scenarios/jetsturn.txt
Data/Scenarios/jetturn.txt
+Data/Scenarios/kargu.txt
Data/Scenarios/laserglow.txt
Data/Scenarios/laserlook.txt
Data/Scenarios/leadinfantry.txt
diff --git a/GeneralsMD/Code/Data/INI/CommandSetReforged.ini b/GeneralsMD/Code/Data/INI/CommandSetReforged.ini
index 15c9cff56..b6bfc9b17 100644
--- a/GeneralsMD/Code/Data/INI/CommandSetReforged.ini
+++ b/GeneralsMD/Code/Data/INI/CommandSetReforged.ini
@@ -916,6 +916,41 @@ CommandButton Command_TurkiyeCommandoRaidFromShortcut
InvalidCursorName = GenericInvalid
End
+; The Kargu base, Turkiye's superweapon, and its swarm: the uplink's cameo for the building, the
+; Hellfire drone's for the swarm.
+
+CommandButton Command_ConstructTurkiyeKarguBase
+ Command = DOZER_CONSTRUCT
+ Object = TurkiyeKarguBase
+ TextLabel = CONTROLBAR:ConstructTurkiyeKarguBase
+ ButtonImage = SAUplink
+ ButtonBorderType = BUILD
+ DescriptLabel = CONTROLBAR:ToolTipTurkiyeKarguBase
+End
+
+CommandButton Command_TurkiyeKarguSwarm
+ Command = SPECIAL_POWER
+ SpecialPower = SuperweaponTurkiyeKarguSwarm
+ Options = NEED_TARGET_POS CONTEXTMODE_COMMAND
+ TextLabel = CONTROLBAR:TurkiyeKarguSwarm
+ ButtonImage = SAHellfire
+ ButtonBorderType = ACTION
+ DescriptLabel = CONTROLBAR:TooltipTurkiyeKarguSwarm
+ RadiusCursorType = DAISYCUTTER
+ InvalidCursorName = GenericInvalid
+End
+
+CommandButton Command_TurkiyeKarguSwarmFromShortcut
+ Command = SPECIAL_POWER_FROM_SHORTCUT
+ SpecialPower = SuperweaponTurkiyeKarguSwarm
+ Options = NEED_TARGET_POS CONTEXTMODE_COMMAND
+ TextLabel = CONTROLBAR:TurkiyeKarguSwarm
+ ButtonImage = SAHellfire
+ DescriptLabel = CONTROLBAR:TooltipTurkiyeKarguSwarm
+ RadiusCursorType = DAISYCUTTER
+ InvalidCursorName = GenericInvalid
+End
+
CommandSet TurkiyeDozerCommandSet
1 = Command_ConstructTurkiyePowerPlant
2 = Command_ConstructTurkiyeBarracks
@@ -926,6 +961,7 @@ CommandSet TurkiyeDozerCommandSet
7 = Command_ConstructTurkiyePatriotBattery
8 = Command_ConstructTurkiyeCommandCenter
9 = Command_ConstructTurkiyeSiper
+ 11 = Command_ConstructTurkiyeKarguBase
14 = Command_DisarmMinesAtPosition
End
@@ -941,6 +977,7 @@ CommandSet TurkiyeDozerCommandSetMines
8 = Command_ConstructTurkiyeCommandCenter
9 = Command_ConstructTurkiyeSiper
10 = Command_ConstructTurkiyeLandMine
+ 11 = Command_ConstructTurkiyeKarguBase
14 = Command_DisarmMinesAtPosition
End
@@ -948,6 +985,11 @@ CommandSet TurkiyeStructureCommandSet
14 = Command_Sell
End
+CommandSet TurkiyeKarguBaseCommandSet
+ 1 = Command_TurkiyeKarguSwarm
+ 14 = Command_Sell
+End
+
CommandSet TurkiyeSiperCommandSet
1 = Command_BunkerExit
2 = Command_BunkerExit
@@ -1109,4 +1151,5 @@ CommandSet SpecialPowerShortcutTurkiye
6 = Command_TurkiyeSwarmStrikeFromShortcut
7 = Command_TurkiyeFireMissionFromShortcut
8 = Command_TurkiyeCommandoRaidFromShortcut
+ 9 = Command_TurkiyeKarguSwarmFromShortcut
End
diff --git a/GeneralsMD/Code/Data/INI/SpecialPowerReforged.ini b/GeneralsMD/Code/Data/INI/SpecialPowerReforged.ini
index e45e60e3b..233f94201 100644
--- a/GeneralsMD/Code/Data/INI/SpecialPowerReforged.ini
+++ b/GeneralsMD/Code/Data/INI/SpecialPowerReforged.ini
@@ -139,3 +139,22 @@ SpecialPower SuperweaponTurkiyeCommandoRaid
AcademyClassify = ACT_SUPERPOWER
AIFiresWhenReady = Yes
End
+
+; The Kargu base's swarm (TurkiyeReforged.ini), Turkiye's superweapon. Five minutes, the Scud
+; Storm's clock, between the Particle Cannon's four and the nuke's six, and the Scud Storm's enum,
+; so every player hears the superweapon announcements. The siren sounds where it is aimed, since the
+; drones take about fifteen seconds to cross a map. The skirmish scripts know no such power; the AI
+; fires it when it is ready (AIPlayer::doReadySpecialPowers).
+
+SpecialPower SuperweaponTurkiyeKarguSwarm
+ Enum = SPECIAL_SCUD_STORM
+ ReloadTime = 300000
+ InitiateAtLocationSound = AirRaidSiren
+ PublicTimer = Yes
+ ViewObjectDuration = 30000
+ ViewObjectRange = 350
+ RadiusCursorRadius = 350
+ ShortcutPower = Yes
+ AcademyClassify = ACT_SUPERPOWER
+ AIFiresWhenReady = Yes
+End
diff --git a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini b/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini
index 55efe68c6..f32045bb3 100644
--- a/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini
+++ b/GeneralsMD/Code/Data/INI/TurkiyeReforged.ini
@@ -231,6 +231,40 @@ Object TurkiyeRadarTower
End
End
+; The Kargu base, Turkiye's superweapon: a hangar whose swarm of kamikaze drones flies out to the
+; twelve dearest targets in a wide circle and dives into them, each drone a projectile from the
+; building to its target (TurkiyeKarguDrone, TurkiyeKarguDroneWeapon). With fewer than twelve
+; targets in the circle the spare drones go round them again, dearest first. The Particle Cannon
+; lends it the body, price, power draw, superweapon limit and public countdown; its beam and the
+; ability that drives it go. Turkiye has no Strategy Center, so the Factory and a Radar Tower open
+; it: an Easy computer, on America's Easy plan, never builds an Airfield. The power's enum is the
+; Scud Storm's, the nearest EVA has: the announcements say Scud Storm until Turkiye has voices of
+; its own.
+
+ObjectReskin TurkiyeKarguBase AmericaParticleCannonUplink
+End
+
+Object TurkiyeKarguBase
+ Side = Turkiye
+ DisplayName = OBJECT:TurkiyeKarguBase
+ CommandSet = TurkiyeKarguBaseCommandSet
+ Prerequisites
+ Object = TurkiyeWarFactory
+ Object = TurkiyeRadarTower
+ End
+ RemoveModule ModuleTag_11
+ RemoveModule ModuleTag_12
+ AddModule
+ Behavior = SwarmStrikeSpecialPower ModuleTag_TurkiyeKarguSwarm
+ SpecialPowerTemplate = SuperweaponTurkiyeKarguSwarm
+ Radius = 350
+ TargetCount = 12
+ RepeatTargets = Yes
+ Weapon = TurkiyeKarguDroneWeapon
+ End
+ End
+End
+
; The engineers' mine, open once the Barracks has researched the Mine Kit.
ObjectReskin TurkiyeLandMine GLADemoTrap
@@ -1100,6 +1134,40 @@ Object TurkiyeClusterMine
Side = Turkiye
End
+; The Kargu base's drone: the Tomahawk missile, which cruises at 120 and dives on its target, drawn
+; as the Hellfire drone. Its fuel lasts 30 seconds rather than 4, enough to cross a large map.
+; The Tomahawk names no side, so a Firtina's missile stays a missile (ThingFactory::newObject).
+
+ObjectReskin TurkiyeKarguDrone TomahawkMissile
+End
+
+Object TurkiyeKarguDrone
+ ReplaceModule ModuleTag_01
+ Draw = W3DModelDraw ModuleTag_01_Turkiye
+ OkToChangeModelColor = Yes
+ DefaultConditionState
+ Model = AVHellDrone
+ End
+ ConditionState = JAMMED
+ ParticleSysBone = None SparksMedium
+ End
+ End
+ End
+ ReplaceModule ModuleTag_07
+ Behavior = MissileAIUpdate ModuleTag_07_Turkiye
+ TryToFollowTarget = Yes
+ FuelLifetime = 30000
+ IgnitionDelay = 0
+ IgnitionFX = FX_TomahawkIgnition
+ InitialVelocity = 50
+ DistanceToTravelBeforeTurning = 80
+ DistanceToTargetBeforeDiving = 100
+ DistanceToTargetForLock = 10
+ End
+ Locomotor = SET_NORMAL TomahawkMissileLocomotor
+ End
+End
+
; The Reinforcement Pad picks its convoy by the owner's side and had none for Turkiye. It sends
; Turkiye the plain American one, which arrives as Turkiye units through newObject.
diff --git a/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini b/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini
index 58bd791af..450c9555d 100644
--- a/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini
+++ b/GeneralsMD/Code/Data/INI/TurkiyeWeaponReforged.ini
@@ -837,6 +837,31 @@ Weapon TurkiyeSwarmStrikeWeapon
AntiAirborneInfantry = No
End
+; The Kargu base's drone, one per target (TurkiyeKarguBase). Unlike the rank tree's munitions it is a
+; projectile: it leaves the hangar, flies the whole way at cruise height and dives on its target,
+; so it can be seen coming and shot down on the way. 700 kills any tank but the Overlord and
+; the Emperor, and twelve of them are the Scud Storm's nine missiles spread over a wider circle.
+Weapon TurkiyeKarguDroneWeapon
+ PrimaryDamage = 700.0
+ PrimaryDamageRadius = 20.0
+ SecondaryDamage = 150.0
+ SecondaryDamageRadius = 50.0
+ AttackRange = 99999.0
+ DamageType = EXPLOSION
+ DeathType = EXPLODED
+ WeaponSpeed = 99999
+ FireFX = FX_TomahawkIgnition
+ FireSound = TomahawkWeapon
+ ProjectileObject = TurkiyeKarguDrone
+ ProjectileExhaust = MissileExhaust
+ ProjectileDetonationFX = WeaponFX_BombTruckDefaultBombDetonation
+ ; NOT_SIMILAR: a drone's blast took the swarm's drones beside it out of the air
+ RadiusDamageAffects = ALLIES ENEMIES NEUTRALS NOT_SIMILAR
+ ClipSize = 0
+ AntiAirborneVehicle = No
+ AntiAirborneInfantry = No
+End
+
; RaptorJetMissileWeapon: Raptor missile out to 280, at aircraft and at the ground, so the
; Kizilelma is a strike fighter and not a 2200 interceptor beside four other air defenses
Weapon TurkiyeKizilelmaMissile
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 831c6b77e..1383c0f97 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -3132,3 +3132,27 @@ END
CONTROLBAR:TooltipTurkiyeCommandoRaid
"Commando Raid \n Recharge: 5:00"
END
+
+OBJECT:TurkiyeKarguBase
+"Kargu Drone Base"
+END
+
+CONTROLBAR:ConstructTurkiyeKarguBase
+"&Kargu Drone Base"
+END
+
+CONTROLBAR:ToolTipTurkiyeKarguBase
+"Sends a swarm of twelve kamikaze drones anywhere on the map. Each one hunts down one of the most valuable targets in the circle and dives into it; spread-out armies suffer most. \n \n Requires: Factory, Radar Tower \n Energy Required: 10 \n Recharge: 5:00"
+END
+
+CONTROLBAR:TurkiyeKarguSwarm
+"&Kargu Swarm"
+END
+
+CONTROLBAR:TooltipTurkiyeKarguSwarm
+"Kargu Swarm \n Recharge: 5:00"
+END
+
+GUI:SuperweaponTurkiyeKarguSwarm
+"Kargu Swarm"
+END
diff --git a/GeneralsMD/Code/Data/Scenarios/kargu.txt b/GeneralsMD/Code/Data/Scenarios/kargu.txt
new file mode 100644
index 000000000..b285ca8e0
--- /dev/null
+++ b/GeneralsMD/Code/Data/Scenarios/kargu.txt
@@ -0,0 +1,36 @@
+# Turkiye's Kargu base fired across Twilight Flame into an American base: a War Factory, two power
+# plants and the command centre, eight Crusaders and six Humvees spread around them. The swarm is
+# called at frame 60; the twelve drones leave the hangar's roof and cross the 1400 to the base in
+# about eight seconds. Compare the tallies at frame 50 and frame 340, after the last hit and before
+# the American buildings heal, and read the SWARM lines for the targets the drones were sent at.
+# The drones themselves are tallied on the way.
+#
+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit
+# -map "Maps\Twilight Flame\Twilight Flame.map" -autoskirmish 2 -takeover
+# -side 0 FactionTurkiye -side 1 FactionAmerica -seed 1 -maxframes 800 -scenario kargu
+# -logPrefix kargu_
+
+10 spawn 0 TurkiyeKarguBase 1 start0:0:250
+10 spawn 0 TurkiyePowerPlant 3 start0:-260:40 90
+
+20 spawn 1 AmericaWarFactory 1 start1:0:260
+20 spawn 1 AmericaPowerPlant 2 start1:-240:-200 120
+20 spawn 1 AmericaTankCrusader 8 start1:-300:150 60
+20 spawn 1 AmericaVehicleHumvee 6 start1:300:-150 80
+
+50 tally 1 AmericaWarFactory
+50 tally 1 AmericaPowerPlant
+50 tally 1 AmericaCommandCenter
+50 tally 1 AmericaTankCrusader
+50 tally 1 AmericaVehicleHumvee
+50 tally 1 *
+60 power 0 TurkiyeKarguBase start1
+100 tally 0 TurkiyeKarguDrone
+200 tally 0 TurkiyeKarguDrone
+340 tally 0 TurkiyeKarguDrone
+340 tally 1 AmericaWarFactory
+340 tally 1 AmericaPowerPlant
+340 tally 1 AmericaCommandCenter
+340 tally 1 AmericaTankCrusader
+340 tally 1 AmericaVehicleHumvee
+340 tally 1 *
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 379da425c..6de8d42d2 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -17429,3 +17429,27 @@ END
CONTROLBAR:TooltipTurkiyeCommandoRaid
"Komando Baskını \n Geri Sayım: 5:00"
END
+
+OBJECT:TurkiyeKarguBase
+"Kargu İHA Üssü"
+END
+
+CONTROLBAR:ConstructTurkiyeKarguBase
+"Kar&gu İHA Üssü"
+END
+
+CONTROLBAR:ToolTipTurkiyeKarguBase
+"Haritanın herhangi bir yerine on iki kamikaze İHA'dan oluşan bir sürü gönderir. Her biri dairedeki en değerli hedeflerden birini bulur ve üstüne dalar; dağınık ordular en çok zarar görür. \n \n Gereken: Fabrika, Radar Kulesi \n Gereken Enerji: 10 \n Geri Sayım: 5:00"
+END
+
+CONTROLBAR:TurkiyeKarguSwarm
+"&Kargu Sürüsü"
+END
+
+CONTROLBAR:TooltipTurkiyeKarguSwarm
+"Kargu Sürüsü \n Geri Sayım: 5:00"
+END
+
+GUI:SuperweaponTurkiyeKarguSwarm
+"Kargu Sürüsü"
+END
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SwarmStrikeSpecialPower.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SwarmStrikeSpecialPower.h
index 83d612ab4..3728da030 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SwarmStrikeSpecialPower.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/SwarmStrikeSpecialPower.h
@@ -19,7 +19,8 @@
// FILE: SwarmStrikeSpecialPower.h ///////////////////////////////////////////////////////////////
//
// Turkiye's loitering munitions: within Radius of the click, the TargetCount most expensive enemies
-// on the ground each take one Weapon shot, and TargetFX plays on each of them.
+// on the ground each take one Weapon shot, and TargetFX plays on each of them. With RepeatTargets
+// all TargetCount shots go: round the targets again, dearest first, or at the click with none.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -44,6 +45,7 @@ public:
Real m_radius;
Int m_targetCount;
+ Bool m_repeatTargets;
const WeaponTemplate *m_weapon;
const FXList *m_targetFX;
};
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
index 5e2055229..acb342cf7 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPlayer.cpp
@@ -7647,15 +7647,38 @@ void AIPlayer::buildAsap( const ThingTemplate *tmpl )
* lobby's superweapon setting and Pro Rules still bind beside it; canMakeUnit asks all three.
* If the tech building it needs is missing, that goes up first, and copies follow once the first
* superweapon is standing, up to AI_TECH_BUILDING_COPIES, so one of them blowing up leaves the tree
- * standing. Hard only, like the rest of the economy. */
+ * standing. Hard only, like the rest of the economy, except for a side whose scripts cannot build its
+ * superweapon (planNamesSuperweapon): Easy and Medium put that one up here too, as late as the scripts
+ * put up America's uplink. */
//----------------------------------------------------------------------------------------------------------
+/** The scripts build a superweapon only through the side's build list (buildSpecificAIBuilding), so a
+ * plan that names none, Turkiye's, which runs America's scripts and has no uplink, never gets one
+ * from them. The request buildAsap puts down is a build list entry of its own, so Easy and Medium
+ * ask for one, as the scripts' once-only line does for America. */
+static Bool planNamesSuperweapon( Player *player )
+{
+ for( BuildListInfo *info = player->getBuildList(); info; info = info->getNext() )
+ {
+ const ThingTemplate *tmpl = TheThingFactory->findTemplate( info->getTemplateName() );
+ if( tmpl && tmpl->isKindOf( KINDOF_FS_SUPERWEAPON ) )
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/** Easy's and Medium's first superweapon when the scripts cannot build it: America's scripts ask for
+ * the uplink at escalation 180 and 100, a point every ten seconds. */
+static const UnsignedInt SCRIPTLESS_SUPERWEAPON_FRAMES[ AISKILL_COUNT ] =
+ { 1800 * LOGICFRAMES_PER_SECOND, 1000 * LOGICFRAMES_PER_SECOND, 0 };
+
void AIPlayer::doSuperweapons( void )
{
- if( !getSkillProfile()->m_economyBuildings )
- return;
const Int phase = computeUpdatePhase( m_player->getPlayerIndex(), SUPERWEAPON_CHECK_RATE );
if( (TheGameLogic->getFrame() + phase) % SUPERWEAPON_CHECK_RATE != 0 )
return;
+ if( !getSkillProfile()->m_economyBuildings &&
+ ( TheGameLogic->getFrame() < SCRIPTLESS_SUPERWEAPON_FRAMES[ m_skillLevel ] || planNamesSuperweapon( m_player ) ) )
+ return;
if( !m_player->getCanBuildBase() || !m_baseCenterSet || !m_player->getEnergy()->hasSufficientPower() )
return; // a dark base's superweapon clock is stopped anyway; the money goes to the plant
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SwarmStrikeSpecialPower.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SwarmStrikeSpecialPower.cpp
index 71212c018..6058d51bb 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SwarmStrikeSpecialPower.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/SpecialPower/SwarmStrikeSpecialPower.cpp
@@ -28,6 +28,7 @@
#include "Common/ThingTemplate.h"
#include "Common/Xfer.h"
#include "GameClient/FXList.h"
+#include "GameLogic/GameLogic.h"
#include "GameLogic/Object.h"
#include "GameLogic/Weapon.h"
#include "GameLogic/Module/SwarmStrikeSpecialPower.h"
@@ -37,6 +38,7 @@ SwarmStrikeSpecialPowerModuleData::SwarmStrikeSpecialPowerModuleData( void )
{
m_radius = 0.0f;
m_targetCount = 1;
+ m_repeatTargets = FALSE;
m_weapon = NULL;
m_targetFX = NULL;
}
@@ -50,6 +52,7 @@ SwarmStrikeSpecialPowerModuleData::SwarmStrikeSpecialPowerModuleData( void )
{
{ "Radius", INI::parseReal, NULL, offsetof( SwarmStrikeSpecialPowerModuleData, m_radius ) },
{ "TargetCount", INI::parseInt, NULL, offsetof( SwarmStrikeSpecialPowerModuleData, m_targetCount ) },
+ { "RepeatTargets", INI::parseBool, NULL, offsetof( SwarmStrikeSpecialPowerModuleData, m_repeatTargets ) },
{ "Weapon", INI::parseWeaponTemplate, NULL, offsetof( SwarmStrikeSpecialPowerModuleData, m_weapon ) },
{ "TargetFX", INI::parseFXList, NULL, offsetof( SwarmStrikeSpecialPowerModuleData, m_targetFX ) },
{ 0, 0, 0, 0 }
@@ -68,6 +71,30 @@ SwarmStrikeSpecialPower::~SwarmStrikeSpecialPower( void )
{
}
+// ------------------------------------------------------------------------------------------------
+/** One shot, at the target or else at the point. A projectile is made at the shooter's foot when its
+ * model has no launch bone, and a drone made at the foot of a building met the ground the frame it
+ * left, so it starts from the roof. */
+// ------------------------------------------------------------------------------------------------
+static void fireShot( const WeaponTemplate *weapon, const Object *source, Object *target, const Coord3D *pos )
+{
+ Weapon *w = TheWeaponStore->allocateNewWeapon( weapon, PRIMARY_WEAPON );
+ w->loadAmmoNow( source );
+ ObjectID projectileID = INVALID_ID;
+ if( target )
+ w->fireWeapon( source, target, &projectileID );
+ else
+ w->fireWeapon( source, pos, &projectileID );
+ w->deleteInstance();
+
+ Object *projectile = TheGameLogic->findObjectByID( projectileID );
+ if( projectile == NULL )
+ return; // a hit with no projectile, the rank tree's munitions
+ Coord3D roof = *projectile->getPosition();
+ roof.z += source->getGeometryInfo().getMaxHeightAbovePosition();
+ projectile->setPosition( &roof );
+}
+
// ------------------------------------------------------------------------------------------------
void SwarmStrikeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real angle, UnsignedInt commandOptions )
{
@@ -84,8 +111,17 @@ void SwarmStrikeSpecialPower::doSpecialPowerAtLocation( const Coord3D *loc, Real
{
DEBUG_LOG(( "SWARM '%s' picks '%s' %d\n", getPowerName().str(), (*it)->getTemplate()->getName().str(), (*it)->getID() ));
FXList::doFXPos( data->m_targetFX, (*it)->getPosition() );
- TheWeaponStore->createAndFireTempWeapon( data->m_weapon, getObject(), *it );
+ fireShot( data->m_weapon, getObject(), *it, NULL );
}
+
+ if( !data->m_repeatTargets )
+ return;
+
+ // the spare shots: round the same targets again, dearest first, or at the click when none stood there
+ for( Int shot = (Int)targets.size(); shot < data->m_targetCount; ++shot )
+ fireShot( data->m_weapon, getObject(), targets.empty() ? NULL : targets[ shot % targets.size() ], loc );
+ DEBUG_LOG(( "SWARM '%s' frame %d sends %d at %d targets around (%.0f,%.0f)\n", getPowerName().str(),
+ TheGameLogic->getFrame(), data->m_targetCount, (Int)targets.size(), loc->x, loc->y ));
}
// ------------------------------------------------------------------------------------------------