diff --git a/src/party_menu.c b/src/party_menu.c index 1d4952375..862302229 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -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,51 +4340,50 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) if (hp == GetMonData(mon, MON_DATA_MAX_HP)) canHeal = FALSE; } - if (ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0)) - { - iTriedHonestlyIDid: - gPartyMenuUseExitCallback = FALSE; - PlaySE(SE_SELECT); - DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); - ScheduleBgCopyTilemapToVram(2); - gTasks[taskId].func = task; - return; - } + cannotUse = ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0); } - else + + if (cannotUse != FALSE) { - goto iTriedHonestlyIDid; //TODO: resolve this goto - } - gPartyMenuUseExitCallback = TRUE; - if (!IsItemFlute(item)) - { - PlaySE(SE_USE_ITEM); - if (gPartyMenu.action != PARTY_ACTION_REUSABLE_ITEM) - RemoveBagItem(item, 1); - } - else - { - PlaySE(SE_GLASS_FLUTE); - } - SetPartyMonAilmentGfx(mon, &sPartyMenuBoxes[gPartyMenu.slotId]); - if (gSprites[sPartyMenuBoxes[gPartyMenu.slotId].statusSpriteId].invisible) - DisplayPartyPokemonLevelCheck(mon, &sPartyMenuBoxes[gPartyMenu.slotId], 1); - if (canHeal == TRUE) - { - if (hp == 0) - AnimatePartySlot(gPartyMenu.slotId, 1); - PartyMenuModifyHP(taskId, gPartyMenu.slotId, 1, GetMonData(mon, MON_DATA_HP) - hp, Task_DisplayHPRestoredMessage); - ResetHPTaskData(taskId, 0, hp); - return; - } - else - { - GetMonNickname(mon, gStringVar1); - GetMedicineItemEffectMessage(item); - DisplayPartyMenuMessage(gStringVar4, TRUE); + gPartyMenuUseExitCallback = FALSE; + PlaySE(SE_SELECT); + DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE); ScheduleBgCopyTilemapToVram(2); gTasks[taskId].func = task; } + else + { + gPartyMenuUseExitCallback = TRUE; + if (!IsItemFlute(item)) + { + PlaySE(SE_USE_ITEM); + if (gPartyMenu.action != PARTY_ACTION_REUSABLE_ITEM) + RemoveBagItem(item, 1); + } + else + { + PlaySE(SE_GLASS_FLUTE); + } + SetPartyMonAilmentGfx(mon, &sPartyMenuBoxes[gPartyMenu.slotId]); + if (gSprites[sPartyMenuBoxes[gPartyMenu.slotId].statusSpriteId].invisible) + DisplayPartyPokemonLevelCheck(mon, &sPartyMenuBoxes[gPartyMenu.slotId], 1); + if (canHeal == TRUE) + { + if (hp == 0) + AnimatePartySlot(gPartyMenu.slotId, 1); + PartyMenuModifyHP(taskId, gPartyMenu.slotId, 1, GetMonData(mon, MON_DATA_HP) - hp, Task_DisplayHPRestoredMessage); + ResetHPTaskData(taskId, 0, hp); + return; + } + else + { + GetMonNickname(mon, gStringVar1); + GetMedicineItemEffectMessage(item); + DisplayPartyMenuMessage(gStringVar4, TRUE); + ScheduleBgCopyTilemapToVram(2); + gTasks[taskId].func = task; + } + } } static void Task_DisplayHPRestoredMessage(u8 taskId)