RogueLife/src/level.h

59 lines
1.2 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 <stdint.h>
#include <stdbool.h>
typedef struct {
/* Enemy type */
uint8_t identity;
/* Enemy level */
uint8_t level;
/* Spawn location */
uint8_t x, y;
/* Spawn time */
fixed_t time;
} level_wave_spawn_t;
typedef struct {
/* Number of enemies */
int enemy_count;
/* List of enemies */
level_wave_spawn_t *enemies;
} level_wave_t;
typedef struct {
/* Dimensions of the level (yeah no surprise right) */
uint16_t width, height;
/* Tile definitions; each tile is a dual-layer base/decoration */
struct {
uint8_t base;
uint8_t decor;
} tiles[];
} level_map_t;
typedef struct {
level_map_t *map;
/* Waves */
int wave_count;
level_wave_t *waves;
} level_t;
/* List of levels */
extern level_t lv_demo;
extern level_t lv_1;