Skip to content

F4 latches the side panel away, and holding Space slides it away - #53

Open
HectorBailey wants to merge 1 commit into
revivalfrom
30-panel-slide
Open

HectorBailey wants to merge 1 commit into
revivalfrom
30-panel-slide

Conversation

@HectorBailey

Copy link
Copy Markdown
Collaborator

For #30, the panel slide alone as agreed; the issue stays open for Enter and h.

The decode. The notes already had the key (F4 → bit 7 of the display-options word, read only by the updater at 0x4948E0) and the Space rule. The updater's motion, read for this: the position runs between 0 and 0x7D; each frame it moves max(1, remaining / 4) towards its target, so it starts fast and eases in; leaving an end plays "Panel" (0x505EBC) and arriving at one plays "Options" (0x502B38). Space is polled and drives the slide only while held and while the cursor is not on the panel's own gadget.

What changed.

  • panelSlide, panelSlideLatched and spaceDown on GameScene; updatePanelSlide runs each frame from update, after the deferred menu actions, and moves the position as decoded, playing the two GUI sounds (Panel and Options, now in InGameSoundsInfo).
  • The side panel is moved with UiComponent::setPosition, which the panel's own render and hit-testing already honour; the minimap is drawn and hit-tested at slidMinimapRect(), including its detection rings; the world viewport's left inset shrinks by the slide so the map shows under it.
  • F4 toggles the latch; Space down and up are tracked in onKeyDown/onKeyUp.
  • The top and bottom bars do not move. Their labels and figures are at fixed positions, and sliding the tiles under them garbled the two; the region above the slid panel is simply the bar, as before.

Verified.

  • rwe_test: all 593 test cases pass (71751 assertions), Linux gcc-14 Debug.
  • Screenshots with the panel latched away via a temporary hook (removed): one caught mid-slide, with the panel and minimap partway off the left edge and the world already widened under them, and one settled, with three pixels of panel border left as the original's 125 leaves it.
  • The Space path, the sounds and the cursor-on-panel exception are not exercised without input automation; they share the update with the F4 path.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun

The original's keyboard has two ways to see the map under the side
panel: F4 flips bit 7 of the display-options word and the panel slides
off the left edge and stays there, and holding Space slides it away
for as long as the key is down, unless the cursor is on the panel
itself. The updater at 0x4948E0 gives the motion: each frame the
position moves a quarter of what is left of the 125 pixels, never less
than one, so the panel starts fast and eases in; the Panel sound plays
as it leaves an end of its travel and Options as it arrives at one.

RWE moves the panel and the minimap with the slide and lets the world
viewport widen under them. The top and bottom bars stay where they
are: their labels and figures sit at fixed positions, and sliding
their tiles under them only garbled the two. Presentation only.

Enter and h, the message bar and the share screen, wait for chat and
sharing to exist; the issue stays open for them.

Issue: #30

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJCbwC9MGZnM6erMDKptun

@CubeB CubeB left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

The decode and the slide look right, and the branch builds and passes on MinGW Debug and Release merged onto current revival. Two things to change before merging, both mismatches between hit-testing and mapping:

  1. GameScene::getUnitUnderCursor (GameScene_commands.cpp, the isCursorOverMinimap() branch) still builds its matrix with worldToMinimapMatrix(simulation.terrain, minimapRect).
  2. GameScene::getMouseTerrainCoordinate (same file) still uses minimapToWorldMatrix(simulation.terrain, minimapRect).

isCursorOverMinimap() now tests slidMinimapRect(). So with the panel mid-slide, or latched away with its last three pixels showing, a cursor over the visible minimap passes the hit test but is mapped as if the minimap had not moved. That puts the picked unit, or the point a right-click orders units to, up to 125 minimap pixels off. Both should use slidMinimapRect(), the same as the click-to-move-camera path in GameScene.cpp already does.

Smaller, and your call: the debug window's GUI checkbox (GameScene_render.cpp, ImGui::Checkbox("GUI", ...)) resets the inset to GuiSizeLeft. Turning the GUI back on with the panel slid leaves the world viewport's left edge wrong until the slide next moves. GuiSizeLeft - panelSlide there would keep it consistent.

🤖 Generated with Claude Code

https://claude.ai/code/session_018moxVoyHDBoHqkw8uqS3HX

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