Merge pull request #1424 from GriffinRichards/constants-trhill

Use some missing fieldmap constants in trainer hill
This commit is contained in:
GriffinR 2021-04-30 15:50:26 -04:00 committed by GitHub
commit 24e02085d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}