From 8072cfe7afbedc652601cbb340942ee6952e236a Mon Sep 17 00:00:00 2001 From: cawtds <38510667+cawtds@users.noreply.github.com> Date: Sun, 11 Aug 2024 22:06:40 +0200 Subject: [PATCH] fix pc spawning on specific tiles when using boxlink/debug pc access --- include/tilesets.h | 3 +++ src/field_specials.c | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/include/tilesets.h b/include/tilesets.h index 855599d89..5e318bc2a 100644 --- a/include/tilesets.h +++ b/include/tilesets.h @@ -10,4 +10,7 @@ extern const u16 gTilesetPalettes_GenericBuilding1[][16]; extern const u32 gTilesetTiles_DepartmentStore[]; extern const u16 gTilesetPalettes_DepartmentStore[][16]; +extern const struct Tileset gTileset_PokemonCenter; +extern const struct Tileset gTileset_GenericBuilding1; + #endif // GUARD_TILESETS_H diff --git a/src/field_specials.c b/src/field_specials.c index 1f5860ed3..c49fca481 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -36,6 +36,7 @@ #include "naming_screen.h" #include "party_menu.h" #include "rtc.h" +#include "tilesets.h" #include "wallclock.h" #include "dynamic_placeholder_text_util.h" #include "new_menu_helpers.h" @@ -237,10 +238,8 @@ static bool8 IsPlayerInFrontOfPC(void) GetXYCoordsOneStepInFrontOfPlayer(&x, &y); tileInFront = MapGridGetMetatileIdAt(x, y); - return (tileInFront == METATILE_Building_PCOff - || tileInFront == METATILE_Building_PCOn - || tileInFront == METATILE_GenericBuilding1_PlayersPCOff - || tileInFront == METATILE_GenericBuilding1_PlayersPCOn); + return (gMapHeader.mapLayout->secondaryTileset == &gTileset_PokemonCenter && (tileInFront == METATILE_Building_PCOn || tileInFront == METATILE_Building_PCOff)) + || (gMapHeader.mapLayout->secondaryTileset == &gTileset_GenericBuilding1 && (tileInFront == METATILE_GenericBuilding1_PlayersPCOn || tileInFront == METATILE_GenericBuilding1_PlayersPCOff)); } #define tState data[0]