Skip to content

unify(collide): Move collision modules to Core - #3209

Open
Jaredl-Dev wants to merge 2 commits into
TheSuperHackers:mainfrom
Jaredl-Dev:unify/crate-collision-modules
Open

unify(collide): Move collision modules to Core#3209
Jaredl-Dev wants to merge 2 commits into
TheSuperHackers:mainfrom
Jaredl-Dev:unify/crate-collision-modules

Conversation

@Jaredl-Dev

@Jaredl-Dev Jaredl-Dev commented Aug 26, 2026

Copy link
Copy Markdown

This merges the collision module family and moves it into Core.

Shared by Generals and Zero Hour:

  • CollideModule
  • ConvertToCarBombCrateCollide
  • ConvertToHijackedVehicleCrateCollide
  • CrateCollide
  • FireWeaponCollide
  • HealCrateCollide
  • MoneyCrateCollide
  • SalvageCrateCollide
  • ShroudCrateCollide
  • SquishCollide
  • UnitCrateCollide
  • VeterancyCrateCollide

Zero Hour-only sabotage modules:

  • SabotageCommandCenterCrateCollide
  • SabotageFakeBuildingCrateCollide
  • SabotageInternetCenterCrateCollide
  • SabotageMilitaryFactoryCrateCollide
  • SabotagePowerPlantCrateCollide
  • SabotageSuperweaponCrateCollide
  • SabotageSupplyCenterCrateCollide
  • SabotageSupplyDropzoneCrateCollide

The shared implementations preserve Generals behavior while retaining Zero Hour-specific collision behavior behind RTS_ZEROHOUR guards. The one-sided sabotage modules are whole-file guarded because they depend on Zero Hour-only interfaces and systems.

Validation

  • Win32 Release builds succeed for both Generals and Zero Hour.
  • VC6 Release builds succeed for both Generals and Zero Hour.
  • Verified all 24 shared files match after normalizing the product-name banner.

Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Aug 26, 2026
@Jaredl-Dev
Jaredl-Dev force-pushed the unify/crate-collision-modules branch from 9de465a to f64d045 Compare August 26, 2026 04:09
@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 26, 2026

Copy link
Copy Markdown

PR Summary by Qodo

Centralize collision modules in Core

✨ Enhancement ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Centralizes shared collision modules for Generals and Zero Hour in Core.
• Preserves product-specific behavior with targeted RTS_ZEROHOUR guards.
• Rewires both product builds to consume the unified Core implementations.
Diagram

graph TD
  G["Generals target"] --> C["Core GameEngine"] --> S["Shared collisions"]
  Z["Zero Hour target"] --> C
  S --> R["Product guards"] --> X["ZH sabotage"]
Loading
High-Level Assessment

Centralizing identical collision modules in Core is the appropriate strategy because it removes duplicate product trees while preserving genuine differences at narrow compile-time boundaries. Keeping parallel copies or introducing runtime product dispatch would increase maintenance or runtime complexity without improving behavior.

Files changed (44) +264 / -107

Refactor (40) +119 / -3
CollideModule.hGuard the sabotage collision interface +4/-0

Guard the sabotage collision interface

• Makes the sabotage-type query part of the collision interface only for Zero Hour builds.

Core/GameEngine/Include/GameLogic/Module/CollideModule.h

ConvertToCarBombCrateCollide.hRelocate car-bomb collision declarations +0/-0

Relocate car-bomb collision declarations

• Moves the unchanged car-bomb crate collision declaration into the shared Core module tree.

Core/GameEngine/Include/GameLogic/Module/ConvertToCarBombCrateCollide.h

ConvertToHijackedVehicleCrateCollide.hRelocate hijack collision declarations +0/-0

Relocate hijack collision declarations

• Moves the unchanged hijacked-vehicle crate collision declaration into Core for both products.

Core/GameEngine/Include/GameLogic/Module/ConvertToHijackedVehicleCrateCollide.h

CrateCollide.hIsolate Zero Hour sabotage APIs +4/-0

Isolate Zero Hour sabotage APIs

• Guards sabotage victim types, collision identification, and feedback APIs while retaining shared crate behavior.

Core/GameEngine/Include/GameLogic/Module/CrateCollide.h

FireWeaponCollide.hRelocate weapon collision declarations +0/-0

Relocate weapon collision declarations

• Moves the unchanged fire-weapon collision declaration into the shared Core module tree.

Core/GameEngine/Include/GameLogic/Module/FireWeaponCollide.h

