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(gameengine): load a mod's crates and fire held OCL timers

Olcay Seygan113e4c1e19d8
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2cfe68a02..2141a6fa9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -477,6 +477,7 @@ found and fixed, EA's own, not port damage.**
- A mod whose unit is switched on, held back or stripped by an upgrade the mod never defines no longer crashes the game as the map loads. The missing name is skipped and written to the log once, and the rest of the unit's upgrades work.
- A mod or an install folder carrying an older skirmish room screen, one without the match record panel, no longer crashes the game on the way into Skirmish. The room opens without the record and plays as before.
- A unit that leaves the factory already a veteran with Chemical Suits on no longer crashes the game (a player hit it under a mod). The suits went on before the unit had a body on screen to mark; such a unit now goes without the ground marking under it.
+- ShockWave's Supply Drop Zone pays again, +1500 a drop for every USA general. A mod's own crates (money, salvage, healing) load beside retail's.
## One interface
diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifest
index 42bf0fbd8..b083e2dea 100644
--- a/GeneralsMD/Code/BuildFingerprint.manifest
+++ b/GeneralsMD/Code/BuildFingerprint.manifest
@@ -506,6 +506,7 @@ Data/Scenarios/sentrydrone.txt
Data/Scenarios/shellpaths.txt
Data/Scenarios/shiftorders.txt
Data/Scenarios/shiftqueue.txt
+Data/Scenarios/shw_supplydrop.txt
Data/Scenarios/spectre_reaim.txt
Data/Scenarios/spectre_reshoot.txt
Data/Scenarios/squad30.txt
diff --git a/GeneralsMD/Code/Data/Scenarios/shw_supplydrop.txt b/GeneralsMD/Code/Data/Scenarios/shw_supplydrop.txt
new file mode 100644
index 000000000..bfed95818
--- /dev/null
+++ b/GeneralsMD/Code/Data/Scenarios/shw_supplydrop.txt
@@ -0,0 +1,12 @@
+# ShockWave's Supply Drop Zone pays out: each drop is six parachuted dummies that, on landing, make a
+# 250 money crate and a structure that collects it (the crate lives in the mod's Crate.ini).
+#
+# generals.exe -headless -quickstart -noshellmap -observer -multiInstance -noFPSLimit
+# -mod D:\zhr-mods-new\ShockWave\ -map "Maps\Alpine Assault\Alpine Assault.map" -autoskirmish 2
+# -takeover -side 0 M1~FactionAmerica -side 1 FactionGLA -seed 1 -maxframes 24000
+# -scenario shw_supplydrop -logPrefix shwdrop_
+#
+# The HEADLESS PLAYER line for slot 0 gives the money earned: +1500 a drop, the first about two and
+# a half minutes in, then one every two minutes.
+
+30 spawn 0 M1~AmericaSupplyDropZone 1 start0:250:0
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/INI.h b/GeneralsMD/Code/GameEngine/Include/Common/INI.h
index e53f7bb57..5761b276d 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/INI.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/INI.h
@@ -181,7 +181,7 @@ enum ModNameType
MODNAME_OBJECT, MODNAME_WEAPON, MODNAME_ARMOR, MODNAME_DAMAGEFX, MODNAME_UPGRADE, MODNAME_SCIENCE,
MODNAME_SPECIALPOWER, MODNAME_COMMANDSET, MODNAME_COMMANDBUTTON, MODNAME_FXLIST, MODNAME_OCL,
MODNAME_PARTICLESYSTEM, MODNAME_LOCOMOTOR, MODNAME_PLAYERTEMPLATE, MODNAME_MAPPEDIMAGE,
- MODNAME_AUDIOEVENT,
+ MODNAME_AUDIOEVENT, MODNAME_CRATE,
MODNAME_COUNT
};
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index bb18a595b..c47e371d8 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1294,7 +1294,7 @@ void GameEngine::init( int argc, char *argv[] )
ini.load( AsciiString( "Data\\INI\\AIDataReforged.ini" ), INI_LOAD_MULTIFILE, &xferCRC );
initSubsystem(TheGameLogic,"TheGameLogic", createGameLogic(), NULL);
initSubsystem(TheTeamFactory,"TheTeamFactory", MSGNEW("GameEngineSubsystem") TeamFactory(), NULL);
- initSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini");
+ initFactionSubsystem(TheCrateSystem,"TheCrateSystem", MSGNEW("GameEngineSubsystem") CrateSystem(), &xferCRC, "Data\\INI\\Default\\Crate.ini", "Data\\INI\\Crate.ini");
initSubsystem(ThePlayerList,"ThePlayerList", MSGNEW("GameEngineSubsystem") PlayerList(), NULL);
initSubsystem(TheRecorder,"TheRecorder", createRecorder(), NULL);
initSubsystem(TheRadar,"TheRadar", createRadar(), NULL);
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
index 2913c57d3..7b1bf8f34 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INI.cpp
@@ -537,7 +537,7 @@ const char *const ModNamespace::FactionFiles[] =
{
"Data\\INI\\Science.ini", "Data\\INI\\PlayerTemplate.ini", "Data\\INI\\FXList.ini", "Data\\INI\\Weapon.ini",
"Data\\INI\\ObjectCreationList.ini", "Data\\INI\\Locomotor.ini", "Data\\INI\\SpecialPower.ini",
- "Data\\INI\\DamageFX.ini", "Data\\INI\\Armor.ini", "Data\\INI\\Object", "Data\\INI\\Upgrade.ini",
+ "Data\\INI\\DamageFX.ini", "Data\\INI\\Armor.ini", "Data\\INI\\Object", "Data\\INI\\Crate.ini", "Data\\INI\\Upgrade.ini",
"Data\\INI\\CommandButton.ini", "Data\\INI\\CommandSet.ini", "Data\\INI\\ParticleSystem.ini",
"Data\\INI\\MappedImages", "Data\\INI\\Music.ini",
"Data\\INI\\SoundEffects.ini", "Data\\INI\\Speech.ini", "Data\\INI\\Voice.ini",
@@ -558,6 +558,7 @@ static const struct { const char *keyword; ModNameType type; } ModBlockTypes[] =
{ "Locomotor", MODNAME_LOCOMOTOR }, { "PlayerTemplate", MODNAME_PLAYERTEMPLATE },
{ "MappedImage", MODNAME_MAPPEDIMAGE },
{ "AudioEvent", MODNAME_AUDIOEVENT }, { "DialogEvent", MODNAME_AUDIOEVENT }, { "MusicTrack", MODNAME_AUDIOEVENT },
+ { "CrateData", MODNAME_CRATE },
};
void ModNamespace::scanMods( void )
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp
index 423b63b4d..242dd28f9 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/OCLUpdate.cpp
@@ -129,8 +129,10 @@ UpdateSleepTime OCLUpdate::update( void )
if( getObject()->isDisabled() )
{
// push the timer back, but only once it is running: 0 means "start the first delay", and
- // bumping it off 0 skipped that delay
- if( m_nextCreationFrame != 0 )
+ // bumping it off 0 skipped that delay. Something carried from birth (a crate in a parachute)
+ // keeps retail's bump and fires on its first free frame: ShockWave's supply crates are
+ // deleted two frames after they land, and a first delay there lost every drop's money.
+ if( m_nextCreationFrame != 0 || getObject()->isDisabledByType( DISABLED_HELD ) )
m_nextCreationFrame++;
return UPDATE_SLEEP_NONE;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp
index f47855576..df3114c16 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/CrateSystem.cpp
@@ -157,9 +157,9 @@ const CrateTemplate *CrateSystem::findCrateTemplate(AsciiString name) const
CrateTemplateOverride overridable(m_crateTemplateVector[i]);
return overridable;
}
-
- return NULL;
+ AsciiString retailName;
+ return TheModNamespace.findRetailName(name, MODNAME_CRATE, &retailName) ? findCrateTemplate(retailName) : NULL;
}
CrateTemplate *CrateSystem::friend_findCrateTemplate(AsciiString name)