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(w3ddevice): classic graphics keeps the original water
Olcay Seygand45267bfac53
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 84d6ff0e7..f1e4a4b1e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -80,6 +80,7 @@ found and fixed, EA's own, not port damage.**- Options has a Water Style box. Modern rolls the sea in waves whose crests catch the sun all the way into the shallows, and at the shore they turn along the bank and pile up foam. Boats push foam off their hulls. Classic stays the default, and either way a map keeps the water colour and depth its maker gave it.- Windows has it now on the default renderer, and the box switches it in the middle of a match. The Direct3D 9 renderer and macOS keep the Classic water and hide the box. Linux still draws one thing Windows does not, a second band of foam laid over the surf where waves break on a beach. The first Modern frame on a fresh install stops for about ten seconds while its two water shaders compile; every match after that loads them from the cache.- The main menu runs smoothly again. 3.4.0's quality slider switched Modern water on for every detail level from Medium up, and for anyone who had never touched the Water Style box, so the sea under the menu cost a pass 11 to 45 ms where Classic water takes 3 to 6 on an RTX 2060. Modern water is your pick again: the slider and the detail presets leave the box as you set it, and Classic is what you get until you choose otherwise.+- Classic Graphics always draws the original water. With Water Style on Modern, which 3.4.0's slider and presets set for you, the sea under the main menu and in every match came out as the new water, smooth and deep blue, beside the 2003 art and its textured teal sea. The box keeps your pick for when Classic Graphics is off again.## Volumetric hazard cloudsdiff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cppindex bc0e3f19c..2e48494ea 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/Water/W3DWater.cpp@@ -944,6 +944,15 @@ bool Supported()} // namespace ModernWater#if ZH_MODERN_WATER+/** The Modern style is asked for and a device draws it. Classic graphics is the 2003 picture, so it+ keeps EA's water whatever WaterStyle says, as it keeps the old clouds and drops the foam; the+ quality slider and its presets put Modern into WaterStyle from Medium up. */+static Bool wantsModernWater(void)+{+ return TheGlobalData && TheGlobalData->m_waterStyle != 0 && !TheGlobalData->m_classicGraphics+ && ModernWater::Supported();+}+/** The Modern water's registers run to c895, past any Direct3D 9 device; on Windows they go to theDirect3D 11 backend's own bank, which is the only device that draws with them. */static void setModernWaterConstants(UnsignedInt first, const float *values, size_t count)@@ -1072,7 +1081,7 @@ void WaterRenderObjClass::registerWaterStyleShaders(void)void WaterRenderObjClass::synchronizeWaterStyle(void){#if ZH_MODERN_WATER- const Bool modern = TheGlobalData && TheGlobalData->m_waterStyle != 0 && ModernWater::Supported();+ const Bool modern = wantsModernWater();if (modern == m_useModernWater) return;// Apply before any reflected or main-scene water draw. Existing recorded draws keep@@ -1436,7 +1445,7 @@ WaterRenderObjClass::~WaterRenderObjClass(void)WaterRenderObjClass::WaterRenderObjClass(void){#if ZH_MODERN_WATER- m_useModernWater = TheGlobalData && TheGlobalData->m_waterStyle != 0 && ModernWater::Supported();+ m_useModernWater = wantsModernWater();#endifmemset( &m_settings, 0, sizeof( m_settings ) );m_dx=0;diff --git a/GeneralsMD/Code/Tests/test_water_grid.cpp b/GeneralsMD/Code/Tests/test_water_grid.cppindex 530472eb6..c843d7987 100644--- a/GeneralsMD/Code/Tests/test_water_grid.cpp+++ b/GeneralsMD/Code/Tests/test_water_grid.cpp@@ -4907,6 +4907,9 @@ TEST(water_style_changes_at_render_boundary_without_advancing_paused_time_or_relTheWritableGlobalData=NULL;water.seedPresentation();water.updateRenderTargetTextures(NULL);water.checkChanged(false);TheWritableGlobalData=scratch;+ // Classic graphics keeps EA's water even with Modern asked for.+ scratch->m_waterStyle=1;scratch->m_classicGraphics=TRUE;+ water.seedPresentation();water.updateRenderTargetTextures(NULL);water.checkUnchanged();}device->Release();} else {