diff options
author | kdx <kikoodx@paranoici.org> | 2023-03-27 07:43:03 +0200 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-03-27 07:43:03 +0200 |
commit | eb7846d195d082578fefb48528c569fa5ef624e3 (patch) | |
tree | fcac9171dab69d32abb79412675899adb75f16a9 | |
parent | 98bc80608f4252fb36bd6d0865341f98b036640b (diff) | |
download | 006-eb7846d195d082578fefb48528c569fa5ef624e3.tar.gz |
scene previous
-rw-r--r-- | src/game.c | 10 | ||||
-rw-r--r-- | src/game.h | 1 | ||||
-rw-r--r-- | src/map.c | 7 | ||||
-rw-r--r-- | src/map.h | 1 |
4 files changed, 19 insertions, 0 deletions
@@ -18,11 +18,21 @@ game_update(Game *this) if (this->queue_next_scene) { if (--this->queue_next_scene == 0) { this->queue_restart_scene = 0; + this->queue_previous_scene = 0; map_next(); game_restart_scene(this); return; } } + if (this->queue_previous_scene) { + if (--this->queue_next_scene == 0) { + this->queue_restart_scene = 0; + this->queue_next_scene = 0; + map_previous(); + game_restart_scene(this); + return; + } + } if (this->queue_restart_scene) { if (--this->queue_restart_scene == 0) game_restart_scene(this); @@ -6,6 +6,7 @@ enum { MAX_ENTITIES = 128 }; typedef struct Game { unsigned long uuid; int queue_next_scene; + int queue_previous_scene; int queue_restart_scene; Entity entities[MAX_ENTITIES]; } Game; @@ -12,6 +12,13 @@ map_next(void) map_id += 1; } +void +map_previous(void) +{ + if (map_id > 0) + map_id -= 1; +} + int map_width(void) { @@ -2,6 +2,7 @@ #include "../map/tmj2c.h" void map_next(void); +void map_previous(void); int map_width(void); int map_height(void); int map_get(int x, int y); |