diff options
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/resources/map.c | 16 | ||||
-rw-r--r-- | src/resources/map.h | 20 |
3 files changed, 14 insertions, 26 deletions
@@ -13,7 +13,6 @@ main(void) struct image *img; struct map_tileset *ts; struct map_exit *e; - int i; SDL_Rect imgrect, surfacerect; init(); @@ -34,9 +33,6 @@ main(void) e->target_map->width, e->target_map->height, e->target_x_coord, e->target_y_coord); } - for (i = 0; i < map->width * map->height; ++i) { - debug("%x", map->layers[LAYER_CHAR_BOT].tiles[i]); - } img = img_png_get("../forest-6-layer-test_ground.png"); img_png_free(img); diff --git a/src/resources/map.c b/src/resources/map.c index 514129d..3fbf12e 100644 --- a/src/resources/map.c +++ b/src/resources/map.c @@ -144,21 +144,15 @@ struct layer * map_get_layer(struct map *m, const char *name) { if (strcmp(name, "ground") == 0) { - return &m->layers[LAYER_GROUND]; + return &m->layers[MAP_LAYER_GROUND]; } else if (strcmp(name, "obj-low") == 0) { - return &m->layers[LAYER_OBJ_LOW]; - } else if (strcmp(name, "char-bot") == 0) { - return &m->layers[LAYER_CHAR_BOT]; + return &m->layers[MAP_LAYER_OBJ_LOW]; } else if (strcmp(name, "obj-mid") == 0) { - return &m->layers[LAYER_OBJ_MID]; - } else if (strcmp(name, "char-top") == 0) { - return &m->layers[LAYER_CHAR_TOP]; + return &m->layers[MAP_LAYER_OBJ_MID]; } else if (strcmp(name, "obj-high") == 0) { - return &m->layers[LAYER_OBJ_HIGH]; + return &m->layers[MAP_LAYER_OBJ_HIGH]; } else if (strcmp(name, "collision") == 0) { - return &m->layers[LAYER_COLLISION]; - } else if (strcmp(name, "weather") == 0) { - return &m->layers[LAYER_WEATHER]; + return &m->layers[MAP_LAYER_COLLISION]; } else { return NULL; } diff --git a/src/resources/map.h b/src/resources/map.h index 02733bc..6d1d789 100644 --- a/src/resources/map.h +++ b/src/resources/map.h @@ -5,16 +5,14 @@ #include "resource.h" #include "image.h" -enum layer_id { - LAYER_GROUND = 0, - LAYER_OBJ_LOW, - LAYER_CHAR_BOT, - LAYER_OBJ_MID, - LAYER_CHAR_TOP, - LAYER_OBJ_HIGH, - LAYER_COLLISION, - LAYER_WEATHER, - LAYERS_MAX +enum map_layer_id { + MAP_LAYER_GROUND = 0, + MAP_LAYER_OBJ_LOW, + MAP_LAYER_OBJ_MID, + MAP_LAYER_OBJ_HIGH, + MAP_LAYER_COLLISION, + MAP_LAYER_WEATHER, + MAP_LAYERS_MAX }; struct tileset { struct resource res; @@ -90,7 +88,7 @@ struct map { int tileheight; struct map_tileset *tilesets_head; struct map_tileset *tilesets_tail; - struct layer layers[LAYERS_MAX]; + struct layer layers[MAP_LAYERS_MAX]; struct map_collision *collisions; struct map_exit *map_exits_head; struct map_exit *map_exits_tail; |