diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 9684b87cdcd..f31448a9cc5 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -696,13 +696,18 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -753,6 +758,12 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); + // TheSuperHackers @bugfix Serialize current flight path step so projectiles can resume mid-flight on load. + if( version >= 2 ) + { + xfer->xferInt( &m_currentFlightPathStep ); + } + } // ------------------------------------------------------------------------------------------------ @@ -764,4 +775,10 @@ void DumbProjectileBehavior::loadPostProcess() // extend base class UpdateModule::loadPostProcess(); + // TheSuperHackers @bugfix Rebuild flight path on load to prevent immediate detonation of in-flight projectiles. + if( m_flightPathSegments > 0 ) + { + calcFlightPath( false ); + } + } diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp index 1c5fcb77dc8..6f0d6084259 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Behavior/DumbProjectileBehavior.cpp @@ -747,13 +747,18 @@ void DumbProjectileBehavior::crc( Xfer *xfer ) // ------------------------------------------------------------------------------------------------ /** Xfer method * Version Info: - * 1: Initial version */ + * 1: Initial version + * 2: TheSuperHackers @bugfix Added m_currentFlightPathStep for mid-flight save/load. */ // ------------------------------------------------------------------------------------------------ void DumbProjectileBehavior::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -804,6 +809,12 @@ void DumbProjectileBehavior::xfer( Xfer *xfer ) // lifespan frame xfer->xferUnsignedInt( &m_lifespanFrame ); + // TheSuperHackers @bugfix Serialize current flight path step so projectiles can resume mid-flight on load. + if( version >= 2 ) + { + xfer->xferInt( &m_currentFlightPathStep ); + } + } // ------------------------------------------------------------------------------------------------ @@ -815,4 +826,10 @@ void DumbProjectileBehavior::loadPostProcess() // extend base class UpdateModule::loadPostProcess(); + // TheSuperHackers @bugfix Rebuild flight path on load to prevent immediate detonation of in-flight projectiles. + if( m_flightPathSegments > 0 ) + { + calcFlightPath( false ); + } + }