Skip to content

unify(commandxlat): Move AcademyStats files to Core and merge CommandXlat and related code from Zero Hour#2765

Merged
xezon merged 2 commits into
TheSuperHackers:mainfrom
xezon:xezon/unity-commandxlat
Jun 16, 2026
Merged

unify(commandxlat): Move AcademyStats files to Core and merge CommandXlat and related code from Zero Hour#2765
xezon merged 2 commits into
TheSuperHackers:mainfrom
xezon:xezon/unity-commandxlat

Conversation

@xezon

@xezon xezon commented Jun 5, 2026

Copy link
Copy Markdown

Merge with Rebase

This change has 2 commits.

  1. Move AcademyStats files to Core and merge related Code from Zero Hour
  2. Merge CommandXlat and related code from Zero Hour

Behavior should be unchanged in both games.

Generals gets

  • AcademyStats class
  • New KindOf flags from Zero Hour (Drone selection and Airfields required a migration strategy)
  • Command behavior related to USA Firebase
  • Move voice logic for GLA worker with shoes upgrade
  • Special Power object auto-selection for Spectre Gunship and Particle Cannon
  • Command behavior related to GLA Sabotage Building
  • Command behavior related to GLA Sneak Attach placement
  • Cursor behavior related to USA Colonel Burton and GLA Bike on cliffs
  • Cheat and Demo commands for Debug
  • Command behavior related to Double Click Attack Move with Alternative Mouse setup

TODO

  • Add commit id to pull titles
  • Test what can be tested in Generals

@xezon xezon added this to the Code foundation build up milestone Jun 5, 2026
@xezon xezon added Gen Relates to Generals ZH Relates to Zero Hour Unify Unifies code between Generals and Zero Hour labels Jun 5, 2026
@greptile-apps

greptile-apps Bot commented Jun 5, 2026

Copy link
Copy Markdown

Greptile Summary

