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(gameengine): say under the resolution list when the monitor has the mode
Olcay Seyganf4867f865a6a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex aa4d0aca0..9e2b60911 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -419,6 +419,7 @@ found and fixed — EA's own, not port damage.**- Alt-tabbing back into a fullscreen game brings the game back, once. It used to flicker between the game and the desktop several times and could end as a minimised window that clicking on the taskbar would not open. Putting the screen back was itself switching windows, and every switch set off another round of it. The game now waits until the switch is over before it touches the screen, and nothing it does on the way in or out takes focus from anyone. Coming back changes no display mode at all, so a 144 or 165 Hz monitor no longer drops to 60 and goes black for a moment.- Fullscreen below your monitor's own resolution fills the screen. Picking 1280x720 or 1600x900 on a 1080p monitor switched the monitor to that size, and on some PCs the switch either did not happen or came out unscaled, so the game sat in the top left corner of the desktop like a window. The monitor now stays at its own resolution and the game's picture is scaled up to cover it, with the pointer following the picture. Your second monitor stays where it was too: on a two-screen desk the old switch moved it 640 pixels to the left, along with every window on it.- Fullscreen Fit, under Window Mode on the Display page of both the Classic and the Reforged options, decides what happens when your resolution is not your monitor's shape: 1920x1080 on a 1920x1200 screen, 1024x768 on a widescreen. Stretch to fill covers every pixel, as before; Keep shape, add bars keeps circles round with black either side. 1024x768 on a 1920x1080 monitor comes out 1440x1080 in the middle with 240 pixels of black left and right.+- Under the resolution list, "Monitor supports this mode" tells you the size you picked is one your monitor lists as its own, asked of Windows each time you change the list or the monitor.- Hotkeys work again after Alt+Tab, and the game's own pointer comes back with them. Since 2.4.0, returning to a fullscreen game left Windows thinking no window was listening to the keyboard: every key you pressed made the Windows error sound and did nothing in the game, and the plain Windows arrow stood in for the game's cursor. The game takes the keyboard back as it comes up from the taskbar now.- 481 base-game textures at four times the resolution now beat Zero Hour's downscaled copies.- The ground is drawn at twice the detail. Every map square used to get a 64-pixel patch of its ground texture, squeezed into sixteen-bit colour; it gets 128 pixels now in full colour, so sand, gravel and tracks stop turning to blocks and bands when you zoom in, and a ground texture that ships at twice the size is shown at that size.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 2164471f5..982923084 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -693,6 +693,10 @@ TOOLTIP:WindowMode"Fullscreen covers the monitor at the resolution above, scaled up to it when smaller, and steps aside on alt-tab. Borderless always draws at the monitor's own resolution and stays put behind other windows."END+GUI:ResolutionNote0+"Monitor supports this mode"+END+GUI:FullscreenScaling"Fullscreen Fit"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex d61ef3d49..4b3da0eff 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15197,6 +15197,10 @@ TOOLTIP:WindowMode"Tam ekran, monitörü yukarıdaki çözünürlükte kaplar, küçükse ekrana büyütür, alt-tab'da kenara çekilir. Kenarlıksız her zaman monitörün kendi çözünürlüğünde çizer ve diğer pencerelerin arkasında yerinde durur."END+GUI:ResolutionNote0+"Monitör bu modu destekliyor"+END+GUI:FullscreenScaling"Tam Ekran Sığdırma"ENDdiff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wndindex 6d0a624af..961ac4730 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd@@ -1828,7 +1828,51 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 34 294, BOTTOMRIGHT: 258 318, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 294, BOTTOMRIGHT: 258 314, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:ResolutionNote";+ STATUS = ENABLED;+ STYLE = STATICTEXT+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ 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;+ 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,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;+ STATICTEXTDATA = CENTERED: 0;+ END+ CHILD+ WINDOW+ WINDOWTYPE = STATICTEXT;+ SCREENRECT = UPPERLEFT: 34 318, BOTTOMRIGHT: 258 342, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelWindowMode";TOOLTIPTEXT = "TOOLTIP:WindowMode";STATUS = ENABLED;@@ -1876,7 +1920,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = COMBOBOX;- SCREENRECT = UPPERLEFT: 40 318, BOTTOMRIGHT: 264 342, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 342, BOTTOMRIGHT: 264 366, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ComboBoxWindowMode";TOOLTIPTEXT = "TOOLTIP:WindowMode";STATUS = ENABLED+IMAGE;@@ -2116,7 +2160,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 34 350, BOTTOMRIGHT: 258 374, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 374, BOTTOMRIGHT: 258 398, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelFullscreenScaling";TOOLTIPTEXT = "TOOLTIP:FullscreenScaling";STATUS = ENABLED;@@ -2164,7 +2208,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = COMBOBOX;- SCREENRECT = UPPERLEFT: 40 374, BOTTOMRIGHT: 264 398, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 398, BOTTOMRIGHT: 264 422, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ComboBoxFullscreenScaling";TOOLTIPTEXT = "TOOLTIP:FullscreenScaling";STATUS = ENABLED+IMAGE;@@ -2404,7 +2448,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 40 406, BOTTOMRIGHT: 264 430, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 430, BOTTOMRIGHT: 264 454, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckVSync";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wndindex 11e156216..76050cc85 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd@@ -1828,7 +1828,51 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 34 294, BOTTOMRIGHT: 258 318, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 294, BOTTOMRIGHT: 258 314, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:ResolutionNote";+ STATUS = ENABLED;+ STYLE = STATICTEXT+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ 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;+ 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,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;+ STATICTEXTDATA = CENTERED: 0;+ END+ CHILD+ WINDOW+ WINDOWTYPE = STATICTEXT;+ SCREENRECT = UPPERLEFT: 34 318, BOTTOMRIGHT: 258 342, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelWindowMode";TOOLTIPTEXT = "TOOLTIP:WindowMode";STATUS = ENABLED;@@ -1876,7 +1920,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = COMBOBOX;- SCREENRECT = UPPERLEFT: 40 318, BOTTOMRIGHT: 264 342, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 342, BOTTOMRIGHT: 264 366, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ComboBoxWindowMode";TOOLTIPTEXT = "TOOLTIP:WindowMode";STATUS = ENABLED+IMAGE;@@ -2116,7 +2160,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 34 350, BOTTOMRIGHT: 258 374, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 374, BOTTOMRIGHT: 258 398, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelFullscreenScaling";TOOLTIPTEXT = "TOOLTIP:FullscreenScaling";STATUS = ENABLED;@@ -2164,7 +2208,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = COMBOBOX;- SCREENRECT = UPPERLEFT: 40 374, BOTTOMRIGHT: 264 398, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 398, BOTTOMRIGHT: 264 422, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ComboBoxFullscreenScaling";TOOLTIPTEXT = "TOOLTIP:FullscreenScaling";STATUS = ENABLED+IMAGE;@@ -2404,7 +2448,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 40 406, BOTTOMRIGHT: 264 430, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 430, BOTTOMRIGHT: 264 454, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckVSync";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cppindex f0b5e3fe0..a5d52817c 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp@@ -1206,6 +1206,30 @@ static void updateResolutionEnabled( void )comboBoxResolution->winEnable( value != WINDOW_MODE_BORDERLESS );}+//-------------------------------------------------------------------------------------------------+/** The line under the resolution list: "the monitor supports this mode" when the picked size is one+ * of the modes Windows lists for the picked monitor, nothing when it is not. Asked of the monitor+ * again rather than of the list, so the line stays honest whatever the list comes to hold. */+//-------------------------------------------------------------------------------------------------+static void updateResolutionNote( void )+{+ GameWindow *note = TheWindowManager->winGetWindowFromId( NULL, NAMEKEY( "OptionsMenu.wnd:ResolutionNote" ) );+ if( note == NULL || comboBoxResolution == NULL )+ return;++ Int index = -1;+ GadgetComboBoxGetSelectedPos( comboBoxResolution, &index );+ Bool supported = FALSE;+ if( index >= 0 && index < menuModeCount )+ {+ DisplayModeEntry modes[ MAX_DISPLAY_MODE_ENTRIES ];+ const Int count = listDisplayModes( selectedMonitor().device, modes, MAX_DISPLAY_MODE_ENTRIES );+ for( Int i = 0; i < count && !supported; ++i )+ supported = ( modes[ i ].width == menuModes[ index ].width && modes[ i ].height == menuModes[ index ].height );+ }+ GadgetStaticTextSetText( note, supported ? TheGameText->fetch( "GUI:ResolutionNote0" ) : UnicodeString::TheEmptyString );+}+static void saveOptions( void ){Int index;@@ -2640,6 +2664,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )// borderless owns the resolution; the list is grey while it is pickedupdateResolutionEnabled();+ updateResolutionNote();TheWindowManager->winSetModal(parent);ignoreSelected = FALSE;@@ -2809,6 +2834,7 @@ WindowMsgHandledType OptionsMenuSystem( GameWindow *window, UnsignedInt msg,// picking borderless greys the resolution list out, the other two hand it backupdateResolutionEnabled();+ updateResolutionNote();break;}diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.pyindex b8b133e45..7db3123cf 100644--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py@@ -203,8 +203,14 @@ READOUTS = [# OptionsMenu.cpp. The detail preset is the one that needs it: picking Ultra only fills in the boxes,# and nothing on the shipped screen said that Accept is what applies them.# (name, label key whose entries 0..count-1 it shows, count)-NOTES = [("DetailNote", "GUI:DetailNote", 5)]+# The resolution's line is one short sentence, shown only when the monitor lists the picked size.+NOTES = [("DetailNote", "GUI:DetailNote", 5), ("ResolutionNote", "GUI:ResolutionNote", 1)]NOTE_HEIGHT = 80+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, "@@ -265,6 +271,7 @@ GROUP_LAYOUT = [("GUI:OptionsGroupScreen", [setting("LabelMonitor", "ComboBoxMonitor"),setting("ResolutionLabel", "ComboBoxResolution"),+ ("note", "ResolutionNote"),setting("LabelWindowMode", "ComboBoxWindowMode"),setting("LabelFullscreenScaling", "ComboBoxFullscreenScaling"),("check", "CheckVSync")]),@@ -368,8 +375,9 @@ REFORGED_ONLY = [def item_height(item):- return {"setting": SETTING_PITCH, "check": CHECK_PITCH, "note": NOTE_HEIGHT + 4,- "button": BUTTON_PITCH}[item[0]]+ if item[0] == "note":+ return note_height(item[1]) + 4+ return {"setting": SETTING_PITCH, "check": CHECK_PITCH, "button": BUTTON_PITCH}[item[0]]def group_height(group):@@ -648,7 +656,7 @@ def build(layout, classic=False):elif item[0] == "check":put(page_name, item[1], left, top, COLUMN_WIDTH, ROW_HEIGHT, CHECK)elif item[0] == "note":- put(page_name, item[1], left - TEXT_NUDGE, top, COLUMN_WIDTH, NOTE_HEIGHT)+ 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)top += item_height(item)