Creates and initializes environment chunks. More...
#include <chunks.h>#include <enemy.h>#include <enemy_types.h>#include <random.h>#include <player.h>Functions | |
| EnvironmentChunk | Chunk_GenerateTiles (Vec2 position, RoomType roomType, Vec2 roomSize, RoomFloorPattern floorPattern, RoomHallways hallways) |
| [Utility] Generates a complete chunk with tiles, hallways, and colliders | |
| void | Chunk_GenerateTilesButVoid (EnvironmentChunk *chunk) |
| [Utility] Regenerates all tiles for an existing chunk | |
| void | Chunk_GenerateFloorTiles (EnvironmentChunk *chunk) |
| [Utility] Generates floor tiles for a chunk | |
| void | Chunk_GenerateHallways (EnvironmentChunk *chunk) |
| [Utility] Generates hallway tiles for a chunk | |
| void | Chunk_GenerateWallTiles (EnvironmentChunk *chunk) |
| [Utility] Generates wall tiles for a chunk | |
| void | Chunk_GenerateHallwayWallTiles (EnvironmentChunk *chunk) |
| [Utility] Generates wall tiles for hallways | |
| void | Chunk_GenerateColliders (EnvironmentChunk *chunk) |
| [Utility] Generates collision boxes for a chunk | |
| void | Chunk_AddWallCollider (Vec2 startTile, Vec2 endTile, EnvironmentChunk *chunk) |
| [Utility] Adds a wall collider to a chunk | |
| void | Chunk_HandlePlayerInsideRoom () |
| [Event Handler] Event handler for when player enters a room | |
| void | Chunk_HandlePlayerInsideHallway () |
| [Event Handler] Event handler for when player enters a hallway | |
| void | Chunk_HandlePlayerInsideEnd () |
| [Event Handler] Event handler for when player enters an end room | |
| void | Chunk_AddRoomTrigger (Vec2 startTile, Vec2 endTile, EnvironmentChunk *chunk) |
| [Utility] Adds a room trigger collider to a chunk | |
| void | Chunk_AddHallwayTrigger (Vec2 startTile, Vec2 endTile, EnvironmentChunk *chunk) |
| [Utility] Adds a hallway trigger collider to a chunk | |
| void | Chunk_AddEndTrigger (Vec2 startTile, Vec2 endTile, EnvironmentChunk *chunk) |
| [Utility] Adds an end room trigger collider to a chunk | |
Creates and initializes environment chunks.
Handles the procedural generation of chunk tiles, walls, and collision boundaries based on chunk parameters.
| void Chunk_AddEndTrigger | ( | Vec2 | startTile, |
| Vec2 | endTile, | ||
| EnvironmentChunk * | chunk | ||
| ) |
[Utility] Adds an end room trigger collider to a chunk
Adds an end trigger to a chunk.
Creates a trigger zone in the center of the end room that detects when the player has reached the level exit.
| startTile | Starting tile position |
| endTile | Ending tile position |
| chunk | Pointer to the chunk |
| void Chunk_AddHallwayTrigger | ( | Vec2 | startTile, |
| Vec2 | endTile, | ||
| EnvironmentChunk * | chunk | ||
| ) |
[Utility] Adds a hallway trigger collider to a chunk
Adds a hallway trigger to a chunk.
Creates a trigger zone that detects when the player is inside a hallway.
| startTile | Starting tile position |
| endTile | Ending tile position |
| chunk | Pointer to the chunk |
| void Chunk_AddRoomTrigger | ( | Vec2 | startTile, |
| Vec2 | endTile, | ||
| EnvironmentChunk * | chunk | ||
| ) |
[Utility] Adds a room trigger collider to a chunk
Adds a room trigger to a chunk.
Creates a trigger zone that detects when the player is inside a room.
| startTile | Starting tile position |
| endTile | Ending tile position |
| chunk | Pointer to the chunk |
| void Chunk_AddWallCollider | ( | Vec2 | startTile, |
| Vec2 | endTile, | ||
| EnvironmentChunk * | chunk | ||
| ) |
[Utility] Adds a wall collider to a chunk
Adds a wall collider to a chunk.
Creates a physical collision box for walls at the specified location.
| startTile | Starting tile position of the wall |
| endTile | Ending tile position of the wall |
| chunk | Pointer to the chunk |
| void Chunk_GenerateColliders | ( | EnvironmentChunk * | chunk | ) |
[Utility] Generates collision boxes for a chunk
Generates colliders for a chunk.
Creates colliders for walls and hallways, as well as trigger zones for room and hallway detection.
| chunk | Pointer to the chunk |
| void Chunk_GenerateFloorTiles | ( | EnvironmentChunk * | chunk | ) |
[Utility] Generates floor tiles for a chunk
Generates floor tiles for a chunk.
Creates the base floor tiles for a room based on its size and floor pattern.
| chunk | Pointer to the chunk |
| void Chunk_GenerateHallways | ( | EnvironmentChunk * | chunk | ) |
[Utility] Generates hallway tiles for a chunk
Generates hallways for a chunk.
Creates floor tiles for hallways based on the room's hallway configuration.
| chunk | Pointer to the chunk |
| void Chunk_GenerateHallwayWallTiles | ( | EnvironmentChunk * | chunk | ) |
[Utility] Generates wall tiles for hallways
Generates hallway wall tiles for a chunk.
Creates wall tiles along the sides of hallways with appropriate corner pieces at junctions.
| chunk | Pointer to the chunk |
| EnvironmentChunk Chunk_GenerateTiles | ( | Vec2 | position, |
| RoomType | roomType, | ||
| Vec2 | roomSize, | ||
| RoomFloorPattern | floorPattern, | ||
| RoomHallways | hallways | ||
| ) |
[Utility] Generates a complete chunk with tiles, hallways, and colliders
Generates tiles for a chunk.
Creates a fully-formed environment chunk with all necessary components including floor tiles, walls, hallways, and collision boxes.
| position | World position of the chunk |
| roomType | Type of room to generate (start, normal, boss, end) |
| roomSize | Size of the room in tiles |
| floorPattern | Pattern to use for floor tiles |
| hallways | Configuration of hallways connected to this room |
| void Chunk_GenerateTilesButVoid | ( | EnvironmentChunk * | chunk | ) |
[Utility] Regenerates all tiles for an existing chunk
Generates void tiles for a chunk.
Clears all existing tiles and colliders from a chunk and regenerates them, useful when hallway configurations change or room state changes.
| chunk | Pointer to the chunk to regenerate |
| void Chunk_GenerateWallTiles | ( | EnvironmentChunk * | chunk | ) |
[Utility] Generates wall tiles for a chunk
Generates wall tiles for a chunk.
Creates wall tiles around the room perimeter using appropriate wall sprites with correct rotations.
| chunk | Pointer to the chunk |
| void Chunk_HandlePlayerInsideEnd | ( | ) |
[Event Handler] Event handler for when player enters an end room
Handles player inside the end.
Updates player state to indicate they have reached the end of the level, enabling level completion functionality.
| void Chunk_HandlePlayerInsideHallway | ( | ) |
[Event Handler] Event handler for when player enters a hallway
Handles player inside a hallway.
Updates player state to indicate they are inside a hallway, which affects combat and movement.
| void Chunk_HandlePlayerInsideRoom | ( | ) |
[Event Handler] Event handler for when player enters a room
Handles player inside a room.
Updates player state to indicate they are inside a room, which affects combat and other game systems.