Prevent Key Items that open other menus from causing a crash if registered and used from the field (#5810)
This commit is contained in:
parent
beeca545aa
commit
c7a2ef3371
1 changed files with 23 additions and 7 deletions
|
@ -1400,9 +1400,17 @@ void ItemUseOutOfBattle_ZygardeCube(u8 taskId)
|
||||||
|
|
||||||
void ItemUseOutOfBattle_Fusion(u8 taskId)
|
void ItemUseOutOfBattle_Fusion(u8 taskId)
|
||||||
{
|
{
|
||||||
gItemUseCB = ItemUseCB_Fusion;
|
if (!gTasks[taskId].tUsingRegisteredKeyItem)
|
||||||
gTasks[taskId].data[0] = FALSE;
|
{
|
||||||
SetUpItemUseCallback(taskId);
|
gItemUseCB = ItemUseCB_Fusion;
|
||||||
|
gTasks[taskId].data[0] = FALSE;
|
||||||
|
SetUpItemUseCallback(taskId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: handle key items with callbacks to menus allow to be used by registering them.
|
||||||
|
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Task_UseHoneyOnField(u8 taskId)
|
void Task_UseHoneyOnField(u8 taskId)
|
||||||
|
@ -1552,10 +1560,18 @@ static void ItemUseOnFieldCB_TownMap(u8 taskId)
|
||||||
|
|
||||||
void ItemUseOutOfBattle_TownMap(u8 taskId)
|
void ItemUseOutOfBattle_TownMap(u8 taskId)
|
||||||
{
|
{
|
||||||
sItemUseOnFieldCB = ItemUseOnFieldCB_TownMap;
|
if (!gTasks[taskId].tUsingRegisteredKeyItem)
|
||||||
gFieldCallback = FieldCB_UseItemOnField;
|
{
|
||||||
gBagMenu->newScreenCallback = CB2_ReturnToField;
|
sItemUseOnFieldCB = ItemUseOnFieldCB_TownMap;
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
gFieldCallback = FieldCB_UseItemOnField;
|
||||||
|
gBagMenu->newScreenCallback = CB2_ReturnToField;
|
||||||
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// TODO: handle key items with callbacks to menus allow to be used by registering them.
|
||||||
|
DisplayDadsAdviceCannotUseItemMessage(taskId, gTasks[taskId].tUsingRegisteredKeyItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tUsingRegisteredKeyItem
|
#undef tUsingRegisteredKeyItem
|
||||||
|
|
Loading…
Reference in a new issue