Operation Null Mind 0.4.1
A 2D roguelike top down shooter game made with SDL2
 
Loading...
Searching...
No Matches
minimap.c File Reference

Implements the minimap display system. More...

#include <maps.h>
#include <app.h>
#include <minimap.h>

Functions

void Minimap_Start ()
 [Start] Initializes the minimap system
 
void Minimap_Render ()
 [Render] Renders the minimap to the screen
 
void Minimap_RenderChunk (EnvironmentChunk *chunk)
 [Render] Renders a specific chunk on the minimap
 
void Minimap_RenderChunkRoom (EnvironmentChunk *chunk)
 [Render] Renders a room on the minimap
 
void Minimap_RenderChunkHallways (EnvironmentChunk *chunk)
 [Render] Renders hallways for a chunk on the minimap
 
SDL_Color Minimap_GetRoomColor (EnvironmentChunk *chunk)
 [Utility] Determines the color of a room on the minimap
 
Vec2 Minimap_GetMinimapChunkPosition (EnvironmentChunk *chunk)
 [Utility] Converts chunk position to minimap screen position
 
RoomHallways Minimap_GetHallways (EnvironmentChunk *chunk)
 [Utility] Gets the visible hallway connections for a chunk
 
bool Minimap_ChunkIsVisible (EnvironmentChunk *chunk)
 [Utility] Determines if a chunk should be visible on the minimap
 

Variables

SDL_Rect minimapPosition = {0, 0, 0, 0}
 Position and size of the minimap on screen.
 
SDL_Texture * playerIndicator = NULL
 

Detailed Description

Implements the minimap display system.

Provides a visual representation of the map layout, player position, and discovered areas during gameplay.

Author
Mango
Date
2025-03-06

Function Documentation

◆ Minimap_ChunkIsVisible()

bool Minimap_ChunkIsVisible ( EnvironmentChunk *  chunk)

[Utility] Determines if a chunk should be visible on the minimap

Check if a chunk should be visible on the minimap.

A chunk is visible if it's discovered or adjacent to a discovered chunk.

Parameters
chunkPointer to the chunk to check
Returns
bool True if the chunk should be visible on the minimap

◆ Minimap_GetHallways()

RoomHallways Minimap_GetHallways ( EnvironmentChunk *  chunk)

[Utility] Gets the visible hallway connections for a chunk

Get the hallways connected to a specific chunk.

Determines which hallways should be drawn on the minimap based on the visibility of adjacent chunks.

Parameters
chunkPointer to the chunk
Returns
RoomHallways Bitmask of visible hallway directions

◆ Minimap_GetMinimapChunkPosition()

Vec2 Minimap_GetMinimapChunkPosition ( EnvironmentChunk *  chunk)

[Utility] Converts chunk position to minimap screen position

Calculate the position of a chunk on the minimap.

Calculates the screen coordinates for a chunk on the minimap.

Parameters
chunkPointer to the chunk
Returns
Vec2 Position of the chunk on the minimap

◆ Minimap_GetRoomColor()

SDL_Color Minimap_GetRoomColor ( EnvironmentChunk *  chunk)

[Utility] Determines the color of a room on the minimap

Determine the appropriate color for a room based on its type.

Returns a color based on the room type and state, such as whether it contains enemies or is a special room type.

Parameters
chunkPointer to the chunk containing the room
Returns
SDL_Color The color to use for the room

◆ Minimap_Render()

void Minimap_Render ( )

[Render] Renders the minimap to the screen

Render the complete minimap to the screen.

Draws the background and all visible chunks on the minimap, representing the explored and visible parts of the game world.

◆ Minimap_RenderChunk()

void Minimap_RenderChunk ( EnvironmentChunk *  chunk)

[Render] Renders a specific chunk on the minimap

Render a specific chunk on the minimap.

Renders both the room and hallways of a chunk on the minimap if they're visible.

Parameters
chunkPointer to the chunk to render

◆ Minimap_RenderChunkHallways()

void Minimap_RenderChunkHallways ( EnvironmentChunk *  chunk)

[Render] Renders hallways for a chunk on the minimap

Render hallways for a chunk on the minimap.

Draws the hallway connections from a room to adjacent rooms in each valid direction.

Parameters
chunkPointer to the chunk containing the hallways

◆ Minimap_RenderChunkRoom()

void Minimap_RenderChunkRoom ( EnvironmentChunk *  chunk)

[Render] Renders a room on the minimap

Render a room within a chunk on the minimap.

Draws a room with appropriate colors based on its type and adds a player indicator if the player is in this room.

Parameters
chunkPointer to the chunk containing the room

◆ Minimap_Start()

void Minimap_Start ( )

[Start] Initializes the minimap system

Initialize the minimap system.

Sets up the minimap's position on screen and loads the player indicator texture.

Variable Documentation

◆ minimapPosition

SDL_Rect minimapPosition = {0, 0, 0, 0}

Position and size of the minimap on screen.

◆ playerIndicator

SDL_Texture* playerIndicator = NULL