Skip to content

fix(lookat): Fix mouse anchor and direction issue for camera pitch#2681

Merged
xezon merged 1 commit intoTheSuperHackers:mainfrom
xezon:xezon/fix-camera-pitch-generals
May 4, 2026
Merged

fix(lookat): Fix mouse anchor and direction issue for camera pitch#2681
xezon merged 1 commit intoTheSuperHackers:mainfrom
xezon:xezon/fix-camera-pitch-generals

Conversation

@xezon
Copy link
Copy Markdown

@xezon xezon commented May 3, 2026

This change is a follow up for #2421 which was not replicated to Generals.

@xezon xezon added this to the Camera Improvements milestone May 3, 2026
@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals Fix Is fixing something, but is not user facing labels May 3, 2026
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 3, 2026

Greptile Summary

This PR ports three bug fixes from GeneralsMD (Zero Hour) to Generals (vanilla) in LookAtXlat.cpp, following up on #2421. The changes fix an inverted pitch direction when dragging the mouse, initialize the anchor position when pitch adjustment begins (preventing an immediate jump), and add DESTROY_MESSAGE to the FOV begin/end cases so those messages are properly consumed.

Confidence Score: 5/5

Safe to merge — all changes are faithful ports of verified fixes from the GeneralsMD sibling file.

All four changes align exactly with the already-merged GeneralsMD reference (PR #2421): the pitch sign flip, anchor initialisation, and two DESTROY_MESSAGE additions. No logic is introduced net-new, and no custom rules are violated.

No files require special attention.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/GameClient/MessageStream/LookAtXlat.cpp Four targeted fixes: inverted pitch sign corrected (+ → -), missing anchor init added for MSG_META_DEMO_BEGIN_ADJUST_PITCH, and missing DESTROY_MESSAGE added for both FOV begin/end cases — all matching the GeneralsMD reference.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Mouse Move Event] --> B{m_isPitching?}
    B -- Yes --> C["angle = Scale * (currentPos.y - anchor.y)"]
    C --> D["userSetPitch(getPitch() - angle)  fixed: was +"]
    D --> E[m_anchor = currentPos]

    F[MSG_META_DEMO_BEGIN_ADJUST_PITCH] --> G[m_isPitching = true]
    G --> H["m_anchor = m_currentPos  added: prevents jump on first move"]
    H --> I["disp = DESTROY_MESSAGE"]

    J[MSG_META_DEMO_BEGIN_ADJUST_FOV] --> K[m_isChangingFOV = true]
    K --> L[m_anchor = m_currentPos]
    L --> M["disp = DESTROY_MESSAGE  added: message now consumed"]

    N[MSG_META_DEMO_END_ADJUST_FOV] --> O[m_isChangingFOV = false]
    O --> P["disp = DESTROY_MESSAGE  added: message now consumed"]
Loading

Reviews (1): Last reviewed commit: "fix(lookat): Fix mouse anchor and direct..." | Re-trigger Greptile

Copy link
Copy Markdown

@Skyaero42 Skyaero42 left a comment

Choose a reason for hiding this comment

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

Ok

@xezon xezon merged commit 022b9a3 into TheSuperHackers:main May 4, 2026
11 checks passed
@xezon xezon deleted the xezon/fix-camera-pitch-generals branch May 4, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Is fixing something, but is not user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants