Add NUM_TILES_PER_METATILE

This commit is contained in:
GriffinR
2022-12-03 17:29:02 -05:00
committed by RubyRaven6
parent d61f959453
commit c0036919b0
3 changed files with 5 additions and 3 deletions
+2
View File
@@ -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
View File
@@ -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
View File
@@ -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);
} }
} }
} }