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(gameengine): nuke damage rolls out from the centre
Olcay Seyganb402a45b6199
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4347689d2..dcae18046 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -1338,6 +1338,7 @@ The whole HUD is on the hardware. Four colours carry it, and they mean the same- 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 ring rolls out well past the fireball and shoves 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.- Up to a thousand craters stay on the ground in a long match, where the game kept five hundred and quietly dropped the oldest.+- A nuke flattens a town from the middle out. EA's missile did all its damage on one frame a second after it landed, so every building under the cloud blew up together. The blast now rolls out from the point of impact with the orange heat ring and reaches the edge six tenths of a second later, levelling each building and toppling each tree as it gets there, and burning the ground in the same ring. What each thing takes is unchanged. A replay recorded before this, with a nuke in it, will not play back the same.- An explosion lights everything around it, smoothly. On the default renderer the light of a blast reaches every tank, soldier, building and patch of ground it can see, fading out with distance, where the ground used to brighten in blocky squares and a model took only four lights at once, so in a big fight half the tanks next to a burning wreck stayed dark. The 32 blasts nearest the camera light at the same time, and a wall with its back to the fire stays in shadow. The light brightens what it falls on by three quarters at most: a nuke's took the ground to white within a few frames until it was held there.- A bright cloud no longer shows what is behind it as a line drawing. Inside a nuke's white cloud, or a falling War Factory's fireball, every tree and wreck under it used to come out as a thin grey outline, and the picture's sharpening ringed each dark piece in white. Both stop where the frame is bright.- Smoke and fire no longer end on a straight line where they meet the ground or a building. A puff that sinks into a hillside or drifts against a wall thins out over its last few metres, softly enough that a nuke's haze and a Scud's grey smoke no longer come out as stacked, stair-stepped terraces, and a toxin cloud lying low over the ground keeps its body instead of breaking into hard-edged green islands. This is the default renderer; Classic and the old renderer keep the hard edge they had in 2003.diff --git a/GeneralsMD/Code/Data/INI/BalanceReforged.ini b/GeneralsMD/Code/Data/INI/BalanceReforged.iniindex 10f69e640..063c5d6b1 100644--- a/GeneralsMD/Code/Data/INI/BalanceReforged.ini+++ b/GeneralsMD/Code/Data/INI/BalanceReforged.ini@@ -1175,6 +1175,97 @@ Object NeutronMissileEndEndEnd++ ; EA's nuke did all its damage on one frame 1180 ms after impact: blasts 1 to 5 only topple+ ; trees, and blast 6 hits the whole 210 radius at once, so every building in it went together.+ ; Each blast's ring now leaves the centre at impact and moves out at 350 a second, reaching+ ; the edge at 600 ms with the orange heat ring, and hits each object once as it passes. The damage an object+ ; takes is EA's, by the same distance; the scorch rings follow the front.+ ReplaceModule ModuleTag_06+ Behavior = NeutronMissileSlowDeathBehavior ModuleTag_06_Front+ DestructionDelay = 3501+ ScorchMarkSize = 320+ FXList = FX_Nuke+ BlastFrontSpeed = 350 ; dist/sec. EA: 0, the whole radius on one frame++ Blast1Enabled = Yes+ Blast1Delay = 0 ; EA: 580+ Blast1ScorchDelay = 171 ; EA: 100+ Blast1InnerRadius = 60.0+ Blast1OuterRadius = 60.0+ Blast1MaxDamage = 0.0+ Blast1MinDamage = 0.0+ Blast1ToppleSpeed = 0.5+ Blast1PushForce = 10.0++ Blast2Enabled = Yes+ Blast2Delay = 0 ; EA: 660+ Blast2ScorchDelay = 257 ; EA: 180+ Blast2InnerRadius = 90.0+ Blast2OuterRadius = 90.0+ Blast2MaxDamage = 0.0+ Blast2MinDamage = 0.0+ Blast2ToppleSpeed = 0.45+ Blast2PushForce = 8.0++ Blast3Enabled = Yes+ Blast3Delay = 0 ; EA: 720+ Blast3ScorchDelay = 343 ; EA: 260+ Blast3InnerRadius = 120.0+ Blast3OuterRadius = 120.0+ Blast3MaxDamage = 0.0+ Blast3MinDamage = 0.0+ Blast3ToppleSpeed = 0.42+ Blast3PushForce = 6.0++ Blast4Enabled = Yes+ Blast4Delay = 0 ; EA: 850+ Blast4ScorchDelay = 429 ; EA: 340+ Blast4InnerRadius = 150.0+ Blast4OuterRadius = 150.0+ Blast4MaxDamage = 0.0+ Blast4MinDamage = 0.0+ Blast4ToppleSpeed = 0.40+ Blast4PushForce = 6.0++ Blast5Enabled = Yes+ Blast5Delay = 0 ; EA: 1000+ Blast5ScorchDelay = 514 ; EA: 420+ Blast5InnerRadius = 180.0+ Blast5OuterRadius = 180.0+ Blast5MaxDamage = 0.0+ Blast5MinDamage = 0.0+ Blast5ToppleSpeed = 0.38+ Blast5PushForce = 6.0++ Blast6Enabled = Yes+ Blast6Delay = 0 ; EA: 1180+ Blast6ScorchDelay = 600 ; EA: 500+ Blast6InnerRadius = 60.0+ Blast6OuterRadius = 210.0+ Blast6MaxDamage = 3500.0+ Blast6MinDamage = 300.0+ Blast6ToppleSpeed = 0.35+ Blast6PushForce = 4.0++ Blast7Enabled = Yes+ Blast7Delay = 999999 ; scorch only+ Blast7ScorchDelay = 720 ; EA: 620+ Blast7OuterRadius = 210.0++ Blast8Enabled = Yes+ Blast8Delay = 999999 ; scorch only+ Blast8ScorchDelay = 800 ; EA: 700+ Blast8OuterRadius = 210.0++ Blast9Enabled = Yes+ Blast9Delay = 999999 ; scorch only+ Blast9ScorchDelay = 900 ; EA: 800+ Blast9OuterRadius = 210.0++ OCL = MIDPOINT OCL_NukeRadiationField+ End+ EndEndObject SupW_NeutronMissile@@ -1203,4 +1294,89 @@ Object SupW_NeutronMissileEndEndEnd++ ; The same front as NeutronMissile above. EA gave this copy its own FX and no radiation field.+ ReplaceModule ModuleTag_06+ Behavior = NeutronMissileSlowDeathBehavior ModuleTag_06_Front+ DestructionDelay = 3501+ ScorchMarkSize = 320+ FXList = SupW_FX_Nuke+ BlastFrontSpeed = 350 ; dist/sec. EA: 0, the whole radius on one frame++ Blast1Enabled = Yes+ Blast1Delay = 0 ; EA: 580+ Blast1ScorchDelay = 171 ; EA: 100+ Blast1InnerRadius = 60.0+ Blast1OuterRadius = 60.0+ Blast1MaxDamage = 0.0+ Blast1MinDamage = 0.0+ Blast1ToppleSpeed = 0.5+ Blast1PushForce = 10.0++ Blast2Enabled = Yes+ Blast2Delay = 0 ; EA: 660+ Blast2ScorchDelay = 257 ; EA: 180+ Blast2InnerRadius = 90.0+ Blast2OuterRadius = 90.0+ Blast2MaxDamage = 0.0+ Blast2MinDamage = 0.0+ Blast2ToppleSpeed = 0.45+ Blast2PushForce = 8.0++ Blast3Enabled = Yes+ Blast3Delay = 0 ; EA: 720+ Blast3ScorchDelay = 343 ; EA: 260+ Blast3InnerRadius = 120.0+ Blast3OuterRadius = 120.0+ Blast3MaxDamage = 0.0+ Blast3MinDamage = 0.0+ Blast3ToppleSpeed = 0.42+ Blast3PushForce = 6.0++ Blast4Enabled = Yes+ Blast4Delay = 0 ; EA: 850+ Blast4ScorchDelay = 429 ; EA: 340+ Blast4InnerRadius = 150.0+ Blast4OuterRadius = 150.0+ Blast4MaxDamage = 0.0+ Blast4MinDamage = 0.0+ Blast4ToppleSpeed = 0.40+ Blast4PushForce = 6.0++ Blast5Enabled = Yes+ Blast5Delay = 0 ; EA: 1000+ Blast5ScorchDelay = 514 ; EA: 420+ Blast5InnerRadius = 180.0+ Blast5OuterRadius = 180.0+ Blast5MaxDamage = 0.0+ Blast5MinDamage = 0.0+ Blast5ToppleSpeed = 0.38+ Blast5PushForce = 6.0++ Blast6Enabled = Yes+ Blast6Delay = 0 ; EA: 1180+ Blast6ScorchDelay = 600 ; EA: 500+ Blast6InnerRadius = 60.0+ Blast6OuterRadius = 210.0+ Blast6MaxDamage = 3500.0+ Blast6MinDamage = 300.0+ Blast6ToppleSpeed = 0.35+ Blast6PushForce = 4.0++ Blast7Enabled = Yes+ Blast7Delay = 999999 ; scorch only+ Blast7ScorchDelay = 720 ; EA: 620+ Blast7OuterRadius = 210.0++ Blast8Enabled = Yes+ Blast8Delay = 999999 ; scorch only+ Blast8ScorchDelay = 800 ; EA: 700+ Blast8OuterRadius = 210.0++ Blast9Enabled = Yes+ Blast9Delay = 999999 ; scorch only+ Blast9ScorchDelay = 900 ; EA: 800+ Blast9OuterRadius = 210.0+ End+ EndEnddiff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.hindex 2aea8e321..8ae4760ce 100644--- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h+++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/NeutronMissileSlowDeathUpdate.h@@ -83,6 +83,7 @@ public:BlastInfo m_blastInfo[ MAX_NEUTRON_BLASTS ]; ///< blast informationReal m_scorchSize; ///< size of scorch markconst FXList *m_fxList; ///< the actual fx list that creates all the visuals.+ Real m_blastFrontSpeed; ///< dist/frame a blast's ring travels out from the centre, 0 hits the whole radius at once};@@ -103,13 +104,14 @@ public:protected:- void doBlast( const BlastInfo *blastInfo ); ///< do blast+ void doBlast( const BlastInfo *blastInfo, Real ringOuter, ObjectIDVector *hit ); ///< do blast to objects within ringOuter not already in hitvoid doScorchBlast( const BlastInfo *blastInfo ); ///< do a scorch blast ringUnsignedInt m_activationFrame; ///< frame we were activated onBool m_completedBlasts[ MAX_NEUTRON_BLASTS ]; ///< blasts indexes we've already doneBool m_completedScorchBlasts[ MAX_NEUTRON_BLASTS ]; ///< scorch blast indexes we've already doneBool m_scorchPlaced; ///< TRUE once we've placed the scorch mark+ ObjectIDVector m_hitObjects[ MAX_NEUTRON_BLASTS ]; ///< sorted ids a moving blast front has already hit, emptied when the blast completes};diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cppindex cd157e07c..d502a835a 100644--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/NeutronMissileSlowDeathUpdate.cpp@@ -71,6 +71,7 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule} // end for im_scorchSize = 0.0f;m_fxList = NULL;+ m_blastFrontSpeed = 0.0f;} // end NeutronMissileSlowDeathBehaviorModuleData@@ -85,6 +86,7 @@ NeutronMissileSlowDeathBehaviorModuleData::NeutronMissileSlowDeathBehaviorModule{{ "ScorchMarkSize", INI::parseReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_scorchSize ) },{ "FXList", INI::parseFXList, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_fxList ) },+ { "BlastFrontSpeed", INI::parseVelocityReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastFrontSpeed ) },{ "Blast1Enabled", INI::parseBool, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].enabled ) },{ "Blast1Delay", INI::parseDurationReal, NULL, offsetof( NeutronMissileSlowDeathBehaviorModuleData, m_blastInfo[ NEUTRON_BLAST_1 ].delay ) },@@ -257,15 +259,34 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void )continue;// has the time of this blast come- if( m_completedBlasts[ i ] == FALSE &&- (currFrame - m_activationFrame > modData->m_blastInfo[ i ].delay) )+ Real sinceBlast = (Real)(currFrame - m_activationFrame) - modData->m_blastInfo[ i ].delay;+ if( m_completedBlasts[ i ] == FALSE && sinceBlast > 0.0f ){+ //+ // With no front speed the blast takes its whole radius on one frame, as EA had it. With+ // one, its ring leaves the centre at the blast's delay and grows each frame, and hits+ // whatever is inside it that it has not hit yet, so the middle of a town goes first. The+ // ids already hit are kept, so a tank driving out ahead of the front is hit once when the+ // front catches it, or on the last frame, and never twice.+ //+ Real ringOuter = 1.0e9f;+ Bool finished = TRUE;+ if( modData->m_blastFrontSpeed > 0.0f )+ {+ ringOuter = modData->m_blastFrontSpeed * sinceBlast;+ finished = ringOuter >= modData->m_blastInfo[ i ].outerRadius;+ if( finished )+ ringOuter = 1.0e9f; // the last frame also takes a big structure whose middle sits past the outer radius+ }+// do the blast- doBlast( &modData->m_blastInfo[ i ] );+ doBlast( &modData->m_blastInfo[ i ], ringOuter, &m_hitObjects[ i ] );// mark this blast as complete now- m_completedBlasts[ i ] = TRUE;+ m_completedBlasts[ i ] = finished;+ if( finished )+ m_hitObjects[ i ].clear();} // end if@@ -291,7 +312,7 @@ UpdateSleepTime NeutronMissileSlowDeathBehavior::update( void )// ------------------------------------------------------------------------------------------------/** Do a single blast for the bomb */// -------------------------------------------------------------------------------------------------void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo )+void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo, Real ringOuter, ObjectIDVector *hit ){// sanity@@ -316,7 +337,7 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo )if( blastInfo->outerRadius ){ObjectIterator *iter = ThePartitionManager->iterateObjectsInRange( missilePos,- blastInfo->outerRadius,+ min( ringOuter, blastInfo->outerRadius ),FROM_BOUNDINGSPHERE_3D,NULL );MemoryPoolObjectHolder hold( iter );@@ -342,6 +363,15 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo )forceVector.y = ( (otherPos->y - missilePos->y) - edgeToMissile.y ) * 0.5f;forceVector.z = ( (otherPos->z - missilePos->z) - edgeToMissile.z ) * 0.5f;+ // only what the front has reached and has not hit before; the list stays sorted by id+ dist = forceVector.length();+ if( dist > ringOuter )+ continue;+ ObjectIDVectorIterator slot = std::lower_bound( hit->begin(), hit->end(), other->getID() );+ if( slot != hit->end() && *slot == other->getID() )+ continue;+ hit->insert( slot, other->getID() );+// try to topple other objectother->topple( &forceVector, blastInfo->toppleSpeed, TOPPLE_OPTIONS_NO_BOUNCE |TOPPLE_OPTIONS_NO_FX );@@ -352,7 +382,6 @@ void NeutronMissileSlowDeathBehavior::doBlast( const BlastInfo *blastInfo )// we do a percentage based on how far away from the inner radius it is, but we// will always do at least blastInfo->minDamage amount of damage//- dist = forceVector.length();if( dist <= blastInfo->innerRadius )damageInfo.in.m_amount = blastInfo->maxDamage;else@@ -483,13 +512,14 @@ void NeutronMissileSlowDeathBehavior::crc( Xfer *xfer )// ------------------------------------------------------------------------------------------------/** Xfer method* Version Info:- * 1: Initial version */+ * 1: Initial version+ * 2: the ids each moving blast front has hit */// ------------------------------------------------------------------------------------------------void NeutronMissileSlowDeathBehavior::xfer( Xfer *xfer ){// version- XferVersion currentVersion = 1;+ XferVersion currentVersion = 2;XferVersion version = currentVersion;xfer->xferVersion( &version, currentVersion );@@ -522,6 +552,11 @@ void NeutronMissileSlowDeathBehavior::xfer( Xfer *xfer )// scorch placedxfer->xferBool( &m_scorchPlaced );+ // what each blast front has hit+ if( version >= 2 )+ for( i = 0; i < maxNeutronBlasts; ++i )+ xfer->xferSTLObjectIDVector( &m_hitObjects[ i ] );+} // end xfer// ------------------------------------------------------------------------------------------------