Skip to content

Conversation

@xezon
Copy link

@xezon xezon commented Jan 31, 2026

This change polishes the camera debug text in W3DDisplay::gatherDebugStats().

The Debug is toggled with CTRL + Q

Changes

  • Now draws the camera angles in degrees
  • Now prints predictable float numbers
  • No longer overlaps the clock display we added in the top corner

shot_20260131_145044_1

TODO

  • Replicate in Generals

@xezon xezon added Enhancement Is new feature or request Minor Severity: Minor < Major < Critical < Blocker Text Is text, string, localization related Gen Relates to Generals ZH Relates to Zero Hour Debug Is mostly debug functionality Fix Is fixing something, but is not user facing labels Jan 31, 2026
@greptile-apps
Copy link

greptile-apps bot commented Jan 31, 2026

Greptile Overview

Greptile Summary

This PR improves the camera debug display (toggled with CTRL+Q) by converting angles from radians to degrees using RAD_TO_DEGF(), applying precision formatting to floating-point values, and adjusting the vertical position from y=3 to y=30 to prevent overlap with the clock display.

Key changes:

  • Converted pitch, FXPitch, angle, and FOV values to degrees for better readability
  • Applied precision formatting (%.3f for zoom, %.2f for angles and positions)
  • Improved text formatting with clearer labels and structure
  • Adjusted debug text Y position to avoid UI overlap
  • Removed commented-out code and unused variable

Duplication note:
Both files (Generals/ and GeneralsMD/) received identical changes, which is correct for maintaining consistency between the vanilla game and Zero Hour expansion codebases.

Confidence Score: 5/5

  • This PR is safe to merge with no risks
  • The changes are purely cosmetic improvements to debug display formatting with no functional logic changes, using an existing well-defined macro for angle conversion
  • No files require special attention

Important Files Changed

Filename Overview
Generals/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp Improved camera debug text formatting with degree conversion, precision formatting, and adjusted vertical positioning to avoid UI overlap
GeneralsMD/Code/GameEngineDevice/Source/W3DDevice/GameClient/W3DDisplay.cpp Improved camera debug text formatting with degree conversion, precision formatting, and adjusted vertical positioning to avoid UI overlap

Sequence Diagram

sequenceDiagram
    participant Debug as Debug System (CTRL+Q)
    participant W3DDisplay as W3DDisplay::gatherDebugStats()
    participant TacticalView as TheTacticalView
    participant DisplayString as m_displayStrings[DebugInfo]
    participant Renderer as drawDebugStats()
    
    Debug->>W3DDisplay: Gather camera debug info
    W3DDisplay->>TacticalView: getPosition(&camPos)
    TacticalView-->>W3DDisplay: camPos (x, y, z)
    W3DDisplay->>TacticalView: getZoom(), getPitch(), getFXPitch(), etc.
    TacticalView-->>W3DDisplay: zoom, pitch, FXPitch, angle, FOV values (radians)
    W3DDisplay->>W3DDisplay: Convert angles with RAD_TO_DEGF()
    W3DDisplay->>W3DDisplay: Format with precision (%.3f, %.2f)
    W3DDisplay->>DisplayString: setText(formatted camera info)
    DisplayString-->>W3DDisplay: Text set
    W3DDisplay->>Renderer: drawDebugStats()
    Note over Renderer: Start Y position adjusted<br/>from y=3 to y=30<br/>to avoid clock overlap
    Renderer->>Renderer: Draw debug text at (3, 30)
Loading

Copy link

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

@xezon
Copy link
Author

xezon commented Jan 31, 2026

Replicated in Generals without conflicts

@xezon xezon changed the title fix(w3ddisplay): Polish the camera debug text in W3DDisplay::gatherDebugStats() fix(display): Polish the camera debug text in W3DDisplay::gatherDebugStats() Jan 31, 2026
@xezon xezon merged commit d01ec97 into TheSuperHackers:main Jan 31, 2026
26 checks passed
@xezon xezon deleted the xezon/fix-camera-debugdisplay branch January 31, 2026 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Debug Is mostly debug functionality Enhancement Is new feature or request Fix Is fixing something, but is not user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker Text Is text, string, localization related ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants