diff --git a/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h b/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h index ada7542a3f6..e1799e99d62 100644 --- a/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h +++ b/Generals/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h @@ -111,6 +111,7 @@ class FlammableUpdate : public UpdateModule, public DamageModuleInterface UnsignedInt m_damageEndFrame; AudioHandle m_audioHandle; Real m_flameDamageLimit; + ObjectID m_flameSource; UnsignedInt m_lastFlameDamageDealt; }; diff --git a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index 95888864883..07aca03a0fd 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -84,6 +84,7 @@ FlammableUpdate::FlammableUpdate( Thing *thing, const ModuleData* moduleData ) : m_damageEndFrame = 0; m_audioHandle = NULL; m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; + m_flameSource = INVALID_ID; m_lastFlameDamageDealt = 0; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); @@ -110,6 +111,12 @@ void FlammableUpdate::onDamage( DamageInfo *damageInfo ) m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; } m_lastFlameDamageDealt = now; +#if RETAIL_COMPATIBLE_CRC + m_flameSource = getObject()->getID(); +#else + // TheSuperHackers @bugfix Stubbjax 03/09/2025 Allow flame damage to award xp to the flame source. + m_flameSource = damageInfo->in.m_sourceID; +#endif Object *me = getObject(); if( !me->getStatusBits().test( OBJECT_STATUS_AFLAME ) && !me->getStatusBits().test( OBJECT_STATUS_BURNED ) ) @@ -229,7 +236,7 @@ void FlammableUpdate::doAflameDamage() DamageInfo info; info.in.m_amount = data->m_aflameDamageAmount; - info.in.m_sourceID = getObject()->getID(); + info.in.m_sourceID = m_flameSource; info.in.m_damageType = DAMAGE_FLAME; info.in.m_deathType = DEATH_BURNED; @@ -287,7 +294,11 @@ void FlammableUpdate::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -312,6 +323,12 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); +#if !RETAIL_COMPATIBLE_XFER_SAVE + if (version >= 2) + { + xfer->xferObjectID(&m_flameSource); + } +#endif } // ------------------------------------------------------------------------------------------------ diff --git a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h index 34e79ff4b5e..be73de96568 100644 --- a/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h +++ b/GeneralsMD/Code/GameEngine/Include/GameLogic/Module/FlammableUpdate.h @@ -111,6 +111,7 @@ class FlammableUpdate : public UpdateModule, public DamageModuleInterface UnsignedInt m_damageEndFrame; AudioHandle m_audioHandle; Real m_flameDamageLimit; + ObjectID m_flameSource; UnsignedInt m_lastFlameDamageDealt; }; diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp index b2bc9ffd2db..14c7b4a7257 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/FlammableUpdate.cpp @@ -84,6 +84,7 @@ FlammableUpdate::FlammableUpdate( Thing *thing, const ModuleData* moduleData ) : m_damageEndFrame = 0; m_audioHandle = NULL; m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; + m_flameSource = INVALID_ID; m_lastFlameDamageDealt = 0; setWakeFrame(getObject(), UPDATE_SLEEP_FOREVER); @@ -110,6 +111,12 @@ void FlammableUpdate::onDamage( DamageInfo *damageInfo ) m_flameDamageLimit = getFlammableUpdateModuleData()->m_flameDamageLimitData; } m_lastFlameDamageDealt = now; +#if RETAIL_COMPATIBLE_CRC + m_flameSource = getObject()->getID(); +#else + // TheSuperHackers @bugfix Stubbjax 03/09/2025 Allow flame damage to award xp to the flame source. + m_flameSource = damageInfo->in.m_sourceID; +#endif Object *me = getObject(); if( !me->getStatusBits().test( OBJECT_STATUS_AFLAME ) && !me->getStatusBits().test( OBJECT_STATUS_BURNED ) ) @@ -229,7 +236,7 @@ void FlammableUpdate::doAflameDamage() DamageInfo info; info.in.m_amount = data->m_aflameDamageAmount; - info.in.m_sourceID = getObject()->getID(); + info.in.m_sourceID = m_flameSource; info.in.m_damageType = DAMAGE_FLAME; info.in.m_deathType = DEATH_BURNED; @@ -287,7 +294,11 @@ void FlammableUpdate::xfer( Xfer *xfer ) { // version +#if RETAIL_COMPATIBLE_XFER_SAVE XferVersion currentVersion = 1; +#else + XferVersion currentVersion = 2; +#endif XferVersion version = currentVersion; xfer->xferVersion( &version, currentVersion ); @@ -312,6 +323,12 @@ void FlammableUpdate::xfer( Xfer *xfer ) // last flame damage dealt xfer->xferUnsignedInt( &m_lastFlameDamageDealt ); +#if !RETAIL_COMPATIBLE_XFER_SAVE + if (version >= 2) + { + xfer->xferObjectID(&m_flameSource); + } +#endif } // ------------------------------------------------------------------------------------------------