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): grid placement and 45 degree snaps on Options > Controls
Olcay Seyganc83de9ba00d2
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a435eeac5..79c7e920f 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1095,7 +1095,8 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- The tab you are on is lit in the same green as the group headings. The original drew it in dark grey on the black panel, which read as a button you could not press rather than the page you were looking at.- Accept sits in the bottom right corner with Cancel beside it, and Defaults stands alone on the far left, out of reach of a slip off Accept. The window is as tall as its busiest page and centred on the screen, instead of reaching from the top of the screen to the bottom with half of every page empty. The box that asks whether to keep a new resolution opens in the middle of the screen too, where it used to sit jammed in the top left corner.- Eight settings that used to need a text editor have a control now: window mode on display, antialiasing, the two glow settings, texture filtering and anisotropic samples on graphics, and who wears a health bar and which colours the players wear on gameplay.-- Twelve more are decided for you instead of asked about. Grid placement, nudging a blocked building, 45 degree building rotation, the placement range ring, workers going back to supply, detailed build tooltips, the HUD overlay and archived replays are simply on - every one of them is the version of the game people were choosing anyway, and a page of eight checkboxes nobody unticks is a page of eight decisions nobody wanted to make. Middle-mouse panning left the screen too, and edge scrolling in a window and 45 degree camera steps are still yours by name in `Options.ini` if the defaults are wrong for your setup.+- More are decided for you instead of asked about. Nudging a blocked building, the placement range ring, workers going back to supply, detailed build tooltips, the HUD overlay and archived replays are simply on - every one of them is the version of the game people were choosing anyway, and a page of six checkboxes nobody unticks is a page of six decisions nobody wanted to make. Middle-mouse panning left the screen too, and edge scrolling in a window is still yours by name in `Options.ini` if the default is wrong for your setup.+- Grid placement, 45 degree building rotation and 45 degree camera steps are back as checkboxes on the Controls page, all three on until you untick them. Turn grid placement off and a building goes down exactly where the cursor puts it, and the white grid lines under the ghost go with it. The red squares where nothing can be built still show, so you can see the rock before you click on it.- A page no longer says its own name twice. Every tab used to open onto a heading repeating the word already written on the button you just pressed, with a rule under it dividing nothing from nothing.- An open dropdown covers what is under it instead of the other way round. The list of resolutions grew downwards behind the labels below it, so half the entries were readable and half were words on top of words.- Every button, slider and checkbox is the artwork the game already had, down to the fonts and the hover colours.diff --git a/GeneralsMD/Code/Data/German/Generals.str b/GeneralsMD/Code/Data/German/Generals.strindex e65c833aa..69d17f6d3 100644--- a/GeneralsMD/Code/Data/German/Generals.str+++ b/GeneralsMD/Code/Data/German/Generals.str@@ -14758,7 +14758,7 @@ GUI:GridBuildENDTOOLTIP:GridBuild-"Gebäude landen auf dem eigenen 10er-Raster der Wegfindung, sodass zwei nach Augenmaß gesetzte Gebäude eine Kante teilen, statt eine zu enge Lücke zum Durchgehen zu lassen."+"Gebäude landen auf dem eigenen 10er-Raster der Wegfindung, das beim Platzieren unter dem Gebäude gezeichnet wird, sodass zwei nach Augenmaß gesetzte Gebäude eine Kante teilen, statt eine zu enge Lücke zum Durchgehen zu lassen. Ist es aus, werden nur die Zellen markiert, auf denen nichts gebaut werden kann."ENDGUI:NudgeBuilddiff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 497d8276f..39d18ef05 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -914,7 +914,7 @@ GUI:GridBuildENDTOOLTIP:GridBuild-"Structures land on the pathfinder's own 10-unit grid, so two buildings put down by eye share an edge instead of leaving a gap too narrow to walk through."+"Structures land on the pathfinder's own 10-unit grid, drawn under the building while you place it, so two buildings put down by eye share an edge instead of leaving a gap too narrow to walk through. Off, only the cells nothing can be built on are marked."ENDGUI:NudgeBuilddiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 0f34eb204..e676e4182 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15402,7 +15402,7 @@ GUI:GridBuildENDTOOLTIP:GridBuild-"Yapılar yol bulucunun kendi 10 birimlik ızgarasına oturur; böylece göz kararı yerleştirilen iki bina, arada yürünemeyecek kadar dar bir boşluk bırakmak yerine kenar kenara durur."+"Yapılar yol bulucunun kendi 10 birimlik ızgarasına oturur, ızgara da yerleştirirken binanın altında çizilir; böylece göz kararı yerleştirilen iki bina, arada yürünemeyecek kadar dar bir boşluk bırakmak yerine kenar kenara durur. Kapalıyken yalnızca bina konamayan hücreler işaretlenir."ENDGUI:NudgeBuilddiff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wndindex 0155e799f..de8bb9138 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd@@ -7475,6 +7475,53 @@ WINDOWIMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;ENDCHILD+ WINDOW+ WINDOWTYPE = CHECKBOX;+ SCREENRECT = UPPERLEFT: 40 322, BOTTOMRIGHT: 264 346, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckSnapCamera45";+ STATUS = ENABLED+IMAGE+BORDER;+ STYLE = CHECKBOX+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;+ HEADERTEMPLATE = "MinorTitle";+ TOOLTIPTEXT = "TOOLTIP:SnapCamera45";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:SnapCamera45";+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ END+ CHILDWINDOWWINDOWTYPE = STATICTEXT;SCREENRECT = UPPERLEFT: 282 150, BOTTOMRIGHT: 506 174, CREATIONRESOLUTION: 800 600;@@ -7614,6 +7661,100 @@ WINDOWIMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;ENDCHILD+ WINDOW+ WINDOWTYPE = CHECKBOX;+ SCREENRECT = UPPERLEFT: 288 238, BOTTOMRIGHT: 512 262, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckGridBuild";+ STATUS = ENABLED+IMAGE+BORDER;+ STYLE = CHECKBOX+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;+ HEADERTEMPLATE = "MinorTitle";+ TOOLTIPTEXT = "TOOLTIP:GridBuild";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:GridBuild";+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ END+ CHILD+ WINDOW+ WINDOWTYPE = CHECKBOX;+ SCREENRECT = UPPERLEFT: 288 266, BOTTOMRIGHT: 512 290, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckSnapBuild45";+ STATUS = ENABLED+IMAGE+BORDER;+ STYLE = CHECKBOX+MOUSETRACK;+ SYSTEMCALLBACK = "[None]";+ INPUTCALLBACK = "[None]";+ TOOLTIPCALLBACK = "[None]";+ DRAWCALLBACK = "[None]";+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;+ HEADERTEMPLATE = "MinorTitle";+ TOOLTIPTEXT = "TOOLTIP:SnapBuild45";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:SnapBuild45";+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;+ END+ CHILDWINDOWWINDOWTYPE = STATICTEXT;SCREENRECT = UPPERLEFT: 530 150, BOTTOMRIGHT: 754 174, CREATIONRESOLUTION: 800 600;diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 48ec34c03..5e6d15947 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -1141,8 +1141,8 @@ GlobalData::GlobalData()// nobody saw them: an Options.ini that predates them simply has no such key, so every one of// them stayed off and the features looked like they had never been added.//- // The first four are still catalog rows, so Options.ini can still turn them off by name even- // though the menu no longer shows them. The rest are not: they left TheOptionCatalog with the+ // The camera rows, grid placement and snap-to-45 building rotation are still catalog rows, so+ // Options.ini (and for some the menu) can turn them off. The rest are not: they left TheOptionCatalog with the// controls that used to set them, and what is written here is what every game gets. GameData.ini// remains the way to change one, because the field table above still names it.//diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cppindex 670252ab8..728269ccc 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp@@ -58,6 +58,8 @@ static void set_m_cameraBoundaryMargin( Int value )}OPTION_BOOL_ACCESSORS( m_edgeScrollInWindowedMode )OPTION_BOOL_ACCESSORS( m_snapCameraRotateTo45 )+OPTION_BOOL_ACCESSORS( m_gridBuildPlacement )+OPTION_BOOL_ACCESSORS( m_snapBuildPlacementTo45 )OPTION_BOOL_ACCESSORS( m_zoomToCursor )OPTION_BOOL_ACCESSORS( m_isometricCamera )OPTION_BOOL_ACCESSORS( m_smoothMotion )@@ -235,10 +237,21 @@ const OptionDef TheOptionCatalog[] =OPTION_BOOL, APPLY_LIVE, 0, 1,get_m_edgeScrollInWindowedMode, set_m_edgeScrollInWindowedMode },- { "SnapCameraRotateTo45", "", "",+ // Back on Options > Controls, with the two building placement rows below it.+ { "SnapCameraRotateTo45", OPT_WND( "CheckSnapCamera45" ), "GUI:SnapCamera45",OPTION_BOOL, APPLY_LIVE, 0, 1,get_m_snapCameraRotateTo45, set_m_snapCameraRotateTo45 },+ // Off, a structure goes wherever the cursor is and the white grid lines under the ghost go+ // with it; the red wash over cells nothing can stand on stays (W3DInGameUI::drawBuildGrid).+ { "GridBuildPlacement", OPT_WND( "CheckGridBuild" ), "GUI:GridBuild",+ OPTION_BOOL, APPLY_LIVE, 0, 1,+ get_m_gridBuildPlacement, set_m_gridBuildPlacement },++ { "SnapBuildPlacementTo45", OPT_WND( "CheckSnapBuild45" ), "GUI:SnapBuild45",+ OPTION_BOOL, APPLY_LIVE, 0, 1,+ get_m_snapBuildPlacementTo45, set_m_snapBuildPlacementTo45 },+// MiddleMousePans used to sit here. There is nothing left to choose: a right drag pans and a// middle drag turns the camera.@@ -317,11 +330,11 @@ const OptionDef TheOptionCatalog[] =OPTION_INT, APPLY_RESTART, 0, 16,get_m_anisotropyLevel, set_m_anisotropyLevel },- // Eight rows used to sit here: grid and nudge build placement, snap-to-45 building rotation, the- // placement range ring, workers returning to supply, detailed build tooltips, the HUD overlay- // and replay archiving. Every one of them is now on for everybody, decided in GlobalData's- // constructor, so there is nothing left to load or save. Gameplay is health bars and nothing- // else.+ // Six rows used to sit here: nudge build placement, the placement range ring, workers returning+ // to supply, detailed build tooltips, the HUD overlay and replay archiving. Every one of them is+ // now on for everybody, decided in GlobalData's constructor, so there is nothing left to load or+ // save. Grid placement and snap-to-45 building rotation left with them and came back to+ // Options > Controls, above.// Off, subtle, normal, strong. Normal (60, the menu's Medium) is the default, set in// GlobalData's constructor: it is the strength the Direct3D 11 frame applied before there was adiff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cppindex 66f11b4f1..dfbba4d19 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBar.cpp@@ -1345,19 +1345,23 @@ void CommandSet::parseCommandButton( INI* ini, void *instance, void *store, cons// get find the command button from this nameconst CommandButton *commandButton = TheControlBar->findCommandButton( AsciiString( token ) );- if( commandButton == NULL )- {-- DEBUG_CRASH(( "[LINE: %d - FILE: '%s'] Unknown command '%s' found in command set\n",- ini->getLineNum(), ini->getFilename().str(), token ));- throw INI_INVALID_DATA;-- } // end if-// get the index to store the command at, and the command array itselfconst CommandButton **buttonArray = (const CommandButton **)store;Int buttonIndex = (Int)(intptr_t)userData;+ if( commandButton == NULL )+ {+ /* A mod's CommandButton.ini can lack a button the fork's CommandSetReforged.ini names: Contra X+ Beta 2 has no Early_Command_ChinaCarpetBomb, and slot 2 of Infa_ChinaCommandCenterCommandSetUpgrade+ threw and stopped the game at start. The slot keeps what it held, which for a patched set is+ empty, since parseCommandSetDefinition clears it first, and every reader already passes over an+ empty slot. The outcome depends only on the files, which are in the INI checksum. */+ DEBUG_LOG(( "[LINE: %d - FILE: '%s'] CommandSet %s slot %d names unknown button '%s'; the slot is skipped.\n",+ ini->getLineNum(), ini->getFilename().str(), ((CommandSet *)instance)->getName().str(),+ buttonIndex + 1, token ));+ return;+ } // end if+// sanityDEBUG_ASSERTCRASH( buttonIndex < MAX_COMMANDS_PER_SET, ("parseCommandButton: button index '%d' out of range\n",buttonIndex) );diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cppindex c7a6b4174..acfbf63f4 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DInGameUI.cpp@@ -675,7 +675,8 @@ static void setGroundOverlayState( void )//-------------------------------------------------------------------------------------------------/** Draw the pathfinder's own cell grid under the structure sitting on the cursor, and cross out- * the cells it cannot go on. GridBuildPlacement snaps a footprint's edges to these very lines+ * the cells it cannot go on. The lines only under GridBuildPlacement; the red cells always.+ * GridBuildPlacement snaps a footprint's edges to these very lines* (see snapPlacementToGrid), so being able to see them is the difference between guessing at a* flush row of buildings and laying one out.*@@ -696,9 +697,11 @@ static void setGroundOverlayState( void )//-------------------------------------------------------------------------------------------------void W3DInGameUI::drawBuildGrid( void ){- // the grid you see is the grid you snap to: with the snap off it would mean nothing- if( m_pendingPlaceType == NULL || TheGlobalData->m_gridBuildPlacement == FALSE )+ if( m_pendingPlaceType == NULL )return;+ // the grid you see is the grid you snap to: with the snap off the lines would mean nothing, but+ // the cells nothing can stand on still do+ const Bool drawLines = TheGlobalData->m_gridBuildPlacement;if( m_placeIcon == NULL || m_placeIcon[ 0 ] == NULL )return;if( TheTerrainLogic == NULL || TheAI == NULL )@@ -764,7 +767,7 @@ void W3DInGameUI::drawBuildGrid( void )// the lines themselves, one quad per cell edge so they follow the ground over every bumpconst Real LINE_ALPHA = 0x58;- for( iy = 0; iy < GRID_POINTS; ++iy )+ for( iy = 0; drawLines && iy < GRID_POINTS; ++iy ){for( ix = 0; ix < GRID_POINTS; ++ix ){diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 2e80f8442..7cef0e7bd 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -12560,16 +12560,16 @@ TEST(text_language_row_offers_every_language)TEST(gameplay_conveniences_are_forced_on_and_left_the_catalog){- /* The Gameplay page is one control now, health bars, and the eight settings that used to share- it are decided here instead of by the player. Two halves have to agree or the removal is a- feature switched off by accident: the row must be gone from the catalog, so nothing loads a- stale "no" out of an Options.ini written before this change, and the constructor must say- TRUE, because with the row gone the constructor is the only thing left that says anything. */+ /* Six settings that used to share the Gameplay page are decided here instead of by the player.+ Two halves have to agree or the removal is a feature switched off by accident: the row must+ be gone from the catalog, so nothing loads a stale "no" out of an Options.ini written before+ this change, and the constructor must say TRUE, because with the row gone the constructor is+ the only thing left that says anything. Grid placement and snap-to-45 building rotation left+ with them and came back as Controls check boxes, so they are below with the menu rows. */static const char *const forced[] ={- "GridBuildPlacement", "NudgeBuildPlacement", "SnapBuildPlacementTo45",- "ShowPlacementRangeRing", "WorkersReturnToSupply", "DetailedBuildTooltips",- "ShowHudOverlay", "ArchiveReplays", NULL+ "NudgeBuildPlacement", "ShowPlacementRangeRing", "WorkersReturnToSupply",+ "DetailedBuildTooltips", "ShowHudOverlay", "ArchiveReplays", NULL};for( Int i = 0; forced[ i ] != NULL; ++i )CHECK( findOptionDef( forced[ i ] ) == NULL );@@ -12602,7 +12602,7 @@ TEST(gameplay_conveniences_are_forced_on_and_left_the_catalog)Options.ini that names one still wins over the default. ZoomToCursor came back to the menu. */static const char *const hidden[] ={- "FormationDrag", "EdgeScrollInWindowedMode", "SnapCameraRotateTo45", NULL+ "FormationDrag", "EdgeScrollInWindowedMode", NULL};for( Int i = 0; hidden[ i ] != NULL; ++i ){@@ -12611,6 +12611,22 @@ TEST(gameplay_conveniences_are_forced_on_and_left_the_catalog)CHECK( def->widgetName == NULL || def->widgetName[ 0 ] == '\0' );}+ /* The two snaps and grid placement are Controls check boxes, on by default. */+ CHECK( scratch->m_snapCameraRotateTo45 );+ static const char *const menu[] =+ {+ "SnapCameraRotateTo45", "GridBuildPlacement", "SnapBuildPlacementTo45", NULL+ };+ for( Int i = 0; menu[ i ] != NULL; ++i )+ {+ const OptionDef *def = findOptionDef( menu[ i ] );+ CHECK( def != NULL );+ if( def == NULL )+ continue;+ CHECK( def->kind == OPTION_BOOL );+ CHECK( def->widgetName != NULL && def->widgetName[ 0 ] != '\0' );+ }+delete scratch; // while it is the current one: a Debug build's ~GlobalData reads TheWritableGlobalDataTheWritableGlobalData = saved;}diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.pyindex 0761c8f43..d4253fc7b 100644--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py@@ -163,6 +163,9 @@ NEW_CONTROLS = [(CHECK, "CheckIsometricCamera", "GUI:IsometricCamera"),(CHECK, "CheckSmoothMotion", "GUI:SmoothMotion"),(CHECK, "CheckStartAtMaxZoom", "GUI:StartAtMaxZoom"),+ (CHECK, "CheckSnapCamera45", "GUI:SnapCamera45"),+ (CHECK, "CheckGridBuild", "GUI:GridBuild"),+ (CHECK, "CheckSnapBuild45", "GUI:SnapBuild45"),(LABEL, "LabelDragTolerance", "GUI:DragTolerance"),(SLIDER, "SliderDragTolerance", None),(CHECK, "CheckTreeSway", "GUI:TreeSway"),@@ -288,10 +291,13 @@ GROUP_LAYOUT = [setting("ScrollSpeedLabel", "SliderScrollSpeed", "ValueScrollSpeed"),("check", "CheckZoomToCursor"),("check", "CheckIsometricCamera"),- ("check", "CheckStartAtMaxZoom")]),+ ("check", "CheckStartAtMaxZoom"),+ ("check", "CheckSnapCamera45")]),("PageControls", 1, "GUI:OptionsGroupOrders", [("check", "Retaliation"),- ("check", "CheckDoubleClickAttackMove")]),+ ("check", "CheckDoubleClickAttackMove"),+ ("check", "CheckGridBuild"),+ ("check", "CheckSnapBuild45")]),("PageControls", 2, "GUI:OptionsGroupInput", [setting("LabelDragTolerance", "SliderDragTolerance", "ValueDragTolerance"),("check", "CheckChromaLighting")]),