Skip to content

Conversation

@LiquidityC
Copy link
Member

@LiquidityC LiquidityC commented Oct 6, 2025

Improved minimap

Create a better minimap that renders the actual room shapes with walls.

Summary by CodeRabbit

  • New Features

    • Revamped minimap with a dedicated texture and smoother rendering.
    • Minimap now updates when entering a room for the first time and highlights the current room.
    • GUI reset clears and refreshes the minimap on game reset.
  • Improvements

    • Minimap rendering uses room-based data for more accurate visualization.
  • Chores

    • Build updated to use the C11 standard.

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

📥 Commits

Reviewing files that changed from the base of the PR and between 2a52b23 and 3dac1b1.

📒 Files selected for processing (9)
  • CMakeLists.txt (1 hunks)
  • src/gui.c (6 hunks)
  • src/gui.h (3 hunks)
  • src/input.c (0 hunks)
  • src/main.c (6 hunks)
  • src/map.c (3 hunks)
  • src/map.h (2 hunks)
  • src/player.c (1 hunks)
  • src/skill.c (1 hunks)
 _________________________________
< WMD: Weapons of Mass Debugging. >
 ---------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)

✅ Unit Test PR creation complete.

  • Create PR with unit tests
  • Commit unit tests in branch new_minimap
  • Post copyable unit tests in a comment

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.

@LiquidityC LiquidityC marked this pull request as ready for review October 6, 2025 21:47
The minimap will now correctly render rooms according to shape and
layout. Walls, pits, traps, doors and level exit are represented.

Next step is to allow for a larger view of the map to be togglable.
@LiquidityC
Copy link
Member Author

image

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Note

Unit test generation is an Early Access feature. Expect some limitations and changes as we gather feedback and continue to improve it.


Generating unit tests... This may take up to 20 minutes.

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/map.h (1)

47-55: Restore missing forward declarations for Trap and UpdateData.

Room still stores Trap* entries and map_update still takes UpdateData*, but both forward declarations were dropped. Without them (or the corresponding headers), this header no longer compiles because those pointer types become unknown. Please add the forward declarations back (or include the headers) before releasing.

 #include "map_room_modifiers.h"
 #include "doorlocktype.h"

+typedef struct UpdateData UpdateData;
+typedef struct Trap Trap;
+

Also applies to: 107-112

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2a52b23 and 3dac1b1.

📒 Files selected for processing (9)
  • CMakeLists.txt (1 hunks)
  • src/gui.c (6 hunks)
  • src/gui.h (3 hunks)
  • src/input.c (0 hunks)
  • src/main.c (6 hunks)
  • src/map.c (3 hunks)
  • src/map.h (2 hunks)
  • src/player.c (1 hunks)
  • src/skill.c (1 hunks)
💤 Files with no reviewable changes (1)
  • src/input.c
🧰 Additional context used
🧬 Code graph analysis (4)
src/map.h (1)
src/map.c (1)
  • map_set_current_room (402-433)
src/gui.h (1)
src/gui.c (3)
  • gui_update_minimap (473-517)
  • gui_reset (519-527)
  • gui_render_minimap (529-540)
src/main.c (3)
src/map.c (1)
  • map_set_current_room (402-433)
src/camera.c (1)
  • camera_follow_position (48-73)
src/gui.c (3)
  • gui_reset (519-527)
  • gui_update_minimap (473-517)
  • gui_render_minimap (529-540)
src/gui.c (2)
src/sprite.c (3)
  • sprite_create (50-54)
  • sprite_render (227-275)
  • sprite_destroy (277-288)
src/texture.c (2)
  • texture_create (27-41)
  • texture_create_blank (43-55)
⏰ 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 (GCC)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Analyze (c-cpp)

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: 0

🧹 Nitpick comments (2)
src/gui.c (2)

195-210: Consider setting blend mode for transparency support.

The minimap texture is created with SDL_TEXTUREACCESS_TARGET, which is correct for render-to-texture operations. However, for proper transparency rendering (particularly for the alpha channel used in gui_update_minimap), consider setting the blend mode explicitly.

Apply this diff to set the blend mode after texture creation:

 	texture_create_blank(texture,
 			     SDL_TEXTUREACCESS_TARGET,
 			     cam->renderer);
+	SDL_SetTextureBlendMode(texture->texture, SDL_BLENDMODE_BLEND);
 
 	gui->miniMap = minimap;

474-478: Remove unnecessary initial color setting.

The white color set on line 477 is immediately overwritten in the loop below. This line serves no purpose and can be removed.

Apply this diff:

 	SDL_SetRenderTarget(cam->renderer, gui->miniMap->textures[0]->texture);
-	SDL_SetRenderDrawColor(cam->renderer, 255, 255, 255, SDL_ALPHA_OPAQUE);
 
 	debug("Updating minimap");
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3dac1b1 and f07cb21.

📒 Files selected for processing (2)
  • src/gui.c (6 hunks)
  • src/map.h (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
src/gui.c (4)
src/sprite.c (3)
  • sprite_create (50-54)
  • sprite_render (227-275)
  • sprite_destroy (277-288)
src/texture.c (2)
  • texture_create (27-41)
  • texture_create_blank (43-55)
src/main.c (2)
  • render_gui (994-1006)
  • initGame (245-273)
src/gui_util.c (1)
  • render_frame_on_texture (22-117)
src/map.h (2)
src/map.c (4)
  • map_set_current_room (402-433)
  • map_set_current_room (401-428)
  • map_add_wall (132-138)
  • map_add_tile (117-130)
src/roommatrix.c (1)
  • roommatrix_populate_from_map (110-220)
⏰ 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: Windows (MSVC)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Ubuntu (Clang)
🔇 Additional comments (8)
src/map.h (3)

23-23: LGTM!

The addition of <stdbool.h> is necessary and correct to support the new bool* first_visit parameter in map_set_current_room.


60-74: LGTM!

The Doxygen-style documentation for the Map struct and its fields improves code maintainability and clarity. Well done!


124-131: All call sites now pass the third argument (NULL or valid bool).*

src/gui.c (5)

26-31: LGTM!

The added includes are appropriate for the new minimap rendering functionality using RoomMatrix and direct SDL rendering operations.


481-509: LGTM!

The color-coding logic for different space types is clear and well-organized:

  • Transparent for lethal spaces
  • Red for traps
  • Blue for doors
  • Green for exits
  • Gray for walls/occupied spaces
  • Purple for walkable spaces

The condition ordering ensures proper priority (e.g., lethal spaces checked first, then traps, then doors, etc.).


514-522: LGTM!

The gui_reset function correctly clears the minimap texture by setting the render target, clearing with transparent black, and resetting the target. This follows the proper SDL render-target pattern.


699-701: LGTM!

The destruction calls correctly match the refactored structure:

  • gui->miniMap replaces gui->miniMapFrame (field rename)
  • gui->silverKey and gui->goldKey are now explicitly destroyed, which is correct since they're not added to any linked list in init_sprites (lines 172-186) and need manual cleanup

524-535: All gui_render_minimap call sites updated: Verified that declaration, implementation, and all calls now use the new signature (Gui*, Camera*, RoomMatrix*).

@LiquidityC LiquidityC merged commit efb0abb into dev Oct 6, 2025
9 checks passed
@LiquidityC LiquidityC deleted the new_minimap branch October 6, 2025 22:16
@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

UTG Post-Process Complete

No new issues were detected in the generated code and all check runs have completed. The unit test generation process has completed successfully.

@coderabbitai
Copy link

coderabbitai bot commented Oct 6, 2025

Creating a PR to put the unit tests in...

The changes have been created in this pull request: View PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants