summaryrefslogtreecommitdiff
path: root/src/party_menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/party_menu.c')
-rwxr-xr-xsrc/party_menu.c128
1 files changed, 64 insertions, 64 deletions
diff --git a/src/party_menu.c b/src/party_menu.c
index 7514cf545..f045a9a47 100755
--- a/src/party_menu.c
+++ b/src/party_menu.c
@@ -74,7 +74,6 @@
#include "constants/party_menu.h"
#include "constants/rgb.h"
#include "constants/songs.h"
-#include "constants/species.h"
#define PARTY_PAL_SELECTED (1 << 0)
#define PARTY_PAL_FAINTED (1 << 1)
@@ -1411,7 +1410,7 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr)
break;
}
- if (gMain.newKeys & START_BUTTON)
+ if (JOY_NEW(START_BUTTON))
return 8;
if (movementDir)
@@ -1421,10 +1420,10 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr)
}
// Pressed Cancel
- if ((gMain.newKeys & A_BUTTON) && *slotPtr == PARTY_SIZE + 1)
+ if ((JOY_NEW(A_BUTTON)) && *slotPtr == PARTY_SIZE + 1)
return 2;
- return gMain.newKeys & (A_BUTTON | B_BUTTON);
+ return JOY_NEW(A_BUTTON | B_BUTTON);
}
static void UpdateCurrentPartySelection(s8 *slotPtr, s8 movementDir)
@@ -1862,7 +1861,7 @@ u8 GetMonAilment(struct Pokemon *mon)
static void SetPartyMonsAllowedInMinigame(void)
{
- s16 *ptr;
+ u16 *ptr;
if (gPartyMenu.menuType == PARTY_MENU_TYPE_MINIGAME)
{
@@ -1964,19 +1963,17 @@ static u8 CanMonLearnTMTutor(struct Pokemon *mon, u16 item, u8 tutor)
if (item >= ITEM_TM01_FOCUS_PUNCH)
{
- if (CanMonLearnTMHM(mon, item - ITEM_TM01_FOCUS_PUNCH))
- move = ItemIdToBattleMoveId(item);
- else
+ if (!CanMonLearnTMHM(mon, item - ITEM_TM01_FOCUS_PUNCH))
return CANNOT_LEARN_MOVE;
- do {} while (0); // :morphon:
- }
- else if (CanLearnTutorMove(GetMonData(mon, MON_DATA_SPECIES), tutor) == FALSE)
- {
- return CANNOT_LEARN_MOVE;
+ else
+ move = ItemIdToBattleMoveId(item);
}
else
{
- move = GetTutorMove(tutor);
+ if (!CanLearnTutorMove(GetMonData(mon, MON_DATA_SPECIES), tutor))
+ return CANNOT_LEARN_MOVE;
+ else
+ move = GetTutorMove(tutor);
}
if (MonKnowsMove(mon, move) == TRUE)
@@ -3765,7 +3762,7 @@ static u16 GetFieldMoveMonSpecies(void)
static void Task_CancelAfterAorBPress(u8 taskId)
{
- if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
+ if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
CursorCb_Cancel1(taskId);
}
@@ -4326,9 +4323,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)
@@ -4337,50 +4338,49 @@ 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;
- }
- }
- else
- {
- goto iTriedHonestlyIDid; //TODO: resolve this goto
+ cannotUse = ExecuteTableBasedItemEffect_(gPartyMenu.slotId, item, 0);
}
- 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 (cannotUse != FALSE)
{
- 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;
+ gPartyMenuUseExitCallback = FALSE;
+ PlaySE(SE_SELECT);
+ DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
+ ScheduleBgCopyTilemapToVram(2);
+ gTasks[taskId].func = task;
}
else
{
- GetMonNickname(mon, gStringVar1);
- GetMedicineItemEffectMessage(item);
- DisplayPartyMenuMessage(gStringVar4, TRUE);
- ScheduleBgCopyTilemapToVram(2);
- gTasks[taskId].func = task;
+ 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;
+ }
}
}
@@ -4722,7 +4722,7 @@ static void Task_DoLearnedMoveFanfareAfterText(u8 taskId)
static void Task_LearnNextMoveOrClosePartyMenu(u8 taskId)
{
- if (IsFanfareTaskInactive() && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)))
+ if (IsFanfareTaskInactive() && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))))
{
if (gPartyMenu.learnMoveState == 1)
Task_TryLearningNextMove(taskId);
@@ -4931,7 +4931,7 @@ static void UpdateMonDisplayInfoAfterRareCandy(u8 slot, struct Pokemon *mon)
static void Task_DisplayLevelUpStatsPg1(u8 taskId)
{
- if (WaitFanfare(FALSE) && IsPartyMenuTextPrinterActive() != TRUE && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)))
+ if (WaitFanfare(FALSE) && IsPartyMenuTextPrinterActive() != TRUE && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))))
{
PlaySE(SE_SELECT);
DisplayLevelUpStatsPg1(taskId);
@@ -4941,7 +4941,7 @@ static void Task_DisplayLevelUpStatsPg1(u8 taskId)
static void Task_DisplayLevelUpStatsPg2(u8 taskId)
{
- if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
+ if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
{
PlaySE(SE_SELECT);
DisplayLevelUpStatsPg2(taskId);
@@ -4951,9 +4951,9 @@ static void Task_DisplayLevelUpStatsPg2(u8 taskId)
static void DisplayLevelUpStatsPg1(u8 taskId)
{
- u16 *arrayPtr = (u16*)sPartyMenuInternal->data;
+ s16 *arrayPtr = sPartyMenuInternal->data;
- arrayPtr[12] = (u16)CreateLevelUpStatsWindow();
+ arrayPtr[12] = CreateLevelUpStatsWindow();
DrawLevelUpWindowPg1(arrayPtr[12], arrayPtr, &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(arrayPtr[12], 2);
ScheduleBgCopyTilemapToVram(2);
@@ -4961,7 +4961,7 @@ static void DisplayLevelUpStatsPg1(u8 taskId)
static void DisplayLevelUpStatsPg2(u8 taskId)
{
- u16 *arrayPtr = (u16 *)sPartyMenuInternal->data;
+ s16 *arrayPtr = sPartyMenuInternal->data;
DrawLevelUpWindowPg2(arrayPtr[12], &arrayPtr[6], TEXT_COLOR_WHITE, TEXT_COLOR_DARK_GREY, TEXT_COLOR_LIGHT_GREY);
CopyWindowToVram(arrayPtr[12], 2);
@@ -4972,7 +4972,7 @@ static void Task_TryLearnNewMoves(u8 taskId)
{
u16 learnMove;
- if (WaitFanfare(0) && ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)))
+ if (WaitFanfare(0) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))))
{
RemoveLevelUpStatsWindow();
learnMove = MonTryLearningNewMove(&gPlayerParty[gPartyMenu.slotId], TRUE);
@@ -5609,7 +5609,7 @@ static void Task_ValidateChosenHalfParty(u8 taskId)
static void Task_ContinueChoosingHalfParty(u8 taskId)
{
- if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
+ if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
{
PlaySE(SE_SELECT);
DisplayPartyMenuStdMessage(PARTY_MSG_CHOOSE_MON);