HealCrateCollide.hRelocate healing crate declarations +0/-0

Relocate healing crate declarations

• Moves the unchanged healing crate collision declaration into Core.

Core/GameEngine/Include/GameLogic/Module/HealCrateCollide.h

MoneyCrateCollide.hGuard upgraded money-crate boosts +10/-0

Guard upgraded money-crate boosts

• Restricts AutoDeposit dependencies, upgrade-boost data, parsing, and lookup APIs to Zero Hour builds.

Core/GameEngine/Include/GameLogic/Module/MoneyCrateCollide.h

SabotageCommandCenterCrateCollide.hGuard command-center sabotage declarations +4/-0

Guard command-center sabotage declarations

• Wraps the relocated command-center sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageCommandCenterCrateCollide.h

SabotageFakeBuildingCrateCollide.hGuard fake-building sabotage declarations +4/-0

Guard fake-building sabotage declarations

• Wraps the relocated fake-building sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageFakeBuildingCrateCollide.h

SabotageInternetCenterCrateCollide.hGuard internet-center sabotage declarations +4/-0

Guard internet-center sabotage declarations

• Wraps the relocated internet-center sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageInternetCenterCrateCollide.h

SabotageMilitaryFactoryCrateCollide.hGuard factory sabotage declarations +4/-0

Guard factory sabotage declarations

• Wraps the relocated military-factory sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageMilitaryFactoryCrateCollide.h

SabotagePowerPlantCrateCollide.hGuard power-plant sabotage declarations +4/-0

Guard power-plant sabotage declarations

• Wraps the relocated power-plant sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotagePowerPlantCrateCollide.h

SabotageSuperweaponCrateCollide.hGuard superweapon sabotage declarations +4/-0

Guard superweapon sabotage declarations

• Wraps the relocated superweapon sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageSuperweaponCrateCollide.h

SabotageSupplyCenterCrateCollide.hGuard supply-center sabotage declarations +4/-0

Guard supply-center sabotage declarations

• Wraps the relocated supply-center sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageSupplyCenterCrateCollide.h

SabotageSupplyDropzoneCrateCollide.hGuard drop-zone sabotage declarations +4/-0

Guard drop-zone sabotage declarations

• Wraps the relocated supply-dropzone sabotage module in a whole-file Zero Hour guard.

Core/GameEngine/Include/GameLogic/Module/SabotageSupplyDropzoneCrateCollide.h

SalvageCrateCollide.hGuard Zero Hour salvage armor APIs +4/-0

Guard Zero Hour salvage armor APIs

• Limits armor eligibility and armor-upgrade helpers to Zero Hour while sharing other salvage behavior.

Core/GameEngine/Include/GameLogic/Module/SalvageCrateCollide.h

ShroudCrateCollide.hRelocate shroud crate declarations +0/-0

Relocate shroud crate declarations

• Moves the unchanged shroud crate collision declaration into Core.

Core/GameEngine/Include/GameLogic/Module/ShroudCrateCollide.h

SquishCollide.hRelocate squish collision declarations +0/-0

Relocate squish collision declarations

• Moves the unchanged squish collision declaration into the shared Core module tree.

Core/GameEngine/Include/GameLogic/Module/SquishCollide.h

UnitCrateCollide.hRelocate unit crate declarations +0/-0

Relocate unit crate declarations

• Moves the unchanged unit crate collision declaration into Core.

Core/GameEngine/Include/GameLogic/Module/UnitCrateCollide.h

VeterancyCrateCollide.hRelocate veterancy crate declarations +0/-0

Relocate veterancy crate declarations

• Moves the unchanged veterancy crate collision declaration into Core.

Core/GameEngine/Include/GameLogic/Module/VeterancyCrateCollide.h

CollideModule.cppRelocate the collision module base +0/-0

Relocate the collision module base

• Moves the unchanged collision module implementation into Core for shared compilation.

Core/GameEngine/Source/GameLogic/Object/Collide/CollideModule.cpp

ConvertToCarBombCrateCollide.cppPreserve Zero Hour booby-trap handling +2/-0

Preserve Zero Hour booby-trap handling

• Keeps booby-trap detonation checks exclusive to Zero Hour in the unified car-bomb conversion path.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToCarBombCrateCollide.cpp

ConvertToHijackedVehicleCrateCollide.cppPreserve product-specific hijacking rules +9/-0

Preserve product-specific hijacking rules

• Guards Zero Hour capture immunity and drone restrictions, and selects each product's veterancy API signature.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp

