summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-25 18:18:22 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-25 18:18:22 (EDT)
commit008b6bfa3ea42619864db4d8bb0696921deb9bf6 (patch)
treec03177e39704c16349b35e54e79b071015769e6e
parenta100e53c440f86e8e49ce7018808722cfeccb13d (diff)
downloaddodge-balls-008b6bfa3ea42619864db4d8bb0696921deb9bf6.zip
dodge-balls-008b6bfa3ea42619864db4d8bb0696921deb9bf6.tar.gz
dodge-balls-008b6bfa3ea42619864db4d8bb0696921deb9bf6.tar.bz2
level: Get tilesets and objects from map
-rw-r--r--src/level.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/level.c b/src/level.c
index 0973003..efa566c 100644
--- a/src/level.c
+++ b/src/level.c
@@ -25,19 +25,19 @@
#include "output.h"
struct db_level {
- char *game_id;
- char *level_id;
- struct db_level *next;
- int player_x;
- int player_y;
- int player_r;
- int player_a;
- int player_s;
- int target_x;
- int target_y;
- int target_r;
- struct db_ball *ball_head;
- struct db_ball *ball_tail;
+ char *game_id;
+ char *level_id;
+ struct db_level *next;
+ struct db_tileset *tilesets;
+ int player_x;
+ int player_y;
+ int player_r;
+ int player_a;
+ int player_s;
+ int target_x;
+ int target_y;
+ int target_r;
+ struct db_ball *balls;
};
struct db_level *
@@ -86,6 +86,12 @@ db_level_play(SDL_Renderer *renderer, struct db_level *level)
return -1;
}
map_texture = db_map_render(map, renderer);
+ level->tilesets = db_map_get_tilesets(map);
+ db_map_get_player(map, &level->player_x, &level->player_y,
+ &level->player_r);
+ db_map_get_target(map, &level->target_x, &level->target_y,
+ &level->target_r);
+ level->balls = db_map_get_balls(map);
if (SDL_RenderClear(renderer) != 0) {
db_err("Failed to clear screen (%s)", SDL_GetError());