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(gamelogic): hold a stopped hacker, six xp per hacking payout

Olcay Seygan98b215b3275c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 60d666d90..44d188e14 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1133,7 +1133,8 @@ A third pass went through the generals' powers, promotions and unit abilities.
- Workers leave other players' supply piles alone. A truck whose pile ran dry went to the nearest pile it could reach, and that was often the one next to a neighbour's supply centre, where it either stood in his queue or stood idle beside the pile with nowhere of its own to carry the boxes. A pile now belongs to whoever has the closest supply centre beside it, and your trucks, Chinooks and workers only pick their own or a free one. The computer counts those piles out too, so it no longer buys trucks for a neighbour's supplies. Across two 4v4 matches on Twilight Flame, trucks were sent to someone else's pile 109 times; now none are, and the money mined stayed within about one percent. A truck you send to a pile yourself still goes where you sent it.
- The white bar over a building's health bar means one of two things: a factory working through its queue, or a superweapon charging. Oil derricks, the black market, supply drop zones, hackers and workers carried one too, each on a money clock nobody can hurry, and a base full of them buried the two bars worth reading. They wear only their health bar now.
- A hacker already at work stays at work when you tell a group of hackers to hack. It used to fold its laptop away and set it up again, and the payout it was halfway to started over from nothing. One that is packing up takes the order and unpacks again. Replays recorded before this change play out differently.
-- A hacker you leave standing goes to work by itself. After ten seconds with no order it walks into your nearest Internet Center with a free seat, if one is close by, or else opens its laptop where it stands. Any order you give starts the ten seconds over. The computer's hackers already did this. Replays recorded before this change play out differently.
+- A hacker you leave standing goes to work by itself. After ten seconds with no order it walks into your nearest Internet Center with a free seat, if one is close by, or else opens its laptop where it stands. Any order you give starts the ten seconds over, and one you stop, or call out of a building, stays put until you give it another. The computer's hackers already did this.
+- A hacker earns six times the experience per payout it used to. On the long rank ladder EA's rate never got a hacker to Heroic in a whole match; now it gets there in about the 17 minutes it took in the original game. Replays recorded before this change play out differently.
- 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.
- Factories take a hundred units in the queue, not nine. The build queue only ever had nine buttons and that had become the limit.
- A match can pay everyone a wage. `MoneyPerMinute` in `GameData.ini` drops the same sum into every
diff --git a/GeneralsMD/Code/Data/INI/BalanceReforged.ini b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
index fde62f6c0..71bf6ad91 100644
--- a/GeneralsMD/Code/Data/INI/BalanceReforged.ini
+++ b/GeneralsMD/Code/Data/INI/BalanceReforged.ini
@@ -2585,11 +2585,30 @@ End
; ---- a player's idle hacker goes to work -------------------------------------------------------
;
; A hacker left standing ten seconds goes into the nearest own Internet Center with a seat within
-; 150, or else starts hacking where it stands. Any order starts the ten seconds over. The computer
-; already does this for its own (AIPlayer's putToHacking), so the module skips every non-human
-; player.
+; 150, or else starts hacking where it stands. Any order starts the ten seconds over, and a stop or
+; an exit the player ordered keeps it standing until his next order. The computer already does this
+; for its own (AIPlayer's putToHacking), so the module skips every non-human player.
+;
+; Hacking pays 6 experience a payout instead of EA's 1. On the fork's rank ladder EA's 1 left a
+; hacker short of Heroic for the whole match; 6 puts it back near retail's 17 minutes. Every other
+; HackInternetAIUpdate field is EA's, the delay inside an Internet Center differing per general as
+; it does in EA's data. No Locomotor line: a replaced AIUpdate keeps the object's sets.
Object ChinaInfantryHacker
+ ReplaceModule ModuleTag_03
+ Behavior = HackInternetAIUpdate ModuleTag_03_Reforged
+ UnpackTime = 7300
+ PackTime = 5133
+ CashUpdateDelay = 2000
+ CashUpdateDelayFast = 1800
+ RegularCashAmount = 5
+ VeteranCashAmount = 6
+ EliteCashAmount = 8
+ HeroicCashAmount = 10
+ XpPerCashUpdate = 6
+ PackUnpackVariationFactor = 0.5
+ End
+ End
AddModule
Behavior = IdleHackerUpdate ModuleTag_IdleHacker
IdleTime = 10000
@@ -2599,6 +2618,20 @@ Object ChinaInfantryHacker
End
Object Tank_ChinaInfantryHacker
+ ReplaceModule ModuleTag_03
+ Behavior = HackInternetAIUpdate ModuleTag_03_Reforged
+ UnpackTime = 7300
+ PackTime = 5133
+ CashUpdateDelay = 2000
+ CashUpdateDelayFast = 1800
+ RegularCashAmount = 5
+ VeteranCashAmount = 6
+ EliteCashAmount = 8
+ HeroicCashAmount = 10
+ XpPerCashUpdate = 6
+ PackUnpackVariationFactor = 0.5
+ End
+ End
AddModule
Behavior = IdleHackerUpdate ModuleTag_IdleHacker
IdleTime = 10000
@@ -2608,6 +2641,20 @@ Object Tank_ChinaInfantryHacker
End
Object Infa_ChinaInfantryHacker
+ ReplaceModule ModuleTag_03
+ Behavior = HackInternetAIUpdate ModuleTag_03_Reforged
+ UnpackTime = 7300
+ PackTime = 5133
+ CashUpdateDelay = 2000
+ CashUpdateDelayFast = 1600
+ RegularCashAmount = 5
+ VeteranCashAmount = 6
+ EliteCashAmount = 8
+ HeroicCashAmount = 10
+ XpPerCashUpdate = 6
+ PackUnpackVariationFactor = 0.5
+ End
+ End
AddModule
Behavior = IdleHackerUpdate ModuleTag_IdleHacker
IdleTime = 10000
@@ -2617,6 +2664,20 @@ Object Infa_ChinaInfantryHacker
End
Object Nuke_ChinaInfantryHacker
+ ReplaceModule ModuleTag_03
+ Behavior = HackInternetAIUpdate ModuleTag_03_Reforged
+ UnpackTime = 7300
+ PackTime = 5133
+ CashUpdateDelay = 2000
+ CashUpdateDelayFast = 1800
+ RegularCashAmount = 5
+ VeteranCashAmount = 6
+ EliteCashAmount = 8
+ HeroicCashAmount = 10
+ XpPerCashUpdate = 6
+ PackUnpackVariationFactor = 0.5
+ End
+ End
AddModule
Behavior = IdleHackerUpdate ModuleTag_IdleHacker
IdleTime = 10000
@@ -2626,6 +2687,20 @@ Object Nuke_ChinaInfantryHacker
End
Object Boss_InfantryHacker
+ ReplaceModule ModuleTag_03
+ Behavior = HackInternetAIUpdate ModuleTag_03_Reforged
+ UnpackTime = 7300
+ PackTime = 5133
+ CashUpdateDelay = 2000
+ CashUpdateDelayFast = 1500
+ RegularCashAmount = 5
+ VeteranCashAmount = 6
+ EliteCashAmount = 8
+ HeroicCashAmount = 10
+ XpPerCashUpdate = 6
+ PackUnpackVariationFactor = 0.5
+ End
+ End
AddModule
Behavior = IdleHackerUpdate ModuleTag_IdleHacker
IdleTime = 10000
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h
index 3743b4f33..8351ffe99 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/HackInternetAIUpdate.h
@@ -185,6 +185,7 @@ class HackInternetAIInterface
public:
virtual Bool isHacking() const = 0;
virtual Bool isHackingPackingOrUnpacking() const = 0;
+ virtual Bool isHeldByPlayer() const = 0; ///< the player's last order was a stop or an exit
};
//-------------------------------------------------------------------------------------------------
@@ -221,6 +222,7 @@ public:
virtual Bool isHacking() const;
virtual Bool isHackingPackingOrUnpacking() const;
+ virtual Bool isHeldByPlayer() const { return m_heldByPlayer; }
protected:
@@ -228,6 +230,7 @@ protected:
AICommandParmsStorage m_pendingCommand;
Bool m_hasPendingCommand;
+ Bool m_heldByPlayer; ///< stopped or called out of a building by the player; IdleHackerUpdate leaves it be
};
#endif
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/IdleHackerUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/IdleHackerUpdate.h
index 178b3fb29..d139f9c6c 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/IdleHackerUpdate.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/IdleHackerUpdate.h
@@ -20,8 +20,9 @@
//
// A human player's hacker left standing for IdleTime goes into the nearest own Internet Center with
// a free seat within CenterRange, or else starts hacking where it stands. Any order resets the
-// clock, since it leaves the hacker busy for at least one frame. The computer's hackers are put to
-// work by AIPlayer (putToHacking), so this one leaves them alone.
+// clock, since it leaves the hacker busy for at least one frame. A stop or an exit the player
+// ordered holds it until his next order (HackInternetAIUpdate::isHeldByPlayer). The computer's
+// hackers are put to work by AIPlayer (putToHacking), so this one leaves them alone.
//
///////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScenarioDrill.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScenarioDrill.h
index 925dd7f8b..f98ee7fea 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/ScenarioDrill.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/ScenarioDrill.h
@@ -95,7 +95,8 @@ enum ScenarioActionType
SCENARIO_ACTION_GUARD, ///< guard <slot> <selector> <targetSlot> <targetSelector>; a guard order on one object, as a script gives it
SCENARIO_ACTION_REPEAT, ///< repeat <slot> <building> <template> on|off; the Ctrl+Alt build key, as MSG_SET_REPEAT_UNIT onto the message stream
SCENARIO_ACTION_RANK, ///< rank <slot> <selector> veteran|elite|heroic|xp N|grade N; a level as the rank cheat sets it (a ladder's pin), N same-class kills of experience, or a ladder grade
- SCENARIO_ACTION_GIVEMONEY ///< givemoney <slot> <targetSlot> <amount>; the Tab screen's Send, as MSG_TRANSFER_MONEY onto the message stream
+ SCENARIO_ACTION_GIVEMONEY, ///< givemoney <slot> <targetSlot> <amount>; the Tab screen's Send, as MSG_TRANSFER_MONEY onto the message stream
+ SCENARIO_ACTION_CLICKSTOP ///< clickstop <slot> <selector>; the Stop key, the group idle MSG_DO_STOP gives (CMD_FROM_PLAYER)
};
/// ScenarioAction::atStart when the position is plain numbers
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
index d9dc1d331..744004aa9 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/AIUpdate/HackInternetAIUpdate.cpp
@@ -64,6 +64,7 @@ AIStateMachine* HackInternetAIUpdate::makeStateMachine()
HackInternetAIUpdate::HackInternetAIUpdate( Thing *thing, const ModuleData* moduleData ) : AIUpdateInterface( thing, moduleData )
{
m_hasPendingCommand = false;
+ m_heldByPlayer = false;
}
//-------------------------------------------------------------------------------------------------
@@ -133,6 +134,15 @@ void HackInternetAIUpdate::aiDoCommand(const AICommandParms* parms)
if (!isAllowedToRespondToAiCommands(parms))
return;
+ // A player who stops a hacker or calls it out of a building means it to stand there, so the idle
+ // hacker's automatic hacking waits for his next order. The AI's own orders, the exit's walk out of
+ // the door among them, change nothing.
+ if( parms->m_cmdSource == CMD_FROM_PLAYER &&
+ ( parms->m_cmd == AICMD_IDLE || parms->m_cmd == AICMD_EXIT || parms->m_cmd == AICMD_EXIT_INSTANTLY ) )
+ m_heldByPlayer = true;
+ else if( parms->m_cmdSource != CMD_FROM_AI )
+ m_heldByPlayer = false;
+
// A hacker already at work, or unpacking to start, ignores a repeat hack order. Without this a
// hack order given to a selection with one idle hacker in it packed up every busy one and
// started it again from nothing. A hacker packing up still takes it, which cancels the pack.
@@ -211,18 +221,20 @@ void HackInternetAIUpdate::crc( Xfer *xfer )
{
// extend base class
AIUpdateInterface::crc(xfer);
+ xfer->xferBool(&m_heldByPlayer);
} // end crc
// ------------------------------------------------------------------------------------------------
/** Xfer method
* Version Info:
* 1: Initial version
- * 2: the pending command keeps its source */
+ * 2: the pending command keeps its source
+ * 3: held by the player */
// ------------------------------------------------------------------------------------------------
void HackInternetAIUpdate::xfer( Xfer *xfer )
{
// version
- XferVersion currentVersion = 2;
+ XferVersion currentVersion = 3;
XferVersion version = currentVersion;
xfer->xferVersion( &version, currentVersion );
@@ -234,6 +246,8 @@ void HackInternetAIUpdate::xfer( Xfer *xfer )
if (version < 2)
m_pendingCommand.setCommandSource(CMD_FROM_AI);
}
+ if (version >= 3)
+ xfer->xferBool(&m_heldByPlayer);
} // end xfer
// ------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp
index f951373b7..95f6994e2 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/IdleHackerUpdate.cpp
@@ -33,6 +33,7 @@
#include "GameLogic/PartitionManager.h"
#include "GameLogic/Module/AIUpdate.h"
#include "GameLogic/Module/ContainModule.h"
+#include "GameLogic/Module/HackInternetAIUpdate.h"
#include "GameLogic/Module/IdleHackerUpdate.h"
//-------------------------------------------------------------------------------------------------
@@ -104,7 +105,8 @@ UpdateSleepTime IdleHackerUpdate::update( void )
const UnsignedInt now = TheGameLogic->getFrame();
// Checked every frame: an order that keeps the hacker busy for a single frame still resets the clock.
- if( me->getControllingPlayer()->getPlayerType() != PLAYER_HUMAN || me->isContained() || me->isEffectivelyDead() || !ai->isIdle() )
+ if( me->getControllingPlayer()->getPlayerType() != PLAYER_HUMAN || me->isContained() || me->isEffectivelyDead() || !ai->isIdle() ||
+ ai->getHackInternetAIInterface()->isHeldByPlayer() )
{
m_idleSinceFrame = now;
return UPDATE_SLEEP_NONE;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp
index 5e08d1cb9..bb2b47c82 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/ScenarioDrill.cpp
@@ -201,6 +201,8 @@ static Bool parseActionType( const AsciiString &token, ScenarioActionType *actio
*action = SCENARIO_ACTION_DOCK;
else if (token == "stop")
*action = SCENARIO_ACTION_STOP;
+ else if (token == "clickstop")
+ *action = SCENARIO_ACTION_CLICKSTOP;
else if (token == "arrive")
*action = SCENARIO_ACTION_ARRIVE;
else if (token == "particles")
@@ -353,6 +355,7 @@ static Int tokensNeededFor( ScenarioActionType action )
case SCENARIO_ACTION_GIVEMONEY: return SCENARIO_TOKENS_STANCE;
case SCENARIO_ACTION_RANK: return SCENARIO_TOKENS_STANCE;
case SCENARIO_ACTION_STOP: return SCENARIO_TOKENS_STOP;
+ case SCENARIO_ACTION_CLICKSTOP: return SCENARIO_TOKENS_STOP;
case SCENARIO_ACTION_TALLY: return SCENARIO_TOKENS_STOP;
case SCENARIO_ACTION_PURCHASE: return SCENARIO_TOKENS_STOP;
case SCENARIO_ACTION_ARRIVE: return SCENARIO_TOKENS_ARRIVE;
@@ -518,6 +521,7 @@ ScenarioParseResult ScenarioDrill_parseLine( const char *line, ScenarioAction *a
break;
case SCENARIO_ACTION_STOP:
+ case SCENARIO_ACTION_CLICKSTOP:
case SCENARIO_ACTION_TALLY:
case SCENARIO_ACTION_PURCHASE:
break;
@@ -1900,6 +1904,14 @@ static Bool executeOrder( const ScenarioAction &action, Player *player, const Co
break;
}
+ case SCENARIO_ACTION_CLICKSTOP:
+ {
+ group->groupIdle( CMD_FROM_PLAYER ); // what GameLogicDispatch does with MSG_DO_STOP
+ DEBUG_LOG(("SCENARIO: frame %d clickstop slot %d '%s' x%d\n",
+ action.frame, action.slot, action.selector.str(), taken));
+ break;
+ }
+
case SCENARIO_ACTION_SPAWN:
case SCENARIO_ACTION_ARRIVE:
case SCENARIO_ACTION_PARTICLES: