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): a classic graphics box that turns every fork visual off
Olcay Seygan6128b79f0106
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 90034c9fb..05956719d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -704,6 +704,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same## The options screen has pages- Display, graphics, effects, audio, controls, gameplay and network, behind seven buttons across the top. The original screen was one panel with everything on it at once, and it was already full the day it shipped: the language filter, the keyboard button and four camera checkboxes are all still in there, parked off the right edge where nobody can reach them, because there was nowhere left to put them.+- Classic Graphics, at the top of the Graphics page, puts the game back the way it looked in 2003 in one click: its own textures and ground in place of the upscaled ones, the old hard shadows, no bump detail on the models and no glow or sharpening over the picture. Leave it off and you have Reforged. The rest of the options stay yours either way, and the box takes effect the next time the game starts.- Every graphics setting is on the Graphics and Effects pages. Shadows, clouds, ground lighting, soft water edges, trees, extra animations, heat haze, texture resolution and the particle limit used to hide in a popup that only opened if you picked Custom from the detail box on another page, so choosing High never showed you what High turns on. Pick a preset now and its settings change in front of you; touch any one of them and the box reads Custom. Texture filtering and the number of anisotropic samples, which needed a text editor, sit there too.- Every page is sorted into titled groups by what the settings do, and the groups sit in the same three columns on every tab. On Graphics the detail preset heads the first column with the texture and particle sliders under it, the picture settings take the second and the terrain the third. The framed boxes the original drew inside each page are gone. They were sized for headings that no longer exist, which is why no two pages started their first setting at the same height.- The detail box has Ultra above High, and a preset now sets everything it is responsible for. Picking High used to leave antialiasing and texture filtering wherever they happened to be; High now brings 4x antialiasing and 8 anisotropic samples with it, and Low turns both down for the machines that need it. Ultra is High with the particle limit at the top of its slider, 5,000 against High's 3,000, detail that is never dropped when the frame rate dips, 8x antialiasing, 16 anisotropic samples, thick smoke and every new shadow and effect switched on. Glow stays yours whichever you pick: the artwork was painted without it.diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 95d0c1d28..6583b7fd0 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -646,6 +646,14 @@ TOOLTIP:VSync"Holds the picture to the monitor so it does not tear. Off, the picture runs as fast as the machine draws. Applied when you Accept."END+GUI:ClassicGraphics+"Classic Graphics"+END++TOOLTIP:ClassicGraphics+"The game as it looked in 2003: its own textures and ground, the old hard shadows, no bump detail and no glow or sharpening. Off is Reforged. Takes effect the next time the game starts."+END+GUI:InfantryShadows"Infantry Shadows"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 35c43f2f6..4fa016163 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15205,6 +15205,14 @@ TOOLTIP:VSync"Görüntüyü monitöre eşler, böylece ekran yırtılmaz. Kapalıyken görüntü, bilgisayarın çizebildiği kadar hızlı akar. Kabul Et'e bastığınızda uygulanır."END+GUI:ClassicGraphics+"Klasik Grafikler"+END++TOOLTIP:ClassicGraphics+"Oyunun 2003'teki görünümü: kendi kaplamaları ve zemini, eski keskin gölgeler, kabartma ayrıntısı yok, parlama ve keskinleştirme yok. Kapalıyken Reforged. Oyun bir sonraki açılışında geçerli olur."+END+GUI:InfantryShadows"Piyade Gölgeleri"ENDdiff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wndindex 008163e3e..4d0ccb87e 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenu.wnd@@ -2463,9 +2463,56 @@ WINDOWSTATICTEXTDATA = CENTERED: 0;ENDCHILD+ WINDOW+ WINDOWTYPE = CHECKBOX;+ SCREENRECT = UPPERLEFT: 40 182, BOTTOMRIGHT: 264 206, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckClassicGraphics";+ 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:ClassicGraphics";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:ClassicGraphics";+ 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: 34 182, BOTTOMRIGHT: 258 206, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 210, BOTTOMRIGHT: 258 234, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:DetailLabel";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -2512,7 +2559,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = COMBOBOX;- SCREENRECT = UPPERLEFT: 40 206, BOTTOMRIGHT: 264 230, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 234, BOTTOMRIGHT: 264 258, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ComboBoxDetail";STATUS = ENABLED+IMAGE;STYLE = MOUSETRACK+COMBOBOX;@@ -2751,7 +2798,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 34 238, BOTTOMRIGHT: 258 262, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 266, BOTTOMRIGHT: 258 290, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelTextureResolution";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -2798,7 +2845,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 178 262, BOTTOMRIGHT: 258 286, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 178 290, BOTTOMRIGHT: 258 314, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ValueTextureResolution";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -2844,7 +2891,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = HORZSLIDER;- SCREENRECT = UPPERLEFT: 40 262, BOTTOMRIGHT: 176 286, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 290, BOTTOMRIGHT: 176 314, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LowResSlider";STATUS = ENABLED+IMAGE+TABSTOP;STYLE = HORZSLIDER+MOUSETRACK;@@ -2919,7 +2966,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 34 294, BOTTOMRIGHT: 258 318, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 34 322, BOTTOMRIGHT: 258 346, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:LabelParticleCap";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -2966,7 +3013,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = STATICTEXT;- SCREENRECT = UPPERLEFT: 178 318, BOTTOMRIGHT: 258 342, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 178 346, BOTTOMRIGHT: 258 370, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ValueParticleCap";STATUS = ENABLED;STYLE = STATICTEXT+MOUSETRACK;@@ -3012,7 +3059,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = HORZSLIDER;- SCREENRECT = UPPERLEFT: 40 318, BOTTOMRIGHT: 176 342, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 40 346, BOTTOMRIGHT: 176 370, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:ParticleCapSlider";STATUS = ENABLED+IMAGE+TABSTOP;STYLE = HORZSLIDER+MOUSETRACK;diff --git a/GeneralsMD/Code/GameEngine/Include/Common/EarlyOptions.h b/GeneralsMD/Code/GameEngine/Include/Common/EarlyOptions.hindex acef7e82f..7063984af 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/EarlyOptions.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/EarlyOptions.h@@ -234,3 +234,20 @@ inline int getEarlyOptionInt( const char *key, int defaultValue, int lo, int hireturn hi;return parsed;}++/** A stored yes or no, read as leniently as the options catalog reads it, so the two never disagree+ * about the same line of the file. */+inline bool isEarlyOptionYes( const char *value )+{+ return ::_stricmp( value, "yes" ) == 0 || ::_stricmp( value, "true" ) == 0+ || ::_stricmp( value, "on" ) == 0 || ::_stricmp( value, "y" ) == 0+ || ::_stricmp( value, "t" ) == 0 || ::_stricmp( value, "1" ) == 0;+}++inline bool getEarlyOptionBool( const char *key, bool defaultValue )+{+ char value[64];+ if (!findEarlyOptionValue( key, value, sizeof( value ) ))+ return defaultValue;+ return isEarlyOptionYes( value );+}diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex 727bfe25c..4934f7e85 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -175,6 +175,7 @@ public:Bool m_startAtMaxZoom; // "StartAtMaxZoom": a game opens as far out as the wheel goes, not at the map's own defaultBool m_shadowsForProps; // "ShadowsForProps": fences, rubbish, shrubs - scenery the art gave no shadow at allBool m_shadowsForParticles; // "ShadowsForParticles": big alpha-blended particle clouds drop a soft blob on the ground+ Bool m_classicGraphics; // "ClassicGraphics": the game's own art, tile, shadows and picture; read at startupBool m_shadowMap; // "-shadowmap": draw the casters into the sun's depth buffer as wellBool m_shadowMapReport; // "-shadowmapreport": log what ended up in that buffer, once a secondBool m_shadowMapOnly; // "-shadowmaponly": the map's shadows with the stencil volumes' own darkening offdiff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 4c10a85b3..3e47d940d 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -681,6 +681,7 @@ GlobalData::GlobalData()m_startAtMaxZoom = TRUE; //open a game framed as wide as the player could zoom by handm_shadowsForProps = TRUE; //likewise: scenery with no shadow of its own gets onem_shadowsForParticles = TRUE; //on by default: the shipped INI has no entry for it+ m_classicGraphics = FALSE;m_shadowMap = TRUE; //the sun's own shadows are what the game draws with nowm_shadowMapOnly = TRUE; //and they replace the stencil volumes rather than joining themm_shadowMapReport = FALSE;@@ -1451,6 +1452,15 @@ void GlobalData::parseGameDataDefinition( INI* ini )// line still wins over the preferences file. setOptionPreferences runs after it and would not.loadOptionsFromPreferences( optionPref );+ // Classic graphics takes the stencil shadows and the unfiltered picture back here, before the+ // command line, so -dx11post still names a chain for the one run it is given. The rest of the+ // setting is read where the device starts and where the archives mount.+ if (TheWritableGlobalData->m_classicGraphics)+ {+ TheWritableGlobalData->m_shadowMap = FALSE;+ TheWritableGlobalData->m_direct3D11PostChain = "off";+ }+applyWindowMode();}diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cppindex 7006e74fc..888668e20 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp@@ -68,6 +68,7 @@ OPTION_INT_ACCESSORS( m_anisotropyLevel )OPTION_INT_ACCESSORS( m_windowMode )OPTION_INT_ACCESSORS( m_msaaLevel )OPTION_BOOL_ACCESSORS( m_vsync )+OPTION_BOOL_ACCESSORS( m_classicGraphics )OPTION_INT_ACCESSORS( m_healthBarMode )OPTION_INT_ACCESSORS( m_playerColorScheme )OPTION_INT_ACCESSORS( m_textLanguage )@@ -314,6 +315,14 @@ const OptionDef TheOptionCatalog[] =OPTION_BOOL, APPLY_DEVICE_RESET, 0, 1,get_m_vsync, set_m_vsync },+ // Classic or Reforged. Classic is the picture the game shipped with: its own textures, EA's+ // ground tile, no normal maps, the stencil shadows and no post effects. The upscaled archives+ // are mounted before GlobalData exists, so Win32BIGFileSystem reads this key out of Options.ini+ // itself, and everything else takes it once while the device starts.+ { "ClassicGraphics", OPT_WND( "CheckClassicGraphics" ), "GUI:ClassicGraphics",+ OPTION_BOOL, APPLY_RESTART, 0, 1,+ get_m_classicGraphics, set_m_classicGraphics },+// Who wears a health bar: everyone, everyone hurt, only the selection, or nobody. Read every// frame by the drawable that is about to draw one, so changing it shows immediately.{ "HealthBars", OPT_WND( "ComboBoxHealthBars" ), "GUI:HealthBars",diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cppindex e63dbc220..1d8dcba55 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp@@ -1091,9 +1091,14 @@ void W3DDisplay::init( void )Direct3D11_Present_Enable( TheGlobalData->m_direct3D11 != FALSE );Direct3D11_Dump_Programs_To( TheGlobalData->m_direct3D11DumpPath.str() );pushDirect3D11PostChain();+ // Classic graphics is read here once and not again: a texture that has looked for its normal+ // map keeps the answer, and a tile size cannot change under a loaded map. The menu says the+ // setting waits for the next launch.+ Direct3D11_Normal_Maps_Enable( !TheGlobalData->m_classicGraphics );// Before any map is read: every tile and the atlas are sized by it. A headless run draws no- // ground, so it keeps EA's tile and the memory.- TheTilePixelExtent = TheGlobalData->m_headless ? SOURCE_TILE_PIXEL_EXTENT : MAX_TILE_PIXEL_EXTENT;+ // ground, so it keeps EA's tile and the memory, and classic graphics keeps EA's tile to look it.+ TheTilePixelExtent = (TheGlobalData->m_headless || TheGlobalData->m_classicGraphics)+ ? SOURCE_TILE_PIXEL_EXTENT : MAX_TILE_PIXEL_EXTENT;// Same problem, same answer: the filter table is built the moment the device exists and WW3D2// cannot see GlobalData, so the player's texture filtering goes in here. Nothing in the gamediff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cppindex 87ec145f2..8943b3b29 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32BIGFileSystem.cpp@@ -38,6 +38,7 @@#include "Win32Device/Common/Win32BIGFile.h"#include "Win32Device/Common/Win32BIGFileSystem.h"#include "Common/registry.h"+#include "Common/EarlyOptions.h"#ifdef _INTERNAL// for occasional debugging...@@ -87,12 +88,27 @@ Win32BIGFileSystem::Win32BIGFileSystem() : ArchiveFileSystem() {Win32BIGFileSystem::~Win32BIGFileSystem() {}+// The classic graphics setting, read out of Options.ini before anything mounts: the archives go in+// long before GlobalData exists, and the fork's upscaled art is the one thing classic has to keep+// out of the directory tree rather than switch off afterwards.+static Bool theClassicGraphics = FALSE;+static const char REFORGED_ARCHIVE_PREFIX[] = "Reforged";++static Bool isReforgedArchive(const AsciiString &path)+{+ const char *name = strrchr(path.str(), '\\');+ name = (name != NULL) ? name + 1 : path.str();+ return _strnicmp(name, REFORGED_ARCHIVE_PREFIX, sizeof(REFORGED_ARCHIVE_PREFIX) - 1) == 0;+}+void Win32BIGFileSystem::init() {DEBUG_ASSERTCRASH(TheLocalFileSystem != NULL, ("TheLocalFileSystem must be initialized before TheArchiveFileSystem."));if (TheLocalFileSystem == NULL) {return;}+ theClassicGraphics = getEarlyOptionBool("ClassicGraphics", false);+//// The exe's own directory and no further down. This used to walk every subdirectory under it,// which had two consequences. A stray archive - one extracted into Data\INI, say - joined the@@ -303,6 +319,12 @@ Bool Win32BIGFileSystem::loadBigFilesFromDirectory(AsciiString dir, AsciiStringBool actuallyAdded = FALSE;FilenameListIter it = filenameList.begin();while (it != filenameList.end()) {+ if (theClassicGraphics && isReforgedArchive(*it)) {+ DEBUG_LOG(("Win32BIGFileSystem::loadBigFilesFromDirectory - classic graphics, leaving %s out.\n", (*it).str()));+ it++;+ continue;+ }+ArchiveFile *archiveFile = openArchiveFile((*it).str());if (archiveFile != NULL) {diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cppindex 59b4effa3..63d37e071 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cpp+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.cpp@@ -31,6 +31,7 @@ static bool Requested = false;static bool PresentRequested = false;static bool VSyncRequested = false;static bool Active = false;+static bool NormalMapsEnabled = true;static DX11DeviceClass Device;static DX11BackendClass Backend;static DX11PostProcessClass Post;@@ -248,9 +249,14 @@ void Direct3D11_Mirror_Texture(unsigned stage, struct IDirect3DBaseTexture9 * te}}+void Direct3D11_Normal_Maps_Enable(bool enabled)+{+ NormalMapsEnabled = enabled;+}+bool Direct3D11_Normal_Maps_Active(){- return Active;+ return Active && NormalMapsEnabled;}void Direct3D11_Mirror_Normal_Map(struct IDirect3DBaseTexture9 * normal_map)diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.h b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.hindex c66539352..225029c55 100644--- a/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.h+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/WW3D2/dx11runtime.h@@ -91,7 +91,9 @@ void Direct3D11_Mirror_Texture(unsigned stage, struct IDirect3DBaseTexture9 * te// Normal maps: TextureClass looks for a "<name>_nrm.dds" beside every texture it binds at stage// zero and hands it over here, null when there is none; the terrain builds its own. Active is-// false on a Direct3D 9 run, which has no pixel half to light with.+// false on a Direct3D 9 run, which has no pixel half to light with, and after the classic graphics+// setting turned them off, which it does once, before the first texture is bound.+void Direct3D11_Normal_Maps_Enable(bool enabled);bool Direct3D11_Normal_Maps_Active();void Direct3D11_Mirror_Normal_Map(struct IDirect3DBaseTexture9 * normal_map);diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex c3dc2ee41..9e70dffcb 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -11472,6 +11472,22 @@ TEST(early_options_reads_the_same_file_userpreferences_writes)::fclose( fp );}+/** ClassicGraphics is read twice: by the archive mount, before the engine exists, and by the options+ catalog. If they disagreed about a hand-edited "true", the game would draw EA's tile over the+ upscaled art or the other way round. */+TEST(early_options_reads_a_yes_the_way_the_catalog_does)+{+ CHECK( isEarlyOptionYes( "yes" ) );+ CHECK( isEarlyOptionYes( "YES" ) );+ CHECK( isEarlyOptionYes( "true" ) );+ CHECK( isEarlyOptionYes( "on" ) );+ CHECK( isEarlyOptionYes( "1" ) );+ CHECK( !isEarlyOptionYes( "no" ) );+ CHECK( !isEarlyOptionYes( "0" ) );+ CHECK( !isEarlyOptionYes( "" ) );+ CHECK( !isEarlyOptionYes( "yess" ) );+}+/** The tab strip's hit test. Nothing in the shipped game uses the tab control, so its arithmetichas never run against a real click; the settings screen is the first layout to use it. */TEST(a_click_on_the_tab_strip_names_the_tab_under_it)diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.pyindex 5a736789e..cc45c4180 100644--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py@@ -128,6 +128,7 @@ NEW_CONTROLS = [(LABEL, "LabelWindowMode", "GUI:WindowMode"),(COMBO, "ComboBoxWindowMode", None),(CHECK, "CheckVSync", "GUI:VSync"),+ (CHECK, "CheckClassicGraphics", "GUI:ClassicGraphics"),(LABEL, "LabelMSAA", "GUI:MSAA"),(COMBO, "ComboBoxMSAA", None),(LABEL, "LabelBloom", "GUI:Bloom"),@@ -218,6 +219,7 @@ GROUP_LAYOUT = [setting("GammaLabel", "SliderGamma", "ValueGamma")]),("PageGraphics", 0, "GUI:OptionsGroupDetail", [+ ("check", "CheckClassicGraphics"),setting("DetailLabel", "ComboBoxDetail"),setting("LabelTextureResolution", "LowResSlider", "ValueTextureResolution"),setting("LabelParticleCap", "ParticleCapSlider", "ValueParticleCap")]),