Skip to content

Conversation

@LiquidityC
Copy link
Member

@LiquidityC LiquidityC commented Oct 7, 2025

It's now possible to press TAB/"Right stick" to display a larger version
of the map on top of the play area. This is the same as the minimap.
Just larger for easier viewing.

Summary by CodeRabbit

  • New Features

    • Toggleable minimap overlay (TAB on keyboard; right-stick press on gamepad).
    • Minimap displays translucent room modifier overlays (Windy, Fire, Crumbling).
  • Improvements

    • Sharper minimap rendering via nearest-neighbor scaling; minimap slightly shorter.
    • Empty/unexplored tiles rendered transparent.
    • Gamepad mappings updated (left stick → jump/space, right stick → map/tab).
  • Documentation

    • How to Play: added “TOGGLE MAP” with TAB key; TAB tooltip icon added.
  • Refactor

    • Reduced unintended global state by tightening variable scope.

@coderabbitai
Copy link

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds a toggleable minimap overlay controlled by TAB/right-stick, implements overlay rendering for room modifiers in the GUI, adjusts minimap init/alpha/scaling, updates input/key definitions and tooltips for TAB, renames texture_render_clip_ex parameters, and tightens variable scope in maproombuilder.lua.

Changes

Cohort / File(s) Summary
Minimap overlay GUI
src/gui.c, src/gui.h
Adds gui_render_minimap_overlay(Gui *gui, Camera *cam) and gui_reset; reduces minimap height, enables nearest-neighbor scaling, uses transparent alpha for NULL tiles; renders translucent overlays for room modifiers (Windy/Fire/Crumbing) with assertion on unexpected types; reorganizes minimap clearing and overlay drawing; adds includes SDL3/SDL_surface.h and map_room_modifiers.h.
Input mappings
src/input.c, src/input.h
Adds KEY_TAB macro (0x20000); keyboard TAB → KEY_TAB; gamepad right stick → KEY_TAB, left stick → KEY_SPACE; removed previous standalone left-stick case.
Main loop toggle
src/main.c
Introduces global gShowMap toggled by TAB in input handler; main render path conditionally calls overlay render when enabled; populateUpdateData made inline static.
Tooltips / Help
src/tooltip.c, src/tooltip_manager.c
Adds TAB glyph handling in tooltip texture mapping (CLIP16(32, 80)); inserts “TOGGLE MAP:” entry using TAB into How To Play tooltip and adds a spacer line.
Texture API readability
src/texture.h, src/texture.c
Renames parameters in texture_render_clip_ex declaration and definition: (Texture *texture, SDL_Rect *dst, SDL_Rect *src, double angle, SDL_Point *rotation_point, SDL_FlipMode flip_mode, Camera *cam) and updates internal usage accordingly (semantic rename of box/clip/point/flip).
Map room builder scope
data/maproombuilder.lua
Replaces implicit/global directions and room assignment with local variables in WINDY modifier branch and create_empty_room; function now returns the local room rather than mutating an outer/global variable.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Input as Input (keyboard/gamepad)
  participant Main as main.c
  participant GUI as gui.c
  participant Cam as Camera

  User->>Input: Press TAB / Right Stick
  Input-->>Main: KEY_TAB event
  Main->>Main: Toggle gShowMap
  alt gShowMap true
    Main->>GUI: gui_render_minimap_overlay(gui, Cam)
    GUI->>GUI: gui_reset() — clear minimap render target
    GUI->>GUI: Draw base minimap (tiles with transparency)
    GUI->>GUI: Draw translucent overlays for room modifiers (Windy/Fire/Crumbing)
    GUI-->>Main: Render complete
  else gShowMap false
    Main->>GUI: gui_render_minimap(gui, Cam)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

I tapped my TAB with a whiskered grin,
A map unfurled where rooms begin.
Wind whispers, flames glow, stones fall slow—
I color each thing where soft lights show.
Hop-hop — the rabbit maps the flow! 🐇🗺️

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Adds large map view” succinctly captures the primary feature introduced by the changeset, namely the ability to display a larger, scaled-up version of the map overlay, and does so without extraneous detail or ambiguity.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch map_view

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df58ef6 and becfb6e.

📒 Files selected for processing (2)
  • src/texture.c (2 hunks)
  • src/texture.h (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/texture.h
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Analyze (c-cpp)
🔇 Additional comments (1)
src/texture.c (1)

286-312: LGTM! Parameter renaming improves clarity.

The parameter renames (boxdst, clipsrc, pointrotation_point, flipTypeflip_mode) enhance readability and follow SDL conventions. The implementation is consistent throughout the function body.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

It's now possible to press TAB/"Right stick" to display a larger version
of the map on top of the play area. This is the same as the minimap.
Just larger for easier viewing.
@LiquidityC
Copy link
Member Author

image

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
src/texture.h (1)

98-99: Consider aligning parameter names with the implementation.

While adding parameter names improves documentation, they don't match the implementation in texture.c:

  • Header: dest, src, rotation_point, flip, camera
  • Implementation: box, clip, point, flipType, cam

For consistency and easier code navigation, consider using the same names in both the declaration and definition.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dedf0fc and eb84010.

⛔ Files ignored due to path filters (1)
  • assets/Extras/Controller.png is excluded by !**/*.png
📒 Files selected for processing (9)
  • data/maproombuilder.lua (2 hunks)
  • src/gui.c (5 hunks)
  • src/gui.h (1 hunks)
  • src/input.c (2 hunks)
  • src/input.h (1 hunks)
  • src/main.c (4 hunks)
  • src/texture.h (1 hunks)
  • src/tooltip.c (1 hunks)
  • src/tooltip_manager.c (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (6)
src/gui.h (1)
src/gui.c (1)
  • gui_render_minimap_overlay (552-563)
src/tooltip_manager.c (1)
src/tooltip.h (1)
  • GAMEPAD_TYPE_MAX (25-27)
data/maproombuilder.lua (3)
src/map_room_modifiers.c (1)
  • map_room_modifier_player_effect (25-42)
src/map_room_modifiers.h (1)
  • struct WindData { (35-37)
src/map_lua.c (1)
  • l_map_set_current_room_modifier (116-150)
src/main.c (2)
src/input.c (1)
  • input_key_is_pressed (244-248)
src/gui.c (1)
  • gui_render_minimap_overlay (552-563)
src/texture.h (1)
src/texture.c (1)
  • texture_render_clip_ex (285-315)
src/gui.c (1)
src/texture.c (5)
  • texture_create_blank (43-55)
  • texture_set_blend_mode (227-232)
  • texture_set_scale_mode (234-239)
  • texture_set_alpha (241-246)
  • texture_render_clip_ex (285-315)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Ubuntu (Clang)
🔇 Additional comments (11)
src/input.h (1)

42-42: LGTM! KEY_TAB addition follows the existing pattern.

The new KEY_TAB constant is correctly positioned as the next power of 2 after KEY_SPACE, maintaining consistency with the established pattern for key definitions.

src/tooltip_manager.c (1)

82-83: LGTM! Tooltip documentation for TAB key is clear and consistent.

The new tooltip entry for toggling the map follows the same formatting pattern as other entries in the how-to-play tooltip.

data/maproombuilder.lua (2)

439-439: LGTM! Local scoping improves code quality.

Changing directions to local directions prevents accidental global variable pollution and follows Lua best practices.


469-469: LGTM! Local scoping improves code quality.

Changing room to local room ensures the variable is properly scoped within the function, preventing unintended global side effects.

src/tooltip.c (1)

50-51: LGTM! TAB key rendering case follows the established pattern.

The implementation is consistent with other key cases like SPACE, ESC, and ENTER.

src/input.c (2)

87-88: LGTM! TAB key mapping is correctly implemented.

The keyboard TAB key is now properly mapped to KEY_TAB, consistent with the new constant defined in input.h.


122-125: Verify gamepad button remapping aligns with UX goals.

The gamepad controls have been remapped:

  • Right Stick (L3) → now toggles map (KEY_TAB)
  • Left Stick (L3) → now holds turn (KEY_SPACE)

Ensure this remapping provides intuitive controls for gamepad users and doesn't conflict with other gamepad actions.

src/main.c (4)

120-120: LGTM! Global flag for map overlay state is appropriate.

The gShowMap flag follows the existing pattern for global game state in this file.


811-813: LGTM! TAB toggle logic is correctly implemented.

The toggle logic properly flips the gShowMap flag when the TAB key is pressed, enabling/disabling the minimap overlay.


1078-1080: LGTM! Overlay rendering is correctly gated.

The minimap overlay is conditionally rendered when gShowMap is true, providing the desired toggle behavior.


914-914: LGTM! Inline hint is a minor optimization.

Adding the inline keyword suggests to the compiler that this function should be inlined, which is appropriate for this small helper function. No behavioral change.

src/gui.c Outdated
Copy link

@coderabbitai coderabbitai bot Oct 7, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Restore the current-room highlight on the enlarged map

The small minimap draws the cyan outline in gui_render_minimap (Lines 540-550) so the player can tell which room they occupy. The new overlay only scales the texture, so once TAB is held the outline disappears and the player loses that orientation cue. Please extend the overlay to render the same highlight (likely by passing the RoomMatrix *rm into this helper and drawing a scaled rectangle after blitting the texture).

🤖 Prompt for AI Agents
In src/gui.c around lines 552 to 563, the overlayed minimap currently only
scales and renders the minimap texture, losing the cyan outline that marks the
player’s current room; update the function signature to accept a RoomMatrix *rm,
after rendering the scaled texture compute the player's room rectangle in
texture coordinates, scale/translate that rect to match the target_box
dimensions (accounting for the same padding and width/height used for the
overlay), then draw the cyan outline (same color/thickness used in
gui_render_minimap) on top of the texture using the scaled rectangle so the
current-room highlight remains visible when the map is enlarged.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created an issue for this. Not in the mood for doing that math right now.

Copy link

Choose a reason for hiding this comment

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

@LiquidityC, sounds good! Creating an issue to track this is the right approach—no need to handle everything in this PR.

Would you like me to resolve this comment since you've created a tracking issue for the follow-up work?

@LiquidityC LiquidityC enabled auto-merge (squash) October 7, 2025 21:30
@LiquidityC LiquidityC merged commit 609f9df into dev Oct 7, 2025
8 of 9 checks passed
@LiquidityC LiquidityC deleted the map_view branch October 7, 2025 21:37
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