diff --git a/src/gfx/process.cpp b/src/gfx/process.cpp index 8fb4bd18..cfab0a5b 100644 --- a/src/gfx/process.cpp +++ b/src/gfx/process.cpp @@ -862,9 +862,9 @@ static UniqueTiles dedupTiles( attr.xFlip = false; attr.yFlip = false; attr.bank = 0; - attr.tileID = 0; + attr.tileID = options.baseTileIDs[attr.bank]; } else { - auto [tileID, matchType] = tiles.addTile({tile, palettes[attr.getPalID(mappings)]}); + auto [tileIdx, matchType] = tiles.addTile({tile, palettes[attr.getPalID(mappings)]}); if (inputWithoutOutput && matchType == TileData::NOPE) { error( @@ -877,8 +877,8 @@ static UniqueTiles dedupTiles( attr.xFlip = matchType == TileData::HFLIP || matchType == TileData::VHFLIP; attr.yFlip = matchType == TileData::VFLIP || matchType == TileData::VHFLIP; - attr.bank = tileID >= options.maxNbTiles[0]; - attr.tileID = (attr.bank ? tileID - options.maxNbTiles[0] : tileID) + attr.bank = tileIdx >= options.maxNbTiles[0]; + attr.tileID = (attr.bank ? tileIdx - options.maxNbTiles[0] : tileIdx) + options.baseTileIDs[attr.bank]; } } diff --git a/test/gfx/reverse_bg.2bpp b/test/gfx/reverse_bg.2bpp new file mode 100644 index 00000000..b402019e Binary files /dev/null and b/test/gfx/reverse_bg.2bpp differ diff --git a/test/gfx/reverse_bg.attrmap b/test/gfx/reverse_bg.attrmap new file mode 100644 index 00000000..09f370e3 Binary files /dev/null and b/test/gfx/reverse_bg.attrmap differ diff --git a/test/gfx/reverse_bg.flags b/test/gfx/reverse_bg.flags new file mode 100644 index 00000000..d0afdf57 --- /dev/null +++ b/test/gfx/reverse_bg.flags @@ -0,0 +1,5 @@ +-b 16 +-u +-t reverse_bg.tilemap +-a reverse_bg.attrmap +-p reverse_bg.pal diff --git a/test/gfx/reverse_bg.pal b/test/gfx/reverse_bg.pal new file mode 100644 index 00000000..4bb5d33d Binary files /dev/null and b/test/gfx/reverse_bg.pal differ diff --git a/test/gfx/reverse_bg.tilemap b/test/gfx/reverse_bg.tilemap new file mode 100644 index 00000000..46581f1a --- /dev/null +++ b/test/gfx/reverse_bg.tilemap @@ -0,0 +1 @@ + \ No newline at end of file