Add NUM_TILES_PER_METATILE
This commit is contained in:
@@ -12,6 +12,8 @@
|
|||||||
#define MAX_MAP_DATA_SIZE 0x2800
|
#define MAX_MAP_DATA_SIZE 0x2800
|
||||||
#define VIRTUAL_MAP_SIZE (MAX_MAP_DATA_SIZE)
|
#define VIRTUAL_MAP_SIZE (MAX_MAP_DATA_SIZE)
|
||||||
|
|
||||||
|
#define NUM_TILES_PER_METATILE 8
|
||||||
|
|
||||||
// Map coordinates are offset by 7 when using the map
|
// Map coordinates are offset by 7 when using the map
|
||||||
// buffer because it needs to load sufficient border
|
// buffer because it needs to load sufficient border
|
||||||
// metatiles to fill the player's view (the player has
|
// metatiles to fill the player's view (the player has
|
||||||
|
|||||||
+1
-1
@@ -236,7 +236,7 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x,
|
|||||||
metatiles = mapLayout->secondaryTileset->metatiles;
|
metatiles = mapLayout->secondaryTileset->metatiles;
|
||||||
metatileId -= NUM_METATILES_IN_PRIMARY;
|
metatileId -= NUM_METATILES_IN_PRIMARY;
|
||||||
}
|
}
|
||||||
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset);
|
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * NUM_TILES_PER_METATILE, offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawMetatile(s32 metatileLayerType, const u16 *tiles, u16 offset)
|
static void DrawMetatile(s32 metatileLayerType, const u16 *tiles, u16 offset)
|
||||||
|
|||||||
+2
-2
@@ -740,9 +740,9 @@ static void BuyMenuDrawMapBg(void)
|
|||||||
metatileLayerType = MapGridGetMetatileLayerTypeAt(x + i, y + j);
|
metatileLayerType = MapGridGetMetatileLayerTypeAt(x + i, y + j);
|
||||||
|
|
||||||
if (metatile < NUM_METATILES_IN_PRIMARY)
|
if (metatile < NUM_METATILES_IN_PRIMARY)
|
||||||
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * 8, metatileLayerType);
|
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * NUM_TILES_PER_METATILE, metatileLayerType);
|
||||||
else
|
else
|
||||||
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * 8), metatileLayerType);
|
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * NUM_TILES_PER_METATILE), metatileLayerType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user