-
-
Notifications
You must be signed in to change notification settings - Fork 7
New minimap #126
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
New minimap #126
Conversation
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... 📒 Files selected for processing (9)
✨ Finishing touches
🧪 Generate unit tests (beta)✅ Unit Test PR creation complete.
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 |
85c679a to
3dac1b1
Compare
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.
|
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. |
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: 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 forTrapandUpdateData.
Roomstill storesTrap*entries andmap_updatestill takesUpdateData*, 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
📒 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)
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: 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
📒 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 newbool* first_visitparameter inmap_set_current_room.
60-74: LGTM!The Doxygen-style documentation for the
Mapstruct 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->miniMapreplacesgui->miniMapFrame(field rename)gui->silverKeyandgui->goldKeyare 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*).
|
✅ 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. |
|
Creating a PR to put the unit tests in... The changes have been created in this pull request: View PR |

Improved minimap
Create a better minimap that renders the actual room shapes with walls.
Summary by CodeRabbit
New Features
Improvements
Chores