Fix specific tiles changing to pc tiles when using boxlink/debug pc (#5141)

This commit is contained in:
cawtds 2024-08-12 21:52:55 +02:00 committed by GitHub
parent 5df53a5c1c
commit ba1512f864
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 6 deletions

View file

@ -7,4 +7,7 @@ extern const u16 gTilesetPalettes_General[][16];
extern const struct Tileset * const gTilesetPointer_SecretBase;
extern const struct Tileset * const gTilesetPointer_SecretBaseRedCave;
extern const struct Tileset gTileset_Building;
extern const struct Tileset gTileset_BrendansMaysHouse;
#endif //GUARD_tilesets_H

View file

@ -44,6 +44,7 @@
#include "strings.h"
#include "task.h"
#include "text.h"
#include "tilesets.h"
#include "tv.h"
#include "wallclock.h"
#include "window.h"
@ -969,6 +970,20 @@ void FieldShowRegionMap(void)
SetMainCallback2(CB2_FieldShowRegionMap);
}
static bool32 IsBuildingPCTile(u32 tileId)
{
return gMapHeader.mapLayout->primaryTileset == &gTileset_Building && (tileId == METATILE_Building_PC_On || tileId == METATILE_Building_PC_Off);
}
static bool32 IsPlayerHousePCTile(u32 tileId)
{
return gMapHeader.mapLayout->secondaryTileset == &gTileset_BrendansMaysHouse
&& (tileId == METATILE_BrendansMaysHouse_BrendanPC_On
|| tileId == METATILE_BrendansMaysHouse_BrendanPC_Off
|| tileId == METATILE_BrendansMaysHouse_MayPC_On
|| tileId == METATILE_BrendansMaysHouse_MayPC_Off);
}
static bool8 IsPlayerInFrontOfPC(void)
{
s16 x, y;
@ -977,12 +992,7 @@ static bool8 IsPlayerInFrontOfPC(void)
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
tileInFront = MapGridGetMetatileIdAt(x, y);
return (tileInFront == METATILE_BrendansMaysHouse_BrendanPC_On
|| tileInFront == METATILE_BrendansMaysHouse_BrendanPC_Off
|| tileInFront == METATILE_BrendansMaysHouse_MayPC_On
|| tileInFront == METATILE_BrendansMaysHouse_MayPC_Off
|| tileInFront == METATILE_Building_PC_On
|| tileInFront == METATILE_Building_PC_Off);
return IsBuildingPCTile(tileInFront) || IsPlayerHousePCTile(tileInFront);
}
// Task data for Task_PCTurnOnEffect and Task_LotteryCornerComputerEffect