Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading