-
-
Notifications
You must be signed in to change notification settings - Fork 7
Adds large map view #130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds large map view #130
Conversation
WalkthroughAdds 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
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
🔇 Additional comments (1)
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. Comment |
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.
There was a problem hiding this 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,camFor 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
⛔ Files ignored due to path filters (1)
assets/Extras/Controller.pngis 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
directionstolocal directionsprevents accidental global variable pollution and follows Lua best practices.
469-469: LGTM! Local scoping improves code quality.Changing
roomtolocal roomensures 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
gShowMapflag 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
gShowMapflag 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
gShowMapis true, providing the desired toggle behavior.
914-914: LGTM! Inline hint is a minor optimization.Adding the
inlinekeyword 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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?

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
Improvements
Documentation
Refactor