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(gameengine): play the supplies depleted voice once a match
Olcay Seygan67e8fc4c45dc
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 356b715a0..d130be312 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -431,6 +431,7 @@ found and fixed — EA's own, not port damage.**- That bar is now the work itself. A worker used to reset it to empty at the very moment it finished and then walk away, so every trip looked like it left mid-handover; and after taking its last box it stood at the pile for one more full loading cycle, taking nothing. It leaves the instant the load is done - which is a little more money per trip, on every worker you own.- A worker loads in one go instead of a box at a time. It used to take one, wait a loading cycle, take the next, wait again, and the bar over its head restarted for each of them; now the whole load changes hands once and the wait is that load's worth of time - four boxes cost what four boxes always cost, in one stretch rather than four. Money in the bank is unchanged, which is the point: three headless matches on the same seeds came back within a few percent of what they earned before.- Supply points refill themselves, slowly, and faster the more of a base has grown around them. A warehouse used to be a fixed lump of money that ran out and left the map with nothing to fight over: whoever mined out the middle first had the game, and the second half of every match was played on income neither side could earn any more. Six hundred dollars comes back every forty seconds standing on its own, every twenty with one supply centre built near it, every thirteen with two - up to what the point started with, never past it. A single box was too little to be worth the trip: a hundred dollars every forty seconds is less than the harvester earns going to fetch it, so a mined-out point stayed mined out as far as anybody playing was concerned. Both sides expanding onto the same patch make it richer and then have to decide which of them keeps it.+- Your workers tell you a supply point has run dry once a match. With piles refilling, they ran dry again and again, and every time the same worker said so.- Workers stop hesitating on their way in and out. A dock has a queue outside it and a worker treated its place in that queue as a destination: it drove to the spot, stopped dead, waited a frame, drove to the door, stopped again, and only then went in - twice a load, and nearly every load with nothing else queued. With the dock empty it drives straight in. The first version of that also skipped the walk to a supply pile or a GLA stash, which have no door of their own, so a worker a long way off played its loading animation where it stood and was paid anyway. In a four-player test match 72 loads were picked up or dropped off away from the dock, one of them 613 feet from it; now there are none.- Hackers show how far off the next payout is. So do the black market and the oil derricks.- A hacker working from inside an Internet Center shows what it earns. The green figure floats over the building on every payout, the way it does over one sitting in the field. It never appeared, because the game asked the hacker whether it could be seen and a garrisoned unit is not drawn at all - which is the one place a hacker is meant to work.diff --git a/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h b/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.hindex 55b5dcec4..06f2a888f 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/ResourceGatheringManager.h@@ -56,6 +56,8 @@ public:void addSupplyWarehouse( Object *newWarehouse ); ///< Warehouse created, or this is starrt of game recordingvoid removeSupplyWarehouse( Object *oldWarehouse ); ///< Warehouse that doesn't replinish has run out of Supply+ Bool claimSuppliesDepletedVoice(); ///< TRUE only the first time a gatherer asks, so the depleted voice plays once a game+protected:Object *findBestSupplyCenterInList(Object *queryObject);@@ -73,6 +75,9 @@ private:objectIDList m_supplyWarehouses;objectIDList m_supplyCenters;+ // Audio only: left out of crc, and xfer so a save format stays unchanged; a loaded game may play it once more.+ Bool m_suppliesDepletedVoicePlayed;+};#endifdiff --git a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cppindex c375a2f51..97db65d9f 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/RTS/ResourceGatheringManager.cpp@@ -41,10 +41,20 @@#include "GameLogic/Module/SupplyWarehouseDockUpdate.h"#include "GameLogic/Module/UpdateModule.h"-ResourceGatheringManager::ResourceGatheringManager()+ResourceGatheringManager::ResourceGatheringManager() :+ m_suppliesDepletedVoicePlayed( FALSE ){}+Bool ResourceGatheringManager::claimSuppliesDepletedVoice()+{+ if( m_suppliesDepletedVoicePlayed )+ return FALSE;++ m_suppliesDepletedVoicePlayed = TRUE;+ return TRUE;+}+ResourceGatheringManager::~ResourceGatheringManager(){m_supplyWarehouses.erase( m_supplyWarehouses.begin(), m_supplyWarehouses.end() );diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cppindex 9658d2567..958a53a41 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/SupplyTruckAIUpdate.cpp@@ -181,7 +181,8 @@ Bool SupplyTruckAIUpdate::gainOneBox( Int remainingStock )elseplayDepleted = TRUE;- if (playDepleted && m_suppliesDepletedVoice.getEventName().isEmpty() == false)+ if (playDepleted && m_suppliesDepletedVoice.getEventName().isEmpty() == false+ && getObject()->getControllingPlayer()->getResourceGatheringManager()->claimSuppliesDepletedVoice()){m_suppliesDepletedVoice.setObjectID(getObject()->getID());m_suppliesDepletedVoice.setPlayingHandle(TheAudio->addAudioEvent(&m_suppliesDepletedVoice));diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cppindex 7eed5907b..0fdf04bfa 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/WorkerAIUpdate.cpp@@ -1147,7 +1147,8 @@ Bool WorkerAIUpdate::gainOneBox( Int remainingStock )elseplayDepleted = TRUE;- if (playDepleted && m_suppliesDepletedVoice.getEventName().isEmpty() == false)+ if (playDepleted && m_suppliesDepletedVoice.getEventName().isEmpty() == false+ && getObject()->getControllingPlayer()->getResourceGatheringManager()->claimSuppliesDepletedVoice()){m_suppliesDepletedVoice.setObjectID(getObject()->getID());m_suppliesDepletedVoice.setPlayingHandle(TheAudio->addAudioEvent(&m_suppliesDepletedVoice));