Skip to content

Commit 78a9efa

Browse files
authored
bugfix(object): Healing no longer prevents stealthed objects from revealing when taking damage (#1508)
Healing no longer ignores the STEALTH_WHILE_NOT_TAKING_DAMAGE object status
1 parent 91a8dca commit 78a9efa

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

Core/GameEngine/Include/Common/GameDefines.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
// Note: Retail compatibility must not be broken before this project officially does.
2222
// Use RETAIL_COMPATIBLE_CRC and RETAIL_COMPATIBLE_XFER_SAVE to guard breaking changes.
2323

24+
#ifndef RETAIL_COMPATIBLE_BUG
25+
#define RETAIL_COMPATIBLE_BUG (1) // Retain bugs present in retail Generals 1.08 and Zero Hour 1.04
26+
#endif
27+
2428
#ifndef RETAIL_COMPATIBLE_CRC
2529
#define RETAIL_COMPATIBLE_CRC (1) // Game is expected to be CRC compatible with retail Generals 1.08, Zero Hour 1.04
2630
#endif

Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,9 @@ void ActiveBody::attemptHealing( DamageInfo *damageInfo )
593593
//(object pointer loses scope as soon as atteptdamage's caller ends)
594594
m_lastDamageInfo = *damageInfo;
595595
m_lastDamageCleared = false;
596+
#if RETAIL_COMPATIBLE_BUG
596597
m_lastDamageTimestamp = TheGameLogic->getFrame();
598+
#endif
597599
m_lastHealingTimestamp = TheGameLogic->getFrame();
598600

599601
// if our health has gone UP then do run the damage module callback

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,7 +835,9 @@ void ActiveBody::attemptHealing( DamageInfo *damageInfo )
835835
//(object pointer loses scope as soon as atteptdamage's caller ends)
836836
m_lastDamageInfo = *damageInfo;
837837
m_lastDamageCleared = false;
838+
#if RETAIL_COMPATIBLE_BUG
838839
m_lastDamageTimestamp = TheGameLogic->getFrame();
840+
#endif
839841
m_lastHealingTimestamp = TheGameLogic->getFrame();
840842

841843
// if our health has gone UP then do run the damage module callback

GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,10 @@ Bool StealthUpdate::allowedToStealth( Object *stealthOwner ) const
317317

318318
if( flags & STEALTH_NOT_WHILE_TAKING_DAMAGE && self->getBodyModule()->getLastDamageTimestamp() >= now - 1 )
319319
{
320+
#if RETAIL_COMPATIBLE_BUG
320321
//Only if it's not healing damage.
321322
if( self->getBodyModule()->getLastDamageInfo()->in.m_damageType != DAMAGE_HEALING )
323+
#endif
322324
{
323325
//Can't stealth if we just took damage in the last frame or two.
324326
if( self->getBodyModule()->getLastDamageTimestamp() != 0xffffffff )

0 commit comments

Comments
 (0)