Skip to content

unify(translator): Merge message translators from Zero Hour#2794

Open
xezon wants to merge 1 commit into
TheSuperHackers:mainfrom
xezon:xezon/unify-xlats
Open

unify(translator): Merge message translators from Zero Hour#2794
xezon wants to merge 1 commit into
TheSuperHackers:mainfrom
xezon:xezon/unify-xlats

Conversation

@xezon

@xezon xezon commented Jun 14, 2026

Copy link
Copy Markdown

This change merges the code of the message translators.

Generals gets

  • MSG_CHEAT_DESHROUD command handler
  • Right mouse button scrolling with Alternate Mouse mode
  • Placement event handler for Sneak Attack Special Power
  • A fix for clicking through gui window elements

@xezon xezon added this to the Code foundation build up milestone Jun 14, 2026
@xezon xezon added Gen Relates to Generals Unify Unifies code between Generals and Zero Hour labels Jun 14, 2026
@xezon xezon changed the title unify(message): Merge message translators from Zero Hour unify(translator): Merge message translators from Zero Hour Jun 14, 2026
@greptile-apps

greptile-apps Bot commented Jun 14, 2026

Copy link
Copy Markdown

Greptile Summary

This PR ports several features and fixes from the Zero Hour expansion back into the base Generals build: right-mouse-button scrolling now works in Alternate Mouse mode, a Sneak Attack special-power placement path is wired up in PlaceEventTranslator, MSG_CHEAT_DESHROUD is handled by LookAtTranslator under the release-cheat build flag, and a long-standing bug where left-clicks passed through GUI elements during scrolling is fixed in WindowXlat.

  • BuildAssistant.h: Adds LBC_GENERIC_FAILURE and two new placement flags (IGNORE_STEALTHED, FAIL_STEALTHED_WITHOUT_FEEDBACK) used by the Sneak Attack path to let the mouse hover over hidden units but block placement clicks on them.
  • PlaceEventTranslator.cpp: When a builder object exposes getSpecialPowerConstructionCommandButton(), placement confirmation now fires MSG_DO_SPECIAL_POWER_AT_LOCATION instead of the regular dozer-construct message.
  • WindowXlat.cpp: While the tactical view has the mouse locked in scroll mode, left-button down/up events are now forwarded to the window manager so control-bar buttons receive their clicks correctly.

Confidence Score: 4/5

The port is well-scoped and the new logic is properly guarded; the only rough edges are two silenced debug assertions without rationale and a ported attribution comment with an old date.

All substantive changes — the Sneak Attack placement path, the scrolling GUI click-through fix, the RMB alternate-mouse unlock, and the cheat deshroud handler — follow the existing patterns correctly. The two commented-out DEBUG_ASSERTCRASH calls lack explanation and have inconsistent indentation, and the ported //Kris: Aug 15, 2003 comment violates the project's comment-date policy, but neither affects runtime behaviour.

LookAtXlat.cpp (commented-out assertions) and WindowXlat.cpp (date-policy violation in ported comment) deserve a quick second look before merging.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Include/Common/BuildAssistant.h Adds LBC_GENERIC_FAILURE enum value and two new LocalLegalToBuildOptions flags (IGNORE_STEALTHED, FAIL_STEALTHED_WITHOUT_FEEDBACK); re-aligns existing flag column spacing. Clean, straightforward additions.
Generals/Code/GameEngine/Source/GameClient/MessageStream/GUICommandTranslator.cpp Renames GUI_COMMAND_SPECIAL_POWER_FROM_COMMAND_CENTER to GUI_COMMAND_SPECIAL_POWER_FROM_SHORTCUT in one case label; minimal one-line rename from Zero Hour unification.
Generals/Code/GameEngine/Source/GameClient/MessageStream/HintSpy.cpp Adds MSG_SABOTAGE_HINT case to the existing hint-message switch; simple one-line addition consistent with the surrounding pattern.
Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp Enables RMB scrolling in alternate mouse mode; adds MSG_CHEAT_DESHROUD handler guarded by _ALLOW_DEBUG_CHEATS_IN_RELEASE; two DEBUG_ASSERTCRASH calls commented out without explanation and with inconsistent indentation.
Generals/Code/GameEngine/Source/GameClient/MessageStream/PlaceEventTranslator.cpp Ports Sneak Attack special power placement path from Zero Hour: detects getSpecialPowerConstructionCommandButton() and fires MSG_DO_SPECIAL_POWER_AT_LOCATION instead of MSG_DOZER_CONSTRUCT; adds IGNORE_STEALTHED and FAIL_STEALTHED_WITHOUT_FEEDBACK build flags. Logic is well-guarded.
Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp Fixes GUI click-through bug when scrolling: allows left button down/up to reach the window manager while mouse is locked in scrolling mode; ports a date-annotated comment from 2003 that violates project comment-date policy.

