Files
major_tom/src/game/level.h
Thomas ded662b42a Add spacecraft exit sequence at level exit zones
Spawn an exit ship when the player approaches an exit zone. The ship
flies in, lands near the exit, and waits for the player to board.
On boarding the player is deactivated, the ship takes off, and the
level transition fires after departure.
2026-03-01 12:38:41 +00:00

43 lines
1.6 KiB
C

#ifndef JNR_LEVEL_H
#define JNR_LEVEL_H
#include "engine/tilemap.h"
#include "engine/entity.h"
#include "engine/camera.h"
#include "engine/audio.h"
#include "engine/parallax.h"
typedef struct Level {
Tilemap map;
EntityManager entities;
Camera camera;
Parallax parallax;
Music music;
bool music_started;
/* ── Exit / transition state ─────────── */
bool exit_triggered; /* player entered an exit zone */
char exit_target[ASSET_PATH_MAX]; /* target level path */
/* ── Intro sequence state ────────────── */
bool has_intro_ship; /* level has a spacecraft intro */
bool player_spawned; /* player has been spawned */
/* ── Exit ship sequence state ────────── */
bool exit_ship_spawned; /* exit spacecraft has been spawned */
bool exit_ship_boarded; /* player has entered the ship */
int exit_zone_idx; /* which exit zone the ship is for */
} Level;
bool level_load(Level *level, const char *path);
bool level_load_generated(Level *level, Tilemap *gen_map);
void level_update(Level *level, float dt);
void level_render(Level *level, float interpolation);
void level_free(Level *level);
/* Returns true if the player has triggered a level exit.
* The target path is stored in level->exit_target. */
bool level_exit_triggered(const Level *level);
#endif /* JNR_LEVEL_H */