mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-14 07:33:44 +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;
|
u16 hp = 0;
|
||||||
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
|
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
|
||||||
u16 item = gSpecialVar_ItemId;
|
u16 item = gSpecialVar_ItemId;
|
||||||
bool8 canHeal;
|
bool8 canHeal, cannotUse;
|
||||||
|
|
||||||
if (NotUsingHPEVItemOnShedinja(mon, item))
|
if (NotUsingHPEVItemOnShedinja(mon, item) == FALSE)
|
||||||
|
{
|
||||||
|
cannotUse = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
canHeal = IsHPRecoveryItem(item);
|
canHeal = IsHPRecoveryItem(item);
|
||||||
if (canHeal == TRUE)
|
if (canHeal == TRUE)
|
||||||
@ -4336,21 +4340,19 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
|||||||
if (hp == GetMonData(mon, MON_DATA_MAX_HP))
|
if (hp == GetMonData(mon, MON_DATA_MAX_HP))
|
||||||
canHeal = FALSE;
|
canHeal = FALSE;
|
||||||
}
|
}
|
||||||
if (ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0))
|
cannotUse = ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cannotUse != FALSE)
|
||||||
{
|
{
|
||||||
iTriedHonestlyIDid:
|
|
||||||
gPartyMenuUseExitCallback = FALSE;
|
gPartyMenuUseExitCallback = FALSE;
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
|
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
|
||||||
ScheduleBgCopyTilemapToVram(2);
|
ScheduleBgCopyTilemapToVram(2);
|
||||||
gTasks[taskId].func = task;
|
gTasks[taskId].func = task;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
goto iTriedHonestlyIDid; //TODO: resolve this goto
|
|
||||||
}
|
|
||||||
gPartyMenuUseExitCallback = TRUE;
|
gPartyMenuUseExitCallback = TRUE;
|
||||||
if (!IsItemFlute(item))
|
if (!IsItemFlute(item))
|
||||||
{
|
{
|
||||||
@ -4381,6 +4383,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
|||||||
ScheduleBgCopyTilemapToVram(2);
|
ScheduleBgCopyTilemapToVram(2);
|
||||||
gTasks[taskId].func = task;
|
gTasks[taskId].func = task;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_DisplayHPRestoredMessage(u8 taskId)
|
static void Task_DisplayHPRestoredMessage(u8 taskId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user