mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Ignore -b and -N when reversing without tilemap
These offsets should only be applied to a tile ID read as input... but this ain't one!
This commit is contained in:
@@ -236,13 +236,15 @@ void reverse() {
|
|||||||
for (size_t ty = 0; ty < height; ++ty) {
|
for (size_t ty = 0; ty < height; ++ty) {
|
||||||
for (size_t tx = 0; tx < width; ++tx) {
|
for (size_t tx = 0; tx < width; ++tx) {
|
||||||
size_t index = options.columnMajor ? ty + tx * width : ty * width + tx;
|
size_t index = options.columnMajor ? ty + tx * width : ty * width + tx;
|
||||||
// Get the tile ID at this location
|
|
||||||
uint8_t gbcTileID = tilemap.has_value() ? (*tilemap)[index] : index;
|
|
||||||
// By default, a tile is unflipped, in bank 0, and uses palette #0
|
// By default, a tile is unflipped, in bank 0, and uses palette #0
|
||||||
uint8_t attribute = attrmap.has_value() ? (*attrmap)[index] : 0x00;
|
uint8_t attribute = attrmap.has_value() ? (*attrmap)[index] : 0x00;
|
||||||
bool bank = attribute & 0x08;
|
bool bank = attribute & 0x08;
|
||||||
gbcTileID -= options.baseTileIDs[bank];
|
// Get the tile ID at this location
|
||||||
size_t tileID = gbcTileID + bank * options.maxNbTiles[0];
|
uint8_t tileID = index;
|
||||||
|
if (tilemap.has_value()) {
|
||||||
|
tileID =
|
||||||
|
(*tilemap)[index] - options.baseTileIDs[bank] + bank * options.maxNbTiles[0];
|
||||||
|
}
|
||||||
assert(tileID < nbTileInstances); // Should have been checked earlier
|
assert(tileID < nbTileInstances); // Should have been checked earlier
|
||||||
|
|
||||||
// We do not have data for tiles trimmed with `-x`, so assume they are "blank"
|
// We do not have data for tiles trimmed with `-x`, so assume they are "blank"
|
||||||
|
|||||||
Reference in New Issue
Block a user