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(gameengine): thicker, longer-lived smoke behind -smoke

Olcay Seygan72d2ae240eee
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index 408ecb1d0..b650e5eec 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -157,6 +157,8 @@ public:
Bool m_shadowsForProps; // "ShadowsForProps": fences, rubbish, shrubs - scenery the art gave no shadow at all
Bool m_shadowsForParticles; // "ShadowsForParticles": big alpha-blended particle clouds drop a soft blob on the ground
Bool m_particleGroundBounce; // "-particlebounce": terrain collision on for every particle system
+ Real m_smokeThickness; // "-smoke": how much longer and thicker every smoke system runs, 0 for shipped behaviour
+ Int m_particleCapOverride; // "-particlecap": stand in for the options slider's MaxParticleCount, 0 to use it
Int m_textureReductionFactor; //how much to cut texture resolution: 2 is half, 3 is quarter, etc.
Bool m_enableBehindBuildingMarkers;
Real m_waterPositionX;
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h
index d473a047b..56194135b 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h
@@ -331,6 +331,40 @@ extern void particleShadowBlobAdd( ParticleShadowBlob *blob, Real x, Real y, Rea
extern Bool particleShadowBlobResolve( const ParticleShadowBlob *blob, Real *centerX, Real *centerY,
Real *sizeX, Real *sizeY, Int *opacity );
+/**
+ * What "-smoke <thickness>" does to one smoke system. A single number on the command line is
+ * spent across three separate properties, because spending all of it on any one of them looks
+ * wrong: all on lifetime gives a thin haze that never leaves, all on alpha gives a solid grey
+ * brick that vanishes on schedule, all on size gives smoke wider than the building it came from.
+ *
+ * Free of ParticleSystem for the same reason the blob is - it needs no subsystems.
+ */
+struct SmokeBoost
+{
+ Real m_lifetimeScale; ///< particle lifetime, system lifetime and every keyframe time
+ Real m_alphaScale; ///< opacity of each particle, clamped to fully opaque
+ Real m_sizeScale; ///< how wide each particle starts
+};
+
+/**
+ * Resolve the command line's thickness into the three scales. Returns FALSE for a thickness
+ * that asks for nothing (anything at or below 1), which is also the "switch not given" case.
+ */
+extern Bool particleSmokeBoostResolve( Real thickness, SmokeBoost *boost );
+
+/**
+ * Does this particle system's name say it is smoke? The match is on the template name because
+ * the shipped ParticleSystem.ini lives inside INIZH.big and there is nothing else to go on.
+ */
+extern Bool particleSmokeNameMatches( const char *name );
+
+/**
+ * The particle ceiling "-smoke" needs. Smoke that lives longer is smoke that is alive at the
+ * same time as more of itself, and removeOldestParticles takes the oldest first - so left at the
+ * shipped ceiling, longer-lived smoke is exactly what the cap deletes to make room for sparks.
+ */
+extern Int particleSmokeParticleCap( Int shippedCap, Real thickness );
+
class ParticleSystemInfo : public Snapshot
{
@@ -540,6 +574,10 @@ public:
void forceGroundCollision( Real bounce, Real friction )
{ m_groundCollision = TRUE; m_groundBounce = bounce; m_groundFriction = friction; }
+ /** Make this system's smoke last longer and read thicker ("-smoke"). Same reason as above:
+ * ParticleSystemInfo is a protected base, so the manager needs a way in. */
+ void forceSmokeBoost( const SmokeBoost &boost );
+
ParticleSystemTemplate( const AsciiString &name );
AsciiString getName( void ) const { return m_name; }
@@ -690,6 +728,7 @@ public:
/// when a particle dies, it calls this method - ONLY FOR USE BY PARTICLE
void removeParticle( Particle *p );
UnsignedInt getParticleCount( void ) const { return m_particleCount; }
+ Bool hasGroundShadow( void ) const { return m_groundShadow != NULL; }
inline ObjectID getAttachedObject( void ) { return m_attachedToObjectID; }
inline DrawableID getAttachedDrawable( void ) { return m_attachedToDrawableID; }
@@ -851,6 +890,7 @@ public:
UnsignedInt getParticleCount( void ) const { return m_particleCount; }
UnsignedInt getFieldParticleCount( void ) const { return m_fieldParticleCount; }
+ UnsignedInt getGroundShadowCount( void ) const { return m_groundShadowCount; }
UnsignedInt getParticleSystemCount( void ) const { return m_particleSystemCount; }
@@ -886,6 +926,7 @@ protected:
UnsignedInt m_particleCount;
UnsignedInt m_fieldParticleCount; ///< this does not need to be xfered, since it is evaluated every frame
+ UnsignedInt m_groundShadowCount; ///< systems holding a decal this frame; counted for the PARTICLES log line
UnsignedInt m_particleSystemCount;
Int m_onScreenParticleCount; ///< number of particles displayed on screen per frame
UnsignedInt m_lastLogicFrameUpdate;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
index 247ddb255..8f96ab617 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/CommandLine.cpp
@@ -867,6 +867,65 @@ Int parseParticleBounce(char *args[], int)
return 1;
}
+/* -smoke [thickness]: every particle system with "smoke" in its name burns longer and reads
+ thicker. Bare -smoke is 2, which is a fire that is still smoking when the wreck has stopped
+ burning; the switch clamps at 8.
+
+ The number is spent across particle lifetime, opacity and width rather than on any one of
+ them, and it raises the particle ceiling with it: the eviction that enforces the shipped
+ ceiling deletes the oldest particle first, and long-lived smoke is the oldest thing on the
+ field, so without the extra headroom the switch would spend its own smoke to make room for
+ sparks. particleSmokeBoostResolve in ParticleSys.cpp is where the split lives.
+
+ Same reason as -particlebounce for this being a switch: the shipped ParticleSystem.ini is
+ inside INIZH.big and a loose copy would have to replace all 1088 systems to change 175. */
+Int parseSmoke(char *args[], int num)
+{
+ const Real DEFAULT_THICKNESS = 2.0f;
+
+ if (TheWritableGlobalData)
+ {
+ if (num > 1 && args[1][0] != '-')
+ {
+ TheWritableGlobalData->m_smokeThickness = (Real)atof(args[1]);
+ return 2;
+ }
+ TheWritableGlobalData->m_smokeThickness = DEFAULT_THICKNESS;
+ }
+ return 1;
+}
+
+/* -particlecap <n>: stand in for the options menu's particle slider for one run.
+
+ The slider writes MaxParticleCount into the player's own Options.ini and the LOD manager
+ applies it well after the command line is parsed, so this is read where the ceiling is read
+ rather than written over the top of it. Worth having because the shipped default is 2500 and
+ a machine whose owner once dragged that slider left is a machine where every effect in the
+ game is starved, which looks exactly like an effect that was never written. */
+Int parseParticleCap(char *args[], int num)
+{
+ if (TheWritableGlobalData && num > 1)
+ {
+ TheWritableGlobalData->m_particleCapOverride = atoi(args[1]);
+ }
+ return 2;
+}
+
+/* -noparticleshadows: take the soft blob back off the ground under every particle cloud.
+
+ ShadowsForParticles is on by default and the shipped INI has no entry for it, so without this
+ there is no way to photograph a frame with the smoke and without its shadow - which is the
+ only way to say how much of the darkening under a cloud is the decal and how much is the
+ sprites themselves. */
+Int parseNoParticleShadows(char *args[], int)
+{
+ if (TheWritableGlobalData)
+ {
+ TheWritableGlobalData->m_shadowsForParticles = FALSE;
+ }
+ return 1;
+}
+
Int parseNoShaders(char *args[], int)
{
if (TheWritableGlobalData)
@@ -2092,6 +2151,9 @@ static CommandLineParam params[] =
{ "-mod", parseMod },
{ "-noshaders", parseNoShaders },
{ "-particlebounce", parseParticleBounce },
+ { "-smoke", parseSmoke },
+ { "-particlecap", parseParticleCap },
+ { "-noparticleshadows", parseNoParticleShadows },
{ "-quickstart", parseQuickStart },
{ "-packetloss", parsePacketLoss },
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 23fab7c63..d9d42796d 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -898,6 +898,8 @@ GlobalData::GlobalData()
m_drawEntireTerrain = FALSE;
m_maxParticleCount = 0;
m_particleGroundBounce = FALSE;
+ m_smokeThickness = 0.0f;
+ m_particleCapOverride = 0;
m_maxFieldParticleCount = 30;
// End Add
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
index c6b1dec7f..4b0362317 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
@@ -432,6 +432,89 @@ Bool particleShadowBlobResolve( const ParticleShadowBlob *blob, Real *centerX, R
return TRUE;
}
+// ------------------------------------------------------------------------------------------------
+/** Spend "-smoke <thickness>" across the three properties that make smoke read as smoke. See
+ * ParticleSys.h for why it is not all spent on one of them. */
+// ------------------------------------------------------------------------------------------------
+Bool particleSmokeBoostResolve( Real thickness, SmokeBoost *boost )
+{
+ // Past this the cloud stops being smoke and starts being a grey wall that never lifts, and
+ // the particle ceiling below cannot keep up with it either.
+ const Real MAX_THICKNESS = 8.0f;
+
+ // Of everything asked for beyond the shipped value, this share goes to opacity and this share
+ // to particle width; the rest goes to time. Both are well under half deliberately: doubling
+ // the life of a cloud is barely noticeable, doubling its opacity is not subtle at all.
+ const Real ALPHA_SHARE = 0.35f;
+ const Real SIZE_SHARE = 0.25f;
+
+ if (thickness <= 1.0f)
+ return FALSE;
+
+ if (thickness > MAX_THICKNESS)
+ thickness = MAX_THICKNESS;
+
+ Real excess = thickness - 1.0f;
+ boost->m_lifetimeScale = thickness;
+ boost->m_alphaScale = 1.0f + excess * ALPHA_SHARE;
+ boost->m_sizeScale = 1.0f + excess * SIZE_SHARE;
+
+ return TRUE;
+}
+
+// ------------------------------------------------------------------------------------------------
+static char particleNameLowerCased( char letter )
+{
+ return (letter >= 'A' && letter <= 'Z') ? (char)(letter - 'A' + 'a') : letter;
+}
+
+// ------------------------------------------------------------------------------------------------
+/** Case-insensitive search for "smoke" anywhere in a template name. Every shipped system is
+ * named by hand and 175 of the 1088 in INIZH.big carry the word, from SmokeTrail through
+ * BuildingSmokeLarge; matching the word is the only handle there is without editing an INI that
+ * lives inside a .big. */
+// ------------------------------------------------------------------------------------------------
+Bool particleSmokeNameMatches( const char *name )
+{
+ static const char WORD[] = "smoke";
+ const Int WORD_LENGTH = sizeof(WORD) - 1;
+
+ if (name == NULL)
+ return FALSE;
+
+ for( const char *at = name; *at != '\0'; ++at )
+ {
+ Int matched = 0;
+ while( matched < WORD_LENGTH && particleNameLowerCased( at[ matched ] ) == WORD[ matched ] )
+ ++matched;
+
+ if (matched == WORD_LENGTH)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+// ------------------------------------------------------------------------------------------------
+/** The ceiling "-smoke" needs. A cloud that lives N times as long has N times as much of itself
+ * in the air at once, and the eviction that enforces the shipped ceiling takes the oldest particle
+ * first - which is the smoke, every time. */
+// ------------------------------------------------------------------------------------------------
+Int particleSmokeParticleCap( Int shippedCap, Real thickness )
+{
+ // A number this side of the vertex buffers the particle renderer fills each frame. Reaching
+ // it at all means something on the field is emitting far more than the smoke this switch
+ // touches, and the shipped eviction is the right answer again at that point.
+ const Int CAP_CEILING = 20000;
+
+ // zero is the player asking for no particles at all, and no switch overrides that
+ if (shippedCap <= 0 || thickness <= 1.0f)
+ return shippedCap;
+
+ Int raised = REAL_TO_INT( shippedCap * thickness );
+ return (raised > CAP_CEILING) ? CAP_CEILING : raised;
+}
+
// ------------------------------------------------------------------------------------------------
/** Collide a particle with the ground. The velocity is split into the part heading into the
* surface and the part sliding along it: the first is reflected and scaled by 'bounce', the
@@ -1861,7 +1944,13 @@ Particle *ParticleSystem::createParticle( const ParticleInfo *info,
// ALWAYS_RENDER particles are exempt from all count limits, and are always created, regardless of LOD issues.
if (priority != ALWAYS_RENDER)
{
- int numInExcess = TheParticleSystemManager->getParticleCount() - (UnsignedInt)TheGlobalData->m_maxParticleCount;
+ // "-particlecap" stands in for the options slider, which the LOD manager applies long
+ // after the command line is parsed
+ Int shippedCap = (TheGlobalData->m_particleCapOverride > 0)
+ ? TheGlobalData->m_particleCapOverride
+ : TheGlobalData->m_maxParticleCount;
+ Int particleCap = particleSmokeParticleCap( shippedCap, TheGlobalData->m_smokeThickness );
+ int numInExcess = TheParticleSystemManager->getParticleCount() - (UnsignedInt)particleCap;
if ( numInExcess > 0)
{
if( TheParticleSystemManager->removeOldestParticles((UnsignedInt) numInExcess, priority) != numInExcess )
@@ -3058,6 +3147,56 @@ ParticleSystemTemplate::~ParticleSystemTemplate()
}
+// ------------------------------------------------------------------------------------------------
+/** Make this system's smoke last longer and read thicker ("-smoke"). */
+// ------------------------------------------------------------------------------------------------
+void ParticleSystemTemplate::forceSmokeBoost( const SmokeBoost &boost )
+{
+ // Smoke that outlives the explosion has to outrank it: removeOldestParticles only takes
+ // particles below the priority of whatever is asking for room, so smoke left down among the
+ // weapon effects is deleted by the next shell that lands. AREA_EFFECT and above are left
+ // alone - AREA_EFFECT carries its own field-particle ceiling and CRITICAL is the superweapons.
+ const ParticlePriorityType PRIORITY_FLOOR = SEMI_CONSTANT;
+
+ m_lifetime.setRange( m_lifetime.getMinimumValue() * boost.m_lifetimeScale,
+ m_lifetime.getMaximumValue() * boost.m_lifetimeScale,
+ m_lifetime.getDistributionType() );
+
+ // zero means the emitter never stops on its own, and scaling that is still never
+ m_systemLifetime = (UnsignedInt)(m_systemLifetime * boost.m_lifetimeScale);
+
+ m_startSize.setRange( m_startSize.getMinimumValue() * boost.m_sizeScale,
+ m_startSize.getMaximumValue() * boost.m_sizeScale,
+ m_startSize.getDistributionType() );
+
+ // Growth is per frame. Left alone against a longer life the cloud would swell far past the
+ // width the art asked for; slowed by the same factor it reaches the same width, later.
+ m_sizeRate.setRange( m_sizeRate.getMinimumValue() / boost.m_lifetimeScale,
+ m_sizeRate.getMaximumValue() / boost.m_lifetimeScale,
+ m_sizeRate.getDistributionType() );
+
+ for( Int keyframe = 0; keyframe < MAX_KEYFRAMES; ++keyframe )
+ {
+ // Keyframe times are frame numbers counted from the particle's birth, so a particle that
+ // lives twice as long against the shipped times spends the extra life at its last key -
+ // which for smoke is fully transparent. The extra life would be invisible.
+ m_alphaKey[ keyframe ].frame =
+ (UnsignedInt)(m_alphaKey[ keyframe ].frame * boost.m_lifetimeScale);
+ m_colorKey[ keyframe ].frame =
+ (UnsignedInt)(m_colorKey[ keyframe ].frame * boost.m_lifetimeScale);
+
+ Real low = m_alphaKey[ keyframe ].var.getMinimumValue() * boost.m_alphaScale;
+ Real high = m_alphaKey[ keyframe ].var.getMaximumValue() * boost.m_alphaScale;
+ if (low > 1.0f) low = 1.0f;
+ if (high > 1.0f) high = 1.0f;
+ m_alphaKey[ keyframe ].var.setRange( low, high,
+ m_alphaKey[ keyframe ].var.getDistributionType() );
+ }
+
+ if (m_priority < PRIORITY_FLOOR)
+ m_priority = PRIORITY_FLOOR;
+}
+
// ------------------------------------------------------------------------------------------------
/** If returns non-NULL, it is a slave system for use ... the create slaves parameter
* tells *this* slave system whether or not it should create any slaves itself
@@ -3094,6 +3233,7 @@ ParticleSystemManager::ParticleSystemManager( void )
m_lastLogicFrameUpdate = 0;
m_particleCount = 0;
m_fieldParticleCount = 0;
+ m_groundShadowCount = 0;
m_particleSystemCount = 0;
//
@@ -3139,6 +3279,31 @@ void ParticleSystemManager::init( void )
(Int)m_templateMap.size()));
}
+ // "-smoke <thickness>" on the command line: every system with "smoke" in its name burns longer
+ // and reads thicker. Same reason this is here rather than in an INI - the shipped
+ // ParticleSystem.ini is inside INIZH.big and a loose copy would have to replace all 1088 of them.
+ SmokeBoost smokeBoost;
+ if( TheGlobalData && particleSmokeBoostResolve( TheGlobalData->m_smokeThickness, &smokeBoost ) )
+ {
+ Int boosted = 0;
+ for( TemplateMap::iterator it = m_templateMap.begin(); it != m_templateMap.end(); ++it )
+ {
+ if( particleSmokeNameMatches( it->second->getName().str() ) )
+ {
+ it->second->forceSmokeBoost( smokeBoost );
+ ++boosted;
+ }
+ }
+
+ // The particle ceiling is not reported here on purpose: at this point in startup it is
+ // still the built-in default and the player's own slider has not been applied yet. It is
+ // read, and scaled, per particle in createParticle.
+ DEBUG_LOG(("-smoke %.2f: %d of %d particle systems boosted, lifetime x%.2f alpha x%.2f "
+ "size x%.2f\n", TheGlobalData->m_smokeThickness, boosted,
+ (Int)m_templateMap.size(), smokeBoost.m_lifetimeScale, smokeBoost.m_alphaScale,
+ smokeBoost.m_sizeScale));
+ }
+
// sanity, our lists must be empty!!
for( Int i = 0; i < NUM_PARTICLE_PRIORITIES; ++i )
{
@@ -3182,6 +3347,7 @@ void ParticleSystemManager::reset( void )
m_particleCount = 0;
m_fieldParticleCount = 0;
+ m_groundShadowCount = 0;
m_particleSystemCount = 0;
m_allParticleSystemMap.clear();
@@ -3207,7 +3373,9 @@ void ParticleSystemManager::update( void )
USE_PERF_TIMER(ParticleSystemManager)
ParticleSystem *sys;
- for(ParticleSystemListIt it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end();)
+ m_groundShadowCount = 0;
+
+ for(ParticleSystemListIt it = m_allParticleSystemList.begin(); it != m_allParticleSystemList.end();)
{
sys = (*it);
if (!sys) {
@@ -3219,9 +3387,23 @@ void ParticleSystemManager::update( void )
++it;
sys->deleteInstance();
} else {
+ if (sys->hasGroundShadow())
+ ++m_groundShadowCount;
++it;
}
}
+
+ // The one number that says what a particle switch actually did, and the only way to compare two
+ // runs at all: two launches of the same seed and the same scenario do not produce the same
+ // frame, so a pixel difference between their screenshots measures the divergence rather than
+ // the change. Grep the log for PARTICLES.
+ const UnsignedInt REPORT_INTERVAL = 100;
+ if (m_lastLogicFrameUpdate % REPORT_INTERVAL == 0)
+ {
+ DEBUG_LOG(("PARTICLES frame %d: %d particles in %d systems, %d ground shadows\n",
+ m_lastLogicFrameUpdate, m_particleCount, m_particleSystemCount,
+ m_groundShadowCount));
+ }
}
// ------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/Tests/test_gameengine.cpp b/GeneralsMD/Code/Tests/test_gameengine.cpp
index aa5a589a9..d0a619f69 100644
--- a/GeneralsMD/Code/Tests/test_gameengine.cpp
+++ b/GeneralsMD/Code/Tests/test_gameengine.cpp
@@ -1667,6 +1667,84 @@ TEST(blob_never_smears_wider_than_the_cap)
CHECK(sy <= 300.0f);
}
+//////////////////////////////////////////////////////////////////////////////
+// Thicker, longer-lived smoke
+//////////////////////////////////////////////////////////////////////////////
+
+/*
+ * "-smoke <thickness>" is three decisions and all three are free functions: how the one
+ * number is spent, which systems it lands on, and how much headroom the particle ceiling
+ * needs so the switch does not evict its own smoke.
+ */
+
+TEST(smoke_boost_is_off_at_or_below_the_shipped_thickness)
+{
+ SmokeBoost boost;
+
+ CHECK(!particleSmokeBoostResolve(0.0f, &boost)); // the switch not given
+ CHECK(!particleSmokeBoostResolve(1.0f, &boost)); // given, asking for nothing
+ CHECK(!particleSmokeBoostResolve(0.5f, &boost)); // given, asking for less
+}
+
+TEST(smoke_boost_spends_most_of_the_number_on_time_and_the_rest_on_look)
+{
+ SmokeBoost boost;
+
+ CHECK(particleSmokeBoostResolve(3.0f, &boost));
+ CHECK_NEAR(boost.m_lifetimeScale, 3.0f, 1e-4f);
+
+ // opacity and width move, but far less than time does - a cloud three times as opaque is
+ // a grey brick
+ CHECK(boost.m_alphaScale > 1.0f);
+ CHECK(boost.m_sizeScale > 1.0f);
+ CHECK(boost.m_alphaScale < boost.m_lifetimeScale);
+ CHECK(boost.m_sizeScale < boost.m_alphaScale);
+}
+
+TEST(smoke_boost_clamps_an_absurd_thickness)
+{
+ SmokeBoost boost;
+
+ CHECK(particleSmokeBoostResolve(1000.0f, &boost));
+ CHECK_NEAR(boost.m_lifetimeScale, 8.0f, 1e-4f);
+}
+
+TEST(smoke_name_match_is_case_insensitive_and_anywhere_in_the_name)
+{
+ CHECK(particleSmokeNameMatches("SmokeTrail"));
+ CHECK(particleSmokeNameMatches("BuildingSmokeLarge"));
+ CHECK(particleSmokeNameMatches("GenericBlackSMOKE"));
+ CHECK(particleSmokeNameMatches("smoke"));
+}
+
+TEST(smoke_name_match_leaves_everything_else_alone)
+{
+ CHECK(!particleSmokeNameMatches("FireballLarge"));
+ CHECK(!particleSmokeNameMatches("SparkShower"));
+ CHECK(!particleSmokeNameMatches("Smok")); // a prefix of the word is not the word
+ CHECK(!particleSmokeNameMatches(""));
+ CHECK(!particleSmokeNameMatches(NULL));
+}
+
+TEST(smoke_cap_leaves_the_shipped_ceiling_alone_when_the_switch_is_off)
+{
+ CHECK_EQ(particleSmokeParticleCap(2500, 0.0f), 2500);
+ CHECK_EQ(particleSmokeParticleCap(2500, 1.0f), 2500);
+}
+
+TEST(smoke_cap_never_overrides_a_player_who_asked_for_no_particles)
+{
+ // the options slider goes to zero and that means zero, switch or no switch
+ CHECK_EQ(particleSmokeParticleCap(0, 8.0f), 0);
+}
+
+TEST(smoke_cap_grows_with_the_thickness_and_stops_at_the_ceiling)
+{
+ CHECK_EQ(particleSmokeParticleCap(2500, 2.0f), 5000);
+ CHECK(particleSmokeParticleCap(2500, 4.0f) > particleSmokeParticleCap(2500, 2.0f));
+ CHECK_EQ(particleSmokeParticleCap(20000, 8.0f), 20000);
+}
+
//////////////////////////////////////////////////////////////////////////////
// The in-flight damage ledger
//////////////////////////////////////////////////////////////////////////////