Sequence Diagram

sequenceDiagram
    participant User
    participant WindowXlat
    participant PlaceEventTranslator
    participant BuildAssistant
    participant InGameUI
    participant MessageStream

    Note over User,MessageStream: GUI click-through fix (new)
    User->>WindowXlat: MSG_RAW_MOUSE_LEFT_BUTTON_DOWN (scrolling)
    WindowXlat->>WindowXlat: isScrolling()? YES - pass through
    WindowXlat->>InGameUI: winProcessMouseEvent(GWM_LEFT_DOWN)

    Note over User,MessageStream: Sneak Attack special power placement (new)
    User->>PlaceEventTranslator: MSG_MOUSE_LEFT_CLICK
    PlaceEventTranslator->>BuildAssistant: "isLocationLegalToBuild(..., IGNORE_STEALTHED | FAIL_STEALTHED_WITHOUT_FEEDBACK)"
    BuildAssistant-->>PlaceEventTranslator: LBC_OK
    PlaceEventTranslator->>PlaceEventTranslator: getSpecialPowerConstructionCommandButton()?
    alt Has special power command button
        PlaceEventTranslator->>MessageStream: appendMessage(MSG_DO_SPECIAL_POWER_AT_LOCATION)
        PlaceEventTranslator->>InGameUI: placeBuildAvailable(null, null)
    else Normal dozer build
        PlaceEventTranslator->>MessageStream: appendMessage(MSG_DOZER_CONSTRUCT)
    end

    Note over User,MessageStream: Cheat deshroud (new, release-cheat build only)
    User->>LookAtTranslator: MSG_CHEAT_DESHROUD
    LookAtTranslator->>LookAtTranslator: isInMultiplayerGame()? NO
    LookAtTranslator->>PartitionManager: revealMapForPlayerPermanently(localPlayerIndex)
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
Generals/Code/GameEngine/Source/GameClient/MessageStream/WindowXlat.cpp:177-179
**Newly added comment references a date prior to 2026.** The attribution comment `//Kris: Aug 15, 2003` was ported verbatim from Zero Hour and has been added to this file in the current diff. Per project policy, newly created comments must not reference dates prior to the current year (2026).

### Issue 2 of 2
Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp:638-656
**Commented-out assertions with inconsistent indentation and no explanation.** Both `DEBUG_ASSERTCRASH` guards for `m_isChangingFOV` are now silenced. The first (`MSG_META_DEMO_BEGIN_ADJUST_FOV`) is commented with `//DEBUG_ASSERTCRASH` at column 0, while the second (`MSG_META_DEMO_END_ADJUST_FOV`) uses `//	DEBUG_ASSERTCRASH` with a leading tab — inconsistent style that suggests they were disabled without a clear rationale. A short inline note explaining why the assert fires spuriously would help future maintainers decide whether to restore them.

Reviews (1): Last reviewed commit: "unify(message): Merge remaining message ..." | Re-trigger Greptile

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant