diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-25 15:10:14 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-25 15:10:14 (EDT) |
commit | 02a02382d63258e96a685ef9e8b3a14462a9f85d (patch) | |
tree | f6576fdeb56369cd8c89df6cd358ba02b3b759e1 /src | |
parent | 14716f2830387ff70017735b784e9904bd065055 (diff) | |
download | dodge-balls-02a02382d63258e96a685ef9e8b3a14462a9f85d.zip dodge-balls-02a02382d63258e96a685ef9e8b3a14462a9f85d.tar.gz dodge-balls-02a02382d63258e96a685ef9e8b3a14462a9f85d.tar.bz2 |
map: Set rects in fewer lines
Diffstat (limited to 'src')
-rw-r--r-- | src/map.c | 16 |
1 files changed, 6 insertions, 10 deletions
@@ -525,12 +525,10 @@ _db_map_render_layer(struct db_map *map, struct db_map_layer *layer, continue; } tile_found = SDL_FALSE; - layer_rect.x = i % map->w; - layer_rect.y = i / map->w; - layer_rect.w = map->tw; - layer_rect.h = map->th; - layer_rect.x *= layer_rect.w; - layer_rect.y *= layer_rect.h; + layer_rect.x = map->tw * (i % map->w); + layer_rect.y = map->th * (i / map->w); + layer_rect.w = map->tw; + layer_rect.h = map->th; for (tileset = map->tileset_head; tileset != NULL; tileset = db_tileset_next(tileset)) { firstgid = db_tileset_firstgid(tileset); @@ -538,12 +536,10 @@ _db_map_render_layer(struct db_map *map, struct db_map_layer *layer, if (gid >= firstgid && gid < lastgid) { columns = db_tileset_columns(tileset); gid -= firstgid; - tile_rect.x = gid % columns; - tile_rect.y = gid / columns; + tile_rect.x = map->tw * (gid % columns); + tile_rect.y = map->th * (gid / columns); tile_rect.w = map->tw; tile_rect.h = map->th; - tile_rect.x *= tile_rect.w; - tile_rect.y *= tile_rect.h; db_dbg("Blitting %dx%d tile at (%d,%d) " "onto %dx%d area of layer at " "(%d,%d)...", |