diff options
Diffstat (limited to 'map.c')
-rw-r--r-- | map.c | 40 |
1 files changed, 39 insertions, 1 deletions
@@ -1,8 +1,9 @@ #include "map.h" #include "sprite.h" #include "standard.h" +#include "solid.h" -void init_map(Map* map) { +void init_map(Map* map, World* world) { const Sprite* floor, * bricks; const Bitmap* fbmp, * bbmp; Bitmap bitmap; @@ -67,6 +68,36 @@ void init_map(Map* map) { ); } + /* Bounds */ + new_solid( + world, + 0, + 0, + (map_width * map_tile_size) << fbits, + map_tile_size << fbits + ); + new_solid( + world, + 0, + ((map_height - 1) * map_tile_size) << fbits, + (map_width * map_tile_size) << fbits, + map_tile_size << fbits + ); + new_solid( + world, + 0, + 0, + map_tile_size << fbits, + (map_height * map_tile_size) << fbits + ); + new_solid( + world, + ((map_width - 1) * map_tile_size) << fbits, + 0, + map_tile_size << fbits, + (map_height * map_tile_size) << fbits + ); + for (i = 0; i < 20; i++) { x = rand_range(0, map_width - 1) * map_tile_size; y = rand_range(0, map_height - 1) * map_tile_size; @@ -77,6 +108,13 @@ void init_map(Map* map) { y, &bricks->rect ); + new_solid( + world, + x << fbits, + y << fbits, + map_tile_size << fbits, + map_tile_size << fbits + ); } } |