From 38f7c9f909815df9886b532e2e631c91ca6db1a6 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 27 Mar 2021 17:20:27 -0400 Subject: ball: Add map member --- (limited to 'src') diff --git a/src/ball.c b/src/ball.c index 5b9fda5..2fd2b97 100644 --- a/src/ball.c +++ b/src/ball.c @@ -21,6 +21,7 @@ #include #include "ball.h" #include "collision.h" +#include "map.h" #include "tileset.h" #include "output.h" @@ -36,12 +37,14 @@ struct db_ball { double s; struct db_tileset *tilesets; int gid; + struct db_map *map; struct db_ball *next; }; struct db_ball * db_ball_new(int x, int y, int r, int a, int d, int sr, double s, - struct db_tileset *tilesets, int gid, struct db_ball *prev) + struct db_tileset *tilesets, int gid, struct db_map *map, + struct db_ball *prev) { struct db_ball *ball; @@ -68,6 +71,7 @@ db_ball_new(int x, int y, int r, int a, int d, int sr, double s, ball->s = s; ball->tilesets = tilesets; ball->gid = gid; + ball->map = map; if (prev != NULL) { prev->next = ball; diff --git a/src/ball.h b/src/ball.h index bcb75c4..9c8e476 100644 --- a/src/ball.h +++ b/src/ball.h @@ -20,12 +20,14 @@ #ifndef DB_BALL_H_ #define DB_BALL_H_ +#include "map.h" #include "tileset.h" struct db_ball; struct db_ball *db_ball_new(int x, int y, int r, int a, int d, int sr, double s, - struct db_tileset *tilesets, int gid, struct db_ball *prev); + struct db_tileset *tilesets, int gid, struct db_map *map, + struct db_ball *prev); void db_balls_move(struct db_ball *ball); void db_balls_collisions(struct db_ball *ball_head); int db_balls_player_collisions(struct db_ball *ball_head, diff --git a/src/map.c b/src/map.c index 53dadaf..6bf2bd9 100644 --- a/src/map.c +++ b/src/map.c @@ -553,7 +553,7 @@ _db_tmx_object_end(void *pv, const char *name) map->obj_r, map->obj_a, map->obj_d, map->obj_sr, map->obj_s, map->tileset_head, map->obj_gid, - map->ball_tail); + map, map->ball_tail); if (map->ball_tail == NULL) { XML_StopParser(p, XML_FALSE); free(map->obj_type); -- cgit v0.9.1