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
fix(water): keep classic as the default on linux
Richard Louie Orilla5a8f0805e87b
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex ae74c4750..a7ad7ec70 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -10,11 +10,12 @@ found and fixed — EA's own, not port damage.**## Modern water on Linux-- Water rolls in waves with sunlight following the crests into the shallows.+- Modern is an opt-in under Options > Water style; Classic stays the default.+ Water rolls in waves with sunlight following the crests into the shallows.Shores redirect waves along their banks and gather foam; vessels leave wakes.- Modern water preserves map-authored depth and opacity, matches material rulesto the effective water color and texture, and adds pollution and bubbles only- to matching water. Choose Classic to keep the previous surface.+ to matching water.- A standalone editor uses the game's water renderer and material rules. Invalidsaved colors leave the current colors intact; default exports protect theloaded rule file. Explicit export destinations remain available.diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex fcce322a9..135f57475 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -971,7 +971,7 @@ GlobalData::GlobalData()m_shadowsForParticles = TRUE; //on by default: the shipped INI has no entry for itm_volumetricSmokeShadows = TRUE;m_smokeFireLighting = TRUE;- m_waterStyle = 1; // keep modern water for existing Options.ini files+ m_waterStyle = 0; // classic by default; modern water is an explicit optionm_explosionDebrisTrails = TRUE;m_shadowQuality = 1; //medium, the 2048 map the shadows always hadm_classicGraphics = FALSE;diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cppindex f85259ddf..865366446 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp@@ -1015,7 +1015,7 @@ void WaterRenderObjClass::registerWaterStyleShaders(void)void WaterRenderObjClass::synchronizeWaterStyle(void){#if defined(__linux__)- const Bool modern = !TheGlobalData || TheGlobalData->m_waterStyle != 0;+ const Bool modern = TheGlobalData && TheGlobalData->m_waterStyle != 0;if (modern == m_useModernWater) return;// Apply before any reflected or main-scene water draw. Existing recorded draws keep@@ -1379,7 +1379,7 @@ WaterRenderObjClass::~WaterRenderObjClass(void)WaterRenderObjClass::WaterRenderObjClass(void){#if defined(__linux__)- m_useModernWater = !TheGlobalData || TheGlobalData->m_waterStyle != 0;+ m_useModernWater = TheGlobalData && TheGlobalData->m_waterStyle != 0;#endifmemset( &m_settings, 0, sizeof( m_settings ) );m_dx=0;diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cppindex 2dec31e77..288dbd402 100644--- a/GeneralsMD/Code/Tests/test_gameengine.cpp+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp@@ -15127,7 +15127,7 @@ TEST(order_lines_are_a_live_check_box_that_starts_on)TheWritableGlobalData = saved;}-TEST(water_style_defaults_to_modern_and_preserves_an_explicit_classic_choice)+TEST(water_style_defaults_to_classic_and_preserves_an_explicit_modern_choice){GlobalData *saved=TheWritableGlobalData;GlobalData *scratch=NEW GlobalData;@@ -15136,17 +15136,17 @@ TEST(water_style_defaults_to_modern_and_preserves_an_explicit_classic_choice)CHECK(water!=NULL);if (water) {UserPreferences pref;- CHECK_EQ(scratch->m_waterStyle,1);- loadOptionsFromPreferences(pref);- CHECK_EQ(water->get(),1);- pref["WaterStyle"]="0";+ CHECK_EQ(scratch->m_waterStyle,0);loadOptionsFromPreferences(pref);CHECK_EQ(water->get(),0);- saveOptionsToPreferences(pref);- CHECK_STR(pref["WaterStyle"].str(),"0");pref["WaterStyle"]="1";loadOptionsFromPreferences(pref);CHECK_EQ(water->get(),1);+ saveOptionsToPreferences(pref);+ CHECK_STR(pref["WaterStyle"].str(),"1");+ pref["WaterStyle"]="0";+ loadOptionsFromPreferences(pref);+ CHECK_EQ(water->get(),0);CHECK_EQ(water->apply,APPLY_LIVE);}delete scratch;diff --git a/GeneralsMD/Code/Tests/test_water_grid.cpp b/GeneralsMD/Code/Tests/test_water_grid.cppindex 90757ab5e..8869bbf93 100644--- a/GeneralsMD/Code/Tests/test_water_grid.cpp+++ b/GeneralsMD/Code/Tests/test_water_grid.cpp@@ -4789,6 +4789,7 @@ struct WaterShaderNameProbe : PosixDevice9 { using PosixDevice9::Engine_Name_Of;class LiveWaterStyleProbe : public WaterRenderObjClass{public:+ bool usesModernWater() const { return m_useModernWater; }const std::vector<WaterOpticalContext::Polygon> &opticalPolygonsForDraw() {refreshModernWaterOpticalPolygons();return m_modernOpticalPolygons;@@ -4890,7 +4891,11 @@ TEST(water_style_changes_at_render_boundary_without_advancing_paused_time_or_relCHECK(d3d && d3d->CreateDevice(0,D3DDEVTYPE_HAL,NULL,0,¶meters,&device)==D3D_OK);if (device) {{- LiveWaterStyleProbe water;water.prepareShaders(device);+ TheWritableGlobalData=NULL;+ LiveWaterStyleProbe water;+ CHECK(!water.usesModernWater());+ TheWritableGlobalData=scratch;scratch->m_waterStyle=1;+ water.prepareShaders(device);water.updateRenderTargetTextures(NULL);for (unsigned i=0;i<32;++i) {const bool modern=(i&1)!=0;water.seedPresentation();scratch->m_waterStyle=modern?1:0;@@ -4899,6 +4904,9 @@ TEST(water_style_changes_at_render_boundary_without_advancing_paused_time_or_relwater.updateRenderTargetTextures(NULL);water.checkChanged(modern);water.seedPresentation();water.updateRenderTargetTextures(NULL);water.checkUnchanged();}+ TheWritableGlobalData=NULL;water.seedPresentation();+ water.updateRenderTargetTextures(NULL);water.checkChanged(false);+ TheWritableGlobalData=scratch;}device->Release();} else {diff --git a/docs/linux.md b/docs/linux.mdindex fecf0eda2..dbc92f4e8 100644--- a/docs/linux.md+++ b/docs/linux.md@@ -2,7 +2,8 @@## Modern water contribution-On Linux, Water style selects Modern or Classic live. Modern is the default.+On Linux, Classic stays the default. Opt in to Modern under Options > Water style;+changes apply live.Windows keeps its original water shader identities; macOS uses the legacy SDLwater programs and hides the Linux selector. Material rules are loaded from`Data/INI/ModernWater.ini` through the game filesystem. Source edits are stageddiff --git a/docs/water-preview.md b/docs/water-preview.mdindex 2d93ec092..5616c6800 100644--- a/docs/water-preview.md+++ b/docs/water-preview.md@@ -5,6 +5,9 @@ production SDL renderer, GPU FFT, Modern water shader and `ModernWater.ini` parsthe game. It requires no game assets, save or running match. The synthetic flat submergedbed and fixed lighting make comparisons repeatable; this is not a campaign-map viewer.+The game defaults to Classic; opt in to Modern under Options > Water style.+The standalone preview always uses Modern.+## Configuration and matchingOn an ordinary launch the tool looks beside its executable for