CrateCollide.cppGuard Zero Hour crate collision behavior +8/-2

Guard Zero Hour crate collision behavior

• Restricts product-specific audio, visuals, parachute rejection, and sabotage feedback to Zero Hour.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp

HealCrateCollide.cppRelocate healing crate behavior +0/-0

Relocate healing crate behavior

• Moves the unchanged healing crate collision implementation into Core.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/HealCrateCollide.cpp

MoneyCrateCollide.cppGuard upgraded supply bonuses +4/-0

Guard upgraded supply bonuses

• Applies and calculates upgrade-based money bonuses only in Zero Hour builds.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp

SabotageCommandCenterCrateCollide.cppGuard command-center sabotage behavior +4/-0

Guard command-center sabotage behavior

• Wraps the relocated command-center sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageCommandCenterCrateCollide.cpp

SabotageFakeBuilding.cppGuard fake-building sabotage behavior +4/-0

Guard fake-building sabotage behavior

• Wraps the relocated fake-building sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageFakeBuilding.cpp

SabotageInternetCenterCrateCollide.cppGuard internet-center sabotage behavior +4/-0

Guard internet-center sabotage behavior

• Wraps the relocated internet-center sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageInternetCenterCrateCollide.cpp

SabotageMilitaryFactoryCrateCollide.cppGuard factory sabotage behavior +4/-0

Guard factory sabotage behavior

• Wraps the relocated military-factory sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageMilitaryFactoryCrateCollide.cpp

SabotagePowerPlantCrateCollide.cppGuard power-plant sabotage behavior +4/-0

Guard power-plant sabotage behavior

• Wraps the relocated power-plant sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotagePowerPlantCrateCollide.cpp

SabotageSuperweaponCrateCollide.cppGuard superweapon sabotage behavior +4/-0

Guard superweapon sabotage behavior

• Wraps the relocated superweapon sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSuperweaponCrateCollide.cpp

SabotageSupplyCenterCrateCollide.cppGuard supply-center sabotage behavior +4/-0

Guard supply-center sabotage behavior

• Wraps the relocated supply-center sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyCenterCrateCollide.cpp

SabotageSupplyDropzoneCrateCollide.cppGuard drop-zone sabotage behavior +4/-0

Guard drop-zone sabotage behavior

• Wraps the relocated supply-dropzone sabotage implementation in a whole-file Zero Hour guard.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SabotageSupplyDropzoneCrateCollide.cpp

SalvageCrateCollide.cppPreserve Zero Hour salvage extensions +10/-1

Preserve Zero Hour salvage extensions

• Guards armor upgrades and academy statistics while retaining the shared weapon, level, and money flow.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp

ShroudCrateCollide.cppRelocate shroud crate behavior +0/-0

Relocate shroud crate behavior

• Moves the unchanged shroud crate collision implementation into Core.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ShroudCrateCollide.cpp

UnitCrateCollide.cppRelocate unit crate behavior +0/-0

Relocate unit crate behavior

• Moves the unchanged unit crate collision implementation into Core.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/UnitCrateCollide.cpp

VeterancyCrateCollide.cppRelocate veterancy crate behavior +0/-0

Relocate veterancy crate behavior

• Moves the unchanged veterancy crate collision implementation into Core.

Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/VeterancyCrateCollide.cpp

FireWeaponCollide.cppRelocate weapon collision behavior +0/-0

Relocate weapon collision behavior

• Moves the unchanged fire-weapon collision implementation into Core.

Core/GameEngine/Source/GameLogic/Object/Collide/FireWeaponCollide.cpp

SquishCollide.cppRelocate squish collision behavior +0/-0

Relocate squish collision behavior

• Moves the unchanged squish collision implementation into Core.

Core/GameEngine/Source/GameLogic/Object/Collide/SquishCollide.cpp

Other (4) +145 / -104
CMakeLists.txtEnable collision modules in the Core build +40/-40

Enable collision modules in the Core build

• Activates the unified collision headers and sources, including Zero Hour sabotage modules, in the Core GameEngine source list.

Core/GameEngine/CMakeLists.txt

CMakeLists.txtRemove local Generals collision compilation +24/-24

Remove local Generals collision compilation

• Comments out collision headers and sources now supplied by the Core GameEngine target.

Generals/Code/GameEngine/CMakeLists.txt

CMakeLists.txtRemove local Zero Hour collision compilation +40/-40

Remove local Zero Hour collision compilation

