Skip to content

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

feat(gameclient): options screen in the front end's look

Olcay Seygan145d337a362a
diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd1df2701..ee1915466 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1368,6 +1368,8 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
- The Graphics page says what you are choosing. A grey line under the detail preset tells you what that preset turns on, and that picking it only fills in the boxes until you press Accept. Labels say what you will see: Cast Shadows and Flat Shadows instead of 3D and 2D, Ground Pattern, Soft Shorelines, Trees And Bushes, Units Behind Buildings. Every tooltip, in English and Turkish, ends with when the setting takes effect: on Accept, from the next map, or the next time the game starts. Antialiasing and texture filtering used to promise a change "when the display device resets" that never came during play; they say next start now, which is when they apply, and antialiasing says plainly that only the old renderer uses it.
- Writing a line into `Options.ini` by hand still works, and the screen shows you what is in there when it opens. Window mode takes effect the moment you accept it; antialiasing applies the next time the game starts.
- The Defaults button still resets what it always reset, which is the original settings. The new rows keep their values.
+- The main menu's buttons no longer show through the options screen. Solo Play to Exit Game used to sit as faint ghosts behind the right of every page; they step aside while the screen is open and come back when it closes. The main menu's logo and frame stay.
+- The options screen matches the other menus. Refresh NAT and the Hotkeys page's Change, No key and Game's key buttons are lettered in capitals like Accept and Cancel, and the Hotkeys lists use the menus' colours: a heading green, a key you changed gold, an empty one grey-blue, and only a clash red. The notes under the resolution, the detail preset and the Hotkeys lists take the same grey-blue.
## The whole game in Turkish
diff --git a/GeneralsMD/Code/Data/German/Generals.str b/GeneralsMD/Code/Data/German/Generals.str
index d2e9942bb..6ca2cf75a 100644
--- a/GeneralsMD/Code/Data/German/Generals.str
+++ b/GeneralsMD/Code/Data/German/Generals.str
@@ -870,7 +870,7 @@ GUI:SendDelay
END
GUI:FirewallRefresh
-"NAT aktualisieren"
+"NAT AKTUALISIEREN"
END
GUI:Exit
@@ -15030,15 +15030,15 @@ GUI:HotkeysCommandBar
END
GUI:HotkeysChange
-"Ändern"
+"ÄNDERN"
END
GUI:HotkeysClear
-"Keine Taste"
+"KEINE TASTE"
END
GUI:HotkeysDefault
-"Standard"
+"STANDARD"
END
TOOLTIP:HotkeyChange
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 922d74231..f918367dd 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1389,15 +1389,19 @@ GUI:HotkeysCommandBar
END
GUI:HotkeysChange
-"Change"
+"CHANGE"
END
GUI:HotkeysClear
-"No key"
+"NO KEY"
END
GUI:HotkeysDefault
-"Game's key"
+"GAME'S KEY"
+END
+
+GUI:FirewallRefresh
+"REFRESH NAT"
END
TOOLTIP:HotkeyChange
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 46fbe316f..313170822 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -930,7 +930,7 @@ GUI:SendDelay
END
GUI:FirewallRefresh
-"NAT'ı Yenile"
+"NAT'I YENİLE"
END
GUI:Exit
@@ -15786,15 +15786,15 @@ GUI:HotkeysCommandBar
END
GUI:HotkeysChange
-"Değiştir"
+"DEĞİŞTİR"
END
GUI:HotkeysClear
-"Tuş yok"
+"TUŞ YOK"
END
GUI:HotkeysDefault
-"Oyunun tuşu"
+"OYUNUN TUŞU"
END
TOOLTIP:HotkeyChange
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index 71c8a8b75..cb3cab3d0 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -1691,7 +1691,7 @@ WINDOW
FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
HEADERTEMPLATE = "LabelRegular";
TOOLTIPDELAY = -1;
- TEXTCOLOR = ENABLED: 192 192 192 255, ENABLEDBORDER: 0 0 0 255, DISABLED: 192 192 192 255, DISABLEDBORDER: 0 0 0 255, HILITE: 192 192 192 255, HILITEBORDER: 0 0 0 255;
+ TEXTCOLOR = ENABLED: 164 170 190 255, ENABLEDBORDER: 0 0 0 255, DISABLED: 164 170 190 255, DISABLEDBORDER: 0 0 0 255, HILITE: 164 170 190 255, HILITEBORDER: 0 0 0 255;
ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
@@ -3234,7 +3234,7 @@ WINDOW
FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
HEADERTEMPLATE = "LabelRegular";
TOOLTIPDELAY = -1;
- TEXTCOLOR = ENABLED: 192 192 192 255, ENABLEDBORDER: 0 0 0 255, DISABLED: 192 192 192 255, DISABLEDBORDER: 0 0 0 255, HILITE: 192 192 192 255, HILITEBORDER: 0 0 0 255;
+ TEXTCOLOR = ENABLED: 164 170 190 255, ENABLEDBORDER: 0 0 0 255, DISABLED: 164 170 190 255, DISABLEDBORDER: 0 0 0 255, HILITE: 164 170 190 255, HILITEBORDER: 0 0 0 255;
ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
@@ -11787,8 +11787,8 @@ WINDOW
INPUTCALLBACK = "[None]";
TOOLTIPCALLBACK = "[None]";
DRAWCALLBACK = "[None]";
- FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
- HEADERTEMPLATE = "ButtonSmall";
+ FONT = NAME: "Generals", SIZE: 15, BOLD: 0;
+ HEADERTEMPLATE = "MainButton";
TOOLTIPTEXT = "TOOLTIP:RefreshNat";
TOOLTIPDELAY = -1;
TEXT = "GUI:FirewallRefresh";
@@ -12942,7 +12942,7 @@ WINDOW
FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
HEADERTEMPLATE = "LabelRegular";
TOOLTIPDELAY = -1;
- TEXTCOLOR = ENABLED: 192 192 192 255, ENABLEDBORDER: 0 0 0 255, DISABLED: 192 192 192 255, DISABLEDBORDER: 0 0 0 255, HILITE: 192 192 192 255, HILITEBORDER: 0 0 0 255;
+ TEXTCOLOR = ENABLED: 164 170 190 255, ENABLEDBORDER: 0 0 0 255, DISABLED: 164 170 190 255, DISABLEDBORDER: 0 0 0 255, HILITE: 164 170 190 255, HILITEBORDER: 0 0 0 255;
ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
@@ -12983,8 +12983,8 @@ WINDOW
INPUTCALLBACK = "[None]";
TOOLTIPCALLBACK = "[None]";
DRAWCALLBACK = "[None]";
- FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
- HEADERTEMPLATE = "ButtonSmall";
+ FONT = NAME: "Generals", SIZE: 15, BOLD: 0;
+ HEADERTEMPLATE = "MainButton";
TOOLTIPTEXT = "TOOLTIP:HotkeyChange";
TOOLTIPDELAY = -1;
TEXT = "GUI:HotkeysChange";
@@ -13030,8 +13030,8 @@ WINDOW
INPUTCALLBACK = "[None]";
TOOLTIPCALLBACK = "[None]";
DRAWCALLBACK = "[None]";
- FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
- HEADERTEMPLATE = "ButtonSmall";
+ FONT = NAME: "Generals", SIZE: 15, BOLD: 0;
+ HEADERTEMPLATE = "MainButton";
TOOLTIPTEXT = "TOOLTIP:HotkeyClear";
TOOLTIPDELAY = -1;
TEXT = "GUI:HotkeysClear";
@@ -13077,8 +13077,8 @@ WINDOW
INPUTCALLBACK = "[None]";
TOOLTIPCALLBACK = "[None]";
DRAWCALLBACK = "[None]";
- FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
- HEADERTEMPLATE = "ButtonSmall";
+ FONT = NAME: "Generals", SIZE: 15, BOLD: 0;
+ HEADERTEMPLATE = "MainButton";
TOOLTIPTEXT = "TOOLTIP:HotkeyDefault";
TOOLTIPDELAY = -1;
TEXT = "GUI:HotkeysDefault";
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
index 0129b74c9..a266a705b 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
@@ -304,6 +304,72 @@ static void showOptionsPage( Int which )
}
}
+//-------------------------------------------------------------------------------------------------
+// The main menu's button columns under the options panel.
+//
+// The panel is the layouts' see-through black, so over the main menu its buttons showed through as
+// ghosts on every page. While options is up over a main menu on screen, the columns are hidden, and
+// shown again on the way out. The panel's draw hides them each frame rather than once: a main menu
+// transition still running when options opens (-optionsmenu opens it over the menu's first frames)
+// shows its column again when it ends. The main menu's logo and frame stay; they are the screen's
+// mark and its edge.
+//-------------------------------------------------------------------------------------------------
+enum { MAIN_MENU_COLUMN_COUNT = 6 };
+
+static const char *TheMainMenuColumnNames[ MAIN_MENU_COLUMN_COUNT ] =
+{
+ "MainMenu.wnd:MapBorder",
+ "MainMenu.wnd:MapBorder1",
+ "MainMenu.wnd:MapBorder2",
+ "MainMenu.wnd:MapBorder3",
+ "MainMenu.wnd:MapBorder4",
+ "MainMenu.wnd:MapBorder5",
+};
+
+static Bool mainMenuColumnHidden[ MAIN_MENU_COLUMN_COUNT ] = { FALSE };
+static GameWinDrawFunc optionsPanelDraw = NULL;
+
+/** The main menu's parent window when the main menu is what options opened over, else NULL. */
+static GameWindow *mainMenuOnScreen( void )
+{
+ GameWindow *mainMenu = TheWindowManager->winGetWindowFromId( NULL, TheNameKeyGenerator->nameToKey( "MainMenu.wnd:MainMenuParent" ) );
+ if( mainMenu == NULL || mainMenu->winIsHidden() )
+ return NULL;
+ return mainMenu;
+}
+
+static void hideMainMenuColumns( void )
+{
+ GameWindow *mainMenu = mainMenuOnScreen();
+ if( mainMenu == NULL )
+ return;
+ for( Int i = 0; i < MAIN_MENU_COLUMN_COUNT; ++i )
+ {
+ GameWindow *column = TheWindowManager->winGetWindowFromId( mainMenu, TheNameKeyGenerator->nameToKey( TheMainMenuColumnNames[ i ] ) );
+ if( column->winIsHidden() )
+ continue;
+ column->winHide( TRUE );
+ mainMenuColumnHidden[ i ] = TRUE;
+ }
+}
+
+static void showMainMenuColumns( void )
+{
+ GameWindow *mainMenu = mainMenuOnScreen();
+ for( Int i = 0; i < MAIN_MENU_COLUMN_COUNT; ++i )
+ {
+ if( mainMenu != NULL && mainMenuColumnHidden[ i ] )
+ TheWindowManager->winGetWindowFromId( mainMenu, TheNameKeyGenerator->nameToKey( TheMainMenuColumnNames[ i ] ) )->winHide( FALSE );
+ mainMenuColumnHidden[ i ] = FALSE;
+ }
+}
+
+static void drawOptionsPanel( GameWindow *window, WinInstanceData *instData )
+{
+ hideMainMenuColumns();
+ optionsPanelDraw( window, instData );
+}
+
enum Detail
{
ULTRADETAIL = 0,
@@ -1696,6 +1762,7 @@ static void DestroyOptionsLayout() {
SignalUIInteraction(SHELL_SCRIPT_HOOK_OPTIONS_CLOSED);
+ showMainMenuColumns();
TheShell->destroyOptionsLayout();
OptionsLayout = NULL;
}
@@ -2685,6 +2752,16 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
// show menu
layout->hide( FALSE );
+ // the main menu's buttons go while this is up; the backdrop's draw keeps them gone
+ // (a layout kept from an earlier open already draws through it)
+ GameWindow *backdrop = layout->getFirstWindow();
+ if( backdrop->winGetDrawFunc() != drawOptionsPanel )
+ {
+ optionsPanelDraw = backdrop->winGetDrawFunc();
+ backdrop->winSetDrawFunc( drawOptionsPanel );
+ }
+ hideMainMenuColumns();
+
// set keyboard focus to main parent
AsciiString parentName( "OptionsMenu.wnd:OptionsMenuParent" );
NameKeyType parentID = TheNameKeyGenerator->nameToKey( parentName );
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
index ff1080f6b..9db1dead8 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenuHotkeys.cpp
@@ -47,6 +47,7 @@
#include "GameClient/HotKey.h"
#include "GameClient/KeyDefs.h"
#include "GameClient/MetaEvent.h"
+#include "GameClient/UIStyle.h"
namespace
{
@@ -70,11 +71,13 @@ enum CaptureKind { CAPTURE_NONE, CAPTURE_COMMAND, CAPTURE_BUTTON };
typedef std::basic_string< WideChar > KeyText; ///< a key as the page shows it, for a map
-const Color TEXT_COLOR = GameMakeColor( 254, 254, 254, 255 );
-const Color HEADING_COLOR = GameMakeColor( 186, 255, 12, 255 );
-const Color CHANGED_COLOR = GameMakeColor( 255, 214, 92, 255 );
+// The front end's tokens (UI-STYLE.md). References, so they read UIStyle's values whatever order
+// the two files' statics are built in. A clash keeps its own red, the one error on the page.
+const Color &TEXT_COLOR = UIStyle::INK;
+const Color &HEADING_COLOR = UIStyle::ACTIVE;
+const Color &CHANGED_COLOR = UIStyle::GOLD;
const Color CLASH_COLOR = GameMakeColor( 255, 104, 72, 255 );
-const Color QUIET_COLOR = GameMakeColor( 150, 150, 150, 255 );
+const Color &QUIET_COLOR = UIStyle::MUTED;
const WideChar WAITING[] = u"..."; ///< the key cell while a key is awaited; the note under the lists says what to press
GameWindow *s_parent = NULL;
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index b6b73fa70..ccb4a55da 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -254,9 +254,10 @@ NOTE_HEIGHTS = {"ResolutionNote": 20}
def note_height(name):
return NOTE_HEIGHTS.get(name, NOTE_HEIGHT)
NOTE_FONT = 'NAME: "Arial", SIZE: 10, BOLD: 0'
-NOTE_COLOR = ("ENABLED: 192 192 192 255, ENABLEDBORDER: 0 0 0 255, "
- "DISABLED: 192 192 192 255, DISABLEDBORDER: 0 0 0 255, "
- "HILITE: 192 192 192 255, HILITEBORDER: 0 0 0 255")
+# UIStyle's MUTED, the front end's colour for a second line
+NOTE_COLOR = ("ENABLED: 164 170 190 255, ENABLEDBORDER: 0 0 0 255, "
+ "DISABLED: 164 170 190 255, DISABLEDBORDER: 0 0 0 255, "
+ "HILITE: 164 170 190 255, HILITEBORDER: 0 0 0 255")
# a cloned slider keeps its template's range unless it is given one; selfcheck holds these to the
# catalog row's own bounds
@@ -602,7 +603,8 @@ def make_list(templates, spec, columns):
walk it, and keeps no more rows than it is given."""
name, left, top, width, height = spec
listbox = clone(templates[HOTKEY_LIST_SOURCE], _named(name))
- listbox.place(left, top, width, height)
+ # the lobby room is laid out at 1920x1080 now, and this page is 800x600
+ listbox.rect = (left, top, left + width, top + height, 800, 600)
listbox.set_prop("STATUS", "ENABLED")
widths = "".join("COLUMNSWIDTH: %d, " % share for share in columns)
listbox.set_prop("LISTBOXDATA", "LENGTH: 300, AUTOSCROLL: 0, SCROLLIFATEND: 0, AUTOPURGE: 0, SCROLLBAR: 1, "
@@ -633,6 +635,7 @@ def build_hotkeys_page(page, templates):
button.place(left, HOTKEY_BUTTON_TOP, HOTKEY_BUTTON_WIDTH, ROW_HEIGHT)
button.put_prop("TEXT", '"%s"' % key)
button.put_prop("TOOLTIPTEXT", '"TOOLTIP:%s"' % name[len("Button"):])
+ restyle(button, templates["ButtonDefaults"])
page.children.append(button)
@@ -720,7 +723,9 @@ def build(layout):
elif item[0] == "note":
put(page_name, item[1], left - TEXT_NUDGE, top, COLUMN_WIDTH, note_height(item[1]))
else:
- put(page_name, item[1], left, top, 160, ROW_HEIGHT)
+ # a button on a page is lettered like the ones under the pages, the
+ # Generals face in capitals, not EA's 10 point Arial
+ put(page_name, item[1], left, top, 160, ROW_HEIGHT, "ButtonDefaults")
top += item_height(item)
if top > page_bottom:
raise ValueError("%s column %d runs to %d, past the page's %d"