Skip to content

bugfix: Restore retail compatibility after retail behavior flags change#2727

Merged
xezon merged 3 commits into
TheSuperHackers:mainfrom
Caball009:fix_retail_behavior_flags
May 19, 2026
Merged

bugfix: Restore retail compatibility after retail behavior flags change#2727
xezon merged 3 commits into
TheSuperHackers:mainfrom
Caball009:fix_retail_behavior_flags

Conversation

@Caball009
Copy link
Copy Markdown

@Caball009 Caball009 commented May 17, 2026

#2691 Turned off some retail behavior which introduces mismatches. This PR aims to fix that.

TODO:

  • Replicate in Generals.
    Generals has one fewer change because this only exists in Zero Hour: RETAIL_COMPATIBLE_CRC || PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR in StealthUpdate::allowedToStealth.

@Caball009 Caball009 added Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour ThisProject The issue was introduced by this project, or this task is specific to this project labels May 17, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 17, 2026

Greptile Summary

This PR corrects preprocessor guards across both the Generals/ and GeneralsMD/ codebases to properly include RETAIL_COMPATIBLE_CRC alongside their corresponding PRESERVE_* flags, ensuring retail-compatible behavior is active whenever either flag is set.

  • Logical rewrites (no semantic change): Several conditions were reordered (A || BB || A) or restructured using De Morgan's law (!A && !B!(A || B)) across TunnelTracker, Player, PoisonedBehavior, ObjectCreationList, and TunnelContain.
  • Real behavior changes: ActiveBody.cpp now records m_lastDamageTimestamp during healing events when RETAIL_COMPATIBLE_CRC=1; StealthUpdate.cpp (GeneralsMD) enables the healing-damage stealth exception in retail mode; CrateCollide.cpp enables multi-crate pickup by default when RETAIL_COMPATIBLE_CRC=1.
  • Known incomplete item: The StealthUpdate.cpp fix is applied to GeneralsMD only; the Generals variant does not have the STEALTH_NOT_WHILE_TAKING_DAMAGE feature at all, so the ActiveBody.cpp timestamp change there is harmless.

Confidence Score: 5/5

Safe to merge — all changes correctly expand retail-compatibility guards or are logically equivalent rewrites with no semantic impact.

The majority of changes are either commutative OR-operand reorderings or De Morgan rewrites with no behavioral difference. The three real behavior changes (ActiveBody timestamp during healing, StealthUpdate healing exception in ZeroHour, CrateCollide multi-pickup default) are the intended fixes. The Generals StealthUpdate.cpp omission is harmless because the STEALTH_NOT_WHILE_TAKING_DAMAGE flag does not exist in the Generals codebase.

No files require special attention.

Important Files Changed

Filename Overview
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/StealthUpdate.cpp Adds RETAIL_COMPATIBLE_CRC to the structure-stealth repair guard, enabling the healing-damage exception in retail mode; properly paired with the ActiveBody.cpp timestamp change.
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp Same real behavior change as Generals: m_lastDamageTimestamp now updated during healing when RETAIL_COMPATIBLE_CRC=1, paired with the matching StealthUpdate fix in this PR.
Generals/Code/GameEngine/Source/GameLogic/Object/Body/ActiveBody.cpp Adds RETAIL_COMPATIBLE_CRC to the stealth-repair guard so m_lastDamageTimestamp is set during healing events under retail mode; safe because Generals has no STEALTH_NOT_WHILE_TAKING_DAMAGE flag.
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp Same m_allowMultiPickup change as Generals — correct retail compatibility restoration.
Generals/Code/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp Extends m_allowMultiPickup default to be true when RETAIL_COMPATIBLE_CRC=1, restoring retail crate behavior.
Generals/Code/GameEngine/Source/Common/RTS/Player.cpp Rewrites !PRESERVE_TUNNEL_HEAL_STACKING && !RETAIL_COMPATIBLE_CRC as !(RETAIL_COMPATIBLE_CRC
GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp Same De Morgan rewrite as Generals Player.cpp — no behavioral difference.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    RC[RETAIL_COMPATIBLE_CRC = 1]
    PS[PRESERVE_* flag = 1]

    RC -->|OR| TH[Tunnel heal stacking path\nTunnelTracker / TunnelContain / Player]
    PS -->|OR| TH

    RC -->|OR| SS[Structure stealth-during-repair\nActiveBody + StealthUpdate MD]
    PS2[PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR] -->|OR| SS

    RC -->|OR| MP[Multi-crate pickup default\nCrateCollide]
    PS3[PRESERVE_MULTI_CRATE_PICKUP] -->|OR| MP

    RC -->|NOR| XPP[XP from poison kills fix DISABLED\nPoisonedBehavior]
    PS4[PRESERVE_NO_XP_FROM_POISON_KILLS] -->|NOR| XPP

    RC -->|NOR| XPO[XP from OCL kills fix DISABLED\nObjectCreationList]
    PS5[PRESERVE_NO_XP_FROM_OCL_KILLS] -->|NOR| XPO
Loading

Reviews (4): Last reviewed commit: "Replicated in Generals." | Re-trigger Greptile

Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
Copy link
Copy Markdown

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do add the overall preserve retail flag pattern, it might be better to split out the custom configuration into a cmake file for the pre configured flags that we are setting.

Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/Common/RTS/Player.cpp Outdated
Comment thread Core/GameEngine/Include/Common/GameDefines.h Outdated
@Caball009 Caball009 force-pushed the fix_retail_behavior_flags branch from d48d2c9 to 9ec6877 Compare May 19, 2026 13:17
@Caball009
Copy link
Copy Markdown
Author

Caball009 commented May 19, 2026

Every use of a PRESERVE_ macro (except PRESERVE_RETAIL_SCRIPTED_CAMERA) is now preceded by a RETAIL_COMPATIBLE_CRC macro.

@githubawn
Copy link
Copy Markdown

Copy link
Copy Markdown

@Mauller Mauller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@Caball009
Copy link
Copy Markdown
Author

Replicated in Generals.

Generals has one fewer change because this only exists in Zero Hour: RETAIL_COMPATIBLE_CRC || PRESERVE_STRUCTURE_STEALTH_DURING_REPAIR in StealthUpdate::allowedToStealth.

Copy link
Copy Markdown

@xezon xezon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good

@xezon xezon merged commit 7dc2632 into TheSuperHackers:main May 19, 2026
17 checks passed
@Caball009 Caball009 deleted the fix_retail_behavior_flags branch May 19, 2026 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Critical Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ThisProject The issue was introduced by this project, or this task is specific to this project ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants