diff options
author | Juan J. Martinez <jjm@usebox.net> | 2023-07-11 22:09:18 +0100 |
---|---|---|
committer | Juan J. Martinez <jjm@usebox.net> | 2023-07-11 22:09:18 +0100 |
commit | d8d566ddfc9535dd773d942c7e874b875cd803b4 (patch) | |
tree | 987779ae55454d2db9f98ca7c80160c9ef617450 /src | |
parent | 26ab42af5d43c641237a59ca12c97143c5fb571b (diff) | |
download | gold-mine-run-d8d566ddfc9535dd773d942c7e874b875cd803b4.tar.gz gold-mine-run-d8d566ddfc9535dd773d942c7e874b875cd803b4.zip |
Multiple stages
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/data.h | 7 | ||||
-rw-r--r-- | src/game.c | 14 |
3 files changed, 20 insertions, 3 deletions
diff --git a/src/Makefile b/src/Makefile index be1b0e1..5815e88 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,7 +11,7 @@ LIBS := -lmikmod IMGS := $(wildcard ../data/*.png) IMG_OBJS := $(IMGS:../data/%.png=%.o) -MAPS := ../data/stage.json +MAPS := $(wildcard ../data/*.json) MAP_OBJS := $(MAPS:../data/%.json=%.o) WAVS := $(wildcard ../data/*.wav) @@ -2,14 +2,19 @@ #define _DATA_H /* embedded data */ + +/* graphics */ extern const uint8_t binary_palette_start[]; extern const uint8_t binary_sprites_start[]; extern const uint8_t binary_tiles_start[]; extern const uint8_t binary_font_start[]; extern const uint8_t binary_title_start[]; -extern const uint8_t binary_stage_start[]; +/* maps */ +extern const uint8_t binary_stage01_start[]; +extern const uint8_t binary_stage02_start[]; +/* sound */ extern const uint8_t binary_music_start[]; extern const uint8_t binary_music_size; @@ -48,6 +48,12 @@ static uint8_t gameover; static uint8_t pause; static Entity *tmonster; +#define STAGES_LEN 2 + +static const uint8_t *stages[STAGES_LEN] = { + binary_stage01_start, binary_stage02_start, +}; + static void hud_render() { char b[32]; @@ -175,7 +181,7 @@ next_stage: blit_target(TARGET_BUFFER); blit_erase(0); - map_init(binary_stage_start); + map_init(stages[stage]); map_render(); hud_render(); @@ -246,6 +252,12 @@ next_stage: if (stageclear == 1) { run_stageclear(); + stage++; + if (stage == STAGES_LEN) + { + /* TODO: endgame */ + break; + } goto next_stage; } } |