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
feat(gameclient): idle worker as an icon key, grid panel fits its buttons
Olcay Seyganc81c2d1d91c5
diff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.htmlindex 583d75d60..ae580792e 100644--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html@@ -171,17 +171,32 @@.menu .bar { position: absolute; left: 4px; right: 4px; height: 2px; background-color: #e8eef2; }.menu:hover .bar { background-color: #e8d27a; }- /* the idle worker: a tab standing on the centre's border at its left end */- .worker { border-bottom: 0; }+ /* a tab cut from a bezel's own steel, standing on its top edge and running down into it */+ .tab { background: linear-gradient(to bottom, #b3bbc4, #8b949e); border-top: 1px solid #dde4ea; border-right: 1px solid #0c1114; }+ .china .tab { background: linear-gradient(to bottom, #d58a70, #c06a52); border-top-color: #f0b8a4; }+ .gla .tab { background: linear-gradient(to bottom, #cabe86, #b8ab6e); border-top-color: #ebe2b4; }++ /* a key sunk in the steel with a one-colour SVG on it, the smoke signals' and the idle worker's:+ under the pointer it comes up out of its well as lit steel with a gold rim, and a key whose+ button has nothing to do is veiled */+ .key { position: absolute; width: 32px; height: 18px; background-color: rgba(4, 8, 10, 0.9);+ border: 1px solid #06090b; border-bottom-color: #9aa4ae; border-right-color: #9aa4ae; }+ .key:hover { background: linear-gradient(to bottom, #b3bbc4, #5a626c); border-color: #e8d27a; }+ .china .key:hover { background: linear-gradient(to bottom, #d58a70, #7a3120); }+ .gla .key:hover { background: linear-gradient(to bottom, #cabe86, #766a3a); }+ .key .icon { position: absolute; left: 9px; top: 2px; width: 14px; height: 14px;+ background-size: 100% 100%; background-repeat: no-repeat; }+ .key .veil { display: none; }+ .disabled .key .veil { display: block; position: absolute; left: 0; top: 0; width: 32px; height: 18px;+ background-color: rgba(4, 8, 10, 0.65); }++ /* the idle worker: a key in a tab standing on the centre's border at its left end */+ .worker .key { left: 3px; top: 3px; }+ .worker .icon { background-image: url(Icons/IdleWorker.svg); }.watching .worker { display: none; }- /* the under-attack light: a tab standing on the radar panel's border at its left end, red while- the bar blinks it */- /* a red lamp in a tab cut from the bezel's own steel, running down into its top edge; dark until- the bar blinks it. The tab is 54 by 14 and the lamp a bar 42 by 10 with its rim */- .alert { background: linear-gradient(to bottom, #b3bbc4, #8b949e); border-top: 1px solid #dde4ea; border-right: 1px solid #0c1114; }- .china .alert { background: linear-gradient(to bottom, #d58a70, #c06a52); border-top-color: #f0b8a4; }- .gla .alert { background: linear-gradient(to bottom, #cabe86, #b8ab6e); border-top-color: #ebe2b4; }+ /* the under-attack light: a red lamp in a tab on the radar's bezel, dark until the bar blinks it.+ The tab is 54 by 14 and the lamp a bar 42 by 10 with its rim */.alert .led { position: absolute; left: 6px; top: 2px; width: 40px; height: 8px; border: 1px solid #120302;background: linear-gradient(to bottom, #4a0d08, #2a0604); }.alert .glint { position: absolute; left: 2px; top: 1px; width: 36px; height: 2px; background-color: #6a2a24; }@@ -195,9 +210,8 @@/* the smoke signals: a step of the radar's bezel on its right, the same steel carried on at theshade the bezel has at that height, with its own lit top edge, and a joint over the bezel's dark- right line so the two read as one piece. Three keys sunk in it like the radar is, each an SVG in one- colour, a crosshair to attack, a shield to defend, an eye to look. Under the pointer a key- comes up out of its well as lit steel with a gold rim */+ right line so the two read as one piece. Three keys in it: a crosshair to attack, a shield to+ defend, an eye to look */.signals { background: linear-gradient(to bottom, #4f575f, #353c45); border-top: 1px solid #dde4ea; border-right: 1px solid #0c1114; }.signals .joint { position: absolute; left: -1px; top: 0; bottom: 0; width: 1px; background: linear-gradient(to bottom, #4f575f, #353c45); }.china .signals, .china .signals .joint { background: linear-gradient(to bottom, #6a2a1c, #3f160f); }@@ -207,13 +221,7 @@/* each key stands at its own top, pushed down by {{signalN.drop}} while it rises: a relativelyplaced box inside an absolutely placed one is laid out from the screen's corner here, and thecolumn came out in the top left */- .signals .signal { position: absolute; left: 3px; width: 32px; height: 18px; background-color: rgba(4, 8, 10, 0.9);- border: 1px solid #06090b; border-bottom-color: #9aa4ae; border-right-color: #9aa4ae; }- .signals .signal:hover { background: linear-gradient(to bottom, #b3bbc4, #5a626c); border-color: #e8d27a; }- .china .signals .signal:hover { background: linear-gradient(to bottom, #d58a70, #7a3120); }- .gla .signals .signal:hover { background: linear-gradient(to bottom, #cabe86, #766a3a); }- .signal .icon { position: absolute; left: 9px; top: 2px; width: 14px; height: 14px;- background-size: 100% 100%; background-repeat: no-repeat; }+ .signals .key { left: 3px; }.signal.attack .icon { background-image: url(Icons/SignalAttack.svg); }.signal.defend .icon { background-image: url(Icons/SignalDefend.svg); }.signal.look .icon { background-image: url(Icons/SignalLook.svg); }@@ -238,7 +246,7 @@<div class="shade" style="right: -{{left.br}}px; top: -{{left.bt}}px; bottom: -{{left.bb}}px"></div><div class="sunk" style="width: {{left.w}}px; height: {{left.h}}px"></div></div>- <div class="piece alert {{alerttab.shown}} {{WinUAttack.state}}" style="left: {{alerttab.x}}px; top: {{alerttab.y}}px; width: {{alerttab.w}}px; height: {{alerttab.h}}px"><div class="led"><div class="glint"></div></div></div>+ <div class="piece tab alert {{alerttab.shown}} {{WinUAttack.state}}" style="left: {{alerttab.x}}px; top: {{alerttab.y}}px; width: {{alerttab.w}}px; height: {{alerttab.h}}px"><div class="led"><div class="glint"></div></div></div><div class="piece bezel solid stack moneyblock {{moneyblock.shown}}" style="left: {{moneyblock.x}}px; top: {{moneyblock.y}}px; width: {{moneyblock.w}}px; height: {{moneyblock.h}}px"><div class="steel" style="left: 0; right: 0; top: 0; bottom: 0"></div><div class="shine" style="left: 0; right: 0; top: 0"></div>@@ -258,7 +266,9 @@<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>- <div class="piece button worker {{workertab.shown}} {{ButtonIdleWorker.state}}" data-click="press:ButtonIdleWorker" style="left: {{workertab.x}}px; top: {{workertab.y}}px; width: {{workertab.w}}px; height: {{workertab.h}}px"><div class="cap">{{text:GUI:BarIdleWorker}}</div></div>+ <div class="piece tab worker {{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><div class="piece frame solid {{right.shown}}" style="left: {{right.x}}px; top: {{right.y}}px; width: {{right.w}}px; height: {{right.h}}px; border-width: {{right.bt}}px {{right.br}}px {{right.bb}}px {{right.bl}}px"></div><div class="piece button {{ButtonPlaceBeacon.shown}} {{ButtonPlaceBeacon.state}}" style="left: {{ButtonPlaceBeacon.x}}px; top: {{ButtonPlaceBeacon.y}}px; width: {{ButtonPlaceBeacon.w}}px; height: {{ButtonPlaceBeacon.h}}px"><div class="cap">{{text:GUI:BarBeacon}}</div></div>@@ -267,9 +277,9 @@<div class="piece signals solid {{signals.shown}}" style="left: {{signals.x}}px; top: {{signals.y}}px; width: {{signals.w}}px; height: {{signals.h}}px"><div class="joint"></div>- <div class="signal attack" data-click="signal:attack" style="top: 3px; margin-top: {{signal0.drop}}px"><div class="icon"></div></div>- <div class="signal defend" data-click="signal:defend" style="top: 27px; margin-top: {{signal1.drop}}px"><div class="icon"></div></div>- <div class="signal look" data-click="signal:look" style="top: 51px; margin-top: {{signal2.drop}}px"><div class="icon"></div></div>+ <div class="key signal attack" data-click="signal:attack" style="top: 3px; margin-top: {{signal0.drop}}px"><div class="icon"></div></div>+ <div class="key signal defend" data-click="signal:defend" style="top: 27px; margin-top: {{signal1.drop}}px"><div class="icon"></div></div>+ <div class="key signal look" data-click="signal:look" style="top: 51px; margin-top: {{signal2.drop}}px"><div class="icon"></div></div></div><div class="piece skillcell well" data-each="skillcells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"></div>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/IdleWorker.svg b/GeneralsMD/Code/Data/Window/Html/Icons/IdleWorker.svgnew file mode 100644index 000000000..c22f1596e--- /dev/null+++ b/GeneralsMD/Code/Data/Window/Html/Icons/IdleWorker.svg@@ -0,0 +1,5 @@+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">+ <path d="M4 15.5C4 10.2 7.6 6.5 12 6.5S20 10.2 20 15.5Z" fill="#eef2f5"/>+ <rect x="10.9" y="4.2" width="2.2" height="3" fill="#eef2f5"/>+ <rect x="1.5" y="16.8" width="21" height="2.6" fill="#eef2f5"/>+</svg>diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 009495a3a..11fe5527d 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -10293,7 +10293,8 @@ static void placeSignalAtView( const std::string &kind )* 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", "ButtonPlaceBeacon", NULL };+static const char *const CONTROL_BAR_CENTRE[] = { "ObserverPlayerListWindow", "ButtonPlaceBeacon", NULL };+static const Int COMMAND_BUTTONS = 14; ///< ButtonCommand01 to 14, the grid a player sees/** The promotion button, small, on the right panel's border beside the page's own skills button,* which takes the outermost place. 800x600 pixels. */@@ -10310,7 +10311,7 @@ enumSKILL_GRID_COLUMNS = 3,SKILLS_BUTTON_WIDTH = 58, ///< wide enough for its name in either languageALERT_TAB_WIDTH = 54, ///< the under-attack light, a lamp on the radar panel's border- WORKER_TAB_WIDTH = 44 ///< the idle worker button, on the command grid panel's border+ WORKER_TAB_WIDTH = 39 ///< the idle worker's key, on the command grid panel's border, as wide as the signals' column};static const char *const SKILLS_FOLDED = "skills"; ///< the flip the skills button toggles; flipped is folded awaystatic const UnsignedInt SIGNAL_RISE_MS = 360; ///< each smoke signal button's climb out of the screen's bottom edge@@ -10478,14 +10479,18 @@ static void stackCentre( HtmlValues &values, Bool shown, IRegion2D ¢re )Bool gridFound = controlBarUnion( CONTROL_BAR_CENTRE, grid );// with nothing selected the bar hides the command grid, and the panel must not go with it: the- // money and the power bar stood over bare battlefield. The grid's place holds whether it is up- GameWindow *commands = controlBarWindow( "CommandWindow" );- if( commands )- {+ // money and the power bar stood over bare battlefield. The grid's place holds whether it is up,+ // and it is the fourteen buttons' place rather than CommandWindow's: the window reaches 34 pixels+ // further left, over where the beacon button stands, and left an empty strip in the panel+ 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;- commands->winGetScreenPosition( &place.lo.x, &place.lo.y );- commands->winGetSize( &width, &height );+ 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;if( !gridFound )@@ -10637,7 +10642,10 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, IIRegion2D centreBox;stackCentre( values, panelCount > 1 && shown[ 1 ], centreBox );- putPageRect( values, "workertab", tabOn( centreBox, WORKER_TAB_WIDTH, FALSE ), panelCount > 1 && shown[ 1 ] );+ // the idle worker's tab holds a key the size of a smoke signal's, so it is a signal row tall+ IRegion2D workerTab = tabOn( centreBox, WORKER_TAB_WIDTH, FALSE );+ workerTab.lo.y = workerTab.hi.y - REAL_TO_INT( SIGNAL_BUTTON_SIZE * scale );+ putPageRect( values, "workertab", workerTab, panelCount > 1 && shown[ 1 ] );HtmlLists lists;putPowerBar( values, lists[ "powercells" ] ); // after the stack, whose frame it divides into cells