summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/map.c18
-rw-r--r--src/map.h4
2 files changed, 22 insertions, 0 deletions
diff --git a/src/map.c b/src/map.c
index add4c3e..53dadaf 100644
--- a/src/map.c
+++ b/src/map.c
@@ -988,3 +988,21 @@ struct db_ball *db_map_get_balls(struct db_map *map)
{
return map->ball_head;
}
+
+int
+db_map_tile_player_collides(struct db_map *map, int x, int y)
+{
+ int i;
+
+ i = y * map->w + x;
+ return (map->p_col[i / 8] & (1 << (i % 8))) != 0;
+}
+
+int
+db_map_tile_ball_collides(struct db_map *map, int x, int y)
+{
+ int i;
+
+ i = y * map->w + x;
+ return (map->b_col[i / 8] & (1 << (i % 8))) != 0;
+}
diff --git a/src/map.h b/src/map.h
index bfd544d..a2cd112 100644
--- a/src/map.h
+++ b/src/map.h
@@ -34,5 +34,9 @@ void db_map_get_player(struct db_map *map, int *x, int *y, int *r, int *gid);
void db_map_get_target(struct db_map *map, int *x, int *y, int *r, int *gid);
struct db_ball *db_map_get_balls(struct db_map *map)
__attribute__((__pure__));
+int db_map_tile_player_collides(struct db_map *map, int x, int y)
+ __attribute__((__pure__));
+int db_map_tile_ball_collides(struct db_map *map, int x, int y)
+ __attribute__((__pure__));
#endif /* DB_MAP_H_ */