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): step the bar's centre up to the money

Olcay Seygan62ff448156d5
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
index 9c650a569..74f91fa65 100644
--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html
+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
@@ -21,8 +21,8 @@
moving with the bar when it slides or minimises; .w and .h are 0 and
{{panelN.shown}} is "hidden" when a minimised bar has stood it down
{{left.x}} .y .w .h the box round the radar, so the left panel is only as big as its bezel
- {{centre.x}} .y .w .h the box round the command grid with the money and the power bar over it;
- {{centre.shown}} as above
+ {{centre.x}} .y .w .h the box round the command grid; {{centre.shown}} as above. The money's and
+ the power bar's steps over it are drawn from MoneyDisplay and PowerWindow
{{right.x}} .y .w .h the box round the portrait and the experience bar. The promotion and
minimise buttons are moved to sit over its top right corner
{{Name.x}} .y .w .h the rectangle of the bar's window Name, {{Name.shown}} "shown" or "hidden"
@@ -63,6 +63,14 @@
.right { margin: -22px 0 0 -8px; padding: 22px 8px 8px 8px; }
.centre { margin: -10px 0 0 -6px; padding: 10px 6px 6px 6px; }
+ /* over the centre, two steps, each narrower than the one under it: the power bar's, then on top
+ the money's. Each hangs down behind the step under it, which is drawn after it and covers the
+ join, so none needs to know where the next one starts */
+ .step { padding-bottom: 30px; }
+ .step .rail { height: 3px; }
+ .powerstep { margin: -8px 0 0 -14px; padding-top: 8px; padding-left: 14px; padding-right: 14px; }
+ .moneystep { margin: -5px 0 0 -8px; padding-top: 5px; padding-left: 8px; padding-right: 8px; }
+
/* a bezel: a window set into the panel, four pixels of steel round a black lip */
.bezel { margin: -5px 0 0 -5px; border: 4px solid #4b535e; border-top-color: #2a3036; border-left-color: #2a3036;
border-bottom-color: #8a949f; border-right-color: #6f7782; }
@@ -110,6 +118,8 @@
<div class="rail"></div>
<div class="alert {{WinUAttack.state}}">{{text:GUI:BarUnderAttack}}</div>
</div>
+ <div class="piece panel solid step moneystep {{centre.shown}} {{MoneyDisplay.shown}}" style="left: {{MoneyDisplay.x}}px; top: {{MoneyDisplay.y}}px; width: {{MoneyDisplay.w}}px; height: {{MoneyDisplay.h}}px"><div class="rail"></div></div>
+ <div class="piece panel solid step powerstep {{centre.shown}} {{PowerWindow.shown}}" style="left: {{PowerWindow.x}}px; top: {{PowerWindow.y}}px; width: {{PowerWindow.w}}px; height: {{PowerWindow.h}}px"><div class="rail"></div></div>
<div class="piece panel solid centre {{centre.shown}}" style="left: {{centre.x}}px; top: {{centre.y}}px; width: {{centre.w}}px; height: {{centre.h}}px">
<div class="rail"></div>
<div class="worker button {{ButtonIdleWorker.state}}" data-click="press:ButtonIdleWorker"><div class="cap">{{text:GUI:BarIdleWorker}}</div></div>
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index 9cc974815..e082b79e6 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -10108,14 +10108,12 @@ static const char *const CONTROL_BAR_STOOD_DOWN[] = { "ButtonOptions", "ButtonId
static const std::string PRESS_ACTION = "press:";
/** The windows each panel is drawn round, so a panel is only as big as what it holds: the left one
- * the radar, the right one the portrait and the experience bar, the centre the command grid with
- * the money and the power bar over it. NULL ends each list. */
+ * the radar, the right one the portrait and the experience bar, the centre the command grid. The
+ * money and the power bar stand on steps of their own over the centre, drawn from their windows'
+ * rectangles. NULL ends each list. */
static const char *const CONTROL_BAR_LEFT[] = { "LeftHUD", NULL };
static const char *const CONTROL_BAR_RIGHT[] = { "RightHUD", "GeneralsExp", "ExpBarForeground", NULL };
-static const char *const CONTROL_BAR_CENTRE[] =
-{
- "CommandWindow", "ObserverPlayerListWindow", "MoneyDisplay", "PowerWindow", "ButtonPlaceBeacon", NULL
-};
+static const char *const CONTROL_BAR_CENTRE[] = { "CommandWindow", "ObserverPlayerListWindow", "ButtonPlaceBeacon", NULL };
/** The promotion and minimise buttons, small, side by side in the right panel's top right corner,
* the minimise button outermost. 800x600 pixels. */
@@ -10231,8 +10229,10 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
HtmlValues values;
values[ "side" ] = spectatorSide();
- values[ "promotion" ] = TheControlBar->isGeneralStarFlashing() ? "ready" : "";
- values[ "watching" ] = localPlayerWatching() ? "watching" : "";
+ // a watcher has no promotions of his own to spend, whatever the bar's flash says
+ const Bool watching = localPlayerWatching();
+ values[ "promotion" ] = !watching && TheControlBar->isGeneralStarFlashing() ? "ready" : "";
+ values[ "watching" ] = watching ? "watching" : "";
values[ "blink" ] = TheGameLogic->getFrame() % LOGICFRAMES_PER_SECOND > LOGICFRAMES_PER_SECOND / 2 ? "lit" : "";
for( Int panel = 0; panel < panelCount; panel++ )
putPageRect( values, "panel" + std::to_string( panel ), panels[ panel ], shown[ panel ] );