This PR unifies AcademyStats into Core (shared) and merges CommandXlat and related game logic from Zero Hour into the Generals build, targeting behavior parity between the two games.

  • AcademyStats move: Header and .cpp enabled in Core's CMake, Player gains an AcademyStats member, and SpecialPowerTemplate gains the AcademyClassify INI field.
  • KindOf expansion: ~25 new KINDOF_* flags ported from ZH (including KINDOF_NO_SELECT to replace KINDOF_DRONE in selection filtering, KINDOF_FS_* faction-structure flags, and KINDOF_AIRFIELD gated behind #if RTS_GENERALS).
  • CommandXlat overhaul: Firebase force-attack rider path, GLA sabotage building context command, cliff-locomotor cursor fix for Colonel Burton/Combat Bike, double-click attack-move guard hint, special power shortcut auto-selection for Spectre/Particle Cannon, and debug cheat commands under _ALLOW_DEBUG_CHEATS_IN_RELEASE.

Confidence Score: 4/5

Safe to merge with the uninitialized-variable fix addressed; all other findings are style-level.

The closestDistance local in getClosestRider is uninitialized and will likely produce compiler warnings on strict builds, even though runtime behavior is safe due to short-circuit evaluation. Everything else — the Firebase rider logic, KindOf expansion, shortcut special power path, and double-click guard hint — is a clean port from Zero Hour with no new logic defects introduced in this PR.

Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp — the new getClosestRider function has an uninitialized closestDistance variable.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp Large merge from Zero Hour: adds Firebase force-attack logic, GLA sabotage building, cliff-cursor detection, double-click attack-move guard, special power shortcut selection, and cheat/demo commands under _ALLOW_DEBUG_CHEATS_IN_RELEASE. Two known issues tracked separately in #2768 and #2769.
Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp Adds new getClosestRider() helper used by the Firebase force-attack path; closestDistance local variable is left uninitialized (safe due to short-circuit but will generate compiler warnings).
Core/GameEngine/Include/Common/AcademyStats.h Moved from ZH-only to Core (shared); uses #pragma once, correct GPL header, no issues found.
Generals/Code/GameEngine/Include/Common/KindOf.h Adds ~25 new KindOf flags ported from Zero Hour, guards KINDOF_AIRFIELD with #if RTS_GENERALS, replaces KINDOF_DRONE with KINDOF_NO_SELECT for drone-selection filtering; static_assert validates the name list.
Generals/Code/GameEngine/Include/GameClient/InGameUI.h Adds ACTIONTYPE_SABOTAGE_BUILDING, camera-tracking drawable accessors, and double-click attack-move hint state; new members use spaces inconsistent with surrounding tab-indented code.
Generals/Code/GameEngine/Source/Common/RTS/SpecialPower.cpp Adds AcademyClassify INI field; column alignment of new entry is misaligned relative to the surrounding parse table block.
GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/CommandXlat.cpp Fixes null-deref guard on workerShoeTemplate, adds RETAIL_COMPATIBLE_NETWORKING guard around appendRealArgument, removes duplicate banner comments; no new logic issues found.
Generals/Code/GameEngine/Source/GameClient/InGameUI.cpp Implements double-click attack-move guard hint (triggerDoubleClickAttackMoveGuardHint, timer-based radius cursor fade); new code uses spaces where surrounding code uses tabs.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[MSG_MOUSE_DOUBLE_CLICK or MSG_MOUSE_CLICK] --> B{doubleClickAttackMove & correct mouse mode?}
    B -- Yes --> C[Append MSG_DO_GUARD_POSITION / recordDoubleClickAttackMoveOrderGiven / triggerDoubleClickAttackMoveGuardHint]
    B -- No --> D[Normal click handling: move / context command]
    E[evaluateContextCommand] --> F{commandType?}
    F -- GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT --> G[findMostReadyShortcutSpecialPowerOfType / issueSpecialPowerCommand]
    F -- GUI_COMMAND_SPECIAL_POWER_CONSTRUCT --> H[issueSpecialPowerCommand for construction placement]
    F -- GUICOMMANDMODE_SABOTAGE_BUILDING --> I[createEnterMessage or MSG_SABOTAGE_HINT]
    J[canObjectForceAttack with victim] --> K{isKindOf SPAWNS_ARE_THE_WEAPONS?}
    K -- No --> L[Standard weapon check]
    K -- Yes --> M{result already POSSIBLE?}
    M -- No --> N[Check spawn slave]
    M -- Yes Firebase --> O[getClosestRider / check rider attack result]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[MSG_MOUSE_DOUBLE_CLICK or MSG_MOUSE_CLICK] --> B{doubleClickAttackMove & correct mouse mode?}
    B -- Yes --> C[Append MSG_DO_GUARD_POSITION / recordDoubleClickAttackMoveOrderGiven / triggerDoubleClickAttackMoveGuardHint]
    B -- No --> D[Normal click handling: move / context command]
    E[evaluateContextCommand] --> F{commandType?}
    F -- GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT --> G[findMostReadyShortcutSpecialPowerOfType / issueSpecialPowerCommand]
    F -- GUI_COMMAND_SPECIAL_POWER_CONSTRUCT --> H[issueSpecialPowerCommand for construction placement]
    F -- GUICOMMANDMODE_SABOTAGE_BUILDING --> I[createEnterMessage or MSG_SABOTAGE_HINT]
    J[canObjectForceAttack with victim] --> K{isKindOf SPAWNS_ARE_THE_WEAPONS?}
    K -- No --> L[Standard weapon check]
    K -- Yes --> M{result already POSSIBLE?}
    M -- No --> N[Check spawn slave]
    M -- Yes Firebase --> O[getClosestRider / check rider attack result]
Loading

Reviews (2): Last reviewed commit: "unify(commandxlat): Merge CommandXlat an..." | Re-trigger Greptile

@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.

Missed that #2792 was to be merged after this one, so I accidental already reviewed this as well.

@xezon xezon force-pushed the xezon/unity-commandxlat branch from 20d30ca to dc1d36b Compare June 16, 2026 20:05
@xezon

xezon commented Jun 16, 2026

Copy link
Copy Markdown
Author

Pull id's added to commit titles.

@xezon

xezon commented Jun 16, 2026

Copy link
Copy Markdown
Author

Generals/Code/GameEngine/Source/GameLogic/Object/Contain/OpenContain.cpp — the new getClosestRider function has an uninitialized closestDistance variable.

Tracked with #2800

@xezon xezon merged commit 091ab3d into TheSuperHackers:main Jun 16, 2026
17 checks passed
xezon added a commit that referenced this pull request Jun 16, 2026
@xezon xezon deleted the xezon/unity-commandxlat branch June 16, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Unify Unifies code between Generals and Zero Hour ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants