Skip to content

Commit

Permalink
Fix specific tiles changing to pc tiles when using boxlink/debug pc (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
cawtds authored Aug 12, 2024
1 parent 5df53a5 commit ba1512f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 3 additions & 0 deletions include/tilesets.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 16 additions & 6 deletions src/field_specials.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit ba1512f

Please sign in to comment.