mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-28 04:34:28 +01:00
Reworked the debug menu's PC access
This commit is contained in:
parent
29c3f57772
commit
5500e64a71
@ -2805,9 +2805,8 @@ static void Task_WaitFadeAccessPC(u8 taskId)
|
|||||||
static void DebugAction_AccessPC(u8 taskId)
|
static void DebugAction_AccessPC(u8 taskId)
|
||||||
{
|
{
|
||||||
Debug_DestroyMenu_Full(taskId);
|
Debug_DestroyMenu_Full(taskId);
|
||||||
CleanupOverworldWindowsAndTilemaps();
|
LockPlayerFieldControls();
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
|
ScriptContext_SetupScript(EventScript_PC);
|
||||||
CreateTask(Task_WaitFadeAccessPC, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -953,9 +953,22 @@ void FieldShowRegionMap(void)
|
|||||||
SetMainCallback2(CB2_FieldShowRegionMap);
|
SetMainCallback2(CB2_FieldShowRegionMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool8 IsPlayerInFrontOfPC(void)
|
||||||
|
{
|
||||||
|
u16 x, y;
|
||||||
|
u16 tileInFront;
|
||||||
|
|
||||||
|
GetXYCoordsOneStepInFrontOfPlayer(&x, &y);
|
||||||
|
tileInFront = MapGridGetMetatileIdAt(x, y);
|
||||||
|
|
||||||
|
return (tileInFront == METATILE_BrendansMaysHouse_BrendanPC_Off
|
||||||
|
|| tileInFront == METATILE_BrendansMaysHouse_MayPC_Off
|
||||||
|
|| tileInFront == METATILE_Building_PC_Off);
|
||||||
|
}
|
||||||
|
|
||||||
void DoPCTurnOnEffect(void)
|
void DoPCTurnOnEffect(void)
|
||||||
{
|
{
|
||||||
if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE)
|
if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE && IsPlayerInFrontOfPC() == TRUE)
|
||||||
{
|
{
|
||||||
u8 taskId = CreateTask(Task_PCTurnOnEffect, 8);
|
u8 taskId = CreateTask(Task_PCTurnOnEffect, 8);
|
||||||
gTasks[taskId].data[0] = 0;
|
gTasks[taskId].data[0] = 0;
|
||||||
@ -1041,29 +1054,33 @@ static void PCTurnOffEffect(void)
|
|||||||
s8 dy = 0;
|
s8 dy = 0;
|
||||||
u16 tileId = 0;
|
u16 tileId = 0;
|
||||||
u8 playerDirection = GetPlayerFacingDirection();
|
u8 playerDirection = GetPlayerFacingDirection();
|
||||||
switch (playerDirection)
|
|
||||||
|
if (IsPlayerInFrontOfPC() == TRUE)
|
||||||
{
|
{
|
||||||
case DIR_NORTH:
|
switch (playerDirection)
|
||||||
dx = 0;
|
{
|
||||||
dy = -1;
|
case DIR_NORTH:
|
||||||
break;
|
dx = 0;
|
||||||
case DIR_WEST:
|
dy = -1;
|
||||||
dx = -1;
|
break;
|
||||||
dy = -1;
|
case DIR_WEST:
|
||||||
break;
|
dx = -1;
|
||||||
case DIR_EAST:
|
dy = -1;
|
||||||
dx = 1;
|
break;
|
||||||
dy = -1;
|
case DIR_EAST:
|
||||||
break;
|
dx = 1;
|
||||||
|
dy = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
||||||
|
tileId = METATILE_Building_PC_Off;
|
||||||
|
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
||||||
|
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||||
|
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||||
|
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||||
|
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
|
||||||
|
DrawWholeMapView();
|
||||||
}
|
}
|
||||||
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
|
||||||
tileId = METATILE_Building_PC_Off;
|
|
||||||
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
|
||||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
|
||||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
|
||||||
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
|
||||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
|
|
||||||
DrawWholeMapView();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoLotteryCornerComputerEffect(void)
|
void DoLotteryCornerComputerEffect(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user