From 861c8d8d5dd5ff84cc359c3f41cadec4121cfdc7 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 25 Mar 2021 18:34:33 -0400 Subject: ball: Add tilesets and gid members --- (limited to 'src') diff --git a/src/ball.c b/src/ball.c index 826b210..b8dd78b 100644 --- a/src/ball.c +++ b/src/ball.c @@ -20,22 +20,25 @@ #include #include "ball.h" #include "collision.h" +#include "tileset.h" #include "output.h" struct db_ball { - double x; - double y; - int r; - double a; - int d; - int sr; - double s; - struct db_ball *next; + double x; + double y; + int r; + double a; + int d; + int sr; + double s; + struct db_tileset *tilesets; + int gid; + 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_ball *prev) + struct db_tileset *tilesets, int gid, struct db_ball *prev) { struct db_ball *ball; @@ -45,13 +48,15 @@ db_ball_new(int x, int y, int r, int a, int d, int sr, double s, return NULL; } - ball->x = x; - ball->y = y; - ball->r = r; - ball->a = a; - ball->d = d; - ball->sr = sr; - ball->s = s; + ball->x = x; + ball->y = y; + ball->r = r; + ball->a = a; + ball->d = d; + ball->sr = sr; + ball->s = s; + ball->tilesets = tilesets; + ball->gid = gid; if (prev != NULL) { prev->next = ball; diff --git a/src/ball.h b/src/ball.h index 9607f81..8cb8e6b 100644 --- a/src/ball.h +++ b/src/ball.h @@ -20,10 +20,12 @@ #ifndef DB_BALL_H_ #define DB_BALL_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_ball *prev); + struct db_tileset *tilesets, int gid, struct db_ball *prev); void db_balls_collisions(struct db_ball *ball_head); int db_balls_player_collisions(struct db_ball *ball_head, int player_x, int player_y, int player_r) diff --git a/src/map.c b/src/map.c index 824f369..09db505 100644 --- a/src/map.c +++ b/src/map.c @@ -539,6 +539,7 @@ _db_tmx_object_end(void *pv, const char *name) map->ball_tail = db_ball_new(map->obj_x, map->obj_y, map->obj_r, map->obj_a, map->obj_d, map->obj_sr, map->obj_s, + map->tileset_head, map->obj_gid, map->ball_tail); if (map->ball_tail == NULL) { XML_StopParser(p, XML_FALSE); -- cgit v0.9.1