Fixed map rendering glitching when using an oversized tileset

This commit is contained in:
Maruno17
2021-10-12 19:05:05 +01:00
committed by infinitefusion
parent fd818e1ee2
commit 770de8161c

View File

@@ -85,8 +85,8 @@ class TilemapRenderer
tile.src_rect.y = ((tile_id - TILESET_START_ID) / TILESET_TILES_PER_ROW) * SOURCE_TILE_HEIGHT tile.src_rect.y = ((tile_id - TILESET_START_ID) / TILESET_TILES_PER_ROW) * SOURCE_TILE_HEIGHT
if @bitmap_wraps[tile.filename] if @bitmap_wraps[tile.filename]
height = @bitmaps[tile.filename].height height = @bitmaps[tile.filename].height
col = (tile_id - TILESET_START_ID) * SOURCE_TILE_HEIGHT / height col = (tile_id - TILESET_START_ID) * SOURCE_TILE_HEIGHT / (TILESET_TILES_PER_ROW * height)
tile.src_rect.x += col * AUTOTILES_COUNT * SOURCE_TILE_WIDTH tile.src_rect.x += col * TILESET_TILES_PER_ROW * SOURCE_TILE_WIDTH
tile.src_rect.y -= col * height tile.src_rect.y -= col * height
end end
end end