Skip to content

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.

feat(w3ddevice): shells and bodies splash in water, as an option

Olcay Seygan85b3d9ce1128
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71a832f4e..9a0c06003 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,10 @@ found and fixed, EA's own, not port damage.**
---
+## Shells land in water
+
+- Water Splashes, under Options, Effects, is a new setting, off by default until it has been played. EA's shells burst on a river as they burst on sand: a fireball and nothing on the water. With this on, a shell or a bomb that comes down in water throws up spray, leaves a patch of foam and sends two rings across the surface, dimmed by the map's light at night. On the wet sand at the water's edge you get the spray alone, since a ring lying on a beach looks like glass. Your opponent's setting is his own, because no part of the game reads this. Fifteen guns shelling one channel without a pause, more than a match ever puts in water, take the graphics card's frame from about 2.45 to 2.64 ms and the slowest frames from about 13 to 15 ms. Direct3D 11 and Classic water only, and off under Classic Graphics.
+
## Weather, if you want it
- Weather, under Options, Effects, is a new setting, off by default until it has been played. A green map gets rain, and a desert map gets blowing sand over a still tan haze. A snowy map with no flakes of its own gets them. The trees lean and sway harder and smoke drifts downwind; a map that already rains or snows, Flooded Plains or Bitter Winter, keeps what EA gave it and takes only the wind. No part of the game reads any of this: what a unit sees and hits stays what the map says, so you and your opponent can have different weather in one match. A sandstorm over a battle of three armies and three superweapons takes the graphics card's frame from about 7.9 to 8.5 ms. Direct3D 11 only, and off under Classic Graphics.
diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
index 245d234dc..1edcf3d49 100644
--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
@@ -6636,6 +6636,242 @@ ParticleSystem SootySmokeColumn
SystemLifetime = 10
End
+; The Water Splashes option, what W3DGameClient::splashInWater plays at the surface where a blast or a
+; falling body meets water: a throw of spray, a foam patch and two rings, on EA's own textures. Nothing
+; names these but that function, so with the option off they are never made.
+
+ParticleSystem WaterSplashThrow
+ Priority = WEAPON_EXPLOSION
+ IsOneShot = No
+ Shader = ALPHA
+ Type = PARTICLE
+ ParticleName = EXWater04.tga
+ AngleZ = 0.00 6.28
+ AngularRateZ = -0.05 0.05
+ AngularDamping = 0.98 0.98
+ VelocityDamping = 0.94 0.94
+ Gravity = -0.10
+ Lifetime = 50.00 50.00
+ SystemLifetime = 2
+ Size = 3.00 6.00
+ StartSizeRate = 0.00 0.00
+ SizeRate = 0.80 1.60
+ SizeRateDamping = 0.97 0.97
+ Alpha1 = 1.00 1.00 0
+ Alpha2 = 0.70 0.70 20
+ Alpha3 = 0.00 0.00 50
+ Alpha4 = 0.00 0.00 0
+ Alpha5 = 0.00 0.00 0
+ Alpha6 = 0.00 0.00 0
+ Alpha7 = 0.00 0.00 0
+ Alpha8 = 0.00 0.00 0
+ Color1 = R:255 G:255 B:255 0
+ Color2 = R:0 G:0 B:0 0
+ Color3 = R:0 G:0 B:0 0
+ Color4 = R:0 G:0 B:0 0
+ Color5 = R:0 G:0 B:0 0
+ Color6 = R:0 G:0 B:0 0
+ Color7 = R:0 G:0 B:0 0
+ Color8 = R:0 G:0 B:0 0
+ ColorScale = 0.00 0.00
+ BurstDelay = 1.00 1.00
+ BurstCount = 10.00 10.00
+ InitialDelay = 0.00 0.00
+ DriftVelocity = X:0.00 Y:0.00 Z:0.00
+ VelocityType = ORTHO
+ VelOrthoX = -1.00 1.00
+ VelOrthoY = -1.00 1.00
+ VelOrthoZ = 1.50 4.00
+ VolumeType = CYLINDER
+ VolCylinderRadius = 2.00
+ VolCylinderLength = 0.00
+ IsHollow = No
+ IsGroundAligned = No
+ IsEmitAboveGroundOnly = No
+ IsParticleUpTowardsEmitter = No
+ WindMotion = Unused
+ WindAngleChangeMin = 0.149924
+ WindAngleChangeMax = 0.449946
+ WindPingPongStartAngleMin = 0.000000
+ WindPingPongStartAngleMax = 0.785398
+ WindPingPongEndAngleMin = 5.497787
+ WindPingPongEndAngleMax = 6.283185
+End
+
+ParticleSystem WaterSplashFoam
+ Priority = WEAPON_EXPLOSION
+ IsOneShot = No
+ Shader = ALPHA
+ Type = PARTICLE
+ ParticleName = EXWave01.tga
+ AngleZ = -3.14 3.14
+ AngularRateZ = 0.00 0.00
+ AngularDamping = 1.00 1.00
+ VelocityDamping = 1.00 1.00
+ Gravity = 0.00
+ Lifetime = 120.00 120.00
+ SystemLifetime = 1
+ Size = 6.00 8.00
+ StartSizeRate = 0.00 0.00
+ SizeRate = 0.60 0.90
+ SizeRateDamping = 0.97 0.97
+ Alpha1 = 0.35 0.35 0
+ Alpha2 = 0.00 0.00 120
+ Alpha3 = 0.00 0.00 0
+ Alpha4 = 0.00 0.00 0
+ Alpha5 = 0.00 0.00 0
+ Alpha6 = 0.00 0.00 0
+ Alpha7 = 0.00 0.00 0
+ Alpha8 = 0.00 0.00 0
+ Color1 = R:170 G:195 B:205 0
+ Color2 = R:0 G:0 B:0 0
+ Color3 = R:0 G:0 B:0 0
+ Color4 = R:0 G:0 B:0 0
+ Color5 = R:0 G:0 B:0 0
+ Color6 = R:0 G:0 B:0 0
+ Color7 = R:0 G:0 B:0 0
+ Color8 = R:0 G:0 B:0 0
+ ColorScale = 0.00 0.00
+ BurstDelay = 1.00 1.00
+ BurstCount = 2.00 2.00
+ InitialDelay = 0.00 0.00
+ DriftVelocity = X:0.00 Y:0.00 Z:0.00
+ VelocityType = ORTHO
+ VelOrthoX = 0.00 0.00
+ VelOrthoY = 0.00 0.00
+ VelOrthoZ = 0.00 0.00
+ VolumeType = LINE
+ VolLineStart = X:0.00 Y:0.00 Z:0.25
+ VolLineEnd = X:0.00 Y:0.00 Z:0.25
+ IsHollow = No
+ IsGroundAligned = Yes
+ IsEmitAboveGroundOnly = No
+ IsParticleUpTowardsEmitter = No
+ WindMotion = Unused
+ WindAngleChangeMin = 0.149924
+ WindAngleChangeMax = 0.449946
+ WindPingPongStartAngleMin = 0.000000
+ WindPingPongStartAngleMax = 0.785398
+ WindPingPongEndAngleMin = 5.497787
+ WindPingPongEndAngleMax = 6.283185
+End
+
+ParticleSystem WaterSplashRing
+ Priority = WEAPON_EXPLOSION
+ IsOneShot = No
+ Shader = ADDITIVE
+ Type = PARTICLE
+ ParticleName = EXShockWav.tga
+ AngleZ = -3.14 3.14
+ AngularRateZ = 0.00 0.00
+ AngularDamping = 1.00 1.00
+ VelocityDamping = 1.00 1.00
+ Gravity = 0.00
+ Lifetime = 90.00 90.00
+ SystemLifetime = 1
+ Size = 6.00 6.00
+ StartSizeRate = 0.00 0.00
+ SizeRate = 2.20 2.20
+ SizeRateDamping = 0.985 0.985
+ Alpha1 = 0.00 0.00 0
+ Alpha2 = 0.20 0.20 0
+ Alpha3 = 0.00 0.00 0
+ Alpha4 = 0.00 0.00 0
+ Alpha5 = 0.00 0.00 0
+ Alpha6 = 0.00 0.00 0
+ Alpha7 = 0.00 0.00 0
+ Alpha8 = 0.00 0.00 0
+ Color1 = R:0 G:0 B:0 0
+ Color2 = R:210 G:210 B:210 3
+ Color3 = R:0 G:0 B:0 90
+ Color4 = R:0 G:0 B:0 0
+ Color5 = R:0 G:0 B:0 0
+ Color6 = R:0 G:0 B:0 0
+ Color7 = R:0 G:0 B:0 0
+ Color8 = R:0 G:0 B:0 0
+ ColorScale = 0.00 0.00
+ BurstDelay = 1.00 1.00
+ BurstCount = 1.00 1.00
+ InitialDelay = 0.00 0.00
+ DriftVelocity = X:0.00 Y:0.00 Z:0.00
+ VelocityType = ORTHO
+ VelOrthoX = 0.00 0.00
+ VelOrthoY = 0.00 0.00
+ VelOrthoZ = 0.00 0.00
+ VolumeType = LINE
+ VolLineStart = X:0.00 Y:0.00 Z:0.25
+ VolLineEnd = X:0.00 Y:0.00 Z:0.25
+ IsHollow = No
+ IsGroundAligned = Yes
+ IsEmitAboveGroundOnly = No
+ IsParticleUpTowardsEmitter = No
+ WindMotion = Unused
+ WindAngleChangeMin = 0.149924
+ WindAngleChangeMax = 0.449946
+ WindPingPongStartAngleMin = 0.000000
+ WindPingPongStartAngleMax = 0.785398
+ WindPingPongEndAngleMin = 5.497787
+ WindPingPongEndAngleMax = 6.283185
+End
+
+ParticleSystem WaterSplashRingLate
+ Priority = WEAPON_EXPLOSION
+ IsOneShot = No
+ Shader = ADDITIVE
+ Type = PARTICLE
+ ParticleName = EXShockWav.tga
+ AngleZ = -3.14 3.14
+ AngularRateZ = 0.00 0.00
+ AngularDamping = 1.00 1.00
+ VelocityDamping = 1.00 1.00
+ Gravity = 0.00
+ Lifetime = 80.00 80.00
+ SystemLifetime = 1
+ Size = 4.00 4.00
+ StartSizeRate = 0.00 0.00
+ SizeRate = 1.70 1.70
+ SizeRateDamping = 0.985 0.985
+ Alpha1 = 0.00 0.00 0
+ Alpha2 = 0.20 0.20 0
+ Alpha3 = 0.00 0.00 0
+ Alpha4 = 0.00 0.00 0
+ Alpha5 = 0.00 0.00 0
+ Alpha6 = 0.00 0.00 0
+ Alpha7 = 0.00 0.00 0
+ Alpha8 = 0.00 0.00 0
+ Color1 = R:0 G:0 B:0 0
+ Color2 = R:150 G:150 B:150 3
+ Color3 = R:0 G:0 B:0 80
+ Color4 = R:0 G:0 B:0 0
+ Color5 = R:0 G:0 B:0 0
+ Color6 = R:0 G:0 B:0 0
+ Color7 = R:0 G:0 B:0 0
+ Color8 = R:0 G:0 B:0 0
+ ColorScale = 0.00 0.00
+ BurstDelay = 1.00 1.00
+ BurstCount = 1.00 1.00
+ InitialDelay = 20.00 20.00
+ DriftVelocity = X:0.00 Y:0.00 Z:0.00
+ VelocityType = ORTHO
+ VelOrthoX = 0.00 0.00
+ VelOrthoY = 0.00 0.00
+ VelOrthoZ = 0.00 0.00
+ VolumeType = LINE
+ VolLineStart = X:0.00 Y:0.00 Z:0.25
+ VolLineEnd = X:0.00 Y:0.00 Z:0.25
+ IsHollow = No
+ IsGroundAligned = Yes
+ IsEmitAboveGroundOnly = No
+ IsParticleUpTowardsEmitter = No
+ WindMotion = Unused
+ WindAngleChangeMin = 0.149924
+ WindAngleChangeMax = 0.449946
+ WindPingPongStartAngleMin = 0.000000
+ WindPingPongStartAngleMax = 0.785398
+ WindPingPongEndAngleMin = 5.497787
+ WindPingPongEndAngleMax = 6.283185
+End
+
; The wreck pieces a vehicle's death throws as models (turrets, wheels, doors, hull plates; the
; ParticleSystem line of their CreateDebris in ObjectCreationListReforged.ini) trail the same dark
; ribbon as the shrapnel above, with a small flame on each of its points that is gone in a quarter
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 4c39404db..bf6932e82 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -1548,6 +1548,14 @@ TOOLTIP:Weather
"Rain falls, or sand blows on a desert map and snow on a snowy one, and a wind bends the trees and leans the smoke. A map with its own rain or snow keeps it and takes only the wind. Only your picture changes: what units see and hit stays the same, and other players see their own setting. Direct3D 11 only, and off under Classic Graphics. Applies when you press Accept."
END
+GUI:WaterSplashes
+"Water Splashes"
+END
+
+TOOLTIP:WaterSplashes
+"A shell, a bomb or a falling body that comes down in water throws up a splash and sends rings across the surface. Only your picture changes: nothing in the game reads it, and other players see their own setting. Direct3D 11 and Classic water only, and off under Classic Graphics. Applies when you press Accept."
+END
+
GUI:FormationDrag
"Drag Out A Formation"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 7128c6731..b4fde8ef5 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -15941,6 +15941,14 @@ TOOLTIP:Weather
"Yağmur yağar, çöl haritasında kum, karlı haritada kar savrulur; rüzgâr ağaçları büker, dumanı yana yatırır. Kendi yağmuru ya da karı olan harita onu korur, yalnızca rüzgârı alır. Değişen sadece sizin görüntünüzdür: birliklerin gördüğü ve vurduğu aynı kalır, diğer oyuncular kendi ayarını görür. Yalnızca Direct3D 11 ile, Klasik Grafikler açıkken kapalıdır. Kabul Et'e basınca uygulanır."
END
+GUI:WaterSplashes
+"Su Sıçramaları"
+END
+
+TOOLTIP:WaterSplashes
+"Suya düşen mermi, bomba ya da ceset su sıçratır ve yüzeyde halkalar yayar. Değişen sadece sizin görüntünüzdür: oyunda hiçbir şey bunu okumaz, diğer oyuncular kendi ayarını görür. Yalnızca Direct3D 11 ve Klasik su ile, Klasik Grafikler açıkken kapalıdır. Kabul Et'e basınca uygulanır."
+END
+
GUI:FormationDrag
"Sürükleyerek Düzen Kur"
END
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index dfbd4ebd6..9b717c78d 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -7921,6 +7921,53 @@ WINDOW
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: 536 434, BOTTOMRIGHT: 760 458, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:CheckWaterSplashes";
+ 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:WaterSplashes";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:WaterSplashes";
+ 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
ENDALLCHILDREN
END
CHILD
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index 9550f347b..b4298d6ec 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -711,6 +711,7 @@ public:
Bool m_hemiAmbient; ///< "HemiAmbient": models take the ambient from the sky above and the ground below (Direct3D 11, client only)
Bool m_ambientOcclusion; ///< "AmbientOcclusion": corners and the ground under what stands on it darken, half size in world units (Direct3D 11, client only)
Bool m_weatherEffects; ///< "Weather": rain, blowing sand or snow by the map's ground, and a wind on trees and smoke (Direct3D 11, client only)
+ Bool m_waterSplashes; ///< "WaterSplashes": a splash and rings where a blast or a falling body meets water (Direct3D 11, client only)
Bool m_internalHdr; ///< "InternalHdr": what passes white in the half float scene keeps its colour on the way to eight bits; no HDR monitor output (Direct3D 11, client only)
Int m_maxParticleCount; ///< maximum number of particles that can exist
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h b/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h
index 362d073be..5213fbf88 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h
@@ -113,7 +113,7 @@ public:
*/
virtual void doFXObj(const FXObjectView* primary, const FXObjectView* secondary = NULL) const;
- /// How wide a burn this nugget's blast asks for under Battle Marks: 0 has no say, below 0 scorches the ground itself.
+ /// How wide a burn this nugget's blast asks for under Battle Marks: 0 has no say, below 0 scorches the ground itself, as wide as the value's size.
virtual Real blastMarkRadius() const { return 0.0f; }
private:
@@ -172,11 +172,15 @@ public:
{
m_nuggets.swap(that.m_nuggets);
std::swap(m_markRadius, that.m_markRadius);
+ std::swap(m_splashRadius, that.m_splashRadius);
}
- /// Battle Marks: told the list's name once it is parsed, decides whether it is a blast on the ground.
+ /// Battle Marks and Water Splashes: told the list's name once it is parsed, decides whether it is a blast on the ground.
void noteBlastByName(const char *name);
+ /// How wide this list splashes in water under Water Splashes, 0 for not at all.
+ Real getSplashRadius() const { return m_splashRadius; }
+
/// inline convenience method to avoid having to check for null.
inline static void doFXPos(const FXList* fx, const Coord3D *primary, const Matrix3D* primaryMtx = NULL, const Real primarySpeed = 0.0f, const Coord3D *secondary = NULL, const Real overrideRadius = 0.0f)
{
@@ -224,6 +228,7 @@ private:
FXNuggetList m_nuggets;
Real m_markRadius; ///< the burn this list leaves on the ground under Battle Marks, 0 for none
+ Real m_splashRadius; ///< how wide it splashes in water under Water Splashes, 0 for not at all
};
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h
index ead0e4000..6ed9a9d04 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h
@@ -143,6 +143,7 @@ public:
virtual void addScorch(const Coord3D *pos, Real radius, Scorches type) = 0;
virtual void addGroundMark(const Coord3D *pos, Real radius, Int type) {} ///< the Battle Marks option: a burn that fades, nothing logic reads
virtual void structureFell(const Coord3D *pos, Real radius) {} ///< a building is down: what the client alone does about it
+ virtual void splashInWater(const Coord3D *pos, Real radius) {} ///< the Water Splashes option: a blast or a body came down here, nothing logic reads
virtual Bool loadMap( AsciiString mapName ); ///< load a map into our scene
virtual void unloadMap( AsciiString mapName ); ///< unload the specified map from our scene
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 0a27c0d2d..55cc157ad 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1140,6 +1140,7 @@ GlobalData::GlobalData()
m_hemiAmbient = FALSE;
m_ambientOcclusion = FALSE;
m_weatherEffects = FALSE;
+ m_waterSplashes = FALSE;
m_internalHdr = FALSE;
m_horizontalScrollSpeedFactor = 1.0;
m_verticalScrollSpeedFactor = 1.0;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
index 8e91676a8..c0f50b17c 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
@@ -147,6 +147,7 @@ OPTION_BOOL_ACCESSORS( m_firelight )
OPTION_BOOL_ACCESSORS( m_hemiAmbient )
OPTION_BOOL_ACCESSORS( m_ambientOcclusion )
OPTION_BOOL_ACCESSORS( m_weatherEffects )
+OPTION_BOOL_ACCESSORS( m_waterSplashes )
OPTION_BOOL_ACCESSORS( m_internalHdr )
OPTION_INT_ACCESSORS( m_shadowQuality )
OPTION_INT_ACCESSORS( m_graphicsQuality )
@@ -652,6 +653,13 @@ const OptionDef TheOptionCatalog[] =
OPTION_BOOL, APPLY_LIVE, 0, 1,
get_m_weatherEffects, set_m_weatherEffects },
+ // A splash and rings where a blast or a falling body meets water: W3DGameClient::splashInWater makes
+ // particle systems, and no sim reads them. Off under Classic graphics, -d3d9 and Modern water, and no
+ // row in the quality table: an opt-in until it has been seen. On Options > Effects.
+ { "WaterSplashes", OPT_WND( "CheckWaterSplashes" ), "GUI:WaterSplashes",
+ OPTION_BOOL, APPLY_LIVE, 0, 1,
+ get_m_waterSplashes, set_m_waterSplashes },
+
// What passes white keeps its colour on the way to the eight bit screen; no HDR monitor output. The
// post chain is told every frame. Classic graphics has no half float scene and -d3d9 no chain, and
// no row in the quality table: an opt-in until it has been seen. On Options > Effects.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
index 8c983088e..115a63d6f 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
@@ -525,7 +525,7 @@ public:
{
}
- virtual Real blastMarkRadius() const { return -1.0f; }
+ virtual Real blastMarkRadius() const { return -max(m_radius, 1.0f); }
virtual void doFXPos(const Coord3D *primary, const Matrix3D* /*primaryMtx*/, const Real /*primarySpeed*/, const Coord3D * /*secondary*/, const Real /*overrideRadius*/ ) const
{
@@ -899,7 +899,7 @@ static const FieldParse TheFXListFieldParse[] =
};
//-------------------------------------------------------------------------------------------------
-FXList::FXList() : m_markRadius(0.0f)
+FXList::FXList() : m_markRadius(0.0f), m_splashRadius(0.0f)
{
}
@@ -919,38 +919,39 @@ void FXList::clear()
}
m_nuggets.clear();
m_markRadius = 0.0f;
+ m_splashRadius = 0.0f;
}
//-------------------------------------------------------------------------------------------------
/** Which lists are a blast that marks the ground goes by name, there being nothing else that says
* so: a muzzle flash shakes the view as hard as a shell landing, and only fifty lists scorch on
* their own, none of them a tank shell or a missile. Client only, read once at parse, and no INI
- * line changes. A list that scorches already keeps that and takes no burn on top. */
+ * line changes. A list that scorches already keeps that and takes no burn on top. Water Splashes
+ * takes every blast the name says and every list that scorches: the names a burn leaves out still
+ * throw water up, and a nuke goes by no blast's name. How high it lands is asked where it lands. */
//-------------------------------------------------------------------------------------------------
void FXList::noteBlastByName(const char *name)
{
static const char *const blasts[] = { "Detonation", "Explosion", "Explode", "Impact", "HitsGround", "HitGround", "Blast", "Crash" };
static const char *const notBurns[] = { "Toxin", "Anthrax", "EMP", "Bio", "Cleanup", "Garrison", "Disguise", "FlashBang", "Patriot", "Stinger", "Spill" };
- m_markRadius = 0.0f;
Bool isBlast = FALSE;
for (size_t i = 0; i < ARRAY_SIZE(blasts); ++i)
isBlast = isBlast || strstr(name, blasts[i]) != NULL;
+ Bool burns = isBlast;
for (size_t i = 0; i < ARRAY_SIZE(notBurns); ++i)
- isBlast = isBlast && strstr(name, notBurns[i]) == NULL;
- if (!isBlast)
- return;
+ burns = burns && strstr(name, notBurns[i]) == NULL;
Real radius = 10.0f;
+ Bool scorches = FALSE;
for (FXNuggetList::const_iterator it = m_nuggets.begin(); it != m_nuggets.end(); ++it)
{
const Real asked = (*it)->blastMarkRadius();
- if (asked < 0.0f)
- return;
- if (asked > radius)
- radius = asked;
+ scorches = scorches || asked < 0.0f;
+ radius = max(radius, (Real)fabs(asked));
}
- m_markRadius = radius;
+ m_markRadius = burns && !scorches ? radius : 0.0f;
+ m_splashRadius = isBlast || scorches ? radius : 0.0f;
}
//-------------------------------------------------------------------------------------------------
@@ -1000,6 +1001,8 @@ void FXList::doFXPosNow(const Coord3D *primary, const Matrix3D* primaryMtx, cons
(*it)->doFXPos(primary, primaryMtx, primarySpeed, secondary, overrideRadius);
}
leaveBlastMark(primary);
+ if (m_splashRadius > 0.0f)
+ TheGameClient->splashInWater(primary, m_splashRadius);
}
//-------------------------------------------------------------------------------------------------
@@ -1067,7 +1070,11 @@ void FXList::doFXObjNow(const FXObjectView* primary, const FXObjectView* seconda
(*it)->doFXObj(primary, secondary);
}
if (primary)
+ {
leaveBlastMark(&primary->position);
+ if (m_splashRadius > 0.0f)
+ TheGameClient->splashInWater(&primary->position, m_splashRadius);
+ }
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
index 31233e745..9fae6503a 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
@@ -2961,7 +2961,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
// three looks only the Direct3D 11 picture draws; under -d3d9 their boxes keep the saved value, greyed
if( !TheGlobalData->m_direct3D11 )
{
- static const char *const direct3D11Only[] = { "MapLight", "TeamGlow", "WaterFoam", "GroundMarks", "Firelight", "HemiAmbient", "AmbientOcclusion", "InternalHdr", "Weather" };
+ static const char *const direct3D11Only[] = { "MapLight", "TeamGlow", "WaterFoam", "GroundMarks", "Firelight", "HemiAmbient", "AmbientOcclusion", "InternalHdr", "Weather", "WaterSplashes" };
for( Int i = 0; i < (Int)( sizeof( direct3D11Only ) / sizeof( direct3D11Only[ 0 ] ) ); ++i )
findOptionWidget( *findOptionDef( direct3D11Only[ i ] ) )->winEnable( FALSE );
}
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp
index 145739ae9..0c3af859d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/PhysicsUpdate.cpp
@@ -49,6 +49,7 @@
#include "GameLogic/Weapon.h"
#include "GameLogic/LogicRandomValue.h"
#include "GameClient/FXList.h"
+#include "GameClient/GameClient.h"
#include "GameClient/Statistics.h" // MuLaw/NormalizeToRange, for the bounce sound volume
const Real DEFAULT_MASS = 1.0f;
@@ -871,6 +872,7 @@ UpdateSleepTime PhysicsBehavior::update()
if (getFlag(WAS_AIRBORNE_LAST_FRAME) && !airborneAtEnd && !getFlag(IMMUNE_TO_FALLING_DAMAGE))
{
doBounceSound(prevPos);
+ TheGameClient->splashInWater(obj->getPosition(), obj->getGeometryInfo().getBoundingCircleRadius());
// the normal always points straight down, though we could
// get the alignWithTerrain() normal if it proves interesting
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h
index ad7fcea7b..f7a0f5aa3 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h
@@ -94,6 +94,7 @@ public:
virtual void addScorch(const Coord3D *pos, Real radius, Scorches type);
virtual void addGroundMark(const Coord3D *pos, Real radius, Int type);
virtual void structureFell(const Coord3D *pos, Real radius);
+ virtual void splashInWater(const Coord3D *pos, Real radius);
virtual void createRayEffectByTemplate( const Coord3D *start, const Coord3D *end, const ThingTemplate* tmpl ); ///< create effect needing start and end location
//virtual Bool getBonePos(Drawable *draw, AsciiString boneName, Coord3D* pos, Matrix3D* transform) const;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp
index 990c3aef7..924ff58ff 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp
@@ -53,6 +53,7 @@
#include "GameClient/RayEffect.h"
#include "GameLogic/GameLogic.h"
#include "GameLogic/Object.h"
+#include "GameLogic/TerrainLogic.h"
#include "GameClient/View.h"
#include "WW3D2/dx11runtime.h"
#include "W3DDevice/GameClient/W3DAssetManager.h"
@@ -186,6 +187,66 @@ void W3DGameClient::structureFell(const Coord3D *pos, Real radius)
TheTacticalView->shake(pos, View::SHAKE_STRONG);
}
+//-------------------------------------------------------------------------------------------------
+/** The Water Splashes option: a blast or a falling body came down at pos. In water it throws a splash
+ * and, where the water has depth, foam and rings, sized by radius, from the surface.
+ * ParticleSystemReforged.ini holds the systems, outside the multiplayer checksum. Classic Graphics
+ * and Direct3D 9 keep EA's water, and the Modern water style its own foam. */
+//-------------------------------------------------------------------------------------------------
+void W3DGameClient::splashInWater(const Coord3D *pos, Real radius)
+{
+ if (!TheGlobalData->m_waterSplashes || TheGlobalData->m_classicGraphics || TheGlobalData->m_waterStyle != 0 || !Direct3D11_Present_Is_Enabled())
+ return;
+ const Coord3D at = *pos;
+ LOGIC_AFTER_TICK( [=]() { splashInWater( &at, radius ); } );
+
+ // any higher is a blast in the air; at or under the surface is what lands, since a shell comes down on
+ // the bed. The surface, not the bed, is where the water shows.
+ const Real MAX_HEIGHT_OVER_WATER = 10.0f;
+ Real waterZ, bedZ;
+ if (!TheTerrainLogic->isUnderwater(pos->x, pos->y, &waterZ, &bedZ) || pos->z > waterZ + MAX_HEIGHT_OVER_WATER)
+ return;
+ if (pos->z > waterZ && TheTerrainLogic->findBridgeAt(pos) != NULL)
+ return;
+ if (ThePartitionManager->getShroudStatusForPlayer(TheObserverCamera.getShroudPlayerIndex(), pos) != CELLSHROUD_CLEAR)
+ return;
+
+ // the systems' colours are a day's: a night's splash takes how bright the map's light is, not its
+ // colour, which on a night map is deep blue
+ const GlobalData::TerrainLighting &light = TheGlobalData->m_terrainLighting[TheGlobalData->m_timeOfDay][0];
+ const Real bright = min(0.3f * (light.ambient.red + light.diffuse.red)
+ + 0.59f * (light.ambient.green + light.diffuse.green)
+ + 0.11f * (light.ambient.blue + light.diffuse.blue), 1.0f);
+
+ // Flat layers want a real surface under them: on the sand at the water's edge they read as glass laid
+ // on a beach. A channel's open water is only 2 deep on the maps measured (Flash Effect, Dark Night)
+ // and that edge 0.1. A piece of debris or the shell itself coming down, radius 1, throws spray alone.
+ const Real MIN_DEPTH_FOR_RINGS = 1.0f;
+ const Real MIN_RADIUS_FOR_RINGS = 3.0f;
+ static const char *const layers[] = { "WaterSplashThrow", "WaterSplashFoam", "WaterSplashRing", "WaterSplashRingLate" };
+ const size_t layerCount = waterZ - bedZ < MIN_DEPTH_FOR_RINGS || radius < MIN_RADIUS_FOR_RINGS ? 1 : ARRAY_SIZE(layers);
+
+ const Real scale = WWMath::Clamp(radius / 15.0f, 0.25f, 4.0f);
+ const Coord3D surface = { pos->x, pos->y, waterZ };
+ const Coord3D velocity = { scale, scale, scale };
+ for (size_t i = 0; i < layerCount; ++i)
+ {
+ ParticleSystem *sys = TheParticleSystemManager->createParticleSystem(TheParticleSystemManager->findTemplate(layers[i]));
+ if (sys == NULL)
+ continue;
+ sys->setPosition(&surface);
+ sys->setSizeMultiplier(scale);
+ sys->setVelocityMultiplier(&velocity);
+ // every key, the first too: tintAllColors leaves that one, and a particle overshoots its rate to the next
+ for (Int key = 0; key < MAX_KEYFRAMES; ++key)
+ {
+ sys->m_colorKey[key].color.red *= bright;
+ sys->m_colorKey[key].color.green *= bright;
+ sys->m_colorKey[key].color.blue *= bright;
+ }
+ }
+}
+
//-------------------------------------------------------------------------------------------------
/** create an effect that requires a start and end location */
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index cbb892ab6..e914781a9 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -1292,6 +1292,33 @@ TEST(armor_skips_an_unknown_damage_type)
remove( TEST_INI );
}
+/* Water Splashes goes by the same names as Battle Marks and takes every list that scorches, a nuke's
+ among them, whatever its name; a muzzle flash shakes the view and splashes nothing. */
+TEST(water_splashes_take_blasts_by_name_and_every_list_that_scorches)
+{
+ CHECK( bootOnce() );
+ if( TheFXListStore == NULL )
+ TheFXListStore = NEW FXListStore;
+
+ writeFile( TEST_INI,
+ "FXList SplashTest_ShellDetonation\r\n"
+ "End\r\n"
+ "FXList SplashTest_Muzzle\r\n"
+ "End\r\n"
+ "FXList SplashTest_Nuke\r\n"
+ " TerrainScorch\r\n"
+ " Type = RANDOM\r\n"
+ " Radius = 120\r\n"
+ " End\r\n"
+ "End\r\n" );
+ CHECK( loadIni( TEST_INI ) );
+ remove( TEST_INI );
+
+ CHECK_NEAR( TheFXListStore->findFXList( "SplashTest_ShellDetonation" )->getSplashRadius(), 10.0f, 0.01f );
+ CHECK_NEAR( TheFXListStore->findFXList( "SplashTest_Muzzle" )->getSplashRadius(), 0.0f, 0.01f );
+ CHECK_NEAR( TheFXListStore->findFXList( "SplashTest_Nuke" )->getSplashRadius(), 120.0f, 0.01f );
+}
+
/* Data\INI\FXListReforged.ini is the fork's own explosion light: 89 of EA's FXLists, each repeated
whole with one LightPulse added. Whole, because FXListStore::parseFXListDefinition clears an
entry before re-reading it - a half-copied block does not add a light, it deletes an explosion.
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index 7cb82ca9e..68ebae8d9 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -244,6 +244,7 @@ NEW_CONTROLS = [
(CHECK, "CheckAmbientOcclusion", "GUI:AmbientOcclusion"),
(CHECK, "CheckInternalHdr", "GUI:InternalHdr"),
(CHECK, "CheckWeather", "GUI:Weather"),
+ (CHECK, "CheckWaterSplashes", "GUI:WaterSplashes"),
(LABEL, "LabelGraphicsQuality", "GUI:GraphicsQuality"),
(SLIDER, "SliderGraphicsQuality", None),
]
@@ -397,7 +398,8 @@ GROUP_LAYOUT = [
("check", "CheckSmokeFireLighting"),
("check", "CheckFirelight"),
("check", "CheckDebrisTrails"),
- ("check", "CheckWeather")])]),
+ ("check", "CheckWeather"),
+ ("check", "CheckWaterSplashes")])]),
("PageAudio", [
("GUI:OptionsGroupVolume", [