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(w3ddevice): battle marks, burns and stains that fade off the ground
Olcay Seygan22a6697a06e6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8736e1531..0533bf5c9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,11 @@ found and fixed, EA's own, not port damage.**---+## The ground remembers the fight++- Battle Marks, under Options, Effects, is a new setting, off by default until it has been looked at on more maps. Tank shells and missiles landing on open ground leave a burn, where only fifty of the game's 431 effects ever marked the ground and a tank shell was not one of them. A building that falls leaves a dark stain with cracks in it. A nuke, a MOAB or a Daisy Cutter burns a ring of scorched earth round its crater, and a tank's track stays dark for three quarters of its length instead of a quarter.+- Marks hold for a minute and are gone three minutes after that. There are never more than 256, the oldest going first, so a two hour match carries no more than a ten minute one, and a nuke's ring takes room enough that one after another clears the older marks early. A gun firing at one spot renews one mark instead of stacking them into a black disc. A blast in the air or over water leaves nothing, and neither does one you could not see, so a mark never gives away a fight in the fog. The Direct3D 9 picture and Classic Graphics keep the old ground.+## The ground a defence can hit- Click one of your defences, or put a new one on the cursor, and the ground it fires on is painted on the terrain in your colour: a quiet wash with a clean line round the end of its reach, lying over the hills and down the slopes, under your units and buildings. Only what you clicked or what you are placing is painted: a base of ten defences no longer floods the ground in colour the moment a dozer picks up a building. Where a cliff, a building or the fog cuts into the ground, the wash fades in softly instead of ending on a line, so you can tell at a glance whether a gap is out of range or out of sight. A faint pulse leaves the line every few seconds and runs inward. The enemy's defences show nothing. This came back after the one-interface change took the old range ring away with the Reforged interface.diff --git a/GeneralsMD/Code/BuildFingerprint.manifest b/GeneralsMD/Code/BuildFingerprint.manifestindex 5ff248f7a..559348e3e 100644--- a/GeneralsMD/Code/BuildFingerprint.manifest+++ b/GeneralsMD/Code/BuildFingerprint.manifest@@ -1780,6 +1780,7 @@ GameEngineDevice/Include/W3DDevice/Common/W3DThingFactory.hGameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.hGameEngineDevice/Include/W3DDevice/GameClient/FlatHeightMap.hGameEngineDevice/Include/W3DDevice/GameClient/GpuParticles.h+GameEngineDevice/Include/W3DDevice/GameClient/GroundMarks.hGameEngineDevice/Include/W3DDevice/GameClient/HeightMap.hGameEngineDevice/Include/W3DDevice/GameClient/Module/W3DDebrisDraw.hGameEngineDevice/Include/W3DDevice/GameClient/Module/W3DDefaultDraw.h@@ -3220,6 +3221,7 @@ Tests/test_gameengine_stubs.cppTests/test_gametext_csf.cppTests/test_global_new_alignment.cppTests/test_glyph_rasteriser.cpp+Tests/test_ground_marks.cppTests/test_harness.hTests/test_hazard_cloud_policy.cppTests/test_hostile_map.incdiff --git a/GeneralsMD/Code/CMakeLists.txt b/GeneralsMD/Code/CMakeLists.txtindex 551826db4..bcffef350 100644--- a/GeneralsMD/Code/CMakeLists.txt+++ b/GeneralsMD/Code/CMakeLists.txt@@ -2223,6 +2223,10 @@ target_include_directories(test_msvc_float_casts PRIVATE ${CMAKE_CURRENT_SOURCE_add_lib_test(test_audio_mix_policy)target_include_directories(test_audio_mix_policy PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/GameEngineDevice/Include)+# W3DDevice/GameClient/GroundMarks.h: the Battle Marks option's cap and fade.+add_lib_test(test_ground_marks)+target_include_directories(test_ground_marks PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/GameEngineDevice/Include)+add_lib_test(test_hazard_cloud_policy)set_target_properties(test_hazard_cloud_policy PROPERTIES CXX_STANDARD 17)target_include_directories(test_hazard_cloud_policy PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Libraries/Include)diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.strindex 283e17ffb..f6a005426 100644--- a/GeneralsMD/Code/Data/Patch.str+++ b/GeneralsMD/Code/Data/Patch.str@@ -1492,6 +1492,14 @@ TOOLTIP:WaterFoam"Rivers and lakes carry flecks of foam and a band of it along the shore, and the sun's shadows fall on the water. The sea's waves are unchanged. Direct3D 11 and Classic water only, and off under Classic Graphics. Applies when you press Accept."END+GUI:GroundMarks+"Battle Marks"+END++TOOLTIP:GroundMarks+"Shells and missiles leave burns on the ground, a fallen building leaves a dark stain with cracks in it, a nuke leaves a burnt ring, and tank treads stay dark for longer. They fade over about four minutes. Direct3D 11 only, and off under Classic Graphics. Applies when you press Accept."+END+GUI:FormationDrag"Drag Out A Formation"ENDdiff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.strindex 38522a0e1..6839ed4ee 100644--- a/GeneralsMD/Code/Data/Turkish/Generals.str+++ b/GeneralsMD/Code/Data/Turkish/Generals.str@@ -15885,6 +15885,14 @@ TOOLTIP:WaterFoam"Nehirlerde ve göllerde köpük benekleri ve kıyı boyunca bir köpük şeridi belirir, güneşin gölgeleri suya düşer. Denizin dalgaları değişmez. Yalnızca Direct3D 11 ve Klasik su ile, Klasik Grafikler açıkken kapalıdır. Kabul Et'e basınca uygulanır."END+GUI:GroundMarks+"Savaş İzleri"+END++TOOLTIP:GroundMarks+"Mermiler ve füzeler yerde yanık bırakır, yıkılan bina çatlaklarla dolu koyu bir leke bırakır, nükleer patlama yanık bir halka bırakır, tank paletlerinin izi daha uzun süre koyu kalır. Yaklaşık dört dakikada silinirler. Yalnızca Direct3D 11 ile, Klasik Grafikler açıkken kapalıdır. Kabul Et'e basınca uygulanır."+END+GUI:FormationDrag"Sürükleyerek Düzen Kur"ENDdiff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wndindex 22cf0a08f..0c0e0d024 100644--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd@@ -6860,6 +6860,53 @@ WINDOWWINDOWWINDOWTYPE = CHECKBOX;SCREENRECT = UPPERLEFT: 288 266, BOTTOMRIGHT: 512 290, CREATIONRESOLUTION: 800 600;+ NAME = "OptionsMenu.wnd:CheckGroundMarks";+ 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:GroundMarks";+ TOOLTIPDELAY = -1;+ TEXT = "GUI:GroundMarks";+ 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 294, BOTTOMRIGHT: 512 318, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckExtraAnimations";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -6906,7 +6953,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 294, BOTTOMRIGHT: 512 318, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 288 322, BOTTOMRIGHT: 512 346, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckTreeSway";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;@@ -6953,7 +7000,7 @@ WINDOWCHILDWINDOWWINDOWTYPE = CHECKBOX;- SCREENRECT = UPPERLEFT: 288 322, BOTTOMRIGHT: 512 346, CREATIONRESOLUTION: 800 600;+ SCREENRECT = UPPERLEFT: 288 350, BOTTOMRIGHT: 512 374, CREATIONRESOLUTION: 800 600;NAME = "OptionsMenu.wnd:CheckBehindBuilding";STATUS = ENABLED+IMAGE+BORDER;STYLE = CHECKBOX+MOUSETRACK;diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h b/GeneralsMD/Code/GameEngine/Include/Common/GameType.hindex ccd80bb77..9e8fb8de4 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GameType.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameType.h@@ -99,6 +99,7 @@ enum ScorchesSCORCH_3 = 2,SCORCH_4 = 3,SHADOW_SCORCH = 4,+ SCORCH_CRACKS = 5, ///< in the texture since EA's day, no INI names it; the Battle Marks option draws it/* SCORCH_6 = 5,SCORCH_7 = 6,SCORCH_8 = 7,diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.hindex 8ac70232e..bd3f12175 100644--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h@@ -705,6 +705,7 @@ public:Bool m_mapLight; ///< "MapLight": warm low sun and a still ground haze (Direct3D 11, client only)Bool m_teamGlow; ///< "TeamGlow": bright house colour glows (Direct3D 11, client only)Bool m_waterFoam; ///< "WaterFoam": foam, shore band and the sun's shadow on water (Direct3D 11, client only)+ Bool m_groundMarks; ///< "GroundMarks": craters, stains and longer treads that fade over minutes (Direct3D 11, client only)Int m_maxParticleCount; ///< maximum number of particles that can existInt m_maxFieldParticleCount; ///< maximum number of field-type particles that can exist (roughly)diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h b/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.hindex deea7b96a..362d073be 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h@@ -113,6 +113,9 @@ 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.+ virtual Real blastMarkRadius() const { return 0.0f; }+private:};@@ -168,8 +171,12 @@ public:void swap(FXList &that){m_nuggets.swap(that.m_nuggets);+ std::swap(m_markRadius, that.m_markRadius);}+ /// Battle Marks: told the list's name once it is parsed, decides whether it is a blast on the ground.+ void noteBlastByName(const char *name);+/// 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){@@ -211,10 +218,12 @@ private:/// what the two above do, at once outside a tick and after it for one a tick asked forvoid doFXPosNow(const Coord3D *primary, const Matrix3D* primaryMtx, const Real primarySpeed, const Coord3D *secondary, const Real overrideRadius) const;void doFXObjNow(const FXObjectView* primary, const FXObjectView* secondary, const Object* primaryObject) const;+ void leaveBlastMark(const Coord3D *at) const;typedef std::list< FXNugget* > FXNuggetList;FXNuggetList m_nuggets;+ Real m_markRadius; ///< the burn this list leaves on the ground under Battle Marks, 0 for none};diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.hindex 8fe3cd721..ead0e4000 100644--- a/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/GameClient.h@@ -141,6 +141,8 @@ public:virtual void createRayEffectByTemplate( const Coord3D *start, const Coord3D *end, const ThingTemplate* tmpl ) = 0; ///< create effect needing start and end locationvirtual 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 itvirtual Bool loadMap( AsciiString mapName ); ///< load a map into our scenevirtual void unloadMap( AsciiString mapName ); ///< unload the specified map from our scenediff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cppindex 81c281a18..1676866cb 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp@@ -1135,6 +1135,7 @@ GlobalData::GlobalData()m_mapLight = FALSE;m_teamGlow = FALSE;m_waterFoam = FALSE;+ m_groundMarks = 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.cppindex b21b0c764..b6def0922 100644--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp@@ -141,6 +141,7 @@ OPTION_BOOL_ACCESSORS( m_explosionDebrisTrails )OPTION_BOOL_ACCESSORS( m_mapLight )OPTION_BOOL_ACCESSORS( m_teamGlow )OPTION_BOOL_ACCESSORS( m_waterFoam )+OPTION_BOOL_ACCESSORS( m_groundMarks )OPTION_INT_ACCESSORS( m_shadowQuality )OPTION_INT_ACCESSORS( m_graphicsQuality )@@ -604,6 +605,13 @@ const OptionDef TheOptionCatalog[] =OPTION_BOOL, APPLY_LIVE, 0, 1,get_m_waterFoam, set_m_waterFoam },+ // Craters and a building's stain on the terrain, fading over minutes, and darker treads. The+ // scorch buffer asks every draw. Off under Classic graphics and -d3d9, and no row in the quality+ // table: an opt-in until it has been seen. On Options > Effects.+ { "GroundMarks", OPT_WND( "CheckGroundMarks" ), "GUI:GroundMarks",+ OPTION_BOOL, APPLY_LIVE, 0, 1,+ get_m_groundMarks, set_m_groundMarks },+// The size of the sun's depth map. The shadow pass asks for it every frame and the backend makes// the map again when the size changes, so a new level shows on the next frame. On Options >// Effects. Classic graphics and -d3d9 draw no map at all.diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cppindex 92acec280..845d3dbe0 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/Drawable.cpp@@ -1488,6 +1488,9 @@ void Drawable::reactToBodyDamageStateChange(BodyDamageType newState)// correctly react to customizationsif ( !TheGameLogic->isLoadingMap() )startAmbientSound(newState, TheGlobalData->m_timeOfDay);++ if (newState == BODY_RUBBLE && !TheGameLogic->isLoadingMap() && getObject() && isKindOf(KINDOF_STRUCTURE) && !isKindOf(KINDOF_BRIDGE))+ TheGameClient->structureFell(getPosition(), getObject()->getGeometryInfo().getBoundingCircleRadius());}//-------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cppindex 0e60f8401..8c983088e 100644--- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp@@ -37,6 +37,7 @@#include "Common/DrawModule.h"#include "Common/LogicThread.h"#include "Common/GameAudio.h"+#include "Common/GlobalData.h"#include "Common/INI.h"#include "Common/Player.h"#include "Common/PlayerList.h"@@ -406,6 +407,17 @@ public:{}+ virtual Real blastMarkRadius() const+ {+ switch (m_shake)+ {+ case View::SHAKE_SUBTLE: return 10.0f;+ case View::SHAKE_NORMAL: return 12.0f;+ case View::SHAKE_STRONG: return 18.0f;+ default: return 30.0f;+ }+ }+virtual void doFXPos(const Coord3D *primary, const Matrix3D* /*primaryMtx*/, const Real /*primarySpeed*/, const Coord3D * /*secondary*/, const Real /*overrideRadius*/ ) const{if (primary)@@ -513,6 +525,8 @@ public:{}+ virtual Real blastMarkRadius() const { return -1.0f; }+virtual void doFXPos(const Coord3D *primary, const Matrix3D* /*primaryMtx*/, const Real /*primarySpeed*/, const Coord3D * /*secondary*/, const Real /*overrideRadius*/ ) const{if (primary)@@ -523,6 +537,23 @@ public:scorch = GameClientRandomValue( SCORCH_1, SCORCH_4 );}TheGameClient->addScorch(primary, m_radius, (Scorches)scorch);++ // Battle Marks: a nuke, a MOAB or a Daisy Cutter burns a ring round its scorch and cracks the+ // ground under it, out of the same texture, so no new art.+ const Real RING_FROM_RADIUS = 100.0f;+ if (TheGlobalData->m_groundMarks && m_radius >= RING_FROM_RADIUS)+ {+ const Int RING_MARKS = 12;+ for (Int i = 0; i < RING_MARKS; ++i)+ {+ const Real angle = 2.0f * PI * (Real)i / (Real)RING_MARKS;+ Coord3D at = *primary;+ at.x += 1.1f * m_radius * (Real)cos(angle);+ at.y += 1.1f * m_radius * (Real)sin(angle);+ TheGameClient->addGroundMark(&at, 0.28f * m_radius, SCORCH_1 + i % (SCORCH_4 - SCORCH_1 + 1));+ }+ TheGameClient->addGroundMark(primary, 0.7f * m_radius, SCORCH_CRACKS);+ }}else{@@ -868,7 +899,7 @@ static const FieldParse TheFXListFieldParse[] =};//--------------------------------------------------------------------------------------------------FXList::FXList()+FXList::FXList() : m_markRadius(0.0f){}@@ -887,6 +918,53 @@ void FXList::clear()(*it)->deleteInstance();}m_nuggets.clear();+ m_markRadius = 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. */+//-------------------------------------------------------------------------------------------------+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;+ for (size_t i = 0; i < ARRAY_SIZE(notBurns); ++i)+ isBlast = isBlast && strstr(name, notBurns[i]) == NULL;+ if (!isBlast)+ return;++ Real radius = 10.0f;+ 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;+ }+ m_markRadius = radius;+}++//-------------------------------------------------------------------------------------------------+void FXList::leaveBlastMark(const Coord3D *at) const+{+ if (m_markRadius <= 0.0f || !TheGlobalData->m_groundMarks)+ return;+ // any higher is a blast in the air or on a roof, and nothing of it lands+ const Real MAX_HEIGHT_OVER_GROUND = 15.0f;+ if (at->z - TheTerrainLogic->getGroundHeight(at->x, at->y) > MAX_HEIGHT_OVER_GROUND)+ return;+ // which burn by where it fell, not the client's random stream: a run with the option on plays+ // every other client-random effect as a run with it off does+ TheGameClient->addGroundMark(at, m_markRadius, SCORCH_1 + ((REAL_TO_INT(at->x) ^ REAL_TO_INT(at->y)) & 3));}//-------------------------------------------------------------------------------------------------@@ -921,6 +999,7 @@ void FXList::doFXPosNow(const Coord3D *primary, const Matrix3D* primaryMtx, cons{(*it)->doFXPos(primary, primaryMtx, primarySpeed, secondary, overrideRadius);}+ leaveBlastMark(primary);}//-------------------------------------------------------------------------------------------------@@ -987,6 +1066,8 @@ void FXList::doFXObjNow(const FXObjectView* primary, const FXObjectView* seconda// HERE THE PRIMARY IS THE GUY RECEIVING THE FX, AND SECONDARY MIGHT BE THE GUY DEALING IT(*it)->doFXObj(primary, secondary);}+ if (primary)+ leaveBlastMark(&primary->position);}@@ -1026,6 +1107,7 @@ const FXList *FXListStore::findFXList(const char* name) const{// read the FXList nameconst char *c = ini->getNextToken();+ const AsciiString name = c; // the token's buffer goes on to the next lineNameKeyType key = TheNameKeyGenerator->nameToKey(c);if (ini->getLoadType() == INI_LOAD_CREATE_OVERRIDES){@@ -1039,6 +1121,7 @@ const FXList *FXListStore::findFXList(const char* name) constFXList& fxl = TheFXListStore->m_fxmap[key];fxl.clear();ini->initFromINI(&fxl, TheFXListFieldParse);+ fxl.noteBlastByName(name.str());}//-------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cppindex 254c92654..637c73bf1 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, greyedif( !TheGlobalData->m_direct3D11 ){- static const char *const direct3D11Only[] = { "MapLight", "TeamGlow", "WaterFoam" };+ static const char *const direct3D11Only[] = { "MapLight", "TeamGlow", "WaterFoam", "GroundMarks" };for( Int i = 0; i < (Int)( sizeof( direct3D11Only ) / sizeof( direct3D11Only[ 0 ] ) ); ++i )findOptionWidget( *findOptionDef( direct3D11Only[ i ] ) )->winEnable( FALSE );}diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.hindex e42c66efd..aef9d8a5e 100644--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/BaseHeightMap.h@@ -44,6 +44,7 @@#include "Common/GameType.h"#include "Common/LogicThread.h"#include "WorldHeightMap.h"+#include "W3DDevice/GameClient/GroundMarks.h"// The lights one terrain relight takes in, the rest dropped. Only the vertex path reads it: the// Direct3D 11 frame lights the ground per pixel and takes BLAST_LIGHT_SLOTS (32) instead. Was 20.@@ -192,6 +193,10 @@ public:/// Update the diffuse value from static light info for one vertex.void doTheLight(VERTEX_FORMAT *vb, Vector3*light, Vector3*normal, RefRenderObjListIterator *pLightsIterator, UnsignedByte alpha);void addScorch(Vector3 location, Real radius, Scorches type);+ /// The Battle Marks option: a burn that fades, on the ring's fixed cap. Nothing without the option.+ void addGroundMark(const Vector3 &location, Real radius, Int type);+ /// The option, and a picture that draws it: Direct3D 11 and not Classic.+ static Bool groundMarksOn(void);/// Everything added so far came with the map and is not to be thrown away to make room.void markScorchesStatic(void);void addTree(DrawableID id, Coord3D location, Real scale, Real angle,@@ -315,6 +320,11 @@ protected:// NOTE: This argument (contrary to most of the rest of the engine), is in degrees, not radians.Real m_curImpassableSlope;+ GroundMarks::Ring m_groundMarks; ///< drawn from the same buffers as the scorches, newest first and in at most half of them+ UnsignedInt m_groundMarksBuilt; ///< logic frame they last went into the buffers+ Bool m_groundMarksPending; ///< one was added since++ void updateGroundMarks(void); ///<Decide whether this frame rebuilds the buffers for the marks.void updateScorches(void); ///<Update m_vertexScorch and m_indexScorch so all scorches will be drawn.void allocateScorchBuffers(void); ///<allocate static buffers for drawing scorch marks.void freeScorchBuffers(void); ///< frees up scorch buffers.diff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/GroundMarks.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/GroundMarks.hnew file mode 100644index 000000000..652dc1c3c--- /dev/null+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/GroundMarks.h@@ -0,0 +1,113 @@+/*+** Command & Conquer Generals Zero Hour(tm)+** Copyright 2025 Electronic Arts Inc.+**+** This program is free software: you can redistribute it and/or modify+** it under the terms of the GNU General Public License as published by+** the Free Software Foundation, either version 3 of the License, or+** (at your option) any later version.+**+** This program is distributed in the hope that it will be useful,+** but WITHOUT ANY WARRANTY; without even the implied warranty of+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+** GNU General Public License for more details.+**+** You should have received a copy of the GNU General Public License+** along with this program. If not, see <http://www.gnu.org/licenses/>.+*/+// Modified 2026 by Olcay Seygan for Zero Hour Reforged; see the git history.++// FILE: GroundMarks.h+// The marks a fight leaves on the terrain under the Battle Marks option, kept free of the engine so+// a test can hold the cap and the fade. A fixed ring: a long match can never hold more than CAPACITY+// marks, the oldest going first. The client's alone; nothing here reads or writes logic.++#pragma once++namespace GroundMarks {++// Where each sits in the scorch texture, EXScorch01: 0 to 3 are burns, then a soft stain, then cracks.+enum { BURN_KINDS = 4, STAIN = 4, CRACKS = 5 };++enum {+ CAPACITY = 256,+ HOLD_FRAMES = 60 * 60, ///< a mark stays whole for a minute of logic frames+ FADE_FRAMES = 3 * 60 * 60, ///< and is gone three minutes after that+ NEW_MARK_FRAMES = 30, ///< new marks wait this long for the buffer to be rebuilt: a barrage is one rebuild+ FADE_STEP_FRAMES = 120 ///< a fading mark changes this often: 90 steps down+};++struct Mark {+ float x, y, radius; ///< radius 0 is an empty slot+ int type;+ unsigned int born; ///< logic frame+};++/// How much of a mark is left at an age in logic frames, 1 to 0.+inline float strength(unsigned int age)+{+ if (age <= HOLD_FRAMES)+ return 1.0f;+ if (age >= HOLD_FRAMES + FADE_FRAMES)+ return 0.0f;+ return 1.0f - (float)(age - HOLD_FRAMES) / (float)FADE_FRAMES;+}++class Ring {+public:+ Ring() { clear(); }++ void clear()+ {+ for (int i = 0; i < CAPACITY; ++i)+ m_marks[i].radius = 0.0f;+ m_next = 0;+ m_held = 0;+ }++ bool empty() const { return m_held == 0; }++ /// A mark on top of a like one renews it, or a gun firing at one spot would stack up to a black disc+ /// and eat the ring. Burns count as one kind.+ void add(float x, float y, float radius, int type, unsigned int now)+ {+ const float limit = radius / 2.0f;+ for (int i = 0; i < CAPACITY; ++i) {+ Mark &m = m_marks[i];+ if (m.radius > 0.0f && within(m.x - x, limit) && within(m.y - y, limit) && within(m.radius - radius, limit)+ && (m.type == type || (m.type < BURN_KINDS && type < BURN_KINDS))) {+ m.born = now;+ return;+ }+ }+ Mark &m = m_marks[m_next];+ m.x = x;+ m.y = y;+ m.radius = radius;+ m.type = type;+ m.born = now;+ m_next = (m_next + 1) % CAPACITY;+ if (m_held < CAPACITY)+ ++m_held;+ }++ /// The i'th newest slot, which may be empty or spent.+ const Mark &newest(int i) const { return m_marks[(m_next + CAPACITY - 1 - i) % CAPACITY]; }++ bool anyLeft(unsigned int now) const+ {+ for (int i = 0; i < m_held; ++i)+ if (strength(now - newest(i).born) > 0.0f)+ return true;+ return false;+ }++private:+ static bool within(float difference, float limit) { return difference < limit && -difference < limit; }++ Mark m_marks[CAPACITY];+ int m_next;+ int m_held;+};++} // namespace GroundMarksdiff --git a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.hindex 1488da731..ad7fcea7b 100644--- a/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h+++ b/GeneralsMD/Code/GameEngineDevice/Include/W3DDevice/GameClient/W3DGameClient.h@@ -92,6 +92,8 @@ public:virtual void reset( void ); ///< reset systemvirtual 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 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/BaseHeightMap.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cppindex 0eb2d2479..fe704a2c4 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/BaseHeightMap.cpp@@ -85,6 +85,7 @@#include "W3DDevice/GameClient/W3DShadow.h"#include "W3DDevice/GameClient/W3DWater.h"#include "W3DDevice/GameClient/W3DShroud.h"+#include "GameLogic/GameLogic.h"#include "WW3D2/dx8wrapper.h"#include "WW3D2/light.h"#include "WW3D2/scene.h"@@ -184,6 +185,7 @@ Int BaseHeightMapRenderObjClass::freeMapResources(void)void BaseHeightMapRenderObjClass::drawScorches(void){+ updateGroundMarks();updateScorches();if (m_curNumScorchIndices == 0) {return;@@ -1628,7 +1630,9 @@ void BaseHeightMapRenderObjClass::updateScorches(void)if (m_scorchesInBuffer > 0) {return;}- if (m_numScorches==0) {+ if (m_numScorches==0 && m_groundMarks.empty()) {+ m_curNumScorchVertices = 0;+ m_curNumScorchIndices = 0;return;}if (!m_indexScorch || !m_vertexScorch) {@@ -1672,11 +1676,37 @@ void BaseHeightMapRenderObjClass::updateScorches(void)if (shadeB > 255.0f) shadeB = 255.0f; if (shadeB < 0.0f) shadeB = 0.0f;Int diffuse=REAL_TO_INT(shadeB) | (REAL_TO_INT(shadeG) << 8) | (REAL_TO_INT(shadeR) << 16) | ((int)255 << 24);m_scorchesInBuffer = 0;- for (curScorch=m_numScorches-1; curScorch>=0; curScorch--) {- m_scorchesInBuffer++;- Real radius = m_scorches[curScorch].radius;- Vector3 loc = m_scorches[curScorch].location;- Int type = m_scorches[curScorch].scorchType;+ // The loop runs over the scorches and, above them, the Battle Marks' slots, which come first, newest+ // first and in at most half the indices, so a long fight leaves the other half to the scorches. The+ // ring is empty with the option off and this is the old loop.+ const Int markSlots = m_groundMarks.empty() ? 0 : GroundMarks::CAPACITY;+ const UnsignedInt markFrame = TheGameLogic->getFrame();+ const Real MARK_ALPHA = 220.0f;+ for (curScorch=m_numScorches-1+markSlots; curScorch>=0; curScorch--) {+ Real radius;+ Vector3 loc;+ Int type;+ Int vertexDiffuse = diffuse;+ if (curScorch >= m_numScorches) {+ const GroundMarks::Mark &mark = m_groundMarks.newest(m_numScorches + markSlots - 1 - curScorch);+ if (mark.radius <= 0.0f) {+ continue;+ }+ m_scorchesInBuffer++;+ const Real strength = GroundMarks::strength(markFrame - mark.born);+ if (strength <= 0.0f || m_curNumScorchIndices > MAX_SCORCH_INDEX/2) {+ continue;+ }+ radius = mark.radius;+ loc.Set(mark.x, mark.y, 0.0f);+ type = mark.type;+ vertexDiffuse = (diffuse & 0x00FFFFFF) | (REAL_TO_INT(strength * MARK_ALPHA) << 24);+ } else {+ m_scorchesInBuffer++;+ radius = m_scorches[curScorch].radius;+ loc = m_scorches[curScorch].location;+ type = m_scorches[curScorch].scorchType;+ }if (type<0) {type = 0;}@@ -1715,8 +1745,8 @@ void BaseHeightMapRenderObjClass::updateScorches(void)Int i, j;for (j=minY; j<maxY; j++) {for (i=minX; i<maxX; i++) {- curVb->diffuse = diffuse;- Real theZ;+ curVb->diffuse = vertexDiffuse;+ Real theZ;theZ = amtToFloat+((float)getClipHeight(i+m_map->getBorderSizeInline(),j+m_map->getBorderSizeInline())*MAP_HEIGHT_SCALE);// The scorchmarks are spaced out by 1.5 in the texture.Real uOffset = (type%SCORCH_PER_ROW) * 1.5f;@@ -1780,9 +1810,61 @@ void BaseHeightMapRenderObjClass::clearAllScorches(void)m_numScorches=0;m_numStaticScorches=0;m_scorchesInBuffer=0;+ m_groundMarks.clear();+ m_groundMarksBuilt=0;+ m_groundMarksPending=FALSE;#endif}+//=============================================================================+// BaseHeightMapRenderObjClass::groundMarksOn+//=============================================================================+Bool BaseHeightMapRenderObjClass::groundMarksOn(void)+{+ return TheGlobalData->m_groundMarks && !TheGlobalData->m_classicGraphics && Direct3D11_Present_Is_Enabled();+}++//=============================================================================+// BaseHeightMapRenderObjClass::addGroundMark+//=============================================================================+void BaseHeightMapRenderObjClass::addGroundMark(const Vector3 &location, Real radius, Int type)+{+#ifdef DO_SCORCH+ if (groundMarksOn() && !TheTerrainLogic->isUnderwater(location.X, location.Y)) {+ m_groundMarks.add(location.X, location.Y, radius, type, TheGameLogic->getFrame());+ m_groundMarksPending = TRUE;+ }+#endif+}++#ifdef DO_SCORCH+//=============================================================================+// BaseHeightMapRenderObjClass::updateGroundMarks+//=============================================================================+/** The marks share the scorches' buffers, whose rebuild is two whole-buffer locks, so a new mark does+ * not rebuild them at once (a barrage would, every frame) and a fade moves in steps. The option+ * turned off, or every mark spent, takes one last rebuild with the ring empty. */+//=============================================================================+void BaseHeightMapRenderObjClass::updateGroundMarks(void)+{+ if (m_groundMarks.empty()) {+ return;+ }+ const UnsignedInt now = TheGameLogic->getFrame();+ if (!groundMarksOn() || !m_groundMarks.anyLeft(now)) {+ m_groundMarks.clear();+ m_groundMarksPending = FALSE;+ m_scorchesInBuffer = 0;+ return;+ }+ if (now - m_groundMarksBuilt >= (UnsignedInt)(m_groundMarksPending ? GroundMarks::NEW_MARK_FRAMES : GroundMarks::FADE_STEP_FRAMES)) {+ m_groundMarksPending = FALSE;+ m_groundMarksBuilt = now;+ m_scorchesInBuffer = 0;+ }+}+#endif+//=============================================================================// BaseHeightMapRenderObjClass::markScorchesStatic//=============================================================================diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cppindex b0a22a1c4..6160db4b6 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/TerrainTex.cpp@@ -1165,7 +1165,15 @@ void ScorchTextureClass::Apply(unsigned int stage)DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );- DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );+ // A Battle Mark fades by its vertex alpha, which the texture's own alpha would otherwise overrule.+ // A map's scorch carries 255 in it and looks the same either way, so the option off keeps EA's state.+ if (TheGlobalData->m_groundMarks) {+ DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );+ DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );+ DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );+ } else {+ DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 );+ }DX8Wrapper::Set_DX8_Texture_Stage_State( 0, D3DTSS_TEXCOORDINDEX, 0 );DX8Wrapper::Set_DX8_Render_State(D3DRS_ALPHABLENDENABLE,true);DX8Wrapper::Set_DX8_Render_State(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cppindex 256c67114..24c21013b 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DGameClient.cpp@@ -47,7 +47,9 @@#include "Common/GameLOD.h"#include "GameClient/Drawable.h"#include "GameClient/GameClient.h"+#include "GameClient/ObserverCamera.h"#include "GameClient/ParticleSys.h"+#include "GameLogic/PartitionManager.h"#include "GameClient/RayEffect.h"#include "GameLogic/GameLogic.h"#include "GameLogic/Object.h"@@ -56,6 +58,7 @@#include "W3DDevice/GameClient/W3DStatusCircle.h"#include "W3DDevice/GameClient/W3DScene.h"#include "W3DDevice/GameClient/W3DShadow.h"+#include "W3DDevice/GameClient/GroundMarks.h"#include "W3DDevice/GameClient/HeightMap.h"#include "WW3D2/part_emt.h"#include "WW3D2/hanim.h"@@ -146,6 +149,35 @@ void W3DGameClient::addScorch(const Coord3D *pos, Real radius, Scorches type)}}+//-------------------------------------------------------------------------------------------------+void W3DGameClient::addGroundMark(const Coord3D *pos, Real radius, Int type)+{+ const Coord3D at = *pos;+ LOGIC_AFTER_TICK( [=]() { addGroundMark( &at, radius, type ); } );+ if (TheTerrainRenderObject)+ TheTerrainRenderObject->addGroundMark(Vector3(pos->x, pos->y, pos->z), radius, type);+}++//-------------------------------------------------------------------------------------------------+/** A building is down, in cells this screen sees: a soft stain with cracks in it. Called from the+ * body's change of state inside logic's pass, and played after it. */+//-------------------------------------------------------------------------------------------------+void W3DGameClient::structureFell(const Coord3D *pos, Real radius)+{+ const Coord3D at = *pos;+ LOGIC_AFTER_TICK( [=]() { structureFell( &at, radius ); } );+ // a landmark bridge counts as a structure at over 1000 units: no round stain fits that+ const Real MAX_STAINED_RADIUS = 150.0f;+ // under this the cracks are smaller than a terrain cell's reach and their edge runs into the next art+ const Real MIN_STAINED_RADIUS = 12.5f;+ if (radius > MAX_STAINED_RADIUS || radius < MIN_STAINED_RADIUS)+ return;+ if (ThePartitionManager->getShroudStatusForPlayer(TheObserverCamera.getShroudPlayerIndex(), pos) != CELLSHROUD_CLEAR)+ return;+ addGroundMark(pos, radius * 1.1f, GroundMarks::STAIN);+ addGroundMark(pos, radius * 0.8f, GroundMarks::CRACKS);+}+//-------------------------------------------------------------------------------------------------/** create an effect that requires a start and end location *///-------------------------------------------------------------------------------------------------diff --git a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cppindex fd48d82f5..1484147f6 100644--- a/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp+++ b/GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DTerrainTracks.cpp@@ -837,7 +837,9 @@ Try improving the fit to vertical surfaces like cliffs.if (shadeB > 255.0f) shadeB = 255.0f; if (shadeB < 0.0f) shadeB = 0.0f;diffuseLight = REAL_TO_INT(shadeB) | (REAL_TO_INT(shadeG) << 8) | (REAL_TO_INT(shadeR) << 16);- Real numFadedEdges=m_maxTankTrackEdges-m_maxTankTrackOpaqueEdges;+ // Battle Marks: a track stays dark for three quarters of its edges, where it fades after a quarter+ const Int opaqueEdges = BaseHeightMapRenderObjClass::groundMarksOn() ? m_maxTankTrackEdges*3/4 : m_maxTankTrackOpaqueEdges;+ Real numFadedEdges=m_maxTankTrackEdges-opaqueEdges;// Lock only the vertices this pass writes. A whole-buffer lock is every track the detail level// allows times every edge, and with Direct3D 11 its unlock copied all of it twice on every pass.@@ -886,10 +888,10 @@ Try improving the fit to vertical surfaces like cliffs.distanceFade=1.0f;- if ((mod->m_activeEdgeCount -1 -i) >= m_maxTankTrackOpaqueEdges)// && i < (MAX_PER_TRACK_EDGE_COUNT-FORCE_FADE_AT_EDGE))+ if ((mod->m_activeEdgeCount -1 -i) >= opaqueEdges)// && i < (MAX_PER_TRACK_EDGE_COUNT-FORCE_FADE_AT_EDGE)){ //we're getting close to the limit on the number of track pieces allowed//so force it to fade out.- distanceFade=1.0f-(float)((mod->m_activeEdgeCount -i)-m_maxTankTrackOpaqueEdges)/numFadedEdges;+ distanceFade=1.0f-(float)((mod->m_activeEdgeCount -i)-opaqueEdges)/numFadedEdges;}distanceFade *= mod->m_edges[index].alpha; //adjust fade with distance from start of trackdiff --git a/GeneralsMD/Code/Tests/test_ground_marks.cpp b/GeneralsMD/Code/Tests/test_ground_marks.cppnew file mode 100644index 000000000..5988a2482--- /dev/null+++ b/GeneralsMD/Code/Tests/test_ground_marks.cpp@@ -0,0 +1,50 @@+// test_ground_marks.cpp: the cap and the fade of the Battle Marks option's ring.++#include "test_harness.h"++#include "W3DDevice/GameClient/GroundMarks.h"++using namespace GroundMarks;++TEST(a_mark_holds_then_fades_to_nothing)+{+ CHECK_EQ(strength(0), 1.0f);+ CHECK_EQ(strength(HOLD_FRAMES), 1.0f);+ CHECK_NEAR(strength(HOLD_FRAMES + FADE_FRAMES / 2), 0.5f, 0.001f);+ CHECK_EQ(strength(HOLD_FRAMES + FADE_FRAMES), 0.0f);+ CHECK_EQ(strength(HOLD_FRAMES + FADE_FRAMES + 1), 0.0f);+}++TEST(the_ring_never_holds_more_than_its_cap_and_the_oldest_goes_first)+{+ Ring ring;+ CHECK(ring.empty());+ const int extra = 10;+ for (int i = 0; i < CAPACITY + extra; ++i)+ ring.add((float)i * 1000.0f, 0.0f, 10.0f, 0, (unsigned int)i);+ CHECK_EQ(ring.newest(0).born, (unsigned int)(CAPACITY + extra - 1));+ CHECK_EQ(ring.newest(CAPACITY - 1).born, (unsigned int)extra);+}++TEST(a_mark_on_a_like_one_renews_it_and_takes_no_slot)+{+ Ring ring;+ ring.add(100.0f, 100.0f, 10.0f, 0, 1);+ ring.add(102.0f, 99.0f, 11.0f, 3, 50); // another burn on the same spot+ CHECK_EQ(ring.newest(0).born, 50u);+ CHECK_EQ(ring.newest(1).radius, 0.0f);+ ring.add(100.0f, 100.0f, 10.0f, CRACKS, 60); // not a burn: both stay+ CHECK_EQ(ring.newest(0).type, (int)CRACKS);+ CHECK_EQ(ring.newest(1).born, 50u);+}++TEST(a_ring_of_spent_marks_says_so)+{+ Ring ring;+ CHECK(!ring.anyLeft(0));+ ring.add(0.0f, 0.0f, 10.0f, 0, 5);+ CHECK(ring.anyLeft(5));+ CHECK(!ring.anyLeft(5 + HOLD_FRAMES + FADE_FRAMES));+ ring.clear();+ CHECK(ring.empty());+}diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.pyindex 778daaf5f..adf96d6a8 100644--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py@@ -237,6 +237,7 @@ NEW_CONTROLS = [(CHECK, "CheckMapLight", "GUI:MapLight"),(CHECK, "CheckTeamGlow", "GUI:TeamGlow"),(CHECK, "CheckWaterFoam", "GUI:WaterFoam"),+ (CHECK, "CheckGroundMarks", "GUI:GroundMarks"),(LABEL, "LabelGraphicsQuality", "GUI:GraphicsQuality"),(SLIDER, "SliderGraphicsQuality", None),]@@ -376,6 +377,7 @@ GROUP_LAYOUT = [("check", "CheckShowProps"),("check", "CheckSmoothWater"),("check", "CheckWaterFoam"),+ ("check", "CheckGroundMarks"),("check", "CheckExtraAnimations"),("check", "CheckTreeSway"),("check", "CheckBehindBuilding")]),