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

Minimap functionality for the game's navigation system. More...

#include <maps.h>

Go to the source code of this file.

Macros

#define MINIMAP_SIZE   100
 Size of the minimap in pixels.
 
#define MINIMAP_CHUNK_SIZE   10
 Size of a chunk on the minimap in pixels.
 
#define MINIMAP_CHUNK_ROOM_SIZE   6
 Size of a room within a chunk on the minimap in pixels.
 
#define MINIMAP_CHUNK_HALLWAY_SIZE   2
 Size of hallways on the minimap in pixels.
 
#define MINIMAP_MARGIN   ((MINIMAP_SIZE - (MINIMAP_CHUNK_SIZE * MAP_SIZE_CHUNK)))
 Margin around the minimap.
 
#define MINIMAP_ROOM_COLOR   255, 255, 255, 255
 Color for regular rooms (R,G,B,A)
 
#define MINIMAP_ENEMY_ROOM_COLOR   255, 0, 0, 255
 Color for enemy rooms (R,G,B,A)
 
#define MINIMAP_SPECIAL_ROOM_COLOR   252, 130, 0, 255
 Color for special rooms (R,G,B,A)
 
#define MINIMAP_START_ROOM_COLOR   0, 255, 0, 255
 Color for the starting room (R,G,B,A)
 
#define MINIMAP_END_ROOM_COLOR   0, 0, 255, 255
 Color for the ending room (R,G,B,A)
 
#define MINIMAP_PLAYER_COLOR   158, 158, 158, 255
 Color for player indicator on minimap (R,G,B,A)
 

Functions

void Minimap_Start ()
 Initialize the minimap system.
 
void Minimap_Render ()
 Render the complete minimap to the screen.
 
void Minimap_RenderChunk (EnvironmentChunk *chunk)
 Render a specific chunk on the minimap.
 
RoomHallways Minimap_GetHallways (EnvironmentChunk *chunk)
 Get the hallways connected to a specific chunk.
 
void Minimap_RenderChunkRoom (EnvironmentChunk *chunk)
 Render a room within a chunk on the minimap.
 
void Minimap_RenderChunkHallways (EnvironmentChunk *chunk)
 Render hallways for a chunk on the minimap.
 
SDL_Color Minimap_GetRoomColor (EnvironmentChunk *chunk)
 Determine the appropriate color for a room based on its type.
 
Vec2 Minimap_GetMinimapChunkPosition (EnvironmentChunk *chunk)
 Calculate the position of a chunk on the minimap.
 
bool Minimap_ChunkIsVisible (EnvironmentChunk *chunk)
 Check if a chunk should be visible on the minimap.
 

Variables

SDL_Rect minimapPosition
 Position and size of the minimap on screen.
 

Detailed Description

Minimap functionality for the game's navigation system.

Author
Mango
Date
2025-03-22

Macro Definition Documentation

◆ MINIMAP_CHUNK_HALLWAY_SIZE

#define MINIMAP_CHUNK_HALLWAY_SIZE   2

Size of hallways on the minimap in pixels.

◆ MINIMAP_CHUNK_ROOM_SIZE

#define MINIMAP_CHUNK_ROOM_SIZE   6

Size of a room within a chunk on the minimap in pixels.

◆ MINIMAP_CHUNK_SIZE

#define MINIMAP_CHUNK_SIZE   10

Size of a chunk on the minimap in pixels.

◆ MINIMAP_END_ROOM_COLOR

#define MINIMAP_END_ROOM_COLOR   0, 0, 255, 255

Color for the ending room (R,G,B,A)

◆ MINIMAP_ENEMY_ROOM_COLOR

#define MINIMAP_ENEMY_ROOM_COLOR   255, 0, 0, 255

Color for enemy rooms (R,G,B,A)

◆ MINIMAP_MARGIN

#define MINIMAP_MARGIN   ((MINIMAP_SIZE - (MINIMAP_CHUNK_SIZE * MAP_SIZE_CHUNK)))

Margin around the minimap.

◆ MINIMAP_PLAYER_COLOR

#define MINIMAP_PLAYER_COLOR   158, 158, 158, 255

Color for player indicator on minimap (R,G,B,A)

◆ MINIMAP_ROOM_COLOR

#define MINIMAP_ROOM_COLOR   255, 255, 255, 255

Color for regular rooms (R,G,B,A)

◆ MINIMAP_SIZE

#define MINIMAP_SIZE   100

Size of the minimap in pixels.

◆ MINIMAP_SPECIAL_ROOM_COLOR

#define MINIMAP_SPECIAL_ROOM_COLOR   252, 130, 0, 255

Color for special rooms (R,G,B,A)

◆ MINIMAP_START_ROOM_COLOR

#define MINIMAP_START_ROOM_COLOR   0, 255, 0, 255

Color for the starting room (R,G,B,A)

Function Documentation

◆ Minimap_ChunkIsVisible()

bool Minimap_ChunkIsVisible ( EnvironmentChunk *  chunk)

Check if a chunk should be visible on the minimap.

Parameters
chunkPointer to the chunk to check
Returns
bool true if the chunk should be visible, false otherwise

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)

Get the hallways connected to a specific chunk.

Parameters
chunkPointer to the chunk to analyze
Returns
RoomHallways Structure containing hallway information

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)

Calculate the position of a chunk on the minimap.

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

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)

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

Parameters
chunkPointer to the chunk containing the room
Returns
SDL_Color Color to use for rendering the room

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 the complete 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 a specific chunk on the minimap.

Parameters
chunkPointer to the environment chunk to render

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 hallways for a chunk on the minimap.

Parameters
chunkPointer to the chunk whose hallways should be rendered

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 a room within a chunk on the minimap.

Parameters
chunkPointer to the chunk containing the room

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 ( )

Initialize the minimap system.

Sets up the initial state of the minimap

Initialize the minimap system.

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

Variable Documentation

◆ minimapPosition

SDL_Rect minimapPosition
extern

Position and size of the minimap on screen.