summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2021-03-27 17:20:27 (EDT)
committer P. J. McDermott <pj@pehjota.net>2021-03-27 17:20:58 (EDT)
commit38f7c9f909815df9886b532e2e631c91ca6db1a6 (patch)
tree0275b8b838af2e897cd8e3227220e3a789fe0cfa /src
parentf5afccb93da63988655817cf49741f9c0955f1a5 (diff)
downloaddodge-balls-38f7c9f909815df9886b532e2e631c91ca6db1a6.zip
dodge-balls-38f7c9f909815df9886b532e2e631c91ca6db1a6.tar.gz
dodge-balls-38f7c9f909815df9886b532e2e631c91ca6db1a6.tar.bz2
ball: Add map member
Diffstat (limited to 'src')
-rw-r--r--src/ball.c6
-rw-r--r--src/ball.h4
-rw-r--r--src/map.c2
3 files changed, 9 insertions, 3 deletions
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 <stdlib.h>
#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);