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(gameclient): put the clock plate on top, and open on nothing

Olcay Seygan23c4ab0ca8b9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c66610771..74e6d2ac2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -297,6 +297,15 @@ Around it, the whole production loop got tightened:
interrupting a busy one when every worker you own is busy. Same for the build list you get with
nothing selected — it stays usable when the whole crew is out working.
- **Workers go back to collecting supplies** after they finish, instead of standing there.
+- **The clock and frame-rate readout is smaller, bolder, and drawn on top of everything.** It used
+ to be painted before the interface, so any panel or dialog covered the one number you look at
+ when something is going wrong.
+- **A game opens with nothing selected.** It used to start with your command centre picked, so your
+ first click on the ground moved its rally point and the command bar opened on a menu you were not
+ looking at.
+- **The tilde key opens the general's promotions.** The panel was a click away on the stars button
+ and nowhere on the keyboard, which is the wrong way round for something you want open the second
+ a promotion lands.
- **`S` stops your units again.** The key was simply not bound: the stop button on the command bar
worked, so nobody noticed that the key every RTS player reaches for did nothing at all.
- **Every button says how long it takes.** Each picture in the command bar carries its time in the
diff --git a/GeneralsMD/Code/Data/INI/CommandMap.ini b/GeneralsMD/Code/Data/INI/CommandMap.ini
index 8c498a32a..ae7379252 100644
--- a/GeneralsMD/Code/Data/INI/CommandMap.ini
+++ b/GeneralsMD/Code/Data/INI/CommandMap.ini
@@ -314,6 +314,17 @@ CommandMap TOGGLE_ATTACKMOVE
DisplayName = GUI:ToggleAttackMove
End
+; the general's promotion screen, on the key above tab
+CommandMap TOGGLE_PURCHASE_SCIENCE
+ Key = KEY_TICK
+ Transition = DOWN
+ Modifiers = NONE
+ UseableIn = GAME
+ Category = INTERFACE
+ Description = GUI:TogglePurchaseScienceDescription
+ DisplayName = GUI:TogglePurchaseScience
+End
+
; stop what you are doing. This file replaces the shipped command map rather than
; merging with it, so a retail key that is not written out here is simply not bound -
; which is what had happened to stop: the grid gives the command bar's stop button a
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index af0fd4ea7..b208fb5e4 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -137,6 +137,22 @@ GUI:CommandSlot14Description
"Presses command bar slot 14 (column 7, bottom row, 'M' in the default grid layout)."
END
+GUI:TogglePurchaseScience
+"Generals Promotions"
+END
+
+GUI:TogglePurchaseScienceDescription
+"Opens and closes the general's promotion screen."
+END
+
+GUI:Stop
+"Stop"
+END
+
+GUI:StopDescription
+"Stops what the selected units are doing."
+END
+
GUI:ToggleAttackMove
"Attack Move"
END
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
index 10ba0d9e4..2d115635a 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/MessageStream.h
@@ -296,6 +296,7 @@ public:
MSG_META_GAME_SPEED_UP, ///< raise the logic rate (fork)
MSG_META_GAME_SPEED_DOWN, ///< lower the logic rate (fork)
MSG_META_GAME_SPEED_RESET, ///< back to the default logic rate (fork)
+ MSG_META_TOGGLE_PURCHASE_SCIENCE, ///< open/close the general's promotion screen (fork)
MSG_META_BEGIN_CAMERA_ROTATE_LEFT,
MSG_META_END_CAMERA_ROTATE_LEFT,
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
index 2d65ba82a..c549c7a1b 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/InGameUI.h
@@ -823,6 +823,7 @@ protected:
// superweapon timer data
SuperweaponMap m_superweapons[MAX_PLAYER_COUNT];
enum { HUD_OVERLAY_POINT_SIZE = 9 }; ///< small: this sits over the battlefield, not in a panel
+ enum { HUD_CLOCK_POINT_SIZE = 7 }; ///< smaller still, and bold: the clock/rate plate is a glance, not a read
void drawHudOverlay( void ); ///< the small elapsed-time / fps plate (ShowHudOverlay)
void drawIncomeRate( void ); ///< income per minute, drawn beside the money window
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
index 7bdc144aa..c4d7dc049 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/MessageStream.cpp
@@ -396,6 +396,7 @@ AsciiString GameMessage::getCommandTypeAsAsciiString(GameMessage::Type t)
CHECK_IF(MSG_META_TAKE_SCREENSHOT)
CHECK_IF(MSG_META_ALL_CHEER)
CHECK_IF(MSG_META_TOGGLE_ATTACKMOVE)
+ CHECK_IF(MSG_META_TOGGLE_PURCHASE_SCIENCE)
CHECK_IF(MSG_META_HOLD_POSITION)
CHECK_IF(MSG_META_TOGGLE_PAUSE)
CHECK_IF(MSG_META_GAME_SPEED_UP)
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 4ee51587d..1340be6c6 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -3836,7 +3836,7 @@ void InGameUI::disregardDrawable( Drawable *draw )
//-------------------------------------------------------------------------------------------------
void InGameUI::postDraw( void )
{
- drawHudOverlay();
+ // drawHudOverlay is NOT called here - it goes on top of everything, see W3DInGameUI::draw
drawIncomeRate();
drawProductionStrip();
@@ -5669,10 +5669,11 @@ void InGameUI::drawHudOverlay( void )
if( m_hudDisplayString == NULL )
{
+ // bold at a small point size, because this plate is read at a glance rather than read
m_hudDisplayString = TheDisplayStringManager->newDisplayString();
m_hudDisplayString->setFont( TheFontLibrary->getFont( m_superweaponNormalFont,
- TheGlobalLanguageData->adjustFontSize( HUD_OVERLAY_POINT_SIZE ),
- FALSE ) );
+ TheGlobalLanguageData->adjustFontSize( HUD_CLOCK_POINT_SIZE ),
+ TRUE ) );
}
m_hudDisplayString->setText( text );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
index 21d95023e..099bc31c8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp
@@ -3265,6 +3265,16 @@ GameMessageDisposition CommandTranslator::translateGameMessage(const GameMessage
TheInGameUI->toggleAttackMoveToMode( );
break;
+ //-----------------------------------------------------------------------------------------
+ // the general's promotion screen. It is one click away on the stars button and nowhere on
+ // the keyboard, which is the wrong way round for something you open the moment a promotion
+ // lands - and the star only flashes until you look at it.
+ case GameMessage::MSG_META_TOGGLE_PURCHASE_SCIENCE:
+ if( TheControlBar )
+ TheControlBar->togglePurchaseScience();
+ disp = DESTROY_MESSAGE;
+ break;
+
//
// Pause and game speed. Both are local-only: they change how fast THIS machine steps its
// logic, so they are refused outright in a network game where every peer has to agree.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
index ee6c02b5b..97ba1221e 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/MetaEvent.cpp
@@ -178,6 +178,7 @@ static const LookupListRec GameMessageMetaTypeNames[] =
{ "SCATTER", GameMessage::MSG_META_SCATTER },
{ "STOP", GameMessage::MSG_META_STOP },
{ "TOGGLE_ATTACKMOVE", GameMessage::MSG_META_TOGGLE_ATTACKMOVE },
+ { "TOGGLE_PURCHASE_SCIENCE", GameMessage::MSG_META_TOGGLE_PURCHASE_SCIENCE },
{ "HOLD_POSITION", GameMessage::MSG_META_HOLD_POSITION },
{ "TOGGLE_PAUSE", GameMessage::MSG_META_TOGGLE_PAUSE },
{ "GAME_SPEED_UP", GameMessage::MSG_META_GAME_SPEED_UP },
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index 125a8d963..2e0422893 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -145,7 +145,6 @@ enum { OBJ_HASH_SIZE = 8192 };
/// The GameLogic singleton instance
GameLogic *TheGameLogic = NULL;
-static void findAndSelectCommandCenter(Object *obj, void* alreadyFound);
// ------------------------------------------------------------------------------------------------
@@ -2298,23 +2297,16 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
// @todo remove this hack
// TheGlobalData->m_inGame = TRUE;
- // If we are now starting a multiplayer or skirmish game, let us set the local players selectionto be the command center
- // We'll ask the Recorder, so we survive replays
- if( TheRecorder->isMultiplayer() )
- {
- // Iterate through each player's objects, and ask if the object
- //is a command center, and if so, select it for that player
- for (Int i = 0; i < MAX_PLAYER_COUNT; ++i)
- {
- Player *player = ThePlayerList->getNthPlayer(i);
- if (player && player->isPlayerActive())
- {
- // we need to iterate their objects, and select the first Command Center we find
- Bool alreadyFound = FALSE;
- player->iterateObjects(findAndSelectCommandCenter, &alreadyFound);
- }
- }
- }
+ //
+ // A skirmish used to open with everyone's command centre selected (findAndSelectCommandCenter,
+ // run for every active player so the state stayed identical on every machine). Nothing is
+ // selected now: the first thing you do in a game is pick what you want, and starting with a
+ // building selected means the first click on the ground is a rally point you did not ask for -
+ // and the command bar opens on a menu you were not looking at.
+ //
+ // Still done for everyone or for no one: the selection is logic state (it builds an AIGroup),
+ // so it has to be the same decision on every peer.
+ //
TheControlBar->initSpecialPowershortcutBar(ThePlayerList->getLocalPlayer());
if(m_gameMode == GAME_SHELL)
@@ -2381,16 +2373,6 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
} // end startNewGame
-//-----------------------------------------------------------------------------------------
-static void findAndSelectCommandCenter(Object *obj, void* alreadyFound)
-{
- if (!((*(Bool*)alreadyFound)) && obj && obj->isKindOf(KINDOF_COMMANDCENTER) )
- {
- ((*(Bool*)alreadyFound)) = TRUE;
- TheGameLogic->selectObject(obj, TRUE, obj->getControllingPlayer()->getPlayerMask(), obj->isLocallyControlled());
-
- }
-}
//-----------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
index f982e5d13..4a65f711e 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp
@@ -444,6 +444,14 @@ void W3DInGameUI::draw( void )
postDraw();
TheWindowManager->winRepaint();
+
+ //
+ // The clock/rate plate goes on last, after every window has painted. In postDraw with the rest
+ // of the world overlays it was drawn before the window manager, so anything the manager put on
+ // top of it - a dialog, the menu, the control bar's own art at the top of the screen - covered
+ // the one reading you want visible exactly when something is going wrong.
+ //
+ drawHudOverlay();
#ifdef EXTENDED_STATS
}