Can only use box link if the map allows escape

This commit is contained in:
kittenchilly 2023-09-12 19:17:01 -05:00
parent 4dbb6011b6
commit be5b46b6c4

View file

@ -56,7 +56,7 @@ static u8 GetDirectionToHiddenItem(s16, s16);
static void PlayerFaceHiddenItem(u8); static void PlayerFaceHiddenItem(u8);
static void CheckForHiddenItemsInMapConnection(u8); static void CheckForHiddenItemsInMapConnection(u8);
static void Task_OpenRegisteredPokeblockCase(u8); static void Task_OpenRegisteredPokeblockCase(u8);
static void Task_WaitFadeAccessPokemonBoxLink(u8); static void Task_AccessPokemonBoxLink(u8);
static void ItemUseOnFieldCB_Bike(u8); static void ItemUseOnFieldCB_Bike(u8);
static void ItemUseOnFieldCB_Rod(u8); static void ItemUseOnFieldCB_Rod(u8);
static void ItemUseOnFieldCB_Itemfinder(u8); static void ItemUseOnFieldCB_Itemfinder(u8);
@ -681,17 +681,20 @@ static void Task_OpenRegisteredPokeblockCase(u8 taskId)
void ItemUseOutOfBattle_PokemonBoxLink(u8 taskId) void ItemUseOutOfBattle_PokemonBoxLink(u8 taskId)
{ {
sItemUseOnFieldCB = Task_WaitFadeAccessPokemonBoxLink; if (CanUseDigOrEscapeRopeOnCurMap)
{
sItemUseOnFieldCB = Task_AccessPokemonBoxLink;
SetUpItemUseOnFieldCallback(taskId); SetUpItemUseOnFieldCallback(taskId);
}
else
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
} }
static void Task_WaitFadeAccessPokemonBoxLink(u8 taskId) static void Task_AccessPokemonBoxLink(u8 taskId)
{ {
if (!gPaletteFade.active)
{
ScriptContext_SetupScript(EventScript_AccessPokemonBoxLink); ScriptContext_SetupScript(EventScript_AccessPokemonBoxLink);
DestroyTask(taskId); DestroyTask(taskId);
}
} }
void ItemUseOutOfBattle_CoinCase(u8 taskId) void ItemUseOutOfBattle_CoinCase(u8 taskId)