summaryrefslogtreecommitdiff
path: root/src/trainer_hill.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2021-08-02 14:08:10 -0400
committerGitHub <noreply@github.com>2021-08-02 14:08:10 -0400
commitbd5cf070597e9c9d175777832859ed0c64fe7760 (patch)
tree4dda9e759cbb4cf0c061c24a83832c59277f7d53 /src/trainer_hill.c
parent06b909bcd80e5b3f882273a317ac957cd57f07a5 (diff)
parentd391486247cc9f29d85787d6711f7cb993cf6585 (diff)
Merge branch 'master' into doc-playerpc
Diffstat (limited to 'src/trainer_hill.c')
-rw-r--r--src/trainer_hill.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/trainer_hill.c b/src/trainer_hill.c
index 059773a0b..3ce90c430 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;
}