• Comments out shared and sabotage collision entries now supplied by the Core GameEngine target.

GeneralsMD/Code/GameEngine/CMakeLists.txt

unify_move_files.pyRecord collision unification operations +41/-0

Record collision unification operations

• Adds the completed merge and move commands for shared collision files and Zero Hour-only sabotage modules.

scripts/cpp/unify_move_files.py

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Aug 26, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can start a comment with 'qodo' or '@qodo' to chat about any finding

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit d9c4ea6 ⚖️ Balanced

Results up to commit 9de465a


🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Qodo Logo

@Skyaero42 Skyaero42 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

ZH has multiple files that are not in generals, but are in the Helper directory. These should also be moved. The remaining CrateCollide files only have minor differences and can be merged.

It is better that a (merge)/move is clearly scope - e.g. per theme or directory - rather than individual files.

@Jaredl-Dev
Jaredl-Dev marked this pull request as draft August 26, 2026 07:01
Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Aug 26, 2026
Jaredl-Dev added a commit to Jaredl-Dev/GeneralsGameCode that referenced this pull request Aug 26, 2026
@Jaredl-Dev
Jaredl-Dev force-pushed the unify/crate-collision-modules branch from f64d045 to 34c371f Compare August 26, 2026 09:39
@Jaredl-Dev
Jaredl-Dev force-pushed the unify/crate-collision-modules branch from 34c371f to d9c4ea6 Compare August 26, 2026 09:52
@Jaredl-Dev Jaredl-Dev changed the title unify(cratecollide): Move crate collision modules to Core unify(collide): Move collision modules to Core Aug 26, 2026
@Jaredl-Dev
Jaredl-Dev marked this pull request as ready for review August 26, 2026 09:55
@Jaredl-Dev

Copy link
Copy Markdown
Author

ZH has multiple files that are not in generals, but are in the Helper directory. These should also be moved. The remaining CrateCollide files only have minor differences and can be merged.

It is better that a (merge)/move is clearly scope - e.g. per theme or directory - rather than individual files.

I have updated this PR. Hopefully I got the game guards right.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code review by qodo was updated up to the latest commit d9c4ea6

@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown

Greptile Summary

The PR moves the collision module family into the shared Core engine while preserving variant-specific behavior through compile-time guards.

  • Adds shared collision headers and sources to the Core GameEngine source interface.
  • Removes the corresponding files from the Generals and GeneralsMD variant source sets.
  • Keeps Zero Hour-only sabotage, armor salvage, upgraded supply, hijacking, and feedback behavior behind RTS_ZEROHOUR.
  • Records the completed file moves in the unification helper script.

Confidence Score: 5/5

The PR appears safe to merge; no concrete build, gameplay, or security regression remains after comparing both former variant implementations and the target composition.

The shared sources compile within their consuming variant targets, and the introduced guards preserve the previously distinct Generals and Zero Hour collision behavior.

Important Files Changed

Filename Overview
Core/GameEngine/CMakeLists.txt Adds the unified collision files to the shared interface source set, allowing each variant target to compile them with its own definitions.
Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/CrateCollide.cpp Preserves shared crate validation and confines parachute and sabotage feedback behavior to Zero Hour.
Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/ConvertToHijackedVehicleCrateCollide.cpp Retains the differing Generals and Zero Hour hijacking rules through correctly directed compile-time guards.
Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/MoneyCrateCollide.cpp Keeps Zero Hour's upgraded supply boost while preserving Generals' original money-crate calculation.
Core/GameEngine/Source/GameLogic/Object/Collide/CrateCollide/SalvageCrateCollide.cpp Preserves Zero Hour armor salvage and academy statistics without exposing them to Generals.
Generals/Code/GameEngine/CMakeLists.txt Removes the now-shared collision files from the Generals variant source set.
GeneralsMD/Code/GameEngine/CMakeLists.txt Removes the now-shared collision files from the Zero Hour variant source set.
scripts/cpp/unify_move_files.py Adds commented records of the collision-family unification operations without changing executable script behavior.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Shared[Core collision sources] --> GI[Generals target interface]
  Shared --> ZI[Zero Hour target interface]
  GI -->|RTS_GENERALS| G[g_gameengine]
  ZI -->|RTS_ZEROHOUR| Z[z_gameengine]
  G --> Common[Shared collision behavior]
  Z --> Common
  Z --> ZH[Zero Hour-only guarded behavior]
Loading

Reviews (1): Last reviewed commit: "unify(collide): Move collision modules t..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants