From 2608018862beaf2f9b228581d8dadea041b009de Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 29 Apr 2021 16:08:43 -0400 Subject: [PATCH] Use some missing fieldmap constants in trainer hill --- src/trainer_hill.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/trainer_hill.c b/src/trainer_hill.c index 059773a0be..3ce90c4309 100644 --- a/src/trainer_hill.c +++ b/src/trainer_hill.c @@ -678,10 +678,10 @@ static u16 GetMetatileForFloor(u8 floorId, u32 x, u32 y, u32 stride) // stride i u16 elevation; impassable = (sHillData->floors[floorId].display.collisionData[y] >> (15 - x) & 1); - metatile = sHillData->floors[floorId].display.metatileData[stride * y + x] + 0x200; - elevation = 0x3000; + metatile = sHillData->floors[floorId].display.metatileData[stride * y + x] + NUM_METATILES_IN_PRIMARY; + elevation = 3 << METATILE_ELEVATION_SHIFT; - return (((impassable << 10) & METATILE_COLLISION_MASK) | elevation) | (metatile & METATILE_ID_MASK); + return ((impassable << METATILE_COLLISION_SHIFT) & METATILE_COLLISION_MASK) | elevation | (metatile & METATILE_ID_MASK); } void GenerateTrainerHillFloorLayout(u16 *mapArg) @@ -710,6 +710,8 @@ void GenerateTrainerHillFloorLayout(u16 *mapArg) gBackupMapLayout.width = 31; gBackupMapLayout.height = 35; dst = mapArg + 224; + + // First 5 rows of the map (Entrance / Exit) are always the same for (i = 0; i < 5; i++) { for (j = 0; j < 16; j++) @@ -718,10 +720,11 @@ void GenerateTrainerHillFloorLayout(u16 *mapArg) src += 16; } + // Load the 16x16 floor-specific layout for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) - dst[j] = GetMetatileForFloor(mapId, j, i, 0x10); + dst[j] = GetMetatileForFloor(mapId, j, i, 16); dst += 31; }