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(gameclient): tank death blast spreads over the hull's footprint

Olcay Seygana36c880114fa
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fecd4f4dc..acc7f3cae 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1992,7 +1992,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same
## Bright things can glow
- Explosions open on a white-hot flash. A tank shell, a rocket, a bomb truck or a dying tank now starts with a white core that cools through yellow and orange in a third of a second before EA's fireball takes over, and the core is as big as the blast: about a tank's width for a shell, much wider for a Scud Storm missile, a MOAB or a Daisy Cutter. On the default renderer the core spills into the screen's glow.
-- A tank that blows up flashes once, short and warm, and its fire tears into five or six burning scraps that spin apart instead of swelling as one ball. Fourteen sparks fly up out of it, each dragging a short glowing streak that shrinks as the spark slows and falls; Explosion Debris Trails turned off takes them away. Classic Graphics keeps EA's blast, and the Spectre's and the Firebase's howitzer shells keep the flash they had.
+- A tank that blows up flashes once, short and warm, and its fire tears into five or six burning scraps that spin apart instead of swelling as one ball. Fourteen sparks fly up out of it, each dragging a short glowing streak that shrinks as the spark slows and falls; Explosion Debris Trails turned off takes them away. The fire, sparks, shrapnel, thrown dirt and the smaller blasts that follow spread over the tank's own hull and line up with the way it faced, so a long vehicle burns along its length and a small one goes up small; all of it used to burst from a round patch in the middle. Classic Graphics keeps EA's blast, and the Spectre's and the Firebase's howitzer shells keep the flash they had.
- Big blasts light the ground further and for longer. Every explosion's light is warmer and holds a little longer, and a bomb truck, a Scud, a bunker buster, a carpet bomb or a nuke throws a wide orange glow that fades over one to two seconds. Falling buildings, the Daisy Cutter, the MOAB, nukes, exploding cars and suicide bombers used to light nothing at all.
- The heaviest blasts leave bigger craters and send a ring of heat haze out across the ground for a second and a half to two seconds, if Heat Effects is on. Heat haze bends what is behind it by a few pixels now. On a blast that size it used to lay a second copy of the ground over the first, shifted by as much as twenty pixels, so the trees and ridges inside a nuke's ring came out doubled.
- A nuke pulls the picture into itself. For a quarter of a second the ground around the blast bends inward toward it, then a dome of shock rises out of it, running flat across the ground in front and standing up behind, rolling well past the fireball and shoving the battlefield aside as it passes, weaker the further it gets. Each Scud Storm missile does a smaller version of the same, and Nuke Cannon shells, Scud Launcher missiles, Tomahawks and bomb trucks give a short kick that is gone in half a second, so a battery firing all match never turns the screen to jelly. This is the default renderer; Classic and the old renderer keep only the heat ring.
diff --git a/GeneralsMD/Code/Data/INI/FXListReforged.ini b/GeneralsMD/Code/Data/INI/FXListReforged.ini
index 4ba053299..7a6923d36 100644
--- a/GeneralsMD/Code/Data/INI/FXListReforged.ini
+++ b/GeneralsMD/Code/Data/INI/FXListReforged.ini
@@ -218,16 +218,21 @@ FXList FX_RaptorDeathExplosion
End
; ----------------------------------------------
+; The blast follows the hull: FootprintBox spreads a system over a flat box this fraction of the
+; dying vehicle's length and width, turned to its heading, so a long tank blasts long and a small
+; one small. The flash, the shockwave and the smoke column stay round, at the centre.
FXList FX_GenericTankDeathExplosion
ParticleSystem
Name = ReforgedVehicleShrapnel
+ FootprintBox = 0.6
End
ParticleSystem
Name = MammothTankExplosionSmoke
+ FootprintBox = 0.6
End
ParticleSystem
Name = MammothTankSubExplosionSmoke
- Radius = 15 30 UNIFORM
+ FootprintBox = 1.0
Height = 0 20 UNIFORM
InitialDelay = 167 667 UNIFORM
End
@@ -238,25 +243,36 @@ FXList FX_GenericTankDeathExplosion
End
ParticleSystem
Name = MammothTankExplosionDebris
+ FootprintBox = 0.8
End
; its own flash, sparks and torn fire, so the howitzer blasts that share EA's flare keep theirs
ParticleSystem
Name = ReforgedTankDeathLenzflare
Offset = X:0.0 Y:0.0 Z:10.0
End
+ ParticleSystem
+ Name = ReforgedTankBlastFire
+ Offset = X:0.0 Y:0.0 Z:8.0
+ FootprintBox = 0.6
+ End
+ ParticleSystem
+ Name = ReforgedTankBlastSparks
+ Offset = X:0.0 Y:0.0 Z:10.0
+ FootprintBox = 0.6
+ End
ParticleSystem
Name = MammothTankExplosionShockwave
End
- ViewShake
+ ViewShake
Type = STRONG
End
TerrainScorch
- Type = RANDOM
+ Type = RANDOM
Radius = 15
End
Sound
Name = TankDie
- End
+ End
LightPulse
Color = R:255 G:150 B:70
Radius = 85
diff --git a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
index 2626960cb..417fd9cd0 100644
--- a/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
+++ b/GeneralsMD/Code/Data/INI/ParticleSystemReforged.ini
@@ -1841,8 +1841,8 @@ End
; The tank death's own flash (FX_GenericTankDeathExplosion in FXListReforged.ini), so the Spectre and
; Firebase howitzer blasts keep MammothTankExplosionLenzflare above. One card for ten frames instead of
; four for forty. Hanging off it: ReforgedTankBlastCore, ReforgedHotCore's copy with SizeRate raised by
-; 40/28 so the core keeps its size under the slower flare, carrying the fire burst as its chained slave;
-; and the flare particle's own attached spark emitter.
+; 40/28 so the core keeps its size under the slower flare. The fire burst and the sparks are played
+; beside it by the FXList, each spread over the dying hull (FootprintBox).
ParticleSystem ReforgedTankDeathLenzflare
Priority = CRITICAL
@@ -1851,7 +1851,6 @@ ParticleSystem ReforgedTankDeathLenzflare
Type = PARTICLE
ParticleName = EXLnzFlar2.tga
SlaveSystem = ReforgedTankBlastCore
- PerParticleAttachedSystem = ReforgedTankBlastSparks
AngleZ = 0.00 0.00
AngularRateZ = 0.00 0.00
AngularDamping = 1.00 1.00
@@ -1909,7 +1908,6 @@ ParticleSystem ReforgedTankBlastCore
Shader = ADDITIVE
Type = PARTICLE
ParticleName = EXLnzFlar2.tga
- SlaveSystem = ReforgedTankBlastFire
AngleZ = 0.00 6.28
AngularRateZ = 0.00 0.00
AngularDamping = 1.00 1.00
@@ -1955,7 +1953,7 @@ End
; Five or six of EA's EXTnkExpl02 cards (a 4 by 4 flipbook that ends broken into burning pieces),
; each played once over half to three quarters of a second, rotated, thrown a few units apart and
-; gone in about 22 frames. Fed once, from the flare's single emission, by the chain under the core.
+; gone in about 22 frames. One burst, scattered over the hull by the FXList's FootprintBox.
ParticleSystem ReforgedTankBlastFire
Priority = DEATH_EXPLOSION
@@ -1969,9 +1967,8 @@ ParticleSystem ReforgedTankBlastFire
AngularDamping = 0.98 0.98
VelocityDamping = 0.85 0.88
Gravity = 0.00
- SlavePosOffset = X:0.00 Y:0.00 Z:-2.00
Lifetime = 14.00 22.00
- SystemLifetime = 0
+ SystemLifetime = 1
Size = 14.00 24.00
StartSizeRate = 0.00 0.00
SizeRate = 0.40 0.90
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h b/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h
index b7086199c..7d9e2351f 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/FXList.h
@@ -60,6 +60,9 @@ struct FXObjectView
Matrix3D transform;
Int playerIndex; ///< of the controlling player, -1 without one
Real boundingCircleRadius;
+ /// half the hull's length along the object's +X and half its width along +Y: a BOX geometry's
+ /// major and minor radius, the radius both ways for a round one
+ Coord2D footprint;
/// the object answers clear for every player: always visible, or out of the partition (garrisoned)
Bool alwaysClear;
/// for the bones an FX reads; a drawable the tick destroyed is deleted only after the tick's FX ran
diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h
index 565144405..26e34b9e7 100644
--- a/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h
+++ b/GeneralsMD/Code/GameEngine/Include/GameClient/ParticleSys.h
@@ -851,6 +851,7 @@ public:
// Access to dynamically changing part of a particle system.
void setEmissionVolumeSphereRadius( Real newRadius ) { if (m_emissionVolumeType == SPHERE) m_emissionVolume.sphere.radius = newRadius; }
void setEmissionVolumeCylinderRadius( Real newRadius ) { if (m_emissionVolumeType == CYLINDER) m_emissionVolume.cylinder.radius = newRadius; }
+ void setEmissionVolumeBox( const Coord3D &halfSize ) { m_emissionVolumeType = BOX; m_emissionVolume.box.halfSize = halfSize; }
EmissionVolumeType getEmisionVolumeType() const { return m_emissionVolumeType; }
ParticlePriorityType getPriority() const { return m_priority; }
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
index 59b6cf43c..8f7d9f65d 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/FXList.cpp
@@ -95,7 +95,10 @@ void FXObjectView::take( const Object *obj )
transform = *obj->getTransformMatrix();
const Player *player = obj->getControllingPlayer();
playerIndex = player ? player->getPlayerIndex() : -1;
- boundingCircleRadius = obj->getGeometryInfo().getBoundingCircleRadius();
+ const GeometryInfo &geom = obj->getGeometryInfo();
+ boundingCircleRadius = geom.getBoundingCircleRadius();
+ footprint.x = geom.getMajorRadius();
+ footprint.y = geom.getGeomType() == GEOMETRY_BOX ? geom.getMinorRadius() : geom.getMajorRadius();
alwaysClear = obj->isKindOf(KINDOF_ALWAYS_VISIBLE) || obj->friend_getPartitionData() == NULL;
drawable = obj->getDrawable();
}
@@ -619,6 +622,7 @@ public:
m_useCallersRadius = FALSE;
m_atTarget = FALSE;
m_rotateX = m_rotateY = m_rotateZ = 0;
+ m_footprintBox = 0.0f;
}
virtual void doFXPos(const Coord3D *primary, const Matrix3D* primaryMtx, const Real /*primarySpeed*/, const Coord3D *secondary, const Real overrideRadius ) const
@@ -661,7 +665,7 @@ public:
else
// if we have an object, then adjust the offset and direction by the object's transformation
// matrix, so that (say) an offset of +10 in the z axis "follows" the orientation of the object.
- reallyDoFX(&primary->position, &primary->transform, primary->id, 0.0f);
+ reallyDoFX(&primary->position, &primary->transform, primary->id, 0.0f, &primary->footprint);
}
else
{
@@ -688,6 +692,7 @@ public:
{ "CreateAtGroundHeight", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_createAtGroundHeight ) },
{ "UseCallersRadius", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_useCallersRadius ) },
{ "AtTarget", INI::parseBool, NULL, offsetof( ParticleSystemFXNugget, m_atTarget ) },
+ { "FootprintBox", INI::parseReal, NULL, offsetof( ParticleSystemFXNugget, m_footprintBox ) },
{ 0, 0, 0, 0 }
};
@@ -698,7 +703,7 @@ public:
protected:
- void reallyDoFX(const Coord3D *primary, const Matrix3D* mtx, ObjectID thingToAttachTo, Real overrideRadius ) const
+ void reallyDoFX(const Coord3D *primary, const Matrix3D* mtx, ObjectID thingToAttachTo, Real overrideRadius, const Coord2D *footprint = NULL ) const
{
Coord3D offset = m_offset;
if (mtx)
@@ -746,6 +751,20 @@ protected:
if (m_rotateZ != 0.0f)
sys->rotateLocalTransformZ(m_rotateZ);
+ // FootprintBox emits over the caller's hull, this fraction of its length and width, as a
+ // flat box turned to its heading, so a long vehicle blasts long. Played at a position,
+ // with no object, the system keeps its own volume.
+ if (m_footprintBox > 0.0f && footprint)
+ {
+ Coord3D halfSize;
+ halfSize.x = footprint->x * m_footprintBox;
+ halfSize.y = footprint->y * m_footprintBox;
+ halfSize.z = 0.0f;
+ sys->setEmissionVolumeBox(halfSize);
+ if (!m_orientToObject)
+ sys->rotateLocalTransformZ(mtx->Get_Z_Rotation());
+ }
+
// by ID: an object the tick destroyed after asking for this is gone now, and the
// system lets go of it on its first update as it did of a dying one
if (m_attachToObject && thingToAttachTo != INVALID_ID)
@@ -783,6 +802,7 @@ private:
GameClientRandomVariable m_height;
GameClientRandomVariable m_delay;
Real m_rotateX, m_rotateY, m_rotateZ;
+ Real m_footprintBox;
Bool m_orientToObject;
Bool m_attachToObject;
Bool m_createAtGroundHeight;
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
index 1da1be2d1..d77f84369 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/System/ParticleSys.cpp
@@ -1927,6 +1927,9 @@ const Coord3D *ParticleSystem::computeParticleVelocity( const Coord3D *pos )
switch( m_emissionVolumeType )
{
+ // a box is read as a cylinder: out across the ground from its centre line, and up at
+ // the other speed, so a flat box over a hull throws its debris up and out of it
+ case BOX:
case CYLINDER:
Coord2D disk;
@@ -1939,7 +1942,6 @@ const Coord3D *ParticleSystem::computeParticleVelocity( const Coord3D *pos )
newVel.z = otherSpeed;
break;
- case BOX: ///< @todo Implement BOX OUTWARD velocity
case SPHERE:
{
newVel.x = pos->x - sysPos.x;
@@ -2092,7 +2094,7 @@ const Coord3D *ParticleSystem::computeParticlePosition( void )
// 1 is left , 4 is right
// 2 is front, 5 is right back
- int side = GameClientRandomValue(0, 6);
+ int side = GameClientRandomValue(0, 5);
if (side % 3 == 0) {
// generate X, Y
newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x );
@@ -2110,7 +2112,7 @@ const Coord3D *ParticleSystem::computeParticlePosition( void )
if (side == 1) {
newPos.x = -m_emissionVolume.box.halfSize.x;
} else {
- newPos.x = m_emissionVolume.box.halfSize.y;
+ newPos.x = m_emissionVolume.box.halfSize.x;
}
} else if (side % 3 == 2) {
@@ -2127,8 +2129,8 @@ const Coord3D *ParticleSystem::computeParticlePosition( void )
newPos.x = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.x, m_emissionVolume.box.halfSize.x );
newPos.y = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.y, m_emissionVolume.box.halfSize.y );
newPos.z = GameClientRandomValueReal( -m_emissionVolume.box.halfSize.z, m_emissionVolume.box.halfSize.z );
- break;
}
+ break;
}
case LINE: