Skip to content

Commit 32fdf48

Browse files
Merge pull request #695 from RubyRaven6/ruby-misc
Add NUM_TILES_PER_METATILE
2 parents d61f959 + c003691 commit 32fdf48

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

include/fieldmap.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#define MAX_MAP_DATA_SIZE 0x2800
1313
#define VIRTUAL_MAP_SIZE (MAX_MAP_DATA_SIZE)
1414

15+
#define NUM_TILES_PER_METATILE 8
16+
1517
// Map coordinates are offset by 7 when using the map
1618
// buffer because it needs to load sufficient border
1719
// metatiles to fill the player's view (the player has

src/field_camera.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x,
236236
metatiles = mapLayout->secondaryTileset->metatiles;
237237
metatileId -= NUM_METATILES_IN_PRIMARY;
238238
}
239-
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset);
239+
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * NUM_TILES_PER_METATILE, offset);
240240
}
241241

242242
static void DrawMetatile(s32 metatileLayerType, const u16 *tiles, u16 offset)

src/shop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -740,9 +740,9 @@ static void BuyMenuDrawMapBg(void)
740740
metatileLayerType = MapGridGetMetatileLayerTypeAt(x + i, y + j);
741741

742742
if (metatile < NUM_METATILES_IN_PRIMARY)
743-
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * 8, metatileLayerType);
743+
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * NUM_TILES_PER_METATILE, metatileLayerType);
744744
else
745-
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * 8), metatileLayerType);
745+
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * NUM_TILES_PER_METATILE), metatileLayerType);
746746
}
747747
}
748748
}

0 commit comments

Comments
 (0)