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): smaller command bar, content-sized panels, painted orders
Olcay Seygan132c13a64e08
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 875327419..a53f33fd9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -624,9 +624,9 @@ A third pass went through the generals' powers, promotions and unit abilities.- Both are an ordinary web page with a stylesheet, in the game's Window folder. Change the colours, the sizes or the order there and the next match you watch draws it that way, and the page opens in a browser too.- A minimised command bar stays minimised. Changing seats, or clicking another player's unit while watching, put the whole bar back up over the battlefield you had just cleared. A new match still opens with the bar up.- The command bar's frame is drawn new, in the same steel as the boards. Each panel holds one thing and is exactly its size, the radar, the command grid, the portrait with the experience bar, and wears a steel border outside it. Grey for America, red for China, sand for GLA. It slides and minimises with the bar, and like the boards it is a page in the Window folder; take the page away and the old painted bar comes back.-- The command bar is laid out anew, all of it running rightwards from the bottom left corner, and the last quarter of the screen's bottom edge is battlefield but for the general's powers in the corner. The radar sits in the corner with your general's experience bar standing beside it, and on its top edge the skills key with your rank's stars, over the under-attack light. Next to it the command panel keeps every order in the same place whatever you select: the unit's own abilities and upgrades along the top, then attack, stop and attack move, then eject, guard and hold position. Attack and hold position are buttons now, where no unit ever had one. Over the panel runs a portrait bar. Select one unit and its upgrades follow its portrait; select a group and every kind of unit in it follows, each with how many you have. A dozer's or a worker's buildings get two bars of their own beside the panel, the first eight on the Q bar and the rest on the W bar, each in the place its two-key shortcut names, with the money and the power bar on top of them.-- Every panel of the bar is only as big as what it holds now, and stands on the bottom of the screen. The radar's border runs out to the screen's left edge. The power bar lies in a steel groove of its own on the worker bars, a row of forty cells that light up from the left with your production and fill the frame from edge to edge when full, the consumption marked by a white needle, with the money in a dark well beside it. Everything the old painting filled round them is battlefield again, and a click there lands on the battlefield.-- The bar's own buttons are drawn to match, steel caps lit gold under the pointer and pressed in when pushed. The menu is a small square with three bars in the screen's top left corner. The idle worker button is a key like the smoke signals', a hard hat on it, in a steel step against the middle panel's bottom left corner, where it no longer hides the end of the power bar, and the build buttons sit down level with it, a few pixels over the bottom of the screen. Each of the fourteen build places is its own dark cell with steel running between them, so an empty place reads as a slot waiting for a button, and the steel is laid over the edge of every picture the way a frame holds a card, the whole picture showing inside it. The production queue and the general's powers are framed the same way. The power bar is sunk into the same steel plate as the build grid, the plate carried on upward as wide as it, and the money's block sits on top of that plate with no seam between them: the build grid, the power and the money read as one piece. The power bar is as long as the build grid on every side, where it used to change length from one faction to the next, and the money sits over the grid's middle. The build grid's panel no longer carries an empty strip down its left side. There is no chat button any more: Enter opens the chat as it always did. The beacon button is gone from the bar too; the smoke signals over the radar are how you point your team at a spot. The portrait sits in the radar's lit steel too. The experience bar beside it is ten gold rungs in a sunk groove, climbing from the bottom as you earn your way to the next rank, and your rank stands in a steel tab on the portrait's top right corner, a key sunk in it like the idle worker's with one star for every rank there is, gold up to the one you hold. A watcher has nothing to promote and no longer gets the tab, which used to hang half into the screen's corner. Its button goes with it: a watcher who clicked a unit used to find an empty patch of screen there that still showed the promotions tooltip and opened the promotion screen. The portrait's grid is steel between dark cells on every side, where America's was drawn in blue lines that matched nothing else on the bar. That key is the promotions button: point at it and it comes up with a gold rim, it blinks bright in your side's own steel while you have a promotion to spend, and a click opens the promotion screen. That screen is rebuilt in the same steel and half its old size: each rank's promotions stand in a grid of build-button cells five wide, like the command grid, an empty place a dark hole, each rank in a steel well of its own with its heading, the wells a plate's thickness apart, the grid's steel laid over the edge of every picture so the picture sits in its cell like a card in a frame, your rank and the points to spend on one line over the experience bar, and Done in the last row's spare place. A gold rim marks what you have bought and a light one what you can buy now. It comes up the way the Esc menu does, the battlefield behind it dimmed to 65% black and the screen fading in over an eighth of a second; the side's old painted screen no longer fades in over it for the first nine frames. The bar has no minimise arrow any more: it is only as big as what it holds. The radar sits sunk in a bezel of lit steel, bright along the top and shadowed down the right, and the build grid and the money wear the same steel, the figure in a dark window of its own, and the under-attack light is a long red lamp set in a steel tab on its top left corner, dark until you are hit and then blinking. No words on it, so it reads the same in any language.+- The command bar is laid out anew, all of it running rightwards from the bottom left corner, and it is smaller: at 1920x1080 it stands 220 pixels tall where the old bar took 312, and nearly half the screen's bottom edge right of it is battlefield but for the general's powers in the corner. The radar sits in the corner with your general's experience bar standing beside it, and on its top edge the under-attack light, the skills key with your rank's stars on that, and over the stars the idle worker button whenever a worker stands idle. Next to it the command panel keeps every order in the same place whatever you select: the unit's own abilities and upgrades along the top, then attack, stop and attack move, then eject, guard and hold position. Only the orders your selection can give are drawn, each in its place, and the rest of the panel is bare steel. Attack and hold position are buttons now, where no unit ever had one, with pictures painted to sit among the game's own: a crosshair on a red plate over a burning sky, a raised palm on a blue one. Over the panel runs a portrait bar only as long as what it holds. Select one unit and its upgrades follow its portrait; select a group and every kind of unit in it follows, each with how many you have. A dozer's or a worker's buildings get two bars of their own beside the panel, the first eight on the Q bar and the rest on the W bar, each in the place its two-key shortcut names, and the power bar stands up at the W bar's right end. Your money has moved to the middle of the screen's top edge.+- Every panel of the bar is only as big as what it holds now, and stands on the bottom of the screen. The radar's border runs out to the screen's left edge. The power bar stands in a steel groove of its own at the right end of the worker bars, twenty cells that light up from the bottom with your production and fill the groove when full, the consumption marked by a white needle across it. The money hangs from the top edge of the screen in a steel plate of its own, the figure in a dark well. Everything the old painting filled round them is battlefield again, and a click there lands on the battlefield.+- The bar's own buttons are drawn to match, steel caps lit gold under the pointer and pressed in when pushed. The menu is a small square with three bars in the screen's top left corner. The idle worker button is a key like the smoke signals', a hard hat on it, in a steel tab over your rank's stars, where it no longer hides the end of the power bar. Each of the fourteen build places is its own dark cell with steel running between them, so an empty place reads as a slot waiting for a button, and the steel is laid over the edge of every picture the way a frame holds a card, the whole picture showing inside it. The production queue and the general's powers are framed the same way. The power bar is sunk into the same steel plate as the build grid, standing at its right end, and is as tall as the grid on every side, where it used to change length from one faction to the next. The build grid's panel no longer carries an empty strip down its left side. There is no chat button any more: Enter opens the chat as it always did. The beacon button is gone from the bar too; the smoke signals over the radar are how you point your team at a spot. The portrait sits in the radar's lit steel too. The experience bar beside it is ten gold rungs in a sunk groove, climbing from the bottom as you earn your way to the next rank, and your rank stands in a steel tab on the portrait's top right corner, a key sunk in it like the idle worker's with one star for every rank there is, gold up to the one you hold. A watcher has nothing to promote and no longer gets the tab, which used to hang half into the screen's corner. Its button goes with it: a watcher who clicked a unit used to find an empty patch of screen there that still showed the promotions tooltip and opened the promotion screen. The portrait's grid is steel between dark cells on every side, where America's was drawn in blue lines that matched nothing else on the bar. That key is the promotions button: point at it and it comes up with a gold rim, it blinks bright in your side's own steel while you have a promotion to spend, and a click opens the promotion screen. That screen is rebuilt in the same steel and half its old size: each rank's promotions stand in a grid of build-button cells five wide, like the command grid, an empty place a dark hole, each rank in a steel well of its own with its heading, the wells a plate's thickness apart, the grid's steel laid over the edge of every picture so the picture sits in its cell like a card in a frame, your rank and the points to spend on one line over the experience bar, and Done in the last row's spare place. A gold rim marks what you have bought and a light one what you can buy now. It comes up the way the Esc menu does, the battlefield behind it dimmed to 65% black and the screen fading in over an eighth of a second; the side's old painted screen no longer fades in over it for the first nine frames. The bar has no minimise arrow any more: it is only as big as what it holds. The radar sits sunk in a bezel of lit steel, bright along the top and shadowed down the right, and the build grid and the money wear the same steel, the figure in a dark window of its own, and the under-attack light is a long red lamp set in a steel tab on its top left corner, dark until you are hit and then blinking. No words on it, so it reads the same in any language.- The general's powers you have bought and can fire, the column that climbed the right edge of the screen, stand in the bottom right corner now in a tray of the bar's own steel. The first sits in the corner against the right edge of the screen, and each one you gain takes the place to the left of the last, three to a row before a new row starts above, so the tray is only ever as big as what you hold and an empty one takes no room at all. Each power sits on a dark cell three quarters the size of a build button, where the side's old tray art used to frame it. It is always out; there is no button to fold it away.- Three buttons sit side by side in a step of the radar's own steel, on its top edge: the smoke signals Alt+Z, X and C send. Press one and the pointer turns to a cross; your next click puts the signal there, on the ground or on the radar, and a right click or Escape takes it back; until now a button dropped its smoke in the middle of your view. Every signal now leaves a mark on the ground in your colour for ten seconds, and the radar ping lasts as long: crossed swords to attack, a shield to defend, an eye to look, each in a ring a few tanks across, fading out over its last two seconds. Each is a key sunk into the steel with a sharp white picture on it instead of a word: a crosshair to attack, a shield to defend, an eye to look. Point at one and it comes up out of its well as lit steel with a gold rim, and it sinks in darker while you hold the button down. They rise into place one after another from the bottom of the screen when the match starts. A game with nobody on your side to see the smoke, a skirmish against the computer or a replay, has no signal buttons at all.- Tooltips wear the bar's steel. Point at a build button and a card opens right above it rather than in a fixed box at the side: the name on a steel header in your side's colour with the price in gold at its end, every "Power Supplied: 5" or "Strong: infantry" line of the description laid out as a label and a bold figure, then the unit's health, damage, attacks a second, damage a second, range and build time in gold, counted with the upgrades you own. Under them every upgrade that touches the unit and what it does to it: a Gattling Tank's card says Chain Guns takes its damage from 15 to 18 and its damage a second from 37 to 46, a Humvee's that TOW adds a 50 damage missile with a range of 317, and an upgrade you already bought turns gold. Point at the upgrade itself and the card lists the units it changes, Composite Armor putting a Crusader from 480 health to 680. At the bottom, "not enough money" or what you still need in a sunk red note at the bottom. Point at something on the battlefield and a small dark box beside the pointer names it, its owner's colour in a stripe down the left edge.diff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txtindex 8b015f0ef..f4c8ee0d4 100644--- a/GeneralsMD/Code/CMakeLists.txt+++ b/GeneralsMD/Code/CMakeLists.txt@@ -666,7 +666,8 @@ add_custom_command(TARGET generals POST_BUILD${CMAKE_CURRENT_SOURCE_DIR}/Data/Install_Final.bmp${CMAKE_CURRENT_SOURCE_DIR}/../Run/# The three command bar plates per side, the smoke signals' ground marks and the- # SupW uplink's pink laser strip (Tools/pink_laser.py). A loose+ # SupW uplink's pink laser strip (Tools/pink_laser.py) and the attack and hold position cameos+ # (Tools/order_cameos.py). A loose# texture beats every .big, so these land in Run/Art/Textures where the W3D file# system looks first.COMMAND ${CMAKE_COMMAND} -E copy_directory@@ -835,6 +836,10 @@ if(Python3_Interpreter_FOUND)# synthetic one and checks the block parser did not eat an End or duplicate a key.add_test(NAME vfx_tune_selfcheckCOMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Tools/vfx_tune.py selfcheck)+ # Tools/order_cameos.py paints the command bar's attack and hold position cameos: two whole+ # pictures in the places the mapped images name, told apart by colour, the same every run.+ add_test(NAME order_cameos_selfcheck+ COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/Tools/order_cameos.py selfcheck)# The options screen is three tracked files that have to agree: TheOptionCatalog names a widget,# Data/Window/Menus/OptionsMenu.wnd has to carry it, and Data/Patch.str has to carry its label,# its tooltip and every combo box entry. Nothing at build time notices a typo in any of them -diff --git a/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tga b/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tganew file mode 100644index 000000000..d8c5e2361Binary files /dev/null and b/GeneralsMD/Code/Data/Art/Textures/ReforgedOrders.tga differdiff --git a/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ini b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ininew file mode 100644index 000000000..f1242aa35--- /dev/null+++ b/GeneralsMD/Code/Data/INI/MappedImages/HandCreated/ReforgedOrders.ini@@ -0,0 +1,19 @@+; The command bar's attack and hold position cameos, painted by Tools/order_cameos.py into+; Art/Textures/ReforgedOrders.tga. ControlBar.html draws them on the page's two order keys.+; Mapped images are not in the multiplayer INI checksum.++MappedImage ReforgedOrderAttack+ Texture = ReforgedOrders.tga+ TextureWidth = 128+ TextureHeight = 64+ Coords = Left:0 Top:0 Right:60 Bottom:48+ Status = NONE+End++MappedImage ReforgedOrderHold+ Texture = ReforgedOrders.tga+ TextureWidth = 128+ TextureHeight = 64+ Coords = Left:64 Top:0 Right:124 Bottom:48+ Status = NONE+Enddiff --git a/GeneralsMD/Code/Data/Window/Html/ControlBar.html b/GeneralsMD/Code/Data/Window/Html/ControlBar.htmlindex 04e058403..51f9c89d3 100644--- a/GeneralsMD/Code/Data/Window/Html/ControlBar.html+++ b/GeneralsMD/Code/Data/Window/Html/ControlBar.html@@ -3,8 +3,10 @@The command bar's frame, drawn where its three plates used to be, and the bar's own buttons, laidout the way the owner drew them on 2026-09-28 (docs/plans/HUD-REDESIGN.md): the radar in thebottom left corner with the experience bar beside it, the command panel with the portrait bar on- it, the Q and W worker bars with the purse on them; over the radar the skills key on the- under-attack light and the smoke signals. The command buttons, the radar, the money and the+ it, the Q and W worker bars with the power bar standing up after them; over the radar the idle+ worker's key on the skills key on the under-attack light, and the smoke signals; the money at the+ screen's top. Laid out at ControlBarHudScale(), 70 percent of the uniform scale the tooltips and+ the boards use. The command buttons, the radar, the money and theportrait are still the bar's windows and paint over this page. The under-attack light, the powerbar and the experience bar are the page's to draw: their windows take the clicks and drawnothing. The menu, idle worker and promotion buttons are the page's altogether, pressed through@@ -27,9 +29,11 @@{{power.fill}} the power bar: production as a percent of the bar, on the bar's own{{power.needle}} logarithmic scale, consumption as the same ({{power.consumes}} "hidden"while it is nought), and {{power.state}} "green",- "yellow" or "red"; the watched player's while watching- data-each="powercells" the same production as 40 cells, each {{lit}} "lit" up to it, standing at- {{x}} pixels inside the frame's lip and {{w}} wide+ "yellow" or "red"; the watched player's while watching. The bar stands+ up: {{power.needley}} is the needle's place in pixels down the groove+ data-each="powercells" the same production as 20 cells from the bottom, each {{lit}} "lit" up to+ it, standing at {{y}} pixels inside the frame's lip, {{h}} tall, {{segh}}+ without its black line{{expframe.x}} ... the experience bar's groove beside the radar, .w and .h its inside,{{expframe.innerw}} the width inside its lip; data-each="expcells" itsten rungs from the bottom up, each {{lit}} "lit" up to the way from this@@ -37,14 +41,15 @@its black linedata-each="rankstars" a star for every rank there is, {{lit}} "lit" up to the one reached, at{{x}} inside the 58 wide key so the row is centred on it- data-each="commandcells" every place a command can go, shown or not, each {{cell.x}} .y .w .h:- the command panel's twelve (five abilities and upgrades; attack, stop,- attack move; eject, seek shelter, guard, hold position) and the worker- bars' eight each+ data-each="commandcells" each {{cell.x}} .y .w .h: the command panel's places that hold a command+ (five abilities and upgrades; attack, stop, attack move; eject, seek+ shelter, guard, hold position), an empty one left as steel, and every+ place of the worker bars, eight each{{attackkey.x}} ... the attack and hold position places, where the page's own keys stand,{{holdkey.x}} ... data-click="order:attack" and "order:hold", for a selection that attackmoves; no command set has a button for either- data-each="portraitcells" the portrait bar's places, the portrait's first, each {{cell.x}} .y .w .h+ data-each="portraitcells" the portrait bar's cells, the portrait's first and then only what it+ holds, each {{cell.x}} .y .w .h{{skilltray.x}} ... the general's powers' tray, a panel as {{centre.x}} is, only as big as thepowers shown; data-each="skillcells" a cell behind each power, each{{cell.x}} .y .w .h@@ -70,10 +75,11 @@{{alerttab.x}} ... the under-attack light, a tab on the radar panel's top edge at its left{{skillstab.x}} ... hand end, and on it the skills key: the rank's stars, pressed throughdata-click="press:ButtonGeneral" for the promotion screen- {{purse.x}} ... the steel on the worker bars, level with the command panel's top, and in- {{workerkey.x}} ... it the idle worker's key, the power bar's frame and the money's well;- {{powerframe.x}} ... {{powerframe.inner}} the height inside the frame and its lip- {{moneyblock.x}} ...+ {{idletab.x}} ... the idle worker's key in a tab on the skills key+ {{powerframe.x}} ... the power bar's groove inside the W bar's frame, after its grid;+ {{powerframe.inner}} the width inside the frame and its lip+ {{moneyplate.x}} ... the money's plate hanging from the screen's top edge in its middle, and+ {{moneyblock.x}} ... the dark well in it the money's window is moved into{{Name.x}} .y .w .h the rectangle of the bar's window Name, {{Name.shown}} "shown" or "hidden"and {{Name.state}} any of "disabled", "hilite", "pushed", for LeftHUD (theradar), RightHUD (the portrait's box), CameoWindow (the portrait),@@ -156,13 +162,12 @@.china .commandcell .bevel { border-bottom-color: #d98a72; border-right-color: #d98a72; }.gla .commandcell .bevel { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }- /* the purse, a plate on the worker bars level with the command panel's top: the idle worker's- key, the power bar's groove and the money's well sunk in it. The money's figure is the bar's- own window over its well */+ /* the money's plate hanging from the screen's top edge, the money's well sunk in it. The money's+ figure is the bar's own window over its well */.stack { box-sizing: border-box; margin: 0; }- .purse .steel { background: linear-gradient(to bottom, #b0b8c1, #7d8691); }- .china .purse .steel { background: linear-gradient(to bottom, #cf8068, #9a4331); }- .gla .purse .steel { background: linear-gradient(to bottom, #c8bc84, #8f8249); }+ .moneyplate .steel { background: linear-gradient(to bottom, #7d8691, #b0b8c1); }+ .china .moneyplate .steel { background: linear-gradient(to bottom, #9a4331, #cf8068); }+ .gla .moneyplate .steel { background: linear-gradient(to bottom, #8f8249, #c8bc84); }.moneywell { background-color: #020405; }.moneywell .lip { position: absolute; left: 0; top: 0; right: 0; bottom: 0; border: 1px solid #06090b;border-bottom-color: #b4bec8; border-right-color: #b4bec8; }@@ -180,28 +185,27 @@left a gap under it */.groove.stack { margin: 0; }- /* the power bar is the page's: a row of cells across the frame, lit from the left up to the+ /* the power bar is the page's: a column of cells up the groove, lit from the bottom up to theproduction in the power bar's own green, yellow or red, a black line between every two, and theconsumption a white needle across them. Full is every cell, lip to lip */- /* the row's height is the frame's inside, {{powerframe.inner}}, written in: a percentage of a- height set by top and bottom does not resolve here, and the cells came out with none */- .cells { position: absolute; left: 1px; top: 1px; right: 1px; }- /* each cell stands at its own {{x}} and {{w}} in pixels, and the gap is the inner block's margin:- floated at a percentage the fortieth cell fell onto a second row, and a percentage of an- absolutely placed box does not resolve here at all */- .cells .cell { position: absolute; top: 0; }- .cells .seg { margin-right: 1px; background-color: #0d1512; background-size: 100% 100%; background-repeat: no-repeat; }+ /* the column's width is the frame's inside, {{powerframe.inner}}, written in: a percentage of a+ width set by left and right does not resolve here, and the cells came out with none */+ .cells { position: absolute; left: 1px; top: 1px; bottom: 1px; }+ /* each cell stands at its own {{y}} and {{h}} in pixels, and the gap is the inner block's margin:+ a percentage of an absolutely placed box does not resolve here at all */+ .cells .cell { position: absolute; left: 0; }+ .cells .seg { margin-top: 1px; background-color: #0d1512; background-size: 100% 100%; background-repeat: no-repeat; }.cells .lit .seg { background-image: url(PowerBarGreen); }.cells.yellow .lit .seg { background-image: url(PowerBarYellow); }.cells.red .lit .seg { background-image: url(PowerBarRed); }- /* the needle is a gauge pointer through the whole groove: a white stem outlined in black so it- reads on a lit cell as well as a dark one, capped top and bottom where it crosses the groove's- edges. It stands after the lip so the lip does not cut it */- .needle { position: absolute; top: -2px; bottom: -2px; width: 4px; margin-left: -2px; background-color: #000000; }+ /* the needle is a gauge pointer through the whole groove at {{power.needley}} pixels down: a white+ stem outlined in black so it reads on a lit cell as well as a dark one, capped left and right+ where it crosses the groove's edges. It stands after the lip so the lip does not cut it */+ .needle { position: absolute; left: -2px; right: -2px; height: 4px; margin-top: -1px; background-color: #000000; }.needle .stem { position: absolute; left: 1px; right: 1px; top: 1px; bottom: 1px; background-color: #f4f6f8; }- .needle .cap { position: absolute; left: -1px; width: 4px; height: 1px; border: 1px solid #000000; background-color: #f4f6f8; }- .needle .head { top: -1px; }- .needle .foot { bottom: -1px; }+ .needle .cap { position: absolute; top: -1px; width: 1px; height: 4px; border: 1px solid #000000; background-color: #f4f6f8; }+ .needle .head { left: -1px; }+ .needle .foot { right: -1px; }.china .groove { border-bottom-color: #d98a72; border-right-color: #d98a72; }.gla .groove { border-bottom-color: #cbbf82; border-right-color: #cbbf82; }@@ -252,22 +256,21 @@.china .step { background: linear-gradient(to bottom, #6a2a1c, #3f160f); border-top-color: #f0b8a4; }.gla .step { background: linear-gradient(to bottom, #665b31, #3c3519); border-top-color: #ebe2b4; }- /* the idle worker: a key at the purse's left end, over the worker bars */- .idle .key { left: 0; top: 0; }+ /* the idle worker: a key in a tab standing on the skills key's, 38 by 22 */+ .idle .key { left: 2px; top: 3px; }.idle .icon { background-image: url(Icons/IdleWorker.svg); }.watching .idle { display: none; }- /* the command panel's attack and hold position: keys over their places' holes, dark until the- pointer lifts them as lit steel, a picture in the middle of the 38 by 33 cell */- .order { background-color: #020405; }- .order:hover { background: linear-gradient(to bottom, #b3bbc4, #5a626c); }- .china .order:hover { background: linear-gradient(to bottom, #d58a70, #7a3120); }- .gla .order:hover { background: linear-gradient(to bottom, #cabe86, #766a3a); }- .held .order:hover { background: linear-gradient(to bottom, #151a1f, #3a414a); }- .order .icon { position: absolute; left: 11px; top: 8px; width: 16px; height: 16px;- background-size: 100% 100%; background-repeat: no-repeat; }- .order.attack .icon { background-image: url(Icons/OrderAttack.svg); }- .order.hold .icon { background-image: url(Icons/OrderHold.svg); }+ /* the command panel's attack and hold position: keys over their places' holes wearing cameos+ painted for them (Code/Tools/order_cameos.py, the mapped images ReforgedOrderAttack and+ ReforgedOrderHold), with the game's own lit and pushed overlays over them the way its command+ buttons wear them */+ .order { background-size: 100% 100%; background-repeat: no-repeat; }+ .order.attack { background-image: url(ReforgedOrderAttack); }+ .order.hold { background-image: url(ReforgedOrderHold); }+ .order .glow { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background-size: 100% 100%; background-repeat: no-repeat; }+ .order:hover .glow { background-image: url(Cameo_hilited); }+ .held .order:hover .glow { background-image: url(Cameo_push); }/* the under-attack light: a red lamp in a tab on the radar's bezel, dark until the bar blinks it.The tab is 66 by 14 and the lamp a bar 54 by 10 with its rim */@@ -368,19 +371,22 @@<div class="shade" style="right: -{{wbar.br}}px; top: -{{wbar.bt}}px; bottom: -{{wbar.bb}}px"></div><div class="sunk grid" style="width: {{wbar.w}}px; height: {{wbar.h}}px"></div></div>- <!-- the purse stands on the worker bars; drawn after them, it takes the top of their steel -->- <div class="piece bezel solid purse {{purse.shown}}" style="left: {{purse.x}}px; top: {{purse.y}}px; width: {{purse.w}}px; height: {{purse.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>- <div class="shade" style="right: 0; top: 0; bottom: 0"></div>+ <!-- the power bar standing up in its groove at the W bar's right, the way the experience bar+ stands beside the radar -->+ <div class="piece groove solid stack {{powerframe.shown}}" style="left: {{powerframe.x}}px; top: {{powerframe.y}}px; width: {{powerframe.w}}px; height: {{powerframe.h}}px">+ <div class="cells {{power.state}}" style="width: {{powerframe.inner}}px"><div class="cell {{lit}}" data-each="powercells" style="top: {{y}}px; height: {{h}}px; width: {{powerframe.inner}}px"><div class="seg" style="width: {{powerframe.inner}}px; height: {{segh}}px"></div></div></div>+ <div class="lip"></div>+ <div class="needle {{power.consumes}}" style="top: {{power.needley}}px"><div class="stem"></div><div class="cap head"></div><div class="cap foot"></div></div></div>- <div class="piece idle {{purse.shown}} {{ButtonIdleWorker.state}}" style="left: {{workerkey.x}}px; top: {{workerkey.y}}px">+ <div class="piece tab idle {{idletab.shown}} {{ButtonIdleWorker.state}}" style="left: {{idletab.x}}px; top: {{idletab.y}}px; width: {{idletab.w}}px; height: {{idletab.h}}px"><div class="key" data-click="press:ButtonIdleWorker"><div class="icon"></div><div class="veil"></div></div></div>- <div class="piece groove solid stack {{powerframe.shown}}" style="left: {{powerframe.x}}px; top: {{powerframe.y}}px; width: {{powerframe.w}}px; height: {{powerframe.h}}px">- <div class="cells {{power.state}}" style="height: {{powerframe.inner}}px"><div class="cell {{lit}}" data-each="powercells" style="left: {{x}}px; width: {{w}}px; height: {{powerframe.inner}}px"><div class="seg" style="height: {{powerframe.inner}}px"></div></div></div>- <div class="lip"></div>- <div class="needle {{power.consumes}}" style="left: {{power.needle}}%"><div class="stem"></div><div class="cap head"></div><div class="cap foot"></div></div>+ <!-- the money, a plate hanging from the screen's top edge in its middle -->+ <div class="piece bezel solid moneyplate {{moneyplate.shown}}" style="left: {{moneyplate.x}}px; top: {{moneyplate.y}}px; width: {{moneyplate.w}}px; height: {{moneyplate.h}}px">+ <div class="steel" style="left: 0; right: 0; top: 0; bottom: 0"></div>+ <div class="lit" style="left: 0; top: 0; bottom: 0"></div>+ <div class="shade" style="right: 0; top: 0; bottom: 0"></div>+ <div class="base" style="left: 0; right: 0; bottom: 0"></div></div><div class="piece moneywell solid {{moneyblock.shown}}" style="left: {{moneyblock.x}}px; top: {{moneyblock.y}}px; width: {{moneyblock.w}}px; height: {{moneyblock.h}}px"><div class="lip"></div></div><div class="piece frame bezel solid {{portrait.shown}}" style="left: {{portrait.x}}px; top: {{portrait.y}}px; width: {{portrait.w}}px; height: {{portrait.h}}px; border-width: {{portrait.bt}}px {{portrait.br}}px {{portrait.bb}}px {{portrait.bl}}px">@@ -392,8 +398,8 @@</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 class="edge" style="left: -{{ring}}px; top: -{{ring}}px; right: -{{ring}}px; bottom: -{{ring}}px; border-width: {{ring}}px"></div><div class="bevel"></div></div><div class="piece commandcell" data-each="portraitcells" style="left: {{cell.x}}px; top: {{cell.y}}px; width: {{cell.w}}px; height: {{cell.h}}px"><div class="edge" style="left: -{{ring}}px; top: -{{ring}}px; right: -{{ring}}px; bottom: -{{ring}}px; border-width: {{ring}}px"></div><div class="bevel"></div></div>- <div class="piece order attack {{attackkey.shown}}" data-click="order:attack" style="left: {{attackkey.x}}px; top: {{attackkey.y}}px; width: {{attackkey.w}}px; height: {{attackkey.h}}px"><div class="icon"></div></div>- <div class="piece order hold {{holdkey.shown}}" data-click="order:hold" style="left: {{holdkey.x}}px; top: {{holdkey.y}}px; width: {{holdkey.w}}px; height: {{holdkey.h}}px"><div class="icon"></div></div>+ <div class="piece order attack {{attackkey.shown}}" data-click="order:attack" style="left: {{attackkey.x}}px; top: {{attackkey.y}}px; width: {{attackkey.w}}px; height: {{attackkey.h}}px"><div class="glow"></div></div>+ <div class="piece order hold {{holdkey.shown}}" data-click="order:hold" style="left: {{holdkey.x}}px; top: {{holdkey.y}}px; width: {{holdkey.w}}px; height: {{holdkey.h}}px"><div class="glow"></div></div><div class="piece frame bezel solid {{skilltray.shown}}" style="left: {{skilltray.x}}px; top: {{skilltray.y}}px; width: {{skilltray.w}}px; height: {{skilltray.h}}px; border-width: {{skilltray.bt}}px {{skilltray.br}}px {{skilltray.bb}}px {{skilltray.bl}}px"><div class="steel" style="left: -{{skilltray.bl}}px; right: -{{skilltray.br}}px; top: -{{skilltray.bt}}px; bottom: -{{skilltray.bb}}px"></div>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/OrderAttack.svg b/GeneralsMD/Code/Data/Window/Html/Icons/OrderAttack.svgdeleted file mode 100644index a66c5d00c..000000000--- a/GeneralsMD/Code/Data/Window/Html/Icons/OrderAttack.svg+++ /dev/null@@ -1,4 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">- <path d="M4 4 17.5 17.5M20 4 6.5 17.5" fill="none" stroke="#eef2f5" stroke-width="2.6" stroke-linecap="round"/>- <path d="M14.5 20.5 20.5 14.5M9.5 20.5 3.5 14.5" fill="none" stroke="#eef2f5" stroke-width="2.4" stroke-linecap="round"/>-</svg>diff --git a/GeneralsMD/Code/Data/Window/Html/Icons/OrderHold.svg b/GeneralsMD/Code/Data/Window/Html/Icons/OrderHold.svgdeleted file mode 100644index c1b01e240..000000000--- a/GeneralsMD/Code/Data/Window/Html/Icons/OrderHold.svg+++ /dev/null@@ -1,5 +0,0 @@-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">- <path d="M7 22V2.5" fill="none" stroke="#eef2f5" stroke-width="2.4" stroke-linecap="round"/>- <path d="M8.2 3.5H19.5L16.5 7.75 19.5 12H8.2Z" fill="#eef2f5"/>- <path d="M3 22H11" fill="none" stroke="#eef2f5" stroke-width="2.4" stroke-linecap="round"/>-</svg>diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.hindex a159e8ca4..bd621a1ac 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBar.h@@ -1557,6 +1557,13 @@ extern Bool ControlBarPanelDesignToScreen( Int panel, const IRegion2D *design,extern Real ControlBarUniformScale( void );extern Real ControlBarUniformScaleFor( Int displayWidth, Int displayHeight ); ///< ...for a screen you name+/** The scale the bottom HUD's page and everything laid out on it are drawn at: the uniform scale cut+ * to CONTROL_BAR_HUD_PERCENT of itself, the owner's "too big" of 2026-09-28, and never below 1. The+ * tooltips, the boards and the menus keep the uniform scale. */+enum { CONTROL_BAR_HUD_PERCENT = 70 };+extern Real ControlBarHudScale( void );+extern Real ControlBarHudScaleFor( Int displayWidth, Int displayHeight );+/** Undo the .wnd loader's separate-axis stretch over a whole layout: every window under 'root' is* recovered to its authored 800x600 rectangle and put back at ControlBarUniformScale(), anchored* at the given fraction of the screen (0 = left/top edge, 1 = right/bottom, 0.5 = centred) withdiff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h b/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.hindex 49d11dcff..1794d4104 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/HtmlOverlay.h@@ -57,6 +57,9 @@ public:void draw( void );+ /** Lay the page out at ControlBarHudScale(), the bottom HUD's, rather than the uniform scale. */+ void setHud( Bool hud );+/** Fade everything the page draws, text, fills and images, 0 to 255; 255 until it is set. */void setAlpha( Int alpha );diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex a4a8f9f69..fce62b958 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -1514,6 +1514,22 @@ Real ControlBarUniformScale( void )return ControlBarUniformScaleFor( TheDisplay->getWidth(), TheDisplay->getHeight() );}+//-------------------------------------------------------------------------------------------------+Real ControlBarHudScaleFor( Int displayWidth, Int displayHeight )+{+ const Real s = ControlBarUniformScaleFor( displayWidth, displayHeight ) * CONTROL_BAR_HUD_PERCENT / 100.0f;+ return s < 1.0f ? 1.0f : s;+}++//-------------------------------------------------------------------------------------------------+Real ControlBarHudScale( void )+{+ if( TheDisplay == NULL )+ return 1.0f;++ return ControlBarHudScaleFor( TheDisplay->getWidth(), TheDisplay->getHeight() );+}+//-------------------------------------------------------------------------------------------------/** One window of a layout being taken out of the loader's stretched space, and everything under it.* Positions are relative to the parent, so both the parent's old and its new screen origin traveldiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cppindex 62865ee2d..f41b9a50b 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/HtmlOverlay.cpp@@ -200,6 +200,8 @@ private:UnsignedInt m_stamp;std::string m_clicked;Int m_alpha; ///< the whole page's, OPAQUE_ALPHA unless it is fading+public:+ Bool m_hud; ///< laid out at ControlBarHudScale(), the bottom HUD's own};//-------------------------------------------------------------------------------------------------@@ -210,7 +212,8 @@ HtmlOverlayContainer::HtmlOverlayContainer( const AsciiString &defaultFont ) :m_screenWidth( 0 ),m_screenHeight( 0 ),m_stamp( 0 ),- m_alpha( OPAQUE_ALPHA )+ m_alpha( OPAQUE_ALPHA ),+ m_hud( FALSE ){}@@ -231,7 +234,7 @@ void HtmlOverlayContainer::setPage( const std::string &html ){const Int width = TheDisplay->getWidth();const Int height = TheDisplay->getHeight();- const Real scale = ControlBarUniformScale();+ const Real scale = m_hud ? ControlBarHudScale() : ControlBarUniformScale();if( m_document && html == m_page && width == m_screenWidth && height == m_screenHeight && scale == m_scale )return;@@ -794,6 +797,7 @@ HtmlOverlay::~HtmlOverlay( void )void HtmlOverlay::setPage( const std::string &html ) { m_container->setPage( html ); }void HtmlOverlay::draw( void ) { m_container->draw(); }+void HtmlOverlay::setHud( Bool hud ) { m_container->m_hud = hud; }void HtmlOverlay::setAlpha( Int alpha ) { m_container->setAlpha( alpha ); }Bool HtmlOverlay::hover( const ICoord2D &mouse ) { return m_container->hover( mouse ); }std::string HtmlOverlay::click( const ICoord2D &mouse ) { return m_container->click( mouse ); }diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cppindex 5b20a4e9c..421ca4285 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/InGameUI.cpp@@ -10890,7 +10890,8 @@ static void putPowerBar( HtmlValues &values, std::vector< HtmlValues > &cells )enum{ONE_UNIT_NEEDLE_TENTHS = 15, ///< a consumption of 1 is drawn as 1.5: log(1) is 0, and 1 is not nothing- POWER_CELLS = 40 ///< the bar is drawn as this many cells, lit up to the production+ POWER_CELLS = 20 ///< the bar is drawn as this many cells, lit up to the production; forty+ ///< stood across the old bar, and up the worker bar's height a cell was two pixels};Player *player = TheControlBar->isObserverControlBarOn() ? TheControlBar->getObserverLookAtPlayer()@@ -10902,23 +10903,27 @@ static void putPowerBar( HtmlValues &values, std::vector< HtmlValues > &cells )const Real needle = consumption == 1 ? ONE_UNIT_NEEDLE_TENTHS / 10.0f : (Real)consumption;values[ "power.fill" ] = std::to_string( REAL_TO_INT( fill * PERCENT ) );values[ "power.needle" ] = std::to_string( REAL_TO_INT( powerBarShare( needle ) * PERCENT ) );- // with nothing drawing power the needle stood at nought, a white bar across the bar's head+ // with nothing drawing power the needle stood at nought, a white bar across the bar's footvalues[ "power.consumes" ] = consumption > 0 ? "" : "hidden";- // each cell gets its place and width in the page's pixels, cut from the frame's inside so they- // add up to it exactly: floated at a percentage each the page rounded them up and the fortieth- // fell onto a second row, and a percentage of an absolutely placed box does not resolve at all+ // the bar stands up: each cell gets its place and height in the page's pixels from the bottom,+ // cut from the frame's inside so they add up to it exactly - floated at a percentage each the+ // page rounded them up, and a percentage of an absolutely placed box does not resolve at all.+ // The needle is a pixel place for the same reasonenum { FRAME_LIP = 1 };- const Int row = atoi( values[ "powerframe.w" ].c_str() ) - 2 * FRAME_LIP;+ const Int column = atoi( values[ "powerframe.h" ].c_str() ) - 2 * FRAME_LIP;+ values[ "power.needley" ] = std::to_string( column - REAL_TO_INT( powerBarShare( needle ) * column ) );cells.clear();const Int lit = REAL_TO_INT( fill * POWER_CELLS );- for( Int cell = 0; cell < POWER_CELLS && row > 0; cell++ )+ for( Int cell = 0; cell < POWER_CELLS && column > 0; cell++ ){- const Int left = cell * row / POWER_CELLS;+ const Int top = column - ( cell + 1 ) * column / POWER_CELLS;HtmlValues entry;entry[ "lit" ] = cell < lit ? "lit" : "";- entry[ "x" ] = std::to_string( left );- entry[ "w" ] = std::to_string( ( cell + 1 ) * row / POWER_CELLS - left );+ entry[ "y" ] = std::to_string( top );+ const Int height = column - cell * column / POWER_CELLS - top;+ entry[ "h" ] = std::to_string( height );+ entry[ "segh" ] = std::to_string( max( 0, height - 1 ) ); // the black line over itcells.push_back( entry );}if( consumption > production )@@ -11054,10 +11059,11 @@ static const char *const CONTROL_BAR_LEFT[] = { "LeftHUD", NULL };static const Int COMMAND_BUTTONS = 14; ///< ButtonCommand01 to 14, the command set a player seesstatic const Int UPGRADE_CAMEOS = 5; ///< UnitUpgrade1 to 5, a single unit's upgrades in the portrait bar-/** The bar as the owner drew it on 2026-09-28, 800x600 pixels: from the left, the radar with the- * experience bar beside it, the command panel with the portrait bar on it, and the Q and W worker- * bars a row lower with the purse, the money and the power bar, on them. Over the radar the skills- * key stands on the under-attack light at its left hand end and the smoke signals at its right. */+/** The bar as the owner drew it on 2026-09-28, 800x600 pixels at ControlBarHudScale(): from the left,+ * the radar with the experience bar beside it, the command panel with the portrait bar on it, and+ * the Q and W worker bars a row lower, the power bar standing up at the W bar's right. Over the+ * radar the idle worker's key stands on the skills key, the skills key on the under-attack light at+ * its left hand end, and the smoke signals at its right. The money hangs from the screen's top. */enum{COMMAND_BUTTON_WIDTH = 50, ///< a command button as ControlBar.wnd authors it, the promotion screen's cell@@ -11071,8 +11077,10 @@ enumWORKER_COLUMNS = 4, ///< a worker bar is its chord's keys: Q W E R over Z X C VWORKER_ROWS = 2,PORTRAIT_WIDTH = 44, ///< the portrait's cell, a cell's height at the portrait's own shape- PORTRAIT_PLACES = 6, ///< the portrait bar's cells after the portrait: a unit's five upgrades and one- ///< more, which ends the bar where the owner's drawing does+ PORTRAIT_PLACES = 7, ///< the most cells the portrait bar holds in one row after the portrait; it is+ ///< only as long as what it holds+ RADAR_WIDTH = 167, ///< the radar, as ControlBar.wnd authors LeftHUD+ RADAR_HEIGHT = 152,EXPERIENCE_WIDTH = 12, ///< the experience bar's groove, the radar's heightEXPERIENCE_GAP = 4, ///< between it and the radarPANEL_FOOT = 4, ///< a grid's ring over the screen's bottom edge, the steel under it@@ -11082,11 +11090,12 @@ enumSIGNAL_BUTTONS = 3, ///< attack, defend, lookSIGNAL_STEP_WIDTH = 104, ///< the signals' step on the radar panel's border at its right hand end,SIGNAL_STEP_HEIGHT = 24, ///< three keys side by side- PURSE_KEY_WIDTH = 34, ///< the idle worker's key at the purse's left end, with its rim- PURSE_KEY_HEIGHT = 20,- PURSE_POWER_HEIGHT = 12, ///< the power bar's groove, frame and lip- PURSE_MONEY_WIDTH = 104, ///< the money's well at the purse's right end- PURSE_MONEY_HEIGHT = 18,+ IDLE_TAB_WIDTH = 38, ///< the idle worker's key in a tab on the skills key's, with its rim+ IDLE_TAB_HEIGHT = 22,+ POWER_WIDTH = 12, ///< the power bar's groove up the W worker bar's right, frame and lip+ MONEY_WIDTH = 104, ///< the money's well in its plate at the screen's top+ MONEY_HEIGHT = 18,+ MONEY_PLATE_BORDER = 5, ///< the plate's steel round the wellSKILL_GRID_GAP = 12, ///< between the general's powers' tray and what it stands onSKILL_TRAY_BORDER = 6, ///< the tray's steel round its cellsQUEUE_TRAY_BORDER = 3, ///< the production queue's tray's, thinner, since the row runs over the battlefield@@ -11096,7 +11105,7 @@ enum/** A grid cell's size on screen. */static ICoord2D cellSize( void ){- const Real scale = ControlBarUniformScale();+ const Real scale = ControlBarHudScale();ICoord2D cell;cell.x = REAL_TO_INT( CELL_WIDTH * scale );cell.y = REAL_TO_INT( CELL_HEIGHT * scale );@@ -11180,7 +11189,8 @@ static Bool controlBarUnion( const char *const *names, IRegion2D &box )return found;}-static void putPageRect( HtmlValues &values, const std::string &name, const IRegion2D &rect, Bool shown );+static void putPageRect( HtmlValues &values, const std::string &name, const IRegion2D &rect, Bool shown,+ Real scale = ControlBarUniformScale() );/** A panel's steel, 800x600 pixels. */enum@@ -11216,7 +11226,7 @@ static IRegion2D framed( const IRegion2D &content, Int border, Bool againstLeft,* the container fits what it holds exactly; `name`.shown as putPageRect writes it. */static void putFrame( HtmlValues &values, const std::string &name, const IRegion2D &content, const IRegion2D &box, Bool shown ){- const Real scale = ControlBarUniformScale();+ const Real scale = ControlBarHudScale();struct Edge { static Int page( Int screen, Real scale ) { return REAL_TO_INT_FLOOR( screen / scale + 0.5f ); } };const Int left = Edge::page( box.lo.x, scale ), top = Edge::page( box.lo.y, scale );const Int innerLeft = Edge::page( content.lo.x, scale ), innerTop = Edge::page( content.lo.y, scale );@@ -11237,7 +11247,7 @@ static void putFrame( HtmlValues &values, const std::string &name, const IRegion/** A tab of `width` by `height` 800x600 pixels standing on `box`'s top edge, from its left or its right. */static IRegion2D tabOn( const IRegion2D &box, Int width, Int height, Bool fromRight ){- const Real scale = ControlBarUniformScale();+ const Real scale = ControlBarHudScale();IRegion2D tab;tab.hi.y = box.lo.y;tab.lo.y = tab.hi.y - REAL_TO_INT( height * scale );@@ -11267,15 +11277,15 @@ static IRegion2D windowScreenRect( GameWindow *window )/** The page's ring of steel round a picture with `gap` screen pixels to its neighbour: half of it in* the page's pixels, so two rings meet in the gap, and one at least, which is the bevel. */-static Int pageRing( Int gap )+static Int pageRing( Int gap, Real scale ){- return max( 1, (Int)REAL_TO_INT_FLOOR( gap / ControlBarUniformScale() / 2 ) );+ return max( 1, (Int)REAL_TO_INT_FLOOR( gap / scale / 2 ) );}/** One cell of a grid for the page: the picture's hole as `cell` and the ring round it. */-static void putCell( HtmlValues &entry, const IRegion2D &picture, Int ring )+static void putCell( HtmlValues &entry, const IRegion2D &picture, Int ring, Real scale ){- putPageRect( entry, "cell", picture, TRUE );+ putPageRect( entry, "cell", picture, TRUE, scale );entry[ "ring" ] = std::to_string( ring );}@@ -11283,7 +11293,7 @@ static void putCell( HtmlValues &entry, const IRegion2D &picture, Int ring )* edge on `left`, screen pixels. */static IRegion2D gridBox( Int left, Int bottom, Int columns, Int rows ){- const Real scale = ControlBarUniformScale();+ const Real scale = ControlBarHudScale();IRegion2D box;box.lo.x = left;box.hi.x = left + REAL_TO_INT( columns * ( CELL_WIDTH + CELL_GAP ) * scale );@@ -11296,7 +11306,7 @@ static IRegion2D gridBox( Int left, Int bottom, Int columns, Int rows )* same room, the portrait bar's when a selection has more types than it has places. */static IRegion2D gridCell( const IRegion2D &box, Int column, Int row, Real share = 1.0f ){- const Real scale = ControlBarUniformScale() * share;+ const Real scale = ControlBarHudScale() * share;IRegion2D cell;cell.lo.x = box.lo.x + REAL_TO_INT( ( CELL_GAP / 2 + column * ( CELL_WIDTH + CELL_GAP ) ) * scale );cell.lo.y = box.lo.y + REAL_TO_INT( ( CELL_GAP / 2 + row * ( CELL_HEIGHT + CELL_GAP ) ) * scale );@@ -11306,43 +11316,26 @@ static IRegion2D gridCell( const IRegion2D &box, Int column, Int row, Real share}//--------------------------------------------------------------------------------------------------/** The purse, the steel standing on the two worker bars level with the command panel's top: the idle- * worker's key at its left end, the power bar's groove across the middle and the money's well at- * its right end, each centred down it. The money's window is moved into its well, cut to its line- * of text, and the power bar's under its groove, so its tooltip stands on the bar. Written as- * purse, workerkey, powerframe and moneyblock. */+/** The money, a steel plate hanging from the screen's top edge in its middle with the figure in a+ * dark well, the owner's call of 2026-09-28: a glance up rather than down into the bar. The money's+ * window is moved into the well, cut to its line of text. Written as moneyplate and moneyblock. *///--------------------------------------------------------------------------------------------------static void putPurse( HtmlValues &values, const IRegion2D &purse, Bool shown )+static void putMoney( HtmlValues &values, Bool shown ){- const Real scale = ControlBarUniformScale();- const Int border = REAL_TO_INT( PANEL_BORDER * scale );- const Int middle = ( purse.lo.y + purse.hi.y ) / 2;- struct Row- {- static IRegion2D across( Int left, Int right, Int middle, Int height )- {- IRegion2D row;- row.lo.x = left;- row.hi.x = right;- row.lo.y = middle - height / 2;- row.hi.y = row.lo.y + height;- return row;- }- };- const Int keyLeft = purse.lo.x + border;- const IRegion2D key = Row::across( keyLeft, keyLeft + REAL_TO_INT( PURSE_KEY_WIDTH * scale ), middle,- REAL_TO_INT( PURSE_KEY_HEIGHT * scale ) );- const Int moneyRight = purse.hi.x - border;- const IRegion2D money = Row::across( moneyRight - REAL_TO_INT( PURSE_MONEY_WIDTH * scale ), moneyRight, middle,- REAL_TO_INT( PURSE_MONEY_HEIGHT * scale ) );- const IRegion2D power = Row::across( key.hi.x + border, money.lo.x - border, middle,- REAL_TO_INT( PURSE_POWER_HEIGHT * scale ) );-- putPageRect( values, "purse", purse, shown );- putPageRect( values, "workerkey", key, shown );- putPageRect( values, "powerframe", power, shown );- putPageRect( values, "moneyblock", money, shown );- TheControlBar->placeWindowAt( controlBarWindow( "PowerWindow" ), power );+ const Real scale = ControlBarHudScale();+ const Int border = REAL_TO_INT( MONEY_PLATE_BORDER * scale );+ IRegion2D money;+ money.lo.x = ( TheDisplay->getWidth() - REAL_TO_INT( MONEY_WIDTH * scale ) ) / 2;+ money.hi.x = money.lo.x + REAL_TO_INT( MONEY_WIDTH * scale );+ money.lo.y = border;+ money.hi.y = money.lo.y + REAL_TO_INT( MONEY_HEIGHT * scale );+ IRegion2D plate = money;+ plate.lo.x -= border;+ plate.hi.x += border;+ plate.lo.y = 0;+ plate.hi.y += border;+ putPageRect( values, "moneyplate", plate, shown, scale );+ putPageRect( values, "moneyblock", money, shown, scale );// the font's height is the line without the drop shadow and the accents over the capitals, and a// window that tall had the figure standing out over its block; half as much again holds it@@ -11350,28 +11343,40 @@ static void putPurse( HtmlValues &values, const IRegion2D &purse, Bool shown )if( moneyWindow->winGetFont() ){enum { MONEY_LINE_HALVES = 3 };- TheControlBar->placeWindowAt( moneyWindow, Row::across( money.lo.x, money.hi.x, middle,- moneyWindow->winGetFont()->height * MONEY_LINE_HALVES / 2 ) );+ const Int height = moneyWindow->winGetFont()->height * MONEY_LINE_HALVES / 2;+ IRegion2D line = money;+ line.lo.y = ( money.lo.y + money.hi.y - height ) / 2;+ line.hi.y = line.lo.y + height;+ TheControlBar->placeWindowAt( moneyWindow, line );}+}++//-------------------------------------------------------------------------------------------------+/** The power bar standing up in its groove at `groove`, screen pixels, with the power window moved+ * under it so its tooltip stands on the bar. The page lays boxes out content-box whatever+ * box-sizing says, so the groove's border goes on top of its width and height: it is handed the+ * content, and the width inside its lip for the cells. Written as powerframe. */+//-------------------------------------------------------------------------------------------------+static void putPowerGroove( HtmlValues &values, const IRegion2D &groove, Bool shown )+{+ putPageRect( values, "powerframe", groove, shown, ControlBarHudScale() );+ TheControlBar->placeWindowAt( controlBarWindow( "PowerWindow" ), groove );- // the page lays boxes out content-box whatever box-sizing says, so the frame's border goes on top- // of its width and height: hand it the content, and the height inside its lip for the cells, since- // a percentage of a height set by top and bottom does not resolve in the page eitherenum { FRAME_BORDER = 2, FRAME_LIP = 1 };const Int width = atoi( values[ "powerframe.w" ].c_str() ) - 2 * FRAME_BORDER;const Int height = atoi( values[ "powerframe.h" ].c_str() ) - 2 * FRAME_BORDER;values[ "powerframe.w" ] = std::to_string( width > 0 ? width : 0 );values[ "powerframe.h" ] = std::to_string( height > 0 ? height : 0 );- values[ "powerframe.inner" ] = std::to_string( height > 2 * FRAME_LIP ? height - 2 * FRAME_LIP : 0 );+ values[ "powerframe.inner" ] = std::to_string( width > 2 * FRAME_LIP ? width - 2 * FRAME_LIP : 0 );}-/** `name`.x, .y, .w and .h in the page's pixels, and `name`.shown "shown" or "hidden". */-static void putPageRect( HtmlValues &values, const std::string &name, const IRegion2D &rect, Bool shown )+/** `name`.x, .y, .w and .h in the page's pixels, `scale` screen pixels to one, and `name`.shown+ * "shown" or "hidden". */+static void putPageRect( HtmlValues &values, const std::string &name, const IRegion2D &rect, Bool shown, Real scale ){// every edge is rounded once, on its own, so two boxes that share an edge on screen share it on// the page too: rounding a width and a height separately left the stacked blocks a pixel or two// apart- const Real scale = ControlBarUniformScale();const Int left = REAL_TO_INT_FLOOR( rect.lo.x / scale + 0.5f );const Int top = REAL_TO_INT_FLOOR( rect.lo.y / scale + 0.5f );const Int right = REAL_TO_INT_FLOOR( rect.hi.x / scale + 0.5f );@@ -11440,7 +11445,10 @@ void InGameUI::drawCellGridFront( Int grid ){HtmlOverlay *&overlay = m_cellFrontOverlay[ grid ];if( overlay == NULL )+ {overlay = new HtmlOverlay( m_superweaponNormalFont );+ overlay->setHud( TRUE );+ }HtmlValues values;HtmlLists lists;@@ -11492,15 +11500,16 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I// fifteen milliseconds, and every click on the battlefield did that twicevalues[ "held" ] = m_controlBarPageHovered && TheMouse->getMouseStatus()->leftState != MBS_Up ? "held" : "";values[ "blink" ] = !values[ "promotion" ].empty() && 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 ] );-// Every panel is a container exactly as big as what it holds, and a border outside it: steel on// the sides facing the battlefield, out to the screen's edge on the sides against it. Everything// else - the tabs, the keys, the signals - stands outside the border. The layout is the owner's- // drawing of 2026-09-28: from the left the radar with the experience bar beside it, the command- // panel with the portrait bar on it, and the Q and W worker bars a row lower with the purse on them- const Real scale = ControlBarUniformScale();+ // drawing of 2026-09-28 at ControlBarHudScale(), which is what the page is laid out at too: from+ // the left the radar with the experience bar beside it, the command panel with the portrait bar on+ // it, and the Q and W worker bars a row lower with the power bar standing up after them+ const Real scale = ControlBarHudScale();+ m_controlBarOverlay->setHud( TRUE );+ for( Int panel = 0; panel < panelCount; panel++ )+ putPageRect( values, "panel" + std::to_string( panel ), panels[ panel ], shown[ panel ], scale );const Int border = REAL_TO_INT( PANEL_BORDER * scale );const Int ring = CELL_GAP / 2;const Int foot = barBottom() - REAL_TO_INT( PANEL_FOOT * scale );@@ -11509,29 +11518,39 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, IHtmlLists lists;// the radar, and the experience bar's groove beside it as tall as it; its own window stood on the- // right panel, which is gone. The left panel holds the two+ // right panel, which is gone. The left panel holds the two. layoutPanels puts the radar at the+ // uniform scale, so it is put again at the HUD'sGameWindow *radarWindow = controlBarWindow( "LeftHUD" );const Bool leftFound = leftShown && !radarWindow->winIsHidden();- IRegion2D content = windowScreenRect( radarWindow );+ IRegion2D content;+ content.lo.x = border;+ content.hi.x = content.lo.x + REAL_TO_INT( RADAR_WIDTH * scale );+ content.hi.y = foot;+ content.lo.y = content.hi.y - REAL_TO_INT( RADAR_HEIGHT * scale );+ TheControlBar->placeWindowAt( radarWindow, content );IRegion2D experience = content;experience.lo.x = content.hi.x + REAL_TO_INT( EXPERIENCE_GAP * scale );experience.hi.x = experience.lo.x + REAL_TO_INT( EXPERIENCE_WIDTH * scale );content.hi.x = experience.hi.x;const IRegion2D leftBox = framed( content, border, TRUE, FALSE );putFrame( values, "left", content, leftBox, leftFound );- putPageRect( values, "expframe", experience, leftFound );+ putPageRect( values, "expframe", experience, leftFound, scale );putExperienceBar( values, lists[ "expcells" ], lists[ "rankstars" ] );// on the radar panel's top edge at its left hand end the under-attack light, and on the light the// skills key: the rank's stars, and the button that opens the promotion screen. A watcher, or a- // player beaten, has no promotions to buy, and the bar disables the button for him+ // player beaten, has no promotions to buy, and the bar disables the button for him. On the skills+ // key the idle worker's, the owner's place for itconst IRegion2D alertTab = tabOn( leftBox, ALERT_TAB_WIDTH, PANEL_TAB_HEIGHT, FALSE );- putPageRect( values, "alerttab", alertTab, leftFound );+ putPageRect( values, "alerttab", alertTab, leftFound, scale );const IRegion2D skillsTab = tabOn( alertTab, SKILLS_TAB_WIDTH, SKILLS_TAB_HEIGHT, FALSE );const Bool skillsShown = leftFound && ThePlayerList->getLocalPlayer()->isPlayerActive();- putPageRect( values, "skillstab", skillsTab, skillsShown );- // the event feed and the production queue's row stand on the key, or on the light without it- m_feedFloor = skillsShown ? skillsTab.lo.y : leftFound ? alertTab.lo.y : barBottom();+ putPageRect( values, "skillstab", skillsTab, skillsShown, scale );+ const IRegion2D idleTab = tabOn( skillsShown ? skillsTab : alertTab, IDLE_TAB_WIDTH, IDLE_TAB_HEIGHT, FALSE );+ const Bool idleShown = leftFound && centreShown;+ putPageRect( values, "idletab", idleTab, idleShown, scale );+ // the event feed and the production queue's row stand on the top key+ m_feedFloor = idleShown ? idleTab.lo.y : skillsShown ? skillsTab.lo.y : leftFound ? alertTab.lo.y : barBottom();// the three smoke signal buttons side by side on the same edge at its right hand end; not there at// all where the keys would do nothing either, a game with no allies to see the smoke@@ -11541,7 +11560,7 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, IsignalStep.hi.y = leftBox.lo.y;signalStep.lo.y = signalStep.hi.y - REAL_TO_INT( SIGNAL_STEP_HEIGHT * scale );const Bool signalsShown = leftFound && signalsAllowed();- putPageRect( values, "signals", signalStep, signalsShown );+ putPageRect( values, "signals", signalStep, signalsShown, scale );const UnsignedInt nowMs = timeGetTime();if( signalsShown && !m_signalsWereShown )m_signalsRiseStartMs = nowMs;@@ -11550,8 +11569,9 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, I// the command panel against the radar's: five places across the top for the unit's own abilities// and upgrades, then attack, stop and attack move, then eject, seek shelter, guard and hold- // position. The worker bars stand beside it a row lower, Q then W, and the purse on them is level- // with its top+ // position. The worker bars stand beside it a row lower, Q then W, and the power bar stands up in+ // its groove inside the W bar's frame, after its grid, the way the experience bar stands in the+ // radar's. The money hangs from the screen's topconst IRegion2D commandBox = gridBox( leftBox.hi.x + border, foot, COMMAND_COLUMNS, COMMAND_ROWS );const IRegion2D centreBox = framed( commandBox, border, FALSE, FALSE );putFrame( values, "centre", commandBox, centreBox, centreShown );@@ -11559,19 +11579,45 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, Iconst IRegion2D qFrame = framed( qBox, border, FALSE, FALSE );putFrame( values, "qbar", qBox, qFrame, centreShown );const IRegion2D wBox = gridBox( qFrame.hi.x + border, foot, WORKER_COLUMNS, WORKER_ROWS );- const IRegion2D wFrame = framed( wBox, border, FALSE, FALSE );- putFrame( values, "wbar", wBox, wFrame, centreShown );- IRegion2D purse;- purse.lo.x = qFrame.lo.x;- purse.hi.x = wFrame.hi.x;- purse.lo.y = centreBox.lo.y;- purse.hi.y = qFrame.lo.y;- putPurse( values, purse, centreShown );- putPowerBar( values, lists[ "powercells" ] ); // after the purse, whose groove it divides into cells-- // every place a command can go, shown or not, so each grid reads as a grid with the steel between- // its places and an empty place is a hole in it. A worker bar's place is its chord key's: the- // second key runs down the columns, Q Z W X E C R V as shipped+ IRegion2D power = wBox;+ power.lo.x = wBox.hi.x + REAL_TO_INT( EXPERIENCE_GAP * scale );+ power.hi.x = power.lo.x + REAL_TO_INT( POWER_WIDTH * scale );+ IRegion2D wContent = wBox;+ wContent.hi.x = power.hi.x;+ const IRegion2D wFrame = framed( wContent, border, FALSE, FALSE );+ putFrame( values, "wbar", wContent, wFrame, centreShown );+ putPowerGroove( values, power, centreShown );+ putPowerBar( values, lists[ "powercells" ] ); // after the groove, which it divides into cells+ putMoney( values, centreShown && !controlBarWindow( "MoneyDisplay" )->winIsHidden() );++ // each command button to the place its command goes to. A click only reaches a window inside+ // every one of its parents, so the buttons' two cover the whole frame; the page's solids still+ // decide what is battlefield+ const IRegion2D frameRect = windowScreenRect( TheControlBar->getMasterParent() );+ TheControlBar->placeWindowAt( controlBarWindow( "CenterBackground" ), frameRect );+ TheControlBar->placeWindowAt( controlBarWindow( "CommandWindow" ), frameRect );+ Int types[ COMMAND_BUTTONS ];+ Int where[ COMMAND_BUTTONS ];+ Bool fights = FALSE;+ for( Int button = 0; button < COMMAND_BUTTONS; button++ )+ {+ GameWindow *window = numberedWindow( "ButtonCommand", button + 1 );+ const CommandButton *command = window->winIsHidden() ? NULL : (const CommandButton *)GadgetButtonGetData( window );+ types[ button ] = command ? command->getCommandType() : GUI_COMMAND_NONE;+ fights = fights || types[ button ] == GUI_COMMAND_ATTACK_MOVE;+ }+ ControlBar_commandPlaces( types, COMMAND_BUTTONS, where );+ Bool taken[ COMMAND_PLACE_COUNT ] = { FALSE };+ for( Int button = 0; button < COMMAND_BUTTONS; button++ )+ if( where[ button ] >= 0 )+ taken[ where[ button ] ] = TRUE;+ // attack and hold position have no button in any command set: the page's keys do what A and H do,+ // for anything that attack moves. Seek shelter has nothing behind it and stays steel+ taken[ COMMAND_PLACE_ATTACK ] = taken[ COMMAND_PLACE_HOLD ] = fights;++ // a cell for every place a command stands in, and on the worker bars for every place, so a builder's+ // two bars read as its chord's keys. A worker bar's place is its chord key's: the second key runs+ // down the columns, Q Z W X E C R V as shipped. An empty place on the command panel is its steelIRegion2D place[ COMMAND_PLACE_COUNT ];for( Int each = 0; each < COMMAND_PLACE_COUNT; each++ ){@@ -11588,46 +11634,49 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, Istd::vector< HtmlValues > &commandCells = lists[ "commandcells" ];for( Int each = 0; each < COMMAND_PLACE_COUNT && centreShown; each++ ){+ if( each < COMMAND_PLACE_Q && !taken[ each ] )+ continue;HtmlValues entry;- putCell( entry, place[ each ], ring );+ putCell( entry, place[ each ], ring, scale );commandCells.push_back( entry );}-- // each command button to the place its command goes to. A click only reaches a window inside- // every one of its parents, so the buttons' two cover the whole frame; the page's solids still- // decide what is battlefield- const IRegion2D frameRect = windowScreenRect( TheControlBar->getMasterParent() );- TheControlBar->placeWindowAt( controlBarWindow( "CenterBackground" ), frameRect );- TheControlBar->placeWindowAt( controlBarWindow( "CommandWindow" ), frameRect );- Int types[ COMMAND_BUTTONS ];- Int where[ COMMAND_BUTTONS ];- Bool fights = FALSE;- for( Int button = 0; button < COMMAND_BUTTONS; button++ )- {- GameWindow *window = numberedWindow( "ButtonCommand", button + 1 );- const CommandButton *command = window->winIsHidden() ? NULL : (const CommandButton *)GadgetButtonGetData( window );- types[ button ] = command ? command->getCommandType() : GUI_COMMAND_NONE;- fights = fights || types[ button ] == GUI_COMMAND_ATTACK_MOVE;- }- ControlBar_commandPlaces( types, COMMAND_BUTTONS, where );for( Int button = 0; button < COMMAND_BUTTONS; button++ )if( where[ button ] >= 0 )TheControlBar->placeWindowAt( numberedWindow( "ButtonCommand", button + 1 ), place[ where[ button ] ] );- // attack and hold position have no button in any command set: the page's keys do what A and H do,- // for anything that attack moves. Seek shelter has nothing behind it and stays a hole- putPageRect( values, "attackkey", place[ COMMAND_PLACE_ATTACK ], centreShown && fights );- putPageRect( values, "holdkey", place[ COMMAND_PLACE_HOLD ], centreShown && fights );+ putPageRect( values, "attackkey", place[ COMMAND_PLACE_ATTACK ], centreShown && fights, scale );+ putPageRect( values, "holdkey", place[ COMMAND_PLACE_HOLD ], centreShown && fights, scale );// the portrait bar on the command panel, flush with its left edge: the portrait, then a single- // unit's upgrades or a multi-selection's types, the owner's rule. More types than places take- // smaller cells, two rows of them, then three. A watcher has no command panel and keeps the- // portrait of what he clicked, the bar standing on the screen's bottom edge in its place- const Bool portraitShown = centreShown || ( panelCount > 2 && shown[ 2 ] );+ // unit's upgrades or a multi-selection's types, the owner's rule, and only as long as what it+ // holds; with no portrait there is no bar. More types than PORTRAIT_PLACES take smaller cells, two+ // rows of them, then three. A watcher has no command panel and keeps the portrait of what he+ // clicked, the bar standing on the screen's bottom edge in its place+ GameWindow *portraitWindow = controlBarWindow( "CameoWindow" );+ const Bool portraitShown = ( centreShown || ( panelCount > 2 && shown[ 2 ] ) ) &&+ !portraitWindow->winIsHidden() && !portraitWindow->winGetParent()->winIsHidden();+ std::vector< GameWindow * > upgrades;+ for( Int upgrade = 1; upgrade <= UPGRADE_CAMEOS; upgrade++ )+ {+ GameWindow *window = controlBarWindow( "UnitUpgrade" + std::to_string( upgrade ) );+ if( !window->winIsHidden() )+ upgrades.push_back( window );+ }+ std::vector< GameWindow * > tiles;+ const std::vector< GameWindow * > &allTiles = TheControlBar->getMultiSelectTiles();+ for( size_t tile = 0; tile < allTiles.size(); tile++ )+ if( allTiles[ tile ] && !allTiles[ tile ]->winIsHidden() )+ tiles.push_back( allTiles[ tile ] );+ Int rows = 1;+ while( (Int)tiles.size() > rows * rows * PORTRAIT_PLACES )+ rows++;+ // a column of `rows` tiles is one cell wide+ const Int columns = tiles.empty() ? (Int)upgrades.size() : ( (Int)tiles.size() + rows - 1 ) / rows;+IRegion2D portraitBox;portraitBox.lo.x = commandBox.lo.x;portraitBox.hi.y = centreShown ? centreBox.lo.y - border : foot;portraitBox.lo.y = portraitBox.hi.y - REAL_TO_INT( ( CELL_HEIGHT + CELL_GAP ) * scale );- portraitBox.hi.x = portraitBox.lo.x + REAL_TO_INT( ( PORTRAIT_WIDTH + CELL_GAP + PORTRAIT_PLACES * ( CELL_WIDTH + CELL_GAP ) ) * scale );+ portraitBox.hi.x = portraitBox.lo.x + REAL_TO_INT( ( PORTRAIT_WIDTH + CELL_GAP + columns * ( CELL_WIDTH + CELL_GAP ) ) * scale );IRegion2D portraitFrame = framed( portraitBox, border, FALSE, FALSE );portraitFrame.hi.y = centreShown ? centreBox.lo.y : barBottom();putFrame( values, "portrait", portraitBox, portraitFrame, portraitShown );@@ -11635,63 +11684,47 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, ITheControlBar->placeWindowAt( controlBarWindow( "WinUnitSelected" ), portraitBox );IRegion2D portraitCell = gridCell( portraitBox, 0, 0 );portraitCell.hi.x = portraitCell.lo.x + REAL_TO_INT( PORTRAIT_WIDTH * scale );- TheControlBar->placeWindowAt( controlBarWindow( "CameoWindow" ), portraitCell );+ TheControlBar->placeWindowAt( portraitWindow, portraitCell );IRegion2D placesBox = portraitBox;placesBox.lo.x = portraitCell.hi.x + REAL_TO_INT( ring * scale );std::vector< HtmlValues > &portraitCells = lists[ "portraitcells" ];- HtmlValues portraitEntry;- putCell( portraitEntry, portraitCell, ring );if( portraitShown )- portraitCells.push_back( portraitEntry );- Int filled = 0;- for( Int upgrade = 1; upgrade <= UPGRADE_CAMEOS; upgrade++ ){- GameWindow *window = controlBarWindow( "UnitUpgrade" + std::to_string( upgrade ) );- if( !window->winIsHidden() )- TheControlBar->placeWindowAt( window, gridCell( placesBox, filled++, 0 ) );+ HtmlValues entry;+ putCell( entry, portraitCell, ring, scale );+ portraitCells.push_back( entry );}- const std::vector< GameWindow * > &tiles = TheControlBar->getMultiSelectTiles();- Int tilesShown = 0;- for( size_t tile = 0; tile < tiles.size(); tile++ )- if( tiles[ tile ] && !tiles[ tile ]->winIsHidden() )- tilesShown++;- Int rows = 1;- while( tilesShown > rows * rows * PORTRAIT_PLACES )- rows++;- filled = 0;- for( size_t tile = 0; tile < tiles.size(); tile++ )+ for( size_t upgrade = 0; upgrade < upgrades.size(); upgrade++ ){- if( tiles[ tile ] == NULL || tiles[ tile ]->winIsHidden() )- continue;- const IRegion2D cell = gridCell( placesBox, filled / rows, filled % rows, 1.0f / rows );- TheControlBar->placeWindowAt( tiles[ tile ], cell );- filled++;- if( rows > 1 && portraitShown )- {- HtmlValues entry;- putCell( entry, cell, 1 );+ const IRegion2D cell = gridCell( placesBox, (Int)upgrade, 0 );+ TheControlBar->placeWindowAt( upgrades[ upgrade ], cell );+ HtmlValues entry;+ putCell( entry, cell, ring, scale );+ if( portraitShown && tiles.empty() )portraitCells.push_back( entry );- }}- for( Int each = 0; each < PORTRAIT_PLACES && rows == 1 && portraitShown; each++ )+ for( size_t tile = 0; tile < tiles.size(); tile++ ){+ const IRegion2D cell = gridCell( placesBox, (Int)tile / rows, (Int)tile % rows, 1.0f / rows );+ TheControlBar->placeWindowAt( tiles[ tile ], cell );HtmlValues entry;- putCell( entry, gridCell( placesBox, each, 0 ), ring );- portraitCells.push_back( entry );+ putCell( entry, cell, rows > 1 ? 1 : ring, scale );+ if( portraitShown )+ portraitCells.push_back( entry );}// the general's powers ready to fire, the first in the corner against the screen's right edge, the// row growing left as they come and wrapping upward past three, each a cell's size. They sit in a// tray of the panels' steel only as big as they are, standing on the screen's bottom edge right of- // the worker bars where three fit there, and over the purse's end where they do not+ // the worker bars where three fit there, and over the W bar's end where they do notconst Int trayBorder = REAL_TO_INT( SKILL_TRAY_BORDER * scale );const ICoord2D cell = cellSize();const Int cellGap = REAL_TO_INT( SKILL_CELL_GAP * scale );const Int trayWidth = SPECIAL_POWER_SHORTCUT_COLS * ( cell.x + cellGap ) + 2 * trayBorder;ICoord2D corner;corner.x = TheDisplay->getWidth() - trayBorder;- corner.y = ( (Int)TheDisplay->getWidth() - wFrame.hi.x >= trayWidth ? barBottom() : purse.lo.y - REAL_TO_INT( SKILL_GRID_GAP * scale ) )+ corner.y = ( (Int)TheDisplay->getWidth() - wFrame.hi.x >= trayWidth ? barBottom() : wFrame.lo.y - REAL_TO_INT( SKILL_GRID_GAP * scale ) )- trayBorder;const Int powersShown = TheControlBar->placeSpecialPowerShortcutGrid( centreShown ? &corner : NULL, cell, cellGap );@@ -11711,7 +11744,7 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, Ipowers.lo.x = min( powers.lo.x, place.lo.x );powers.lo.y = min( powers.lo.y, place.lo.y );HtmlValues entry;- putCell( entry, place, pageRing( cellGap ) );+ putCell( entry, place, pageRing( cellGap, scale ), scale );places.push_back( entry );}IRegion2D tray = powers;@@ -11737,7 +11770,7 @@ Bool InGameUI::drawControlBarPage( const IRegion2D *panels, const Bool *shown, Iconst std::string name = CONTROL_BAR_WINDOWS[ each ];GameWindow *window = controlBarWindow( name );IRegion2D rect;- putPageRect( values, name, rect, controlBarWindowRect( window, rect ) );+ putPageRect( values, name, rect, controlBarWindowRect( window, rect ), scale );values[ name + ".state" ] = controlBarWindowState( window );}@@ -12127,7 +12160,8 @@ void InGameUI::drawPromotionPage( GameWindow *parent, Bool front )continue;HtmlValues entry;- putCell( entry, place.rect, pageRing( REAL_TO_INT( PROMOTION_CELL_GAP * ControlBarUniformScale() ) ) );+ putCell( entry, place.rect, pageRing( REAL_TO_INT( PROMOTION_CELL_GAP * ControlBarUniformScale() ), ControlBarUniformScale() ),+ ControlBarUniformScale() );entry[ "state" ] = place.button && !place.button->winIsHidden() ? promotionState( place.button ) : "empty";cells.push_back( entry );}@@ -12650,7 +12684,7 @@ void InGameUI::drawProductionStripColumn( Int left, Int bottomY )//-------------------------------------------------------------------------------------------------void InGameUI::drawQueueTray( void ){- const Real scale = ControlBarUniformScale();+ const Real scale = ControlBarHudScale();const ICoord2D cell = cellSize();const Int gap = REAL_TO_INT( SKILL_CELL_GAP * scale );const Int trayBorder = REAL_TO_INT( QUEUE_TRAY_BORDER * scale );@@ -12690,7 +12724,7 @@ void InGameUI::drawQueueTray( void )place.hi.x = place.lo.x + cell.x;place.hi.y = cellsBox.hi.y;HtmlValues entry;- putCell( entry, place, pageRing( gap ) );+ putCell( entry, place, pageRing( gap, scale ), scale );cellList.push_back( entry );}@@ -12698,6 +12732,8 @@ void InGameUI::drawQueueTray( void ){m_queueOverlay = new HtmlOverlay( m_superweaponNormalFont );m_queueFrontOverlay = new HtmlOverlay( m_superweaponNormalFont );+ m_queueOverlay->setHud( TRUE );+ m_queueFrontOverlay->setHud( TRUE );}values[ "layer" ] = "back";m_queueOverlay->setPage( HtmlTemplate_expand( m_queuePage, values, lists, lookupGameText ) );diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cppindex de91bdc8e..dc4352084 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/GUI/Gadget/W3DPushButton.cpp@@ -83,10 +83,10 @@ void W3DGadgetPushButtonImageDrawOne(GameWindow *window, WinInstanceData *instDa// PRIVATE FUNCTIONS //////////////////////////////////////////////////////////-/** The command bar's own scale, from ControlBar.cpp. Declared rather than included: ControlBar.h+/** The bottom HUD's own scale, the one its buttons are laid out at, from ControlBar.cpp. Declared rather than included: ControlBar.h* drags in the whole command-set machinery for one function that takes nothing and returns a* float. */-extern Real ControlBarUniformScale( void );+extern Real ControlBarHudScale( void );/** Point size a corner marking wears on a command button at 800x600, which is the resolution the* command bar and its 50x44 buttons were drawn for. Everything else is this times the scale the@@ -118,7 +118,7 @@ static GameFont *getBadgeFont( GameWindow *window, Real designPoints = BADGE_DESif( font == NULL )return NULL;- Int pointSize = REAL_TO_INT_FLOOR( designPoints * ControlBarUniformScale() );+ Int pointSize = REAL_TO_INT_FLOOR( designPoints * ControlBarHudScale() );if( pointSize < 6 )pointSize = 6;diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 73e9a7f35..fcd6e2972 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -11165,6 +11165,19 @@ TEST(the_hud_is_measured_at_the_command_bars_own_scale)CHECK_NEAR( ControlBarUniformScaleFor( 0, 0 ), 1.0f, 0.001f );}+/* The bottom HUD is drawn smaller than the rest, the owner's "too big": seventy percent of the+ uniform scale, so 1.26 at 1920x1080 where the boards stand at 1.8, and never under what was+ authored, so 1280x720 stays at 1 where seventy percent would have been 0.84. */+TEST(controlbar_hud_scale_is_seventy_percent_and_never_below_one)+{+ CHECK_NEAR( ControlBarHudScaleFor( 1920, 1080 ), 1.26f, 0.001f );+ CHECK_NEAR( ControlBarHudScaleFor( 3840, 2160 ), 2.52f, 0.001f );+ CHECK_NEAR( ControlBarHudScaleFor( 2560, 1080 ), 1.26f, 0.001f );+ CHECK_NEAR( ControlBarHudScaleFor( 1280, 720 ), 1.0f, 0.001f );+ CHECK_NEAR( ControlBarHudScaleFor( 800, 600 ), 1.0f, 0.001f );+ CHECK( ControlBarHudScaleFor( 1920, 1080 ) < ControlBarUniformScaleFor( 1920, 1080 ) );+}+/* A health bar is drawn in raw pixels over a tank whose own size on screen is set by the camera,and the camera fills the screen's *height*. So the bar has to follow the height too. Measuredoff the width it was two and a half times too wide on a 32:9 screen: the bar of a barracksdiff --git a/GeneralsMD/Code/Tools/order_cameos.py b/GeneralsMD/Code/Tools/order_cameos.pynew file mode 100644index 000000000..f0a8413c2--- /dev/null+++ b/GeneralsMD/Code/Tools/order_cameos.py@@ -0,0 +1,205 @@+"""The command bar's attack and hold position cameos, painted in the manner of EA's command cameos+(SSStop, SSGuard): a sign with a bevelled steel rim and four bolts standing over a painted+backdrop. No command set has a button for either order, so the game has no picture for them.++Attack is a red plate with a white crosshair over a burning sky, hold position a blue plate with a+raised palm over a blue one. Each is painted at four times its size and brought down, which is+what softens the edges into the look of the shipped art. The noise is seeded, so the file comes+out the same every time.++ python Tools/order_cameos.py # writes Data/Art/Textures/ReforgedOrders.tga+ python Tools/order_cameos.py selfcheck++The mapped images are Data/INI/MappedImages/HandCreated/ReforgedOrders.ini, whose coordinates are+CAMEO_PLACES below."""+import math+import os+import sys++import numpy as np+from PIL import Image, ImageDraw, ImageFilter++CAMEO_W, CAMEO_H = 60, 48 # every command cameo in the shipped mapped images+SUPER = 4 # painted at this many times the size+TEXTURE_W, TEXTURE_H = 128, 64+CAMEO_PLACES = {"attack": (0, 0), "hold": (64, 0)}+SEED = 20260928+OUT_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..", "Data", "Art", "Textures", "ReforgedOrders.tga")++W, H = CAMEO_W * SUPER, CAMEO_H * SUPER+++def value_noise(rng, octaves):+ """Clouds: random grids of growing size, each blown up smooth and added at half the last's weight."""+ field = np.zeros((H, W))+ weight, total = 1.0, 0.0+ for octave in range(octaves):+ cells = 3 * 2 ** octave+ grid = rng.random((cells, cells + cells // 2))+ layer = np.asarray(Image.fromarray((grid * 255).astype(np.uint8)).resize((W, H), Image.BICUBIC), dtype=float) / 255+ field += layer * weight+ total += weight+ weight /= 2+ return field / total+++def backdrop(rng, top, bottom, cloud, ground, glow=None):+ """A sky from `top` to `bottom` with clouds of `cloud`, a ragged dark ground along the foot and,+ if given, a fire's glow rising off it."""+ rows = np.linspace(0, 1, H)[:, None, None]+ sky = np.asarray(top, float) * (1 - rows) + np.asarray(bottom, float) * rows+ sky = np.broadcast_to(sky, (H, W, 3)).copy()+ clouds = np.clip((value_noise(rng, 5) - 0.42) * 2.6, 0, 1)[:, :, None]+ sky = sky * (1 - clouds * 0.7) + np.asarray(cloud, float) * clouds * 0.7+ if glow is not None:+ heat = np.clip(rows[:, :, 0] * 1.6 - 0.55, 0, 1) * np.clip(value_noise(rng, 4) * 1.6 - 0.3, 0, 1)+ sky = sky * (1 - heat[:, :, None]) + np.asarray(glow, float) * heat[:, :, None]+ image = Image.fromarray(np.clip(sky, 0, 255).astype(np.uint8), "RGB")+ draw = ImageDraw.Draw(image)+ ridge = value_noise(rng, 3)[0]+ points = [(x, int(H * 0.86 - ridge[x] * H * 0.1)) for x in range(0, W, 4)] + [(W, H), (0, H)]+ draw.polygon(points, fill=ground)+ return image+++def rim_colours(angle):+ """Steel lit from the top left: a bevel's colour at `angle` round it, 0 at the top left."""+ light = 0.5 + 0.5 * math.cos(angle)+ return tuple(int(90 + 150 * light) for _ in range(3))+++def bolt(draw, x, y, radius):+ draw.ellipse((x - radius, y - radius, x + radius, y + radius), fill=(60, 64, 70))+ draw.ellipse((x - radius + 2, y - radius + 2, x + radius - 3, y + radius - 3), fill=(215, 220, 226))+++def shadow_under(image, mask, offset):+ """A soft dark copy of `mask` under the sign, down and to the right."""+ blurred = mask.filter(ImageFilter.GaussianBlur(SUPER * 1.5))+ shifted = Image.new("L", mask.size)+ shifted.paste(blurred, (offset, offset))+ darkened = Image.new("RGB", image.size, (0, 0, 0))+ image.paste(darkened, (0, 0), shifted.point(lambda v: v * 0.6))+++def plate(image, outline, face, bolts):+ """A sign: `outline` the points of its edge, a steel rim round a `face` of colour, bolts at+ `bolts`. The rim is a ring of short strokes each shaded by the way it faces."""+ mask = Image.new("L", image.size)+ ImageDraw.Draw(mask).polygon(outline, fill=255)+ shadow_under(image, mask, SUPER * 2)+ draw = ImageDraw.Draw(image)+ draw.polygon(outline, fill=(150, 155, 162))+ count = len(outline)+ for each in range(count):+ a, b = outline[each], outline[(each + 1) % count]+ facing = math.atan2(-(b[0] - a[0]), b[1] - a[1]) - math.radians(135)+ draw.line((a, b), fill=rim_colours(facing), width=SUPER * 3)+ centre = (sum(p[0] for p in outline) / count, sum(p[1] for p in outline) / count)+ inner = [(centre[0] + (x - centre[0]) * 0.84, centre[1] + (y - centre[1]) * 0.84) for x, y in outline]+ draw.polygon(inner, fill=(30, 30, 34))+ face_points = [(centre[0] + (x - centre[0]) * 0.8, centre[1] + (y - centre[1]) * 0.8) for x, y in outline]+ shade = Image.new("L", image.size)+ ImageDraw.Draw(shade).polygon(face_points, fill=255)+ rows = np.linspace(1.18, 0.78, H)[:, None, None]+ lit = np.clip(np.broadcast_to(np.asarray(face, float), (H, W, 3)) * rows, 0, 255).astype(np.uint8)+ image.paste(Image.fromarray(lit, "RGB"), (0, 0), shade)+ for x, y in bolts:+ bolt(draw, x, y, SUPER * 2)+ return centre+++def circle_points(cx, cy, radius, count=48):+ return [(cx + radius * math.cos(2 * math.pi * i / count), cy + radius * math.sin(2 * math.pi * i / count))+ for i in range(count)]+++def attack(rng):+ image = backdrop(rng, (70, 40, 34), (190, 90, 40), (120, 110, 104), (34, 26, 20), glow=(255, 150, 40))+ cx, cy, radius = W / 2, H / 2 - SUPER, H * 0.44+ diagonal = radius * 0.62+ plate(image, circle_points(cx, cy, radius), (205, 32, 28),+ [(cx - diagonal, cy - diagonal), (cx + diagonal, cy - diagonal),+ (cx - diagonal, cy + diagonal), (cx + diagonal, cy + diagonal)])+ draw = ImageDraw.Draw(image)+ white = (248, 246, 240)+ ring = radius * 0.46+ thick = SUPER * 3+ draw.ellipse((cx - ring, cy - ring, cx + ring, cy + ring), outline=white, width=thick)+ reach, gap = radius * 0.72, radius * 0.18+ for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):+ draw.line((cx + dx * gap, cy + dy * gap, cx + dx * reach, cy + dy * reach), fill=white, width=thick)+ dot = SUPER * 2+ draw.ellipse((cx - dot, cy - dot, cx + dot, cy + dot), fill=white)+ return image+++def hold(rng):+ image = backdrop(rng, (70, 110, 170), (170, 190, 205), (235, 238, 240), (52, 48, 38))+ left, top, right, bottom = W * 0.2, SUPER * 2, W * 0.8, H - SUPER * 5+ cut = SUPER * 6+ outline = [(left + cut, top), (right - cut, top), (right, top + cut), (right, bottom - cut),+ (right - cut, bottom), (left + cut, bottom), (left, bottom - cut), (left, top + cut)]+ inset = SUPER * 5+ cx, cy = plate(image, outline, (36, 84, 190),+ [(left + inset, top + inset), (right - inset, top + inset),+ (left + inset, bottom - inset), (right - inset, bottom - inset)])+ # a raised palm: the palm, four fingers and the thumb, each a rounded bar+ draw = ImageDraw.Draw(image)+ white = (248, 246, 240)+ scale = (bottom - top) / 125.0+ cy -= 4 * scale+ palm = (cx - 20 * scale, cy - 2 * scale, cx + 20 * scale, cy + 34 * scale)+ draw.rounded_rectangle(palm, radius=10 * scale, fill=white)+ fingers = [(-15.5, 42), (-5.2, 50), (5.2, 48), (15.5, 40)]+ for x, length in fingers:+ width = 8 * scale+ draw.rounded_rectangle((cx + x * scale - width / 2, cy + 6 * scale - length * scale,+ cx + x * scale + width / 2, cy + 8 * scale), radius=width / 2, fill=white)+ thumb = Image.new("L", image.size)+ ImageDraw.Draw(thumb).rounded_rectangle((cx + 12 * scale, cy - 4 * scale, cx + 22 * scale, cy + 28 * scale),+ radius=5 * scale, fill=255)+ thumb = thumb.rotate(-35, center=(cx + 17 * scale, cy + 26 * scale), resample=Image.BICUBIC)+ image.paste(Image.new("RGB", image.size, white), (0, 0), thumb)+ return image+++def cameo(painted):+ small = painted.resize((CAMEO_W, CAMEO_H), Image.LANCZOS)+ return small.filter(ImageFilter.UnsharpMask(radius=1, percent=60, threshold=2))+++def texture():+ rng = np.random.default_rng(SEED)+ sheet = Image.new("RGBA", (TEXTURE_W, TEXTURE_H), (0, 0, 0, 0))+ for name, paint in (("attack", attack), ("hold", hold)):+ sheet.paste(cameo(paint(rng)).convert("RGBA"), CAMEO_PLACES[name])+ return sheet+++def selfcheck():+ sheet = texture()+ assert sheet.size == (TEXTURE_W, TEXTURE_H)+ for name, (x, y) in CAMEO_PLACES.items():+ picture = np.asarray(sheet.crop((x, y, x + CAMEO_W, y + CAMEO_H)), dtype=int)+ assert picture[:, :, 3].min() == 255, name # a whole cameo, no hole in it+ assert picture[:, :, :3].std() > 30, name # a picture, not a flat fill+ # red plate on the left, blue on the right: the two read apart at a glance+ attack_mid = np.asarray(sheet.crop((20, 10, 40, 30)), dtype=int)[:, :, :3].mean(axis=(0, 1))+ hold_mid = np.asarray(sheet.crop((64 + 12, 6, 64 + 20, 14)), dtype=int)[:, :, :3].mean(axis=(0, 1))+ assert attack_mid[0] > attack_mid[2], attack_mid+ assert hold_mid[2] > hold_mid[0], hold_mid+ assert np.array_equal(np.asarray(texture()), np.asarray(sheet)) # seeded: the same file every time+ print("order_cameos selfcheck ok")+++def main():+ if len(sys.argv) > 1 and sys.argv[1] == "selfcheck":+ selfcheck()+ return+ texture().save(OUT_PATH)+ print(OUT_PATH)+++if __name__ == "__main__":+ main()