RogueLife/src/level.h

57 lines
1.3 KiB
C

//---
// level: Static level model
//
// This module provides representations for read-only data structures
// describing levels, from which dynamic maps can be built. The only role of
// models is that we can import them into the game and then load them into
// maps. This is a convenience to abstract away the storage format of levels.
//---
#pragma once
#include "fixed.h"
#include "map.h"
#include <stdint.h>
#include <stdbool.h>
#include <gint/display.h>
/* A level wave is a list of pairs (enemy identity, amount) pairs which
indicate how many enemies to spawn. The order might be random and another
dynamically-allocated structure is used in game_t to keep track of this
assignment. */
typedef struct {
int entry_count;
struct {
uint8_t identity;
uint8_t amount;
} *entries;
/* Duration in seconds */
int duration;
/* Delay after the wave in seconds */
int delay_after;
} level_wave_t;
typedef struct {
map_t const *map;
/* Player spawn location */
uint8_t player_spawn_x;
uint8_t player_spawn_y;
/* Spawner positions */
int spawner_count;
uint8_t *spawner_x;
uint8_t *spawner_y;
/* Waves; the array is not terminated */
int wave_count;
level_wave_t *waves;
} level_t;
/* List of levels */
extern level_t level_lv1;
extern level_t level_lv2;