Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(gameclient): centre the swatch colour in its box's hole

Olcay Seygan75fb67ba159d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9478e605f..014196d34 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,6 +70,7 @@ found and fixed — EA's own, not port damage.**
- The personality column lost its heading. A computer's row shows its level and its personality side by side; a player's row, and an open or closed seat, gives the name box the personality's room as well, so long names fit and no empty gap sits in the middle of the row.
- The record and the map list stay on top of the seats. Once you had picked an army, colour or team, those boxes drew over the open record; and the seat rows, their colour boxes and the personality list showed through the map list. The whole seat table now steps aside while the map list is open, in the skirmish, LAN and online rooms alike, and comes back as it was. The record's Close button closes it; it did nothing before.
- Select Map swaps the seat table for the map list instead of laying a small 4:3 window across the room. The list fills the seat table's whole panel under Official and Unofficial tabs in the room's own blue-framed style; its preview stands exactly where the room's map stands, and Accept and Cancel take the row of the map's name and Select Map. The map column and the match rules beside it keep their size and place.
+- The colour and team swatches sit in the middle of their boxes, with the same dark border on all four sides. The colour used to sit two pixels low, over the box's bottom edge, with a dark band along the top only.
- The three rooms wear the same frame as the loading and score screens that follow them: the score screen's blue ruler and grid around the edge of the screen, with the panel sitting on its bright line. The LAN and online panels get the blue edge the skirmish one had, under the same blue rule; the seat rows sit on the panel's black in that blue; the colour bar is a little wider. Record and Close are in capitals like every other button, the record's heading is lettered green, and the darker names in the colour list are lifted toward white so they read on black, the way the score screen lifts them.
- The menus no longer make you sit through their animations. A click or a key while buttons are still sliding or flashing in puts them where they were going, and the click counts: Solo Play pressed while the main menu is still coming up opens its list straight away, where it used to be ignored. A screen on its way out goes the moment you press anything, so Skirmish then a click reaches the skirmish room in about 100ms instead of half a second, and Back to the main menu in 10ms instead of 380.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
index 412b84045..4610d096d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameNetwork/GUIUtil.cpp
@@ -1030,18 +1030,24 @@ void LobbyStartSpotFill(Int x, Int y, Int width, Int height, Color fill)
}
// A colour swatch drawn as one of the rules page's check boxes: their own empty box, and the colour
-// inside its bevel with a little room between.
+// inside its hole with the same room on all four sides.
static void drawSwatch(GameWindow *window, WinInstanceData *instData)
{
Int x, y, width, height;
window->winGetScreenPosition(&x, &y);
window->winGetSize(&width, &height);
TheDisplay->drawImage(TheMappedImageCollection->findImageByName("Active-Unchecked"), x, y, x + width, y + height);
- const Int padding = max(2, width / 5);
- // the box art's hole sits a pixel left of and below its middle at 26 pixels (two at 4K)
- const Int holeShift = max(1, width / 26);
- TheDisplay->drawFillRect(x + padding - holeShift, y + padding + holeShift, width - 2 * padding,
- height - 2 * padding, window->winGetEnabledColor(0));
+ // the art is a 22 pixel cell whose black hole runs from 3 to 17 on both axes, up and left of the
+ // middle because the drop shadow takes the last two; each edge is rounded on its own so the hole
+ // is found again at whatever size the room was scaled to
+ const Int CELL = 22, HOLE_START = 3, HOLE_END = 17;
+ const Int holeLeft = x + (HOLE_START * width + CELL / 2) / CELL;
+ const Int holeRight = x + (HOLE_END * width + CELL / 2) / CELL;
+ const Int holeTop = y + (HOLE_START * height + CELL / 2) / CELL;
+ const Int holeBottom = y + (HOLE_END * height + CELL / 2) / CELL;
+ const Int gap = max(1, min(holeRight - holeLeft, holeBottom - holeTop) / 8);
+ TheDisplay->drawFillRect(holeLeft + gap, holeTop + gap, holeRight - holeLeft - 2 * gap,
+ holeBottom - holeTop - 2 * gap, window->winGetEnabledColor(0));
}
void DrawMapListTab(GameWindow *window, WinInstanceData *instData)