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): a cell behind each command button, steel between them

Olcay Seyganabb7337ae6e2
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
index 865ab6b80..30e7d88cb 100644
--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html
+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html
@@ -24,6 +24,7 @@
{{skillsbutton.x}} ... the skills button's place in the right panel's corner; data-click
"flip:skills" folds the general's powers away and back, and
{{flip:skills}} is "flipped" while they are folded
+ data-each="commandcells" the fourteen command buttons' places, shown or not, each {{cell.x}} .y .w .h
data-each="skillcells" the grid's nine empty places behind the powers, each {{cell.x}} .y .w .h;
none while the skills button has them folded away
{{signals.x}} ... the column of smoke signal buttons against the left panel;
@@ -120,6 +121,15 @@
.gla .bezel .steel { background: linear-gradient(to bottom, #b8ab6e, #766a3a 30%, #3c3519); }
.gla .bezel .shine { background-color: #ebe2b4; }
.gla .bezel .sunk { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }
+ /* the command grid: its well is steel, and each of the fourteen places a dark cell a pixel round
+ its button, so steel lines run between the buttons and an empty place shows as a hole */
+ .bezel .sunk.grid { background-color: #3a414a; }
+ .china .bezel .sunk.grid { background-color: #45190f; }
+ .gla .bezel .sunk.grid { background-color: #423a1c; }
+ .commandcell { margin: -1px 0 0 -1px; border: 1px solid #06090b; border-bottom-color: #9aa4ae; border-right-color: #9aa4ae;
+ background-color: #020405; }
+ .china .commandcell { border-bottom-color: #d98a72; border-right-color: #d98a72; }
+ .gla .commandcell { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }
/* over the centre's border the power bar's frame and on it the money's block, stacked flush */
.stack { box-sizing: border-box; margin: 0; }
@@ -273,8 +283,9 @@
<div class="shine" style="left: -{{centre.bl}}px; right: -{{centre.br}}px; top: -{{centre.bt}}px"></div>
<div class="lit" style="left: -{{centre.bl}}px; top: -{{centre.bt}}px; bottom: -{{centre.bb}}px"></div>
<div class="shade" style="right: -{{centre.br}}px; top: -{{centre.bt}}px; bottom: -{{centre.bb}}px"></div>
- <div class="sunk" style="width: {{centre.w}}px; height: {{centre.h}}px"></div>
+ <div class="sunk grid" style="width: {{centre.w}}px; height: {{centre.h}}px"></div>
</div>
+ <div class="piece commandcell" data-each="commandcells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"></div>
<div class="piece step worker solid {{workertab.shown}} {{ButtonIdleWorker.state}}" style="left: {{workertab.x}}px; top: {{workertab.y}}px; width: {{workertab.w}}px; height: {{workertab.h}}px">
<div class="key" data-click="press:ButtonIdleWorker"><div class="icon"></div><div class="veil"></div></div>
</div>
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
index e3d67b0dd..44b6d39e9 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp
@@ -10475,21 +10475,28 @@ static IRegion2D tabOn( const IRegion2D &box, Int width, Bool fromRight )
* line of text and set down on the block under it, so its block is no taller than the figure.
* Written as centre, powerframe and moneyblock. */
//-------------------------------------------------------------------------------------------------
+/** ButtonCommandNN's screen rectangle, `button` 1 to COMMAND_BUTTONS, shown or not. */
+static IRegion2D commandButtonRect( Int button )
+{
+ char name[ 32 ];
+ snprintf( name, sizeof( name ), "ButtonCommand%02d", button );
+ GameWindow *command = controlBarWindow( name );
+ IRegion2D place;
+ Int width = 0, height = 0;
+ command->winGetScreenPosition( &place.lo.x, &place.lo.y );
+ command->winGetSize( &width, &height );
+ place.hi.x = place.lo.x + width;
+ place.hi.y = place.lo.y + height;
+ return place;
+}
+
/** The box round the fourteen command buttons, shown or not. */
static IRegion2D commandButtonsBox( void )
{
IRegion2D box;
for( Int button = 1; button <= COMMAND_BUTTONS; button++ )
{
- char name[ 32 ];
- snprintf( name, sizeof( name ), "ButtonCommand%02d", button );
- GameWindow *command = controlBarWindow( name );
- IRegion2D place;
- Int width = 0, height = 0;
- command->winGetScreenPosition( &place.lo.x, &place.lo.y );
- command->winGetSize( &width, &height );
- place.hi.x = place.lo.x + width;
- place.hi.y = place.lo.y + height;
+ const IRegion2D place = commandButtonRect( button );
if( button == 1 )
box = place;
box.lo.x = min( box.lo.x, place.lo.x );
@@ -10693,6 +10700,16 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I
HtmlLists lists;
putPowerBar( values, lists[ "powercells" ] ); // after the stack, whose frame it divides into cells
+ // a well behind each of the fourteen command buttons, shown or not, so the grid reads as a grid
+ // with the steel between its places, and an empty place is a hole in it rather than bare dark
+ std::vector< HtmlValues > &commandCells = lists[ "commandcells" ];
+ for( Int button = 1; button <= COMMAND_BUTTONS && panelCount > 1 && shown[ 1 ]; button++ )
+ {
+ HtmlValues entry;
+ putPageRect( entry, "cell", commandButtonRect( button ), TRUE );
+ commandCells.push_back( entry );
+ }
+
const Bool rightFound = controlBarUnion( CONTROL_BAR_RIGHT, content );
const IRegion2D rightBox = framed( content, border, FALSE, TRUE );
putFrame( values, "right", content, rightBox, rightFound && rightShown );