mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 15:13:42 +01:00
Merge pull request #1238 from ketsuban/master
Eliminate goto in ItemUseCB_Medicine
This commit is contained in:
commit
fbff087e9a
@ -4325,9 +4325,13 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
||||
u16 hp = 0;
|
||||
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
|
||||
u16 item = gSpecialVar_ItemId;
|
||||
bool8 canHeal;
|
||||
bool8 canHeal, cannotUse;
|
||||
|
||||
if (NotUsingHPEVItemOnShedinja(mon, item))
|
||||
if (NotUsingHPEVItemOnShedinja(mon, item) == FALSE)
|
||||
{
|
||||
cannotUse = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
canHeal = IsHPRecoveryItem(item);
|
||||
if (canHeal == TRUE)
|
||||
@ -4336,21 +4340,19 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
||||
if (hp == GetMonData(mon, MON_DATA_MAX_HP))
|
||||
canHeal = FALSE;
|
||||
}
|
||||
if (ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0))
|
||||
cannotUse = ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0);
|
||||
}
|
||||
|
||||
if (cannotUse != FALSE)
|
||||
{
|
||||
iTriedHonestlyIDid:
|
||||
gPartyMenuUseExitCallback = FALSE;
|
||||
PlaySE(SE_SELECT);
|
||||
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = task;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
goto iTriedHonestlyIDid; //TODO: resolve this goto
|
||||
}
|
||||
gPartyMenuUseExitCallback = TRUE;
|
||||
if (!IsItemFlute(item))
|
||||
{
|
||||
@ -4381,6 +4383,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = task;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_DisplayHPRestoredMessage(u8 taskId)
|
||||
|
Loading…
x
Reference in New Issue
Block a user