diff options
Diffstat (limited to 'src/map.c')
-rw-r--r-- | src/map.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -396,7 +396,7 @@ _db_tmx_map_el_start(void *pv, const char *name, const char **attr) db_xml_get_string_attr(p, attr, "source", &source, 1); db_dbg(" Tileset: <%s>", source); map->tileset_tail = db_tileset_new(map->game_id, source, - firstgid, map->tileset_tail); + firstgid, map->tw, map->th, map->tileset_tail); if (map->tileset_head == NULL) { map->tileset_head = map->tileset_tail; } @@ -516,8 +516,6 @@ _db_map_render_layer(struct db_map *map, struct db_map_layer *layer, int firstgid; int lastgid; int columns; - int tilewidth; - int tileheight; SDL_Rect tile_rect; SDL_Rect layer_rect; @@ -532,20 +530,18 @@ _db_map_render_layer(struct db_map *map, struct db_map_layer *layer, firstgid = db_tileset_firstgid(tileset); lastgid = firstgid + db_tileset_tilecount(tileset); if (gid >= firstgid && gid < lastgid) { - columns = db_tileset_columns (tileset); - tilewidth = db_tileset_tilewidth (tileset); - tileheight = db_tileset_tileheight(tileset); + columns = db_tileset_columns(tileset); gid -= firstgid; tile_rect.x = gid % columns; tile_rect.y = gid / columns; - tile_rect.w = tilewidth; - tile_rect.h = tileheight; + tile_rect.w = map->tw; + tile_rect.h = map->th; tile_rect.x *= tile_rect.w; tile_rect.y *= tile_rect.h; layer_rect.x = i % map->w; layer_rect.y = i / map->w; - layer_rect.w = tilewidth; - layer_rect.h = tileheight; + layer_rect.w = map->tw; + layer_rect.h = map->th; layer_rect.x *= layer_rect.w; layer_rect.y *= layer_rect.h; db_dbg("Blitting %dx%d tile at (%d,%d) " |