Re-apply joypad macros (minus merge conflicts)

This commit is contained in:
aaaaaa123456789 2020-11-02 22:02:39 -03:00
parent 6545745e59
commit bacc831aa9
71 changed files with 651 additions and 648 deletions

View File

@ -765,7 +765,7 @@ bool16 TextPrinterWaitWithDownArrow(struct TextPrinter *textPrinter)
else
{
TextPrinterDrawDownArrow(textPrinter);
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
result = TRUE;
PlaySE(SE_SELECT);
@ -844,13 +844,13 @@ u16 RenderText(struct TextPrinter *textPrinter)
switch (textPrinter->state)
{
case 0:
if ((gMain.heldKeys & (A_BUTTON | B_BUTTON)) && subStruct->hasPrintBeenSpedUp)
if ((JOY_HELD(A_BUTTON | B_BUTTON)) && subStruct->hasPrintBeenSpedUp)
textPrinter->delayCounter = 0;
if (textPrinter->delayCounter && textPrinter->textSpeed)
{
textPrinter->delayCounter--;
if (gTextFlags.canABSpeedUpPrint && (gMain.newKeys & (A_BUTTON | B_BUTTON)))
if (gTextFlags.canABSpeedUpPrint && (JOY_NEW(A_BUTTON | B_BUTTON)))
{
subStruct->hasPrintBeenSpedUp = TRUE;
textPrinter->delayCounter = 0;

View File

@ -1296,13 +1296,13 @@ const u8 *GetApprenticeNameInLanguage(u32 apprenticeId, s32 language)
// Functionally unused
static void Task_SwitchToFollowupFuncAfterButtonPress(u8 taskId)
{
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
SwitchTaskToFollowupFunc(taskId);
}
static void Task_ExecuteFuncAfterButtonPress(u8 taskId)
{
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{
gApprenticeFunc = (void*)(u32)(((u16)gTasks[taskId].data[0] | (gTasks[taskId].data[1] << 16)));
gApprenticeFunc();

View File

@ -240,12 +240,12 @@ static void HandleInputChooseAction(void)
DoBounceEffect(gActiveBattler, BOUNCE_HEALTHBOX, 7, 1);
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
if (gMain.newAndRepeatedKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
if (JOY_REPEAT(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@ -266,7 +266,7 @@ static void HandleInputChooseAction(void)
}
PlayerBufferExecCompleted();
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
if (gActionSelectionCursor[gActiveBattler] & 1) // if is B_ACTION_USE_ITEM or B_ACTION_RUN
{
@ -276,7 +276,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
if (!(gActionSelectionCursor[gActiveBattler] & 1)) // if is B_ACTION_USE_MOVE or B_ACTION_SWITCH
{
@ -286,7 +286,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (gActionSelectionCursor[gActiveBattler] & 2) // if is B_ACTION_SWITCH or B_ACTION_RUN
{
@ -296,7 +296,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (!(gActionSelectionCursor[gActiveBattler] & 2)) // if is B_ACTION_USE_MOVE or B_ACTION_USE_ITEM
{
@ -306,7 +306,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
{
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
&& GetBattlerPosition(gActiveBattler) == B_POSITION_PLAYER_RIGHT
@ -326,7 +326,7 @@ static void HandleInputChooseAction(void)
PlayerBufferExecCompleted();
}
}
else if (gMain.newKeys & START_BUTTON)
else if (JOY_NEW(START_BUTTON))
{
SwapHpBarsWithHpText();
}
@ -359,12 +359,12 @@ static void HandleInputChooseTarget(void)
} while (i < gBattlersCount);
}
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
@ -372,7 +372,7 @@ static void HandleInputChooseTarget(void)
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
PlayerBufferExecCompleted();
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
@ -381,7 +381,7 @@ static void HandleInputChooseTarget(void)
DoBounceEffect(gActiveBattler, BOUNCE_MON, 7, 1);
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
}
else if (gMain.newKeys & (DPAD_LEFT | DPAD_UP))
else if (JOY_NEW(DPAD_LEFT | DPAD_UP))
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
@ -423,7 +423,7 @@ static void HandleInputChooseTarget(void)
} while (i == 0);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
else if (gMain.newKeys & (DPAD_RIGHT | DPAD_DOWN))
else if (JOY_NEW(DPAD_RIGHT | DPAD_DOWN))
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_HideAsMoveTarget;
@ -472,12 +472,12 @@ static void HandleInputChooseMove(void)
bool32 canSelectTarget = FALSE;
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct*)(&gBattleBufferA[gActiveBattler][4]);
if (gMain.heldKeys & DPAD_ANY && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
if (JOY_HELD(DPAD_ANY) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
gPlayerDpadHoldFrames++;
else
gPlayerDpadHoldFrames = 0;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
u8 moveTarget;
@ -539,13 +539,13 @@ static void HandleInputChooseMove(void)
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCb_ShowAsMoveTarget;
}
}
else if (gMain.newKeys & B_BUTTON || gPlayerDpadHoldFrames > 59)
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
{
PlaySE(SE_SELECT);
BtlController_EmitTwoReturnValues(1, 10, 0xFFFF);
PlayerBufferExecCompleted();
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
if (gMoveSelectionCursor[gActiveBattler] & 1)
{
@ -557,7 +557,7 @@ static void HandleInputChooseMove(void)
MoveSelectionDisplayMoveType();
}
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
if (!(gMoveSelectionCursor[gActiveBattler] & 1)
&& (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose)
@ -570,7 +570,7 @@ static void HandleInputChooseMove(void)
MoveSelectionDisplayMoveType();
}
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (gMoveSelectionCursor[gActiveBattler] & 2)
{
@ -582,7 +582,7 @@ static void HandleInputChooseMove(void)
MoveSelectionDisplayMoveType();
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (!(gMoveSelectionCursor[gActiveBattler] & 2)
&& (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose)
@ -595,7 +595,7 @@ static void HandleInputChooseMove(void)
MoveSelectionDisplayMoveType();
}
}
else if (gMain.newKeys & SELECT_BUTTON)
else if (JOY_NEW(SELECT_BUTTON))
{
if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK))
{
@ -617,26 +617,26 @@ u32 sub_8057FBC(void) // unused
{
u32 var = 0;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
var = 1;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0x140;
var = 0xFF;
}
if (gMain.newKeys & DPAD_LEFT && gMoveSelectionCursor[gActiveBattler] & 1)
if (JOY_NEW(DPAD_LEFT) && gMoveSelectionCursor[gActiveBattler] & 1)
{
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
gMoveSelectionCursor[gActiveBattler] ^= 1;
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
}
if (gMain.newKeys & DPAD_RIGHT && !(gMoveSelectionCursor[gActiveBattler] & 1)
if (JOY_NEW(DPAD_RIGHT) && !(gMoveSelectionCursor[gActiveBattler] & 1)
&& (gMoveSelectionCursor[gActiveBattler] ^ 1) < gNumberOfMovesToChoose)
{
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
@ -644,14 +644,14 @@ u32 sub_8057FBC(void) // unused
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
}
if (gMain.newKeys & DPAD_UP && gMoveSelectionCursor[gActiveBattler] & 2)
if (JOY_NEW(DPAD_UP) && gMoveSelectionCursor[gActiveBattler] & 2)
{
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
gMoveSelectionCursor[gActiveBattler] ^= 2;
PlaySE(SE_SELECT);
MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0);
}
if (gMain.newKeys & DPAD_DOWN && !(gMoveSelectionCursor[gActiveBattler] & 2)
if (JOY_NEW(DPAD_DOWN) && !(gMoveSelectionCursor[gActiveBattler] & 2)
&& (gMoveSelectionCursor[gActiveBattler] ^ 2) < gNumberOfMovesToChoose)
{
MoveSelectionDestroyCursorAt(gMoveSelectionCursor[gActiveBattler]);
@ -669,7 +669,7 @@ static void HandleMoveSwitching(void)
struct ChooseMoveStruct moveStruct;
u8 totalPPBonuses;
if (gMain.newKeys & (A_BUTTON | SELECT_BUTTON))
if (JOY_NEW(A_BUTTON | SELECT_BUTTON))
{
PlaySE(SE_SELECT);
@ -763,7 +763,7 @@ static void HandleMoveSwitching(void)
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
}
else if (gMain.newKeys & (B_BUTTON | SELECT_BUTTON))
else if (JOY_NEW(B_BUTTON | SELECT_BUTTON))
{
PlaySE(SE_SELECT);
MoveSelectionDestroyCursorAt(gMultiUsePlayerCursor);
@ -773,7 +773,7 @@ static void HandleMoveSwitching(void)
MoveSelectionDisplayPpNumber();
MoveSelectionDisplayMoveType();
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
if (gMultiUsePlayerCursor & 1)
{
@ -791,7 +791,7 @@ static void HandleMoveSwitching(void)
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
}
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
if (!(gMultiUsePlayerCursor & 1) && (gMultiUsePlayerCursor ^ 1) < gNumberOfMovesToChoose)
{
@ -809,7 +809,7 @@ static void HandleMoveSwitching(void)
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
}
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (gMultiUsePlayerCursor & 2)
{
@ -827,7 +827,7 @@ static void HandleMoveSwitching(void)
MoveSelectionCreateCursorAt(gMultiUsePlayerCursor, 27);
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (!(gMultiUsePlayerCursor & 2) && (gMultiUsePlayerCursor ^ 2) < gNumberOfMovesToChoose)
{
@ -1402,21 +1402,21 @@ static void DoHitAnimBlinkSpriteEffect(void)
static void PlayerHandleUnknownYesNoInput(void)
{
if (gMain.newKeys & DPAD_UP && gMultiUsePlayerCursor != 0)
if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor);
gMultiUsePlayerCursor = 0;
BattleCreateYesNoCursorAt(0);
}
if (gMain.newKeys & DPAD_DOWN && gMultiUsePlayerCursor == 0)
if (JOY_NEW(DPAD_DOWN) && gMultiUsePlayerCursor == 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gMultiUsePlayerCursor);
gMultiUsePlayerCursor = 1;
BattleCreateYesNoCursorAt(1);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
PlaySE(SE_SELECT);
@ -1428,7 +1428,7 @@ static void PlayerHandleUnknownYesNoInput(void)
PlayerBufferExecCompleted();
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
PlaySE(SE_SELECT);

View File

@ -170,7 +170,7 @@ static void SafariBufferRunCommand(void)
static void HandleInputChooseAction(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@ -191,7 +191,7 @@ static void HandleInputChooseAction(void)
}
SafariBufferExecCompleted();
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
if (gActionSelectionCursor[gActiveBattler] & 1)
{
@ -201,7 +201,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
if (!(gActionSelectionCursor[gActiveBattler] & 1))
{
@ -211,7 +211,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (gActionSelectionCursor[gActiveBattler] & 2)
{
@ -221,7 +221,7 @@ static void HandleInputChooseAction(void)
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (!(gActionSelectionCursor[gActiveBattler] & 2))
{

View File

@ -4110,7 +4110,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
u8 tourneyId = sTourneyTreeTrainerIds[position];
u16 roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
input = INFOCARD_INPUT_AB;
// Next opponent card cant scroll
@ -4121,7 +4121,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
{
// For trainer info cards, pos is 0 when on a trainer info card (not viewing that trainer's match progression)
// Scrolling up/down from a trainer info card goes to other trainer info cards
if (gMain.newKeys & DPAD_UP && sInfoCard->pos == 0)
if (JOY_NEW(DPAD_UP) && sInfoCard->pos == 0)
{
if (position == 0)
position = DOME_TOURNAMENT_TRAINERS_COUNT - 1;
@ -4129,7 +4129,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
position--;
input = TRAINERCARD_INPUT_UP;
}
else if (gMain.newKeys & DPAD_DOWN && sInfoCard->pos == 0)
else if (JOY_NEW(DPAD_DOWN) && sInfoCard->pos == 0)
{
if (position == DOME_TOURNAMENT_TRAINERS_COUNT - 1)
position = 0;
@ -4138,13 +4138,13 @@ static u8 Task_GetInfoCardInput(u8 taskId)
input = TRAINERCARD_INPUT_DOWN;
}
// Scrolling left can only be done after scrolling right
else if (gMain.newKeys & DPAD_LEFT && sInfoCard->pos != 0)
else if (JOY_NEW(DPAD_LEFT) && sInfoCard->pos != 0)
{
sInfoCard->pos--;
input = TRAINERCARD_INPUT_LEFT;
}
// Scrolling right from a trainer info card shows their match progression
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
// Can only scroll right from a trainer card until the round they were eliminated
if (DOME_TRAINERS[tourneyId].isEliminated && sInfoCard->pos - 1 < DOME_TRAINERS[tourneyId].eliminatedAt)
@ -4172,7 +4172,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
{
// For match info cards, pos is 1 when on the match card, 0 when on the left trainer, and 1 when on the right trainer
// Scrolling up/down from a match info card goes to the next/previous match
if (gMain.newKeys & DPAD_UP && sInfoCard->pos == 1)
if (JOY_NEW(DPAD_UP) && sInfoCard->pos == 1)
{
if (position == DOME_TOURNAMENT_TRAINERS_COUNT)
position = sLastMatchCardNum[roundId];
@ -4180,7 +4180,7 @@ static u8 Task_GetInfoCardInput(u8 taskId)
position--;
input = MATCHCARD_INPUT_UP;
}
else if (gMain.newKeys & DPAD_DOWN && sInfoCard->pos == 1)
else if (JOY_NEW(DPAD_DOWN) && sInfoCard->pos == 1)
{
if (position == sLastMatchCardNum[roundId])
position = DOME_TOURNAMENT_TRAINERS_COUNT;
@ -4189,12 +4189,12 @@ static u8 Task_GetInfoCardInput(u8 taskId)
input = MATCHCARD_INPUT_DOWN;
}
// Scrolling left/right from a match info card shows the trainer info card of the competitors for that match
else if (gMain.newKeys & DPAD_LEFT && sInfoCard->pos != 0)
else if (JOY_NEW(DPAD_LEFT) && sInfoCard->pos != 0)
{
input = MATCHCARD_INPUT_LEFT;
sInfoCard->pos--;
}
else if (gMain.newKeys & DPAD_RIGHT && (sInfoCard->pos == 0 || sInfoCard->pos == 1))
else if (JOY_NEW(DPAD_RIGHT) && (sInfoCard->pos == 0 || sInfoCard->pos == 1))
{
input = MATCHCARD_INPUT_RIGHT;
sInfoCard->pos++;
@ -5042,12 +5042,12 @@ static u8 UpdateTourneyTreeCursor(u8 taskId)
int tourneyTreeCursorSpriteId = gTasks[taskId].data[1];
int roundId = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
if (gMain.newKeys == B_BUTTON || (gMain.newKeys & A_BUTTON && tourneyTreeCursorSpriteId == TOURNEY_TREE_CLOSE_BUTTON))
if (gMain.newKeys == B_BUTTON || (JOY_NEW(A_BUTTON) && tourneyTreeCursorSpriteId == TOURNEY_TREE_CLOSE_BUTTON))
{
PlaySE(SE_SELECT);
selection = TOURNEY_TREE_SELECTED_CLOSE;
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (tourneyTreeCursorSpriteId < DOME_TOURNAMENT_TRAINERS_COUNT)
{
@ -5551,7 +5551,7 @@ static void Task_HandleStaticTourneyTreeInput(u8 taskId)
gTasks[taskId].tState = STATE_WAIT_FOR_INPUT;
break;
case STATE_WAIT_FOR_INPUT:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].tState = STATE_CLOSE_TOURNEY_TREE;

View File

@ -1478,7 +1478,7 @@ static void Task_HandleSelectionScreenYesNo(u8 taskId)
gTasks[taskId].data[0] = 5;
break;
case 5:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (sFactorySelectScreen->yesNoCursorPos == 0)
@ -1496,7 +1496,7 @@ static void Task_HandleSelectionScreenYesNo(u8 taskId)
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sub_819B958(4);
@ -1505,12 +1505,12 @@ static void Task_HandleSelectionScreenYesNo(u8 taskId)
gTasks[taskId].data[0] = 1;
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
else if (JOY_REPEAT(DPAD_UP))
{
PlaySE(SE_SELECT);
Select_UpdateYesNoCursorPosition(-1);
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
PlaySE(SE_SELECT);
Select_UpdateYesNoCursorPosition(1);
@ -1538,7 +1538,7 @@ static void Task_HandleSelectionScreenMenu(u8 taskId)
}
break;
case 3:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
u8 retVal;
PlaySE(SE_SELECT);
@ -1565,7 +1565,7 @@ static void Task_HandleSelectionScreenMenu(u8 taskId)
gTasks[taskId].func = Task_FromSelectScreenToSummaryScreen;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sub_819F3F8(sFactorySelectScreen->unk294[1], &sFactorySelectScreen->unk2A0, FALSE);
@ -1574,12 +1574,12 @@ static void Task_HandleSelectionScreenMenu(u8 taskId)
gTasks[taskId].data[0] = 1;
gTasks[taskId].func = Task_HandleSelectionScreenChooseMons;
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
else if (JOY_REPEAT(DPAD_UP))
{
PlaySE(SE_SELECT);
Select_UpdateMenuCursorPosition(-1);
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
PlaySE(SE_SELECT);
Select_UpdateMenuCursorPosition(1);
@ -1618,21 +1618,21 @@ static void Task_HandleSelectionScreenChooseMons(u8 taskId)
}
break;
case 1:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
sFactorySelectScreen->unk2A2 = FALSE;
gTasks[taskId].data[0] = 2;
gTasks[taskId].func = Task_HandleSelectionScreenMenu;
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
else if (JOY_REPEAT(DPAD_LEFT))
{
PlaySE(SE_SELECT);
Select_UpdateBallCursorPosition(-1);
Select_PrintMonCategory();
Select_PrintMonSpecies();
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
PlaySE(SE_SELECT);
Select_UpdateBallCursorPosition(1);
@ -1641,7 +1641,7 @@ static void Task_HandleSelectionScreenChooseMons(u8 taskId)
}
break;
case 11:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
sub_819F3F8(sFactorySelectScreen->unk294[1], &sFactorySelectScreen->unk2A0, FALSE);
@ -2361,7 +2361,7 @@ static void Task_HandleSwapScreenYesNo(u8 taskId)
gTasks[taskId].data[0] = 5;
break;
case 5:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (sFactorySwapScreen->yesNoCursorPos == 0)
@ -2380,7 +2380,7 @@ static void Task_HandleSwapScreenYesNo(u8 taskId)
gTasks[taskId].func = (void*)((hiPtr << 16) | loPtr);
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gTasks[taskId].data[1] = 0;
@ -2389,12 +2389,12 @@ static void Task_HandleSwapScreenYesNo(u8 taskId)
loPtr = gTasks[taskId].data[7];
gTasks[taskId].func = (void*)((hiPtr << 16) | loPtr);
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
else if (JOY_REPEAT(DPAD_UP))
{
PlaySE(SE_SELECT);
Swap_UpdateYesNoCursorPosition(-1);
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
PlaySE(SE_SELECT);
Swap_UpdateYesNoCursorPosition(1);
@ -2485,12 +2485,12 @@ static void Task_HandleSwapScreenMenu(u8 taskId)
case 3:
if (sFactorySwapScreen->unk30 != TRUE)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
Swap_RunMenuOptionFunc(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sub_819F3F8(sFactorySwapScreen->unk2C, &sFactorySwapScreen->unk30, TRUE);
@ -2501,11 +2501,11 @@ static void Task_HandleSwapScreenMenu(u8 taskId)
gTasks[taskId].data[5] = 1;
gTasks[taskId].func = sub_819D770;
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
else if (JOY_REPEAT(DPAD_UP))
{
Swap_UpdateMenuCursorPosition(-1);
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
Swap_UpdateMenuCursorPosition(1);
}
@ -2526,7 +2526,7 @@ static void Task_HandleSwapScreenChooseMons(u8 taskId)
}
break;
case 1:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
sFactorySwapScreen->unk22 = FALSE;
@ -2534,7 +2534,7 @@ static void Task_HandleSwapScreenChooseMons(u8 taskId)
sub_819EAC0();
Swap_RunActionFunc(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sFactorySwapScreen->unk22 = FALSE;
@ -2546,25 +2546,25 @@ static void Task_HandleSwapScreenChooseMons(u8 taskId)
gTasks[taskId].data[5] = 0;
gTasks[taskId].func = sub_819D588;
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
else if (JOY_REPEAT(DPAD_LEFT))
{
Swap_UpdateBallCursorPosition(-1);
Swap_PrintMonCategory();
Swap_PrintMonSpecies();
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
Swap_UpdateBallCursorPosition(1);
Swap_PrintMonCategory();
Swap_PrintMonSpecies();
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
Swap_UpdateActionCursorPosition(1);
Swap_PrintMonCategory();
Swap_PrintMonSpecies();
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
else if (JOY_REPEAT(DPAD_UP))
{
Swap_UpdateActionCursorPosition(-1);
Swap_PrintMonCategory();
@ -3929,7 +3929,7 @@ static void Task_SwapCantHaveSameMons(u8 taskId)
gTasks[taskId].data[0]++;
break;
case 1:
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sub_819F3F8(sFactorySwapScreen->unk2C, &sFactorySwapScreen->unk30, TRUE);

View File

@ -1831,7 +1831,7 @@ void BattleMainCB2(void)
UpdatePaletteFade();
RunTasks();
if (gMain.heldKeys & B_BUTTON && gBattleTypeFlags & BATTLE_TYPE_RECORDED && sub_8186450())
if (JOY_HELD(B_BUTTON) && gBattleTypeFlags & BATTLE_TYPE_RECORDED && sub_8186450())
{
gSpecialVar_Result = gBattleOutcome = B_OUTCOME_PLAYER_TELEPORTED;
ResetPaletteFadeControl();
@ -2487,7 +2487,7 @@ static void sub_803939C(void)
}
break;
case 5:
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
if (gBattleCommunication[CURSOR_POSITION] != 0)
{
@ -2497,7 +2497,7 @@ static void sub_803939C(void)
BattleCreateYesNoCursorAt(0);
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (gBattleCommunication[CURSOR_POSITION] == 0)
{
@ -2507,7 +2507,7 @@ static void sub_803939C(void)
BattleCreateYesNoCursorAt(1);
}
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (gBattleCommunication[CURSOR_POSITION] == 0)
@ -2521,7 +2521,7 @@ static void sub_803939C(void)
gBattleCommunication[MULTIUSE_STATE]++;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gBattleCommunication[MULTIUSE_STATE]++;

View File

@ -839,7 +839,7 @@ static void Task_HandlePyramidBagInput(u8 taskId)
s16 *data = gTasks[taskId].data;
if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
{
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
if (gPyramidBagCursorData.unk4 != 2)
{
@ -965,7 +965,7 @@ static void HandleMenuActionInput(u8 taskId)
if (MenuHelpers_CallLinkSomething() != TRUE)
{
s8 id = Menu_GetCursorPos();
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
if (id > 0 && IsValidMenuAction(id - 2))
{
@ -973,7 +973,7 @@ static void HandleMenuActionInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (id < gPyramidBagResources->menuActionsCount - 2 && IsValidMenuAction(id + 2))
{
@ -981,7 +981,7 @@ static void HandleMenuActionInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
}
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
if (id & 1 && IsValidMenuAction(id - 1))
{
@ -989,7 +989,7 @@ static void HandleMenuActionInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
}
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (!(id & 1) && IsValidMenuAction(id + 1))
{
@ -997,13 +997,13 @@ static void HandleMenuActionInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
}
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8 != NULL)
sMenuActions[gPyramidBagResources->menuActionIds[id]].func.void_u8(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sMenuActions[ACTION_CANCEL].func.void_u8(taskId);
@ -1143,7 +1143,7 @@ static void sub_81C64B4(u8 taskId)
{
sub_81C645C(data[8]);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(3, 0);
@ -1151,7 +1151,7 @@ static void sub_81C64B4(u8 taskId)
ScheduleBgCopyTilemapToVram(1);
sub_81C6350(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(3, 0);
@ -1179,7 +1179,7 @@ static void sub_81C65CC(u8 taskId)
u16 *scrollOffset = &gPyramidBagCursorData.scrollPosition;
u16 *selectedRow = &gPyramidBagCursorData.cursorPosition;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
RemovePyramidBagItem(gSpecialVar_ItemId, data[8]);
@ -1220,7 +1220,7 @@ static void sub_81C66AC(u8 taskId)
static void sub_81C66EC(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
Task_CloseBattlePyramidBagMessage(taskId);
@ -1277,7 +1277,7 @@ static void Task_ItemSwapHandleInput(u8 taskId)
s16 *data = gTasks[taskId].data;
if (MenuHelpers_CallLinkSomething() != TRUE)
{
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
PlaySE(SE_SELECT);
ListMenuGetScrollAndRow(data[0], &gPyramidBagCursorData.scrollPosition, &gPyramidBagCursorData.cursorPosition);
@ -1295,7 +1295,7 @@ static void Task_ItemSwapHandleInput(u8 taskId)
break;
case LIST_CANCEL:
PlaySE(SE_SELECT);
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
PerformItemSwap(taskId);
else
sub_81C6A14(taskId);

View File

@ -356,7 +356,7 @@ static void Task_CloseTrainerHillRecordsOnButton(u8 taskId)
{
struct Task *task = &gTasks[taskId];
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
task->func = Task_BeginPaletteFade;

View File

@ -5362,21 +5362,21 @@ static void Cmd_yesnoboxlearnmove(void)
BattleCreateYesNoCursorAt(0);
break;
case 1:
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
}
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 1;
BattleCreateYesNoCursorAt(1);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (gBattleCommunication[1] == 0)
@ -5390,7 +5390,7 @@ static void Cmd_yesnoboxlearnmove(void)
gBattleScripting.learnMoveState = 5;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gBattleScripting.learnMoveState = 5;
@ -5479,21 +5479,21 @@ static void Cmd_yesnoboxstoplearningmove(void)
BattleCreateYesNoCursorAt(0);
break;
case 1:
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
}
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 1;
BattleCreateYesNoCursorAt(1);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@ -5504,7 +5504,7 @@ static void Cmd_yesnoboxstoplearningmove(void)
HandleBattleWindow(0x18, 0x8, 0x1D, 0xD, WINDOW_CLEAR);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
@ -5774,28 +5774,28 @@ static void Cmd_yesnobox(void)
BattleCreateYesNoCursorAt(0);
break;
case 1:
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
}
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 1;
BattleCreateYesNoCursorAt(1);
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
gBattleCommunication[CURSOR_POSITION] = 1;
PlaySE(SE_SELECT);
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
gBattlescriptCurrInstr++;
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
@ -10074,21 +10074,21 @@ static void Cmd_trygivecaughtmonnick(void)
BattleCreateYesNoCursorAt(0);
break;
case 1:
if (gMain.newKeys & DPAD_UP && gBattleCommunication[CURSOR_POSITION] != 0)
if (JOY_NEW(DPAD_UP) && gBattleCommunication[CURSOR_POSITION] != 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 0;
BattleCreateYesNoCursorAt(0);
}
if (gMain.newKeys & DPAD_DOWN && gBattleCommunication[CURSOR_POSITION] == 0)
if (JOY_NEW(DPAD_DOWN) && gBattleCommunication[CURSOR_POSITION] == 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(gBattleCommunication[CURSOR_POSITION]);
gBattleCommunication[CURSOR_POSITION] = 1;
BattleCreateYesNoCursorAt(1);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (gBattleCommunication[CURSOR_POSITION] == 0)
@ -10101,7 +10101,7 @@ static void Cmd_trygivecaughtmonnick(void)
gBattleCommunication[MULTIUSE_STATE] = 4;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gBattleCommunication[MULTIUSE_STATE] = 4;

View File

@ -1665,7 +1665,7 @@ static void Task_ShowBerryCrushRankings(u8 taskId)
CopyWindowToVram(data[1], 3);
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
break;
else
return;
@ -2498,9 +2498,9 @@ void sub_8023558(struct BerryCrushGame *r3)
void sub_80236B8(struct BerryCrushGame *r5)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
r5->unk5C.unk02_2 = 1;
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
{
if (r5->unk68.as_four_players.others[r5->unk8].unk4.as_hwords[5] < r5->unk28)
++r5->unk68.as_four_players.others[r5->unk8].unk4.as_hwords[5];
@ -2966,7 +2966,7 @@ static u32 sub_8024048(struct BerryCrushGame *r5, u8 *r6)
--r5->unk138.unk0;
return 0;
}
if (!(gMain.newKeys & A_BUTTON))
if (!(JOY_NEW(A_BUTTON)))
return 0;
PlaySE(SE_SELECT);
sub_802222C(r5);

View File

@ -190,13 +190,13 @@ static void berry_fix_main(void)
berry_fix_mb_manager->state = 1;
break;
case 1:
if (berry_fix_text_update(5) == 5 && (gMain.newKeys & A_BUTTON))
if (berry_fix_text_update(5) == 5 && (JOY_NEW(A_BUTTON)))
{
berry_fix_mb_manager->state = 2;
}
break;
case 2:
if (berry_fix_text_update(0) == 0 && (gMain.newKeys & A_BUTTON))
if (berry_fix_text_update(0) == 0 && (JOY_NEW(A_BUTTON)))
{
berry_fix_mb_manager->state = 3;
}
@ -235,13 +235,13 @@ static void berry_fix_main(void)
}
break;
case 6:
if (berry_fix_text_update(3) == 3 && gMain.newKeys & A_BUTTON)
if (berry_fix_text_update(3) == 3 && JOY_NEW(A_BUTTON))
{
DoSoftReset();
}
break;
case 7:
if (berry_fix_text_update(4) == 4 && gMain.newKeys & A_BUTTON)
if (berry_fix_text_update(4) == 4 && JOY_NEW(A_BUTTON))
{
berry_fix_mb_manager->state = 1;
}

View File

@ -536,12 +536,12 @@ static void Task_HandleInput(u8 taskId)
{
if (!gPaletteFade.active)
{
u16 arrowKeys = gMain.newAndRepeatedKeys & DPAD_ANY;
u16 arrowKeys = JOY_REPEAT(DPAD_ANY);
if (arrowKeys == DPAD_UP)
TryChangeDisplayedBerry(taskId, -1);
else if (arrowKeys == DPAD_DOWN)
TryChangeDisplayedBerry(taskId, 1);
else if (gMain.newKeys & (A_BUTTON | B_BUTTON))
else if (JOY_NEW(A_BUTTON | B_BUTTON))
PrepareToCloseBerryTagScreen(taskId);
}
}

View File

@ -163,7 +163,7 @@ static bool32 CheckLinkErrored(u8 taskId)
static bool32 CheckLinkCanceledBeforeConnection(u8 taskId)
{
if ((gMain.newKeys & B_BUTTON)
if ((JOY_NEW(B_BUTTON))
&& IsLinkConnectionEstablished() == FALSE)
{
gLinkType = 0;
@ -178,7 +178,7 @@ static bool32 CheckLinkCanceled(u8 taskId)
if (IsLinkConnectionEstablished())
SetSuppressLinkErrorMessage(TRUE);
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
gLinkType = 0;
gTasks[taskId].func = Task_LinkupFailed;
@ -277,7 +277,7 @@ static void Task_LinkupAwaitConfirmation(u8 taskId)
UpdateLinkPlayerCountDisplay(taskId, linkPlayerCount);
if (!(gMain.newKeys & A_BUTTON))
if (!(JOY_NEW(A_BUTTON)))
return;
if (linkPlayerCount < tMinPlayers)
@ -304,12 +304,12 @@ static void Task_LinkupTryConfirmation(u8 taskId)
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
gTasks[taskId].func = Task_LinkupConfirmWhenReady;
}
else if (gMain.heldKeys & B_BUTTON)
else if (JOY_HELD(B_BUTTON))
{
ShowFieldAutoScrollMessage(gText_ConfirmLinkWhenPlayersReady);
gTasks[taskId].func = Task_LinkupConfirmWhenReady;
}
else if (gMain.heldKeys & A_BUTTON)
else if (JOY_HELD(A_BUTTON))
{
PlaySE(SE_SELECT);
CheckShouldAdvanceLinkState();

View File

@ -1492,7 +1492,7 @@ static void Task_DisplayAppealNumberText(u8 taskId)
static void Task_TryShowMoveSelectScreen(u8 taskId)
{
// Wait for button press to show move select screen
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys == B_BUTTON))
if ((JOY_NEW(A_BUTTON)) || (gMain.newKeys == B_BUTTON))
{
PlaySE(SE_SELECT);
if (!Contest_IsMonsTurnDisabled(gContestPlayerMonIndex))
@ -1558,7 +1558,7 @@ static void Task_HandleMoveSelectInput(u8 taskId)
numMoves++;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
gTasks[taskId].func = Task_SelectedMove;

View File

@ -248,7 +248,7 @@ static void HoldContestPainting(void)
gContestPaintingFadeCounter--;
break;
case 1:
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
{
gContestPaintingState++;
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB(0, 0, 0));

View File

@ -1142,7 +1142,7 @@ static void CB2_RunCreditsSequence(void)
RunTasks();
AnimateSprites();
if ((gMain.heldKeys & B_BUTTON)
if ((JOY_HELD(B_BUTTON))
&& gHasHallOfFameRecords != 0
&& gTasks[gUnknown_0203BCE2].func == Task_ProgressCreditTasks)
{

View File

@ -1236,7 +1236,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
{
u32 input = ListMenu_ProcessInput(gTasks[taskId].tMenuListTaskId);
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (input)
{
@ -1254,7 +1254,7 @@ static void Task_HandleDaycareLevelMenuInput(u8 taskId)
DestroyTask(taskId);
EnableBothScriptContexts();
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
gSpecialVar_Result = DAYCARE_EXITED_LEVEL_MENU;
DestroyListMenuTask(gTasks[taskId].tMenuListTaskId, NULL, NULL);

View File

@ -1147,7 +1147,7 @@ static void DontTossDecoration(u8 taskId)
static void ReturnToDecorationItemsAfterInvalidSelection(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
ClearDialogWindowAndFrame(0, 0);
AddDecorationWindow(WINDOW_DECORATION_CATEGORIES);
@ -1803,7 +1803,7 @@ static bool8 ApplyCursorMovement_IsInvalid(u8 taskId)
static bool8 IsHoldingDirection(void)
{
u16 heldKeys = gMain.heldKeys & DPAD_ANY;
u16 heldKeys = JOY_HELD(DPAD_ANY);
if (heldKeys != DPAD_UP && heldKeys != DPAD_DOWN && heldKeys != DPAD_LEFT && heldKeys != DPAD_RIGHT)
return FALSE;
@ -1827,13 +1827,14 @@ static void Task_SelectLocation(u8 taskId)
sPlacePutAwayYesNoFunctions[tDecorationItemsMenuCommand].yesFunc(taskId);
return;
}
else if (tButton == B_BUTTON)
if (tButton == B_BUTTON)
{
sPlacePutAwayYesNoFunctions[tDecorationItemsMenuCommand].noFunc(taskId);
return;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_UP)
if ((JOY_HELD(DPAD_ANY)) == DPAD_UP)
{
sDecorationLastDirectionMoved = DIR_SOUTH;
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 0;
@ -1841,7 +1842,7 @@ static void Task_SelectLocation(u8 taskId)
tCursorY--;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_DOWN)
if ((JOY_HELD(DPAD_ANY)) == DPAD_DOWN)
{
sDecorationLastDirectionMoved = DIR_NORTH;
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 0;
@ -1849,7 +1850,7 @@ static void Task_SelectLocation(u8 taskId)
tCursorY++;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_LEFT)
if ((JOY_HELD(DPAD_ANY)) == DPAD_LEFT)
{
sDecorationLastDirectionMoved = DIR_WEST;
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = -2;
@ -1857,7 +1858,7 @@ static void Task_SelectLocation(u8 taskId)
tCursorX--;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_RIGHT)
if ((JOY_HELD(DPAD_ANY)) == DPAD_RIGHT)
{
sDecorationLastDirectionMoved = DIR_EAST;
gSprites[sDecor_CameraSpriteObjectIdx1].data[2] = 2;
@ -1877,10 +1878,10 @@ static void Task_SelectLocation(u8 taskId)
if (!tButton)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
tButton = A_BUTTON;
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
tButton = B_BUTTON;
}
}
@ -1895,7 +1896,7 @@ static void ContinueDecorating(u8 taskId)
static void CantPlaceDecorationPrompt(u8 taskId)
{
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
ContinueDecorating(taskId);
}
@ -1928,7 +1929,7 @@ static void CopyTile(u8 *dest, u16 tile)
case BG_TILE_H_FLIP(0) >> 10:
for (i = 0; i < 8; i++)
{
dest[4 * i] = (buffer[4 * (i + 1) - 1] >> 4) + ((buffer[4 * (i + 1) - 1] & 0x0F) << 4);
dest[4 * i + 0] = (buffer[4 * (i + 1) - 1] >> 4) + ((buffer[4 * (i + 1) - 1] & 0x0F) << 4);
dest[4 * i + 1] = (buffer[4 * (i + 1) - 2] >> 4) + ((buffer[4 * (i + 1) - 2] & 0x0F) << 4);
dest[4 * i + 2] = (buffer[4 * (i + 1) - 3] >> 4) + ((buffer[4 * (i + 1) - 3] & 0x0F) << 4);
dest[4 * i + 3] = (buffer[4 * (i + 1) - 4] >> 4) + ((buffer[4 * (i + 1) - 4] & 0x0F) << 4);
@ -1937,7 +1938,7 @@ static void CopyTile(u8 *dest, u16 tile)
case BG_TILE_V_FLIP(0) >> 10:
for (i = 0; i < 8; i++)
{
dest[4 * i] = buffer[4 * (7 - i)];
dest[4 * i + 0] = buffer[4 * (7 - i) + 0];
dest[4 * i + 1] = buffer[4 * (7 - i) + 1];
dest[4 * i + 2] = buffer[4 * (7 - i) + 2];
dest[4 * i + 3] = buffer[4 * (7 - i) + 3];
@ -2386,7 +2387,7 @@ static void AttemptPutAwayDecoration_(u8 taskId)
static void ContinuePuttingAwayDecorationsPrompt(u8 taskId)
{
if (gMain.newKeys & A_BUTTON || gMain.newKeys & B_BUTTON)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
ContinuePuttingAwayDecorations(taskId);
}

View File

@ -107,7 +107,7 @@ static void Task_DiplomaFadeIn(u8 taskId)
static void Task_DiplomaWaitForKeyPress(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
gTasks[taskId].func = Task_DiplomaFadeOut;

View File

@ -2354,19 +2354,19 @@ static void sub_8027554(void)
{
if (gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] == 0)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 2;
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
PlaySE(SE_M_CHARM);
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 3;
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
PlaySE(SE_M_CHARM);
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
gUnknown_02022C98->unk31A0[gUnknown_02022C98->multiplayerId].unk2C.unk0 = 1;
gUnknown_02022C98->unkB0[gUnknown_02022C98->multiplayerId] = 6;
@ -2652,7 +2652,7 @@ static void Task_ShowDodrioBerryPickingRecords(u8 taskId)
data[0]++;
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
rbox_fill_rectangle(data[1]);
CopyWindowToVram(data[1], 1);
@ -4265,7 +4265,7 @@ static void sub_802988C(void)
gUnknown_02022CF8->state++;
break;
case 4:
if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON)
if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON))
{
gUnknown_02022CF8->unk301C = 0;
PlaySE(SE_SELECT);
@ -4297,7 +4297,7 @@ static void sub_802988C(void)
gUnknown_02022CF8->state++;
break;
case 8:
if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON)
if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON))
{
gUnknown_02022CF8->unk301C = 0;
PlaySE(SE_SELECT);
@ -4357,7 +4357,7 @@ static void sub_802988C(void)
gUnknown_02022CF8->state++;
break;
case 11:
if (++gUnknown_02022CF8->unk301C >= 30 && gMain.newKeys & A_BUTTON)
if (++gUnknown_02022CF8->unk301C >= 30 && JOY_NEW(A_BUTTON))
{
gUnknown_02022CF8->unk301C = 0;
PlaySE(SE_SELECT);
@ -4423,14 +4423,14 @@ static void sub_802A010(void)
AddTextPrinterParameterized(gUnknown_02022CF8->unk3008[1], 1, gText_SelectorArrow2, 0, ((y - 1) * 16) + 1, -1, NULL);
CopyWindowToVram(gUnknown_02022CF8->unk3008[1], 3);
// Increment state only if A or B button have been pressed.
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (gUnknown_02022CF8->unk3020 == 0)
gUnknown_02022CF8->unk3020 = 1;
gUnknown_02022CF8->state++;
}
else if (gMain.newKeys & (DPAD_UP | DPAD_DOWN))
else if (JOY_NEW(DPAD_UP | DPAD_DOWN))
{
PlaySE(SE_SELECT);
switch (gUnknown_02022CF8->unk3020)
@ -4446,7 +4446,7 @@ static void sub_802A010(void)
break;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
gUnknown_02022CF8->unk3020 = 2;

View File

@ -1522,7 +1522,7 @@ static u16 sub_811AB68(void)
{
do
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
sub_811BF78();
sEasyChatScreen->state = 2;
@ -1531,30 +1531,30 @@ static u16 sub_811AB68(void)
sEasyChatScreen->unk_0c = 0;
return 9;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return sub_811B150();
}
else if (gMain.newKeys & START_BUTTON)
else if (JOY_NEW(START_BUTTON))
{
return sub_811B1B4();
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
sEasyChatScreen->mainCursorRow--;
break;
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
sEasyChatScreen->mainCursorColumn--;
break;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
sEasyChatScreen->mainCursorRow++;
break;
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
sEasyChatScreen->mainCursorColumn++;
break;
@ -1594,7 +1594,7 @@ static u16 sub_811ACDC(void)
{
do
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (sEasyChatScreen->mainCursorColumn)
{
@ -1609,30 +1609,30 @@ static u16 sub_811ACDC(void)
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
return sub_811B150();
}
else if (gMain.newKeys & START_BUTTON)
else if (JOY_NEW(START_BUTTON))
{
return sub_811B1B4();
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
sEasyChatScreen->mainCursorRow--;
break;
}
else if (gMain.newKeys & DPAD_LEFT)
else if (JOY_NEW(DPAD_LEFT))
{
sEasyChatScreen->mainCursorColumn--;
break;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
sEasyChatScreen->mainCursorRow = 0;
break;
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
sEasyChatScreen->mainCursorColumn++;
break;
@ -1665,10 +1665,10 @@ static u16 sub_811ACDC(void)
static u16 sub_811AE44(void)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
return sub_811B32C();
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (sEasyChatScreen->unk_0a != -1)
return sub_811B2B0();
@ -1684,19 +1684,19 @@ static u16 sub_811AE44(void)
}
}
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
return sub_811B33C();
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
return sub_811B528(2);
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
if (JOY_REPEAT(DPAD_DOWN))
return sub_811B528(3);
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
if (JOY_REPEAT(DPAD_LEFT))
return sub_811B528(1);
if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
if (JOY_REPEAT(DPAD_RIGHT))
return sub_811B528(0);
return 0;
@ -1704,31 +1704,31 @@ static u16 sub_811AE44(void)
static u16 sub_811AF00(void)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
sEasyChatScreen->state = 2;
return 14;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
return sub_811B394();
if (gMain.newKeys & START_BUTTON)
if (JOY_NEW(START_BUTTON))
return sub_811B794(4);
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
return sub_811B794(5);
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
return sub_811B794(2);
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
if (JOY_REPEAT(DPAD_DOWN))
return sub_811B794(3);
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
if (JOY_REPEAT(DPAD_LEFT))
return sub_811B794(1);
if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
if (JOY_REPEAT(DPAD_RIGHT))
return sub_811B794(0);
return 0;
@ -1793,10 +1793,10 @@ static u16 sub_811B040(void)
static u16 sub_811B08C(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
return 26;
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
return sub_811B150();
return 0;
@ -1804,7 +1804,7 @@ static u16 sub_811B08C(void)
static u16 sub_811B0BC(void)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
sEasyChatScreen->state = sub_811B2A4();
return 7;

View File

@ -137,7 +137,7 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1)
{
*arg0 = 1;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
*arg0 = 0;
return 1;
@ -158,7 +158,7 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1)
*arg1 = 0;
*arg0 = 3;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
*arg0 = 0;
return 1;
@ -288,7 +288,7 @@ static void sub_81D5084(u8 taskId)
OpenEReaderLink();
data->unk8 = 6;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
sub_81D505C(&data->unk0);
PlaySE(SE_SELECT);
@ -296,7 +296,7 @@ static void sub_81D5084(u8 taskId)
}
break;
case 6:
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
CloseLink();
@ -436,7 +436,7 @@ static void sub_81D5084(u8 taskId)
}
break;
case 19:
if (IsFanfareTaskInactive() && (gMain.newKeys & (A_BUTTON | B_BUTTON)))
if (IsFanfareTaskInactive() && (JOY_NEW(A_BUTTON | B_BUTTON)))
data->unk8 = 26;
break;
case 23:

View File

@ -858,21 +858,21 @@ static void Task_EvolutionScene(u8 taskID)
}
break;
case 4:
if (gMain.newKeys & DPAD_UP && sEvoCursorPos != 0)
if (JOY_NEW(DPAD_UP) && sEvoCursorPos != 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(sEvoCursorPos);
sEvoCursorPos = 0;
BattleCreateYesNoCursorAt(0);
}
if (gMain.newKeys & DPAD_DOWN && sEvoCursorPos == 0)
if (JOY_NEW(DPAD_DOWN) && sEvoCursorPos == 0)
{
PlaySE(SE_SELECT);
BattleDestroyYesNoCursorAt(sEvoCursorPos);
sEvoCursorPos = 1;
BattleCreateYesNoCursorAt(1);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
PlaySE(SE_SELECT);
@ -888,7 +888,7 @@ static void Task_EvolutionScene(u8 taskID)
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
PlaySE(SE_SELECT);

View File

@ -1788,7 +1788,7 @@ static bool8 Fishing_ShowDots(struct Task *task)
AlignFishingAnimationFrames();
task->tFrameCounter++;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
task->tStep = FISHING_NO_BITE;
if (task->tRoundsPlayed != 0)
@ -1877,7 +1877,7 @@ static bool8 Fishing_WaitForA(struct Task *task)
task->tFrameCounter++;
if (task->tFrameCounter >= reelTimeouts[task->tFishingRod])
task->tStep = FISHING_GOT_AWAY;
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
task->tStep++;
return FALSE;
}

View File

@ -280,7 +280,7 @@ void Task_HandlePorthole(u8 taskId)
}
break;
case IDLE_CHECK:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
data[1] = 1;
if (!ScriptMovement_IsObjectMovementFinished(OBJ_EVENT_ID_PLAYER, location->mapNum, location->mapGroup))
return;

View File

@ -937,14 +937,14 @@ static void Task_HandleFrontierPassInput(u8 taskId)
{
u8 var = FALSE; // Reused, first informs whether the cursor moves, then used as the new cursor area.
if (gMain.heldKeys & DPAD_UP && sPassGfx->cursorSprite->pos1.y >= 9)
if (JOY_HELD(DPAD_UP) && sPassGfx->cursorSprite->pos1.y >= 9)
{
sPassGfx->cursorSprite->pos1.y -= 2;
if (sPassGfx->cursorSprite->pos1.y <= 7)
sPassGfx->cursorSprite->pos1.y = 2;
var = TRUE;
}
if (gMain.heldKeys & DPAD_DOWN && sPassGfx->cursorSprite->pos1.y <= 135)
if (JOY_HELD(DPAD_DOWN) && sPassGfx->cursorSprite->pos1.y <= 135)
{
sPassGfx->cursorSprite->pos1.y += 2;
if (sPassGfx->cursorSprite->pos1.y >= 137)
@ -952,14 +952,14 @@ static void Task_HandleFrontierPassInput(u8 taskId)
var = TRUE;
}
if (gMain.heldKeys & DPAD_LEFT && sPassGfx->cursorSprite->pos1.x >= 6)
if (JOY_HELD(DPAD_LEFT) && sPassGfx->cursorSprite->pos1.x >= 6)
{
sPassGfx->cursorSprite->pos1.x -= 2;
if (sPassGfx->cursorSprite->pos1.x <= 4)
sPassGfx->cursorSprite->pos1.x = 5;
var = TRUE;
}
if (gMain.heldKeys & DPAD_RIGHT && sPassGfx->cursorSprite->pos1.x <= 231)
if (JOY_HELD(DPAD_RIGHT) && sPassGfx->cursorSprite->pos1.x <= 231)
{
sPassGfx->cursorSprite->pos1.x += 2;
if (sPassGfx->cursorSprite->pos1.x >= 233)
@ -969,7 +969,7 @@ static void Task_HandleFrontierPassInput(u8 taskId)
if (!var) // Cursor did not change.
{
if (sPassData->cursorArea != CURSOR_AREA_NOTHING && gMain.newKeys & A_BUTTON)
if (sPassData->cursorArea != CURSOR_AREA_NOTHING && JOY_NEW(A_BUTTON))
{
if (sPassData->cursorArea <= CURSOR_AREA_RECORD) // Map, Card, Record
{
@ -986,7 +986,7 @@ static void Task_HandleFrontierPassInput(u8 taskId)
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_PC_OFF);
SetMainCallback2(CB2_HideFrontierPass);
@ -1443,19 +1443,19 @@ static void Task_HandleFrontierMap(u8 taskId)
break;
return;
case 1:
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_PC_OFF);
data[0] = 4;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (sMapData->cursorPos >= NUM_FRONTIER_FACILITIES - 1)
HandleFrontierMapCursorMove(0);
else
data[0] = 2;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (sMapData->cursorPos == 0)
HandleFrontierMapCursorMove(1);

View File

@ -729,7 +729,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId)
static void Task_Hof_ExitOnKeyPressed(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
FadeOutBGM(4);
gTasks[taskId].func = Task_Hof_HandlePaletteOnExit;
@ -991,7 +991,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
{
u16 i;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (gTasks[taskId].tCurrTeamNo != 0) // prepare another team to view
{
@ -1019,7 +1019,7 @@ static void Task_HofPC_HandleInput(u8 taskId)
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
}
}
else if (gMain.newKeys & B_BUTTON) // turn off hall of fame PC
else if (JOY_NEW(B_BUTTON)) // turn off hall of fame PC
{
if (IsCryPlayingOrClearCrySongs())
{
@ -1028,12 +1028,12 @@ static void Task_HofPC_HandleInput(u8 taskId)
}
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
}
else if (gMain.newKeys & DPAD_UP && gTasks[taskId].tCurrMonId != 0) // change mon -1
else if (JOY_NEW(DPAD_UP) && gTasks[taskId].tCurrMonId != 0) // change mon -1
{
gTasks[taskId].tCurrMonId--;
gTasks[taskId].func = Task_HofPC_PrintMonInfo;
}
else if (gMain.newKeys & DPAD_DOWN && gTasks[taskId].tCurrMonId < gTasks[taskId].tMonNo - 1) // change mon +1
else if (JOY_NEW(DPAD_DOWN) && gTasks[taskId].tCurrMonId < gTasks[taskId].tMonNo - 1) // change mon +1
{
gTasks[taskId].tCurrMonId++;
gTasks[taskId].func = Task_HofPC_PrintMonInfo;
@ -1097,7 +1097,7 @@ static void Task_HofPC_PrintDataIsCorrupted(u8 taskId)
static void Task_HofPC_ExitOnButtonPress(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
gTasks[taskId].func = Task_HofPC_HandlePaletteOnExit;
}

View File

@ -1167,7 +1167,7 @@ void Task_BagMenu_HandleInput(u8 taskId)
SwitchBagPocket(taskId, MENU_CURSOR_DELTA_RIGHT, 0);
return;
default:
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
if (CanSwapItems() == TRUE)
{
@ -1229,12 +1229,12 @@ static u8 GetSwitchBagPocketDirection(void)
if (gBagMenu->pocketSwitchDisabled)
return SWITCH_POCKET_NONE;
LRKeys = GetLRKeysPressed();
if ((gMain.newKeys & DPAD_LEFT) || LRKeys == MENU_L_PRESSED)
if ((JOY_NEW(DPAD_LEFT)) || LRKeys == MENU_L_PRESSED)
{
PlaySE(SE_SELECT);
return SWITCH_POCKET_LEFT;
}
if ((gMain.newKeys & DPAD_RIGHT) || LRKeys == MENU_R_PRESSED)
if ((JOY_NEW(DPAD_RIGHT)) || LRKeys == MENU_R_PRESSED)
{
PlaySE(SE_SELECT);
return SWITCH_POCKET_RIGHT;
@ -1388,7 +1388,7 @@ static void Task_HandleSwappingItemsInput(u8 taskId)
if (MenuHelpers_CallLinkSomething() != TRUE)
{
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
PlaySE(SE_SELECT);
ListMenuGetScrollAndRow(data[0], &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket], &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket]);
@ -1406,7 +1406,7 @@ static void Task_HandleSwappingItemsInput(u8 taskId)
break;
case LIST_CANCEL:
PlaySE(SE_SELECT);
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
sub_81AC498(taskId);
else
sub_81AC590(taskId);
@ -1645,7 +1645,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
if (MenuHelpers_CallLinkSomething() != TRUE)
{
s8 cursorPos = Menu_GetCursorPos();
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
if (cursorPos > 0 && sub_81ACDFC(cursorPos - 2))
{
@ -1653,7 +1653,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
}
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (cursorPos < (gBagMenu->contextMenuNumItems - 2) && sub_81ACDFC(cursorPos + 2))
{
@ -1661,7 +1661,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
}
}
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
else if ((JOY_NEW(DPAD_LEFT)) || GetLRKeysPressed() == MENU_L_PRESSED)
{
if ((cursorPos & 1) && sub_81ACDFC(cursorPos - 1))
{
@ -1669,7 +1669,7 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
}
}
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
else if ((JOY_NEW(DPAD_RIGHT)) || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (!(cursorPos & 1) && sub_81ACDFC(cursorPos + 1))
{
@ -1677,12 +1677,12 @@ void Task_HandleOutOfBattleItemMenuInput(u8 taskId)
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
}
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
sItemMenuActions[gBagMenu->contextMenuItemsPtr[cursorPos]].func.void_u8(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sItemMenuActions[ITEMMENUACTION_CANCEL].func.void_u8(taskId);
@ -1786,13 +1786,13 @@ void Task_ChooseHowManyToToss(u8 taskId)
{
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_RemoveWindow(7);
BagMenu_TossItems(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_RemoveWindow(7);
@ -1818,7 +1818,7 @@ void Task_ActuallyToss(u8 taskId)
u16* scrollPos = &gBagPositionStruct.scrollPosition[gBagPositionStruct.pocket];
u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket];
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
RemoveBagItem(gSpecialVar_ItemId, tItemCount);
@ -1886,7 +1886,7 @@ static void BagMenu_PrintItemCantBeHeld(u8 taskId)
void sub_81AD350(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_InitListsMenu(taskId);
@ -2060,13 +2060,13 @@ static void Task_SellHowManyDialogueHandleInput(u8 taskId)
{
PrintItemSoldAmount(gBagMenu->windowPointers[8], tItemCount, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_RemoveWindow(8);
DisplaySellItemPriceAndConfirm(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_PrintCursor_(data[0], 0);
@ -2108,7 +2108,7 @@ static void BagMenu_Sell_UpdateItemListAndMoney(u8 taskId)
static void BagMenu_Sell_WaitForABPress(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
RemoveMoneyWindow();
@ -2144,13 +2144,13 @@ static void Task_ChooseHowManyToDeposit(u8 taskId)
{
PrintItemDepositAmount(gBagMenu->windowPointers[7], tItemCount);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_RemoveWindow(7);
BagMenu_TryDepositItem(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_PrintDescription(data[1]);
@ -2189,7 +2189,7 @@ static void BagMenu_Deposit_WaitForABPress(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
BagMenu_PrintDescription(data[1]);

View File

@ -792,7 +792,7 @@ static void BootUpSoundTMHM(u8 taskId)
static void Task_ShowTMHMContainedMessage(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
StringCopy(gStringVar1, gMoveNames[ItemIdToBattleMoveId(gSpecialVar_ItemId)]);
StringExpandPlaceholders(gStringVar4, gText_TMHMContainedVar1);
@ -956,7 +956,7 @@ void ItemUseInBattle_PokeBall(u8 taskId)
static void Task_CloseStatIncreaseMessage(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
if (!InBattlePyramid())
Task_FadeAndCloseBagMenu(taskId);

View File

@ -445,27 +445,27 @@ static void TestBlockTransfer(u8 nothing, u8 is, u8 used)
static void LinkTestProcessKeyInput(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
gShouldAdvanceLinkState = 1;
}
if (gMain.heldKeys & B_BUTTON)
if (JOY_HELD(B_BUTTON))
{
InitBlockSend(gHeap + 0x4000, 0x00002004);
}
if (gMain.newKeys & L_BUTTON)
if (JOY_NEW(L_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(2, 0, 0));
}
if (gMain.newKeys & START_BUTTON)
if (JOY_NEW(START_BUTTON))
{
SetSuppressLinkErrorMessage(TRUE);
}
if (gMain.newKeys & R_BUTTON)
if (JOY_NEW(R_BUTTON))
{
TrySavingData(SAVE_LINK);
}
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
SetCloseLinkCallback();
}
@ -1754,7 +1754,7 @@ static void CB2_PrintErrorMessage(void)
{
if (gWirelessCommType == 1)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_PIN);
gWirelessCommType = 0;
@ -1764,7 +1764,7 @@ static void CB2_PrintErrorMessage(void)
}
else if (gWirelessCommType == 2)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
rfu_REQ_stopMode();
rfu_waitREQComplete();

View File

@ -335,11 +335,11 @@ s32 DoMysteryGiftListMenu(const struct WindowTemplate *windowTemplate, const str
break;
case 1:
sMysteryGiftLinkMenu.currItemId = ListMenu_ProcessInput(sMysteryGiftLinkMenu.listTaskId);
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
sMysteryGiftLinkMenu.state = 2;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
sMysteryGiftLinkMenu.currItemId = LIST_CANCEL;
sMysteryGiftLinkMenu.state = 2;
@ -410,20 +410,20 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
{
struct ListMenu *list = (void*) gTasks[listTaskId].data;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
return list->template.items[list->scrollOffset + list->selectedRow].id;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return LIST_CANCEL;
}
else if (gMain.newAndRepeatedKeys & DPAD_UP)
else if (JOY_REPEAT(DPAD_UP))
{
ListMenuChangeSelection(list, TRUE, 1, FALSE);
return LIST_NOTHING_CHOSEN;
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
ListMenuChangeSelection(list, TRUE, 1, TRUE);
return LIST_NOTHING_CHOSEN;
@ -439,10 +439,12 @@ s32 ListMenu_ProcessInput(u8 listTaskId)
rightButton = FALSE;
break;
case LIST_MULTIPLE_SCROLL_DPAD:
// note: JOY_REPEAT won't match here
leftButton = gMain.newAndRepeatedKeys & DPAD_LEFT;
rightButton = gMain.newAndRepeatedKeys & DPAD_RIGHT;
break;
case LIST_MULTIPLE_SCROLL_L_R:
// same as above
leftButton = gMain.newAndRepeatedKeys & L_BUTTON;
rightButton = gMain.newAndRepeatedKeys & R_BUTTON;
break;

View File

@ -524,7 +524,7 @@ static void CB2_WaitForPaletteExitOnKeyPress(void)
static void CB2_ExitOnKeyPress(void)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
sMailRead->callback2 = CB2_ExitMailReadFreeVars;

View File

@ -282,10 +282,10 @@ static void ReadKeys(void)
// Remap L to A if the L=A option is enabled.
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_L_EQUALS_A)
{
if (gMain.newKeys & L_BUTTON)
if (JOY_NEW(L_BUTTON))
gMain.newKeys |= A_BUTTON;
if (gMain.heldKeys & L_BUTTON)
if (JOY_HELD(L_BUTTON))
gMain.heldKeys |= A_BUTTON;
}

View File

@ -695,7 +695,7 @@ static void Task_MainMenuCheckSaveFile(u8 taskId)
static void Task_WaitForSaveFileErrorWindow(u8 taskId)
{
RunTextPrinters();
if (!IsTextPrinterActive(7) && (gMain.newKeys & A_BUTTON))
if (!IsTextPrinterActive(7) && (JOY_NEW(A_BUTTON)))
{
ClearWindowTilemap(7);
ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]);
@ -730,7 +730,7 @@ static void Task_MainMenuCheckBattery(u8 taskId)
static void Task_WaitForBatteryDryErrorWindow(u8 taskId)
{
RunTextPrinters();
if (!IsTextPrinterActive(7) && (gMain.newKeys & A_BUTTON))
if (!IsTextPrinterActive(7) && (JOY_NEW(A_BUTTON)))
{
ClearWindowTilemap(7);
ClearMainMenuWindowTilemap(&sWindowTemplates_MainMenu[7]);
@ -886,14 +886,14 @@ static bool8 HandleMainMenuInput(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
IsWirelessAdapterConnected(); // why bother calling this here? debug? Task_HandleMainMenuAPressed will check too
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = Task_HandleMainMenuAPressed;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA);
@ -901,7 +901,7 @@ static bool8 HandleMainMenuInput(u8 taskId)
SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160));
gTasks[taskId].func = Task_HandleMainMenuBPressed;
}
else if ((gMain.newKeys & DPAD_UP) && tCurrItem > 0)
else if ((JOY_NEW(DPAD_UP)) && tCurrItem > 0)
{
if (tMenuType == HAS_MYSTERY_EVENTS && tIsScrolled == TRUE && tCurrItem == 1)
{
@ -913,7 +913,7 @@ static bool8 HandleMainMenuInput(u8 taskId)
sCurrItemAndOptionMenuCheck = tCurrItem;
return TRUE;
}
else if ((gMain.newKeys & DPAD_DOWN) && tCurrItem < tItemCount - 1)
else if ((JOY_NEW(DPAD_DOWN)) && tCurrItem < tItemCount - 1)
{
if (tMenuType == HAS_MYSTERY_EVENTS && tCurrItem == 3 && tIsScrolled == FALSE)
{
@ -1150,7 +1150,7 @@ static void Task_DisplayMainMenuInvalidActionError(u8 taskId)
gTasks[taskId].tCurrItem++;
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
@ -1593,7 +1593,7 @@ static void Task_NewGameBirchSpeech_WaitForWhatsYourNameToPrint(u8 taskId)
static void Task_NewGameBirchSpeech_WaitPressBeforeNameChoice(u8 taskId)
{
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
gTasks[taskId].func = Task_NewGameBirchSpeech_StartNamingScreen;

View File

@ -1252,7 +1252,7 @@ static bool32 sub_81962D8(u8 taskId)
static bool32 sub_8196330(u8 taskId)
{
s16 *taskData = gTasks[taskId].data;
if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && gMain.newKeys & (A_BUTTON | B_BUTTON))
if (!ExecuteMatchCallTextPrinter(taskData[2]) && !IsSEPlaying() && JOY_NEW(A_BUTTON | B_BUTTON))
{
FillWindowPixelBuffer(taskData[2], PIXEL_FILL(8));
CopyWindowToVram(taskData[2], 2);
@ -1345,7 +1345,7 @@ static void InitMatchCallTextPrinter(int windowId, const u8 *str)
static bool32 ExecuteMatchCallTextPrinter(int windowId)
{
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
gTextFlags.canABSpeedUpPrint = 1;
else
gTextFlags.canABSpeedUpPrint = 0;

View File

@ -981,23 +981,23 @@ u8 Menu_GetCursorPos(void)
s8 Menu_ProcessInput(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
PlaySE(SE_SELECT);
Menu_MoveCursor(-1);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
PlaySE(SE_SELECT);
Menu_MoveCursor(1);
@ -1011,23 +1011,23 @@ s8 Menu_ProcessInputNoWrap(void)
{
u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (oldPos != Menu_MoveCursorNoWrapAround(-1))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (oldPos != Menu_MoveCursorNoWrapAround(1))
PlaySE(SE_SELECT);
@ -1039,23 +1039,23 @@ s8 Menu_ProcessInputNoWrap(void)
s8 ProcessMenuInput_other(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (!sMenu.APressMuted)
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
{
PlaySE(SE_SELECT);
Menu_MoveCursor(-1);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
{
PlaySE(SE_SELECT);
Menu_MoveCursor(1);
@ -1407,34 +1407,34 @@ u8 ChangeGridMenuCursorPosition(s8 deltaX, s8 deltaY)
s8 sub_8199284(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
@ -1448,34 +1448,34 @@ s8 Menu_ProcessInputGridLayout(void)
{
u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
PlaySE(SE_SELECT);
@ -1487,34 +1487,34 @@ s8 Menu_ProcessInputGridLayout(void)
s8 sub_81993D8(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_UP);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_NONE, MENU_CURSOR_DELTA_DOWN);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_LEFT, MENU_CURSOR_DELTA_NONE);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
{
PlaySE(SE_SELECT);
ChangeListMenuCursorPosition(MENU_CURSOR_DELTA_RIGHT, MENU_CURSOR_DELTA_NONE);
@ -1529,34 +1529,34 @@ s8 sub_8199484(void)
{
u8 oldPos = sMenu.cursorPos;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
return sMenu.cursorPos;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return MENU_B_PRESSED;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
{
if (oldPos != ChangeGridMenuCursorPosition(0, -1))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
{
if (oldPos != ChangeGridMenuCursorPosition(0, 1))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT || GetLRKeysPressedAndHeld() == MENU_L_PRESSED)
{
if (oldPos != ChangeGridMenuCursorPosition(-1, 0))
PlaySE(SE_SELECT);
return MENU_NOTHING_CHOSEN;
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT || GetLRKeysPressedAndHeld() == MENU_R_PRESSED)
{
if (oldPos != ChangeGridMenuCursorPosition(1, 0))
PlaySE(SE_SELECT);

View File

@ -183,7 +183,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
{
s16 valBefore = (*arg0);
if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
if ((JOY_REPEAT(DPAD_ANY)) == DPAD_UP)
{
(*arg0)++;
if ((*arg0) > arg1)
@ -199,7 +199,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
return TRUE;
}
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_DOWN)
{
(*arg0)--;
if ((*arg0) <= 0)
@ -215,7 +215,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
return TRUE;
}
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_RIGHT)
{
(*arg0) += 10;
if ((*arg0) > arg1)
@ -231,7 +231,7 @@ bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1)
return TRUE;
}
}
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT)
else if ((JOY_REPEAT(DPAD_ANY)) == DPAD_LEFT)
{
(*arg0) -= 10;
if ((*arg0) <= 0)
@ -255,9 +255,9 @@ u8 GetLRKeysPressed(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.newKeys & L_BUTTON)
if (JOY_NEW(L_BUTTON))
return MENU_L_PRESSED;
if (gMain.newKeys & R_BUTTON)
if (JOY_NEW(R_BUTTON))
return MENU_R_PRESSED;
}
@ -268,9 +268,9 @@ u8 GetLRKeysPressedAndHeld(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.newAndRepeatedKeys & L_BUTTON)
if (JOY_REPEAT(L_BUTTON))
return MENU_L_PRESSED;
if (gMain.newAndRepeatedKeys & R_BUTTON)
if (JOY_REPEAT(R_BUTTON))
return MENU_R_PRESSED;
}

View File

@ -394,7 +394,7 @@ bool8 MonMarkingsMenuHandleInput(void)
{
u16 i;
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
s8 pos;
PlaySE(SE_SELECT);
@ -404,7 +404,7 @@ bool8 MonMarkingsMenuHandleInput(void)
return TRUE;
}
if (gMain.newKeys & DPAD_DOWN)
if (JOY_NEW(DPAD_DOWN))
{
s8 pos;
PlaySE(SE_SELECT);
@ -414,7 +414,7 @@ bool8 MonMarkingsMenuHandleInput(void)
return TRUE;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@ -433,7 +433,7 @@ bool8 MonMarkingsMenuHandleInput(void)
return TRUE;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
return FALSE;

View File

@ -732,7 +732,7 @@ static void DoMoveRelearnerMain(void)
}
break;
case MENU_STATE_WAIT_FOR_A_BUTTON:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
sMoveRelearnerStruct->state = MENU_STATE_FADE_AND_RETURN;
@ -778,7 +778,7 @@ static void HandleInput(bool8 showContest)
switch (itemId)
{
case LIST_NOTHING_CHOSEN:
if (!(gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysPressed())
if (!(JOY_NEW(DPAD_LEFT | DPAD_RIGHT)) && !GetLRKeysPressed())
{
break;
}

View File

@ -163,7 +163,7 @@ static void CB2_MysteryEventMenu(void)
PrintMysteryMenuText(0, gText_PressAToLoadEvent, 1, 2, 1);
gMain.state++;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
CloseLink();
@ -177,7 +177,7 @@ static void CB2_MysteryEventMenu(void)
case 5:
if (GetLinkPlayerCount_2() == 2)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
CheckShouldAdvanceLinkState();
@ -187,7 +187,7 @@ static void CB2_MysteryEventMenu(void)
CopyWindowToVram(1, 3);
gMain.state++;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
CloseLink();
@ -227,7 +227,7 @@ static void CB2_MysteryEventMenu(void)
}
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
CloseLink();
@ -274,7 +274,7 @@ static void CB2_MysteryEventMenu(void)
}
break;
case 14:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
gMain.state++;

View File

@ -561,7 +561,7 @@ bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str)
goto inc;
case 1:
DrawDownArrow(1, 0xD0, 0x14, 1, FALSE, &sDownArrowCounterAndYCoordIdx[0], &sDownArrowCounterAndYCoordIdx[1]);
if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
if (({JOY_NEW(A_BUTTON | B_BUTTON);}))
{
inc:
(*textState)++;
@ -595,7 +595,7 @@ bool32 unref_HideDownArrowAndWaitButton(u8 * textState)
{
case 0:
HideDownArrow();
if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
if (({JOY_NEW(A_BUTTON | B_BUTTON);}))
{
(*textState)++;
}
@ -930,7 +930,7 @@ static bool32 mevent_save_game(u8 * state)
(*state)++;
break;
case 3:
if (({gMain.newKeys & (A_BUTTON | B_BUTTON);}))
if (({JOY_NEW(A_BUTTON | B_BUTTON);}))
{
(*state)++;
}
@ -1458,11 +1458,11 @@ void task00_mystery_gift(u8 taskId)
case 20:
if (data->IsCardOrNews == 0)
{
if (({gMain.newKeys & A_BUTTON;}))
if (({JOY_NEW(A_BUTTON);}))
{
data->state = 21;
}
if (({gMain.newKeys & B_BUTTON;}))
if (({JOY_NEW(B_BUTTON);}))
{
data->state = 27;
}

View File

@ -271,16 +271,16 @@ static void Task_OptionMenuFadeIn(u8 taskId)
static void Task_OptionMenuProcessInput(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (gTasks[taskId].data[TD_MENUSELECTION] == MENUITEM_CANCEL)
gTasks[taskId].func = Task_OptionMenuSave;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
gTasks[taskId].func = Task_OptionMenuSave;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (gTasks[taskId].data[TD_MENUSELECTION] > 0)
gTasks[taskId].data[TD_MENUSELECTION]--;
@ -288,7 +288,7 @@ static void Task_OptionMenuProcessInput(u8 taskId)
gTasks[taskId].data[TD_MENUSELECTION] = MENUITEM_CANCEL;
HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]);
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (gTasks[taskId].data[TD_MENUSELECTION] < MENUITEM_CANCEL)
gTasks[taskId].data[TD_MENUSELECTION]++;
@ -405,7 +405,7 @@ static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style)
static u8 TextSpeed_ProcessInput(u8 selection)
{
if (gMain.newKeys & DPAD_RIGHT)
if (JOY_NEW(DPAD_RIGHT))
{
if (selection <= 1)
selection++;
@ -414,7 +414,7 @@ static u8 TextSpeed_ProcessInput(u8 selection)
sArrowPressed = TRUE;
}
if (gMain.newKeys & DPAD_LEFT)
if (JOY_NEW(DPAD_LEFT))
{
if (selection != 0)
selection--;
@ -451,7 +451,7 @@ static void TextSpeed_DrawChoices(u8 selection)
static u8 BattleScene_ProcessInput(u8 selection)
{
if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT))
if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT))
{
selection ^= 1;
sArrowPressed = TRUE;
@ -474,7 +474,7 @@ static void BattleScene_DrawChoices(u8 selection)
static u8 BattleStyle_ProcessInput(u8 selection)
{
if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT))
if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT))
{
selection ^= 1;
sArrowPressed = TRUE;
@ -497,7 +497,7 @@ static void BattleStyle_DrawChoices(u8 selection)
static u8 Sound_ProcessInput(u8 selection)
{
if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT))
if (JOY_NEW(DPAD_LEFT | DPAD_RIGHT))
{
selection ^= 1;
SetPokemonCryStereo(selection);
@ -521,7 +521,7 @@ static void Sound_DrawChoices(u8 selection)
static u8 FrameType_ProcessInput(u8 selection)
{
if (gMain.newKeys & DPAD_RIGHT)
if (JOY_NEW(DPAD_RIGHT))
{
if (selection < WINDOW_FRAMES_COUNT - 1)
selection++;
@ -532,7 +532,7 @@ static u8 FrameType_ProcessInput(u8 selection)
LoadPalette(GetWindowFrameTilesPal(selection)->pal, 0x70, 0x20);
sArrowPressed = TRUE;
}
if (gMain.newKeys & DPAD_LEFT)
if (JOY_NEW(DPAD_LEFT))
{
if (selection != 0)
selection--;
@ -579,7 +579,7 @@ static void FrameType_DrawChoices(u8 selection)
static u8 ButtonMode_ProcessInput(u8 selection)
{
if (gMain.newKeys & DPAD_RIGHT)
if (JOY_NEW(DPAD_RIGHT))
{
if (selection <= 1)
selection++;
@ -588,7 +588,7 @@ static u8 ButtonMode_ProcessInput(u8 selection)
sArrowPressed = TRUE;
}
if (gMain.newKeys & DPAD_LEFT)
if (JOY_NEW(DPAD_LEFT))
{
if (selection != 0)
selection--;

View File

@ -2453,19 +2453,18 @@ static void UpdateHeldKeyCode(u16 key)
static u16 KeyInterCB_ReadButtons(u32 key)
{
if (gMain.heldKeys & DPAD_UP)
if (JOY_HELD(DPAD_UP))
return LINK_KEY_CODE_DPAD_UP;
else if (gMain.heldKeys & DPAD_DOWN)
if (JOY_HELD(DPAD_DOWN))
return LINK_KEY_CODE_DPAD_DOWN;
else if (gMain.heldKeys & DPAD_LEFT)
if (JOY_HELD(DPAD_LEFT))
return LINK_KEY_CODE_DPAD_LEFT;
else if (gMain.heldKeys & DPAD_RIGHT)
if (JOY_HELD(DPAD_RIGHT))
return LINK_KEY_CODE_DPAD_RIGHT;
else if (gMain.newKeys & START_BUTTON)
if (JOY_NEW(START_BUTTON))
return LINK_KEY_CODE_START_BUTTON;
else if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
return LINK_KEY_CODE_A_BUTTON;
else
return LINK_KEY_CODE_EMPTY;
}
@ -2573,7 +2572,7 @@ static u16 sub_8087170(u32 keyOrPlayerId)
{
if (sPlayerTradingStates[keyOrPlayerId] == PLAYER_TRADING_STATE_UNK_2)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
SetKeyInterceptCallback(KeyInterCB_DoNothingAndKeepAlive);
return LINK_KEY_CODE_UNK_7;

View File

@ -1410,7 +1410,7 @@ static u16 PartyMenuButtonHandler(s8 *slotPtr)
break;
}
if (gMain.newKeys & START_BUTTON)
if (JOY_NEW(START_BUTTON))
return 8;
if (movementDir)
@ -1420,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)
@ -3764,7 +3764,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);
}
@ -4721,7 +4721,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);
@ -4930,7 +4930,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);
@ -4940,7 +4940,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);
@ -4971,7 +4971,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);
@ -5608,7 +5608,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);

View File

@ -1134,7 +1134,7 @@ static void ItemStorage_ProcessInput(u8 taskId)
s32 id;
data = gTasks[taskId].data;
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
if ((playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos) != (playerPCItemPageInfo.count - 1))
@ -1212,7 +1212,7 @@ static void sub_816C4FC(u8 taskId)
s32 id;
data = gTasks[taskId].data;
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
ListMenuGetScrollAndRow(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
ItemStorage_DoItemSwap(taskId, FALSE);
@ -1227,7 +1227,7 @@ static void sub_816C4FC(u8 taskId)
case LIST_NOTHING_CHOSEN:
break;
case LIST_CANCEL:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
ItemStorage_DoItemSwap(taskId, FALSE);
}
@ -1332,7 +1332,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId)
sub_816C6BC(sub_816BC7C(4), data[2], STR_CONV_MODE_LEADING_ZEROS, 8, 1, 3);
else
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
sub_816BCC4(4);
@ -1341,7 +1341,7 @@ static void ItemStorage_HandleQuantityRolling(u8 taskId)
else
ItemStorage_DoItemToss(taskId);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
sub_816BCC4(4);
@ -1412,7 +1412,7 @@ static void ItemStorage_HandleRemoveItem(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
RemovePCItem((playerPCItemPageInfo.cursorPos + playerPCItemPageInfo.itemsAbove), data[2]);
DestroyListMenuTask(data[5], &(playerPCItemPageInfo.itemsAbove), &(playerPCItemPageInfo.cursorPos));
@ -1429,7 +1429,7 @@ static void ItemStorage_WaitPressHandleResumeProcessInput(u8 taskId)
s16 *data;
data = gTasks[taskId].data;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
ItemStorage_PrintItemPcResponse(ItemStorage_GetItemPcResponse(gSaveBlock1Ptr->pcItems[(playerPCItemPageInfo.itemsAbove + playerPCItemPageInfo.cursorPos)].itemId));
ItemStorage_StartScrollIndicatorAndProcessInput(taskId);

View File

@ -984,7 +984,7 @@ static void Task_HandlePokeblockMenuInput(u8 taskId)
if (!gPaletteFade.active && MenuHelpers_CallLinkSomething() != TRUE)
{
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
if (sSavedPokeblockData.lastItemPage + sSavedPokeblockData.lastItemPos != sPokeblockMenu->itemsNo - 1)
@ -1035,7 +1035,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
if (MenuHelpers_CallLinkSomething() == TRUE)
return;
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
PlaySE(SE_SELECT);
ListMenuGetScrollAndRow(data[0], &sSavedPokeblockData.lastItemPage, &sSavedPokeblockData.lastItemPos);
@ -1069,7 +1069,7 @@ static void Task_HandlePokeblocksSwapInput(u8 taskId)
break;
case LIST_CANCEL: // same id as STOW CASE field
PlaySE(SE_SELECT);
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
HandlePokeblocksSwap(taskId, FALSE);
else
HandlePokeblocksSwap(taskId, TRUE);
@ -1193,7 +1193,7 @@ static void TossPokeblockChoice_Yes(u8 taskId)
static void HandleErasePokeblock(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
s16 *data;
u16 *lastPage, *lastPos;

View File

@ -1672,7 +1672,7 @@ static void Task_HandlePokedexInput(u8 taskId)
}
else
{
if ((gMain.newKeys & A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
{
UpdateSelectedMonSpriteId();
BeginNormalPaletteFade(~(1 << (gSprites[sPokedexView->selectedMonSpriteId].oam.paletteNum + 16)), 0, 0, 0x10, RGB_BLACK);
@ -1681,7 +1681,7 @@ static void Task_HandlePokedexInput(u8 taskId)
PlaySE(SE_PIN);
FreeWindowAndBgBuffers();
}
else if (gMain.newKeys & START_BUTTON)
else if (JOY_NEW(START_BUTTON))
{
sPokedexView->menuY = 0;
sPokedexView->menuIsOpen = TRUE;
@ -1689,7 +1689,7 @@ static void Task_HandlePokedexInput(u8 taskId)
gTasks[taskId].func = Task_HandlePokedexStartMenuInput;
PlaySE(SE_SELECT);
}
else if (gMain.newKeys & SELECT_BUTTON)
else if (JOY_NEW(SELECT_BUTTON))
{
PlaySE(SE_SELECT);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
@ -1703,7 +1703,7 @@ static void Task_HandlePokedexInput(u8 taskId)
PlaySE(SE_PC_LOGIN);
FreeWindowAndBgBuffers();
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = Task_ClosePokedex;
@ -1736,7 +1736,7 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId)
}
else
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (sPokedexView->menuCursorPos)
{
@ -1767,18 +1767,18 @@ static void Task_HandlePokedexStartMenuInput(u8 taskId)
}
//Exit menu when Start or B is pressed
if (gMain.newKeys & (START_BUTTON | B_BUTTON))
if (JOY_NEW(START_BUTTON | B_BUTTON))
{
sPokedexView->menuIsOpen = FALSE;
gTasks[taskId].func = Task_HandlePokedexInput;
PlaySE(SE_SELECT);
}
else if ((gMain.newAndRepeatedKeys & DPAD_UP) && sPokedexView->menuCursorPos != 0)
else if ((JOY_REPEAT(DPAD_UP)) && sPokedexView->menuCursorPos != 0)
{
sPokedexView->menuCursorPos--;
PlaySE(SE_SELECT);
}
else if ((gMain.newAndRepeatedKeys & DPAD_DOWN) && sPokedexView->menuCursorPos < 3)
else if ((JOY_REPEAT(DPAD_DOWN)) && sPokedexView->menuCursorPos < 3)
{
sPokedexView->menuCursorPos++;
PlaySE(SE_SELECT);
@ -1872,7 +1872,7 @@ static void Task_HandleSearchResultsInput(u8 taskId)
}
else
{
if ((gMain.newKeys & A_BUTTON) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
if ((JOY_NEW(A_BUTTON)) && sPokedexView->pokedexList[sPokedexView->selectedPokemon].seen)
{
u32 a;
@ -1884,7 +1884,7 @@ static void Task_HandleSearchResultsInput(u8 taskId)
PlaySE(SE_PIN);
FreeWindowAndBgBuffers();
}
else if (gMain.newKeys & START_BUTTON)
else if (JOY_NEW(START_BUTTON))
{
sPokedexView->menuY = 0;
sPokedexView->menuIsOpen = TRUE;
@ -1892,7 +1892,7 @@ static void Task_HandleSearchResultsInput(u8 taskId)
gTasks[taskId].func = Task_HandleSearchResultsStartMenuInput;
PlaySE(SE_SELECT);
}
else if (gMain.newKeys & SELECT_BUTTON)
else if (JOY_NEW(SELECT_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].tTaskId = LoadSearchMenu();
@ -1901,7 +1901,7 @@ static void Task_HandleSearchResultsInput(u8 taskId)
PlaySE(SE_PC_LOGIN);
FreeWindowAndBgBuffers();
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = Task_ReturnToPokedexFromSearchResults;
@ -1933,7 +1933,7 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId)
}
else
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (sPokedexView->menuCursorPos)
{
@ -1969,18 +1969,18 @@ static void Task_HandleSearchResultsStartMenuInput(u8 taskId)
}
//Exit menu when Start or B is pressed
if (gMain.newKeys & (START_BUTTON | B_BUTTON))
if (JOY_NEW(START_BUTTON | B_BUTTON))
{
sPokedexView->menuIsOpen = FALSE;
gTasks[taskId].func = Task_HandleSearchResultsInput;
PlaySE(SE_SELECT);
}
else if ((gMain.newAndRepeatedKeys & DPAD_UP) && sPokedexView->menuCursorPos)
else if ((JOY_REPEAT(DPAD_UP)) && sPokedexView->menuCursorPos)
{
sPokedexView->menuCursorPos--;
PlaySE(SE_SELECT);
}
else if ((gMain.newAndRepeatedKeys & DPAD_DOWN) && sPokedexView->menuCursorPos < 4)
else if ((JOY_REPEAT(DPAD_DOWN)) && sPokedexView->menuCursorPos < 4)
{
sPokedexView->menuCursorPos++;
PlaySE(SE_SELECT);
@ -2589,7 +2589,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
u16 startingPos;
u8 scrollDir = 0;
if ((gMain.heldKeys & DPAD_UP) && (selectedMon > 0))
if ((JOY_HELD(DPAD_UP)) && (selectedMon > 0))
{
scrollDir = 1;
selectedMon = GetNextPosition(1, selectedMon, 0, sPokedexView->pokemonListCount - 1);
@ -2597,7 +2597,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
CreateMonListEntry(1, selectedMon, ignored);
PlaySE(SE_DEX_SCROLL);
}
else if ((gMain.heldKeys & DPAD_DOWN) && (selectedMon < sPokedexView->pokemonListCount - 1))
else if ((JOY_HELD(DPAD_DOWN)) && (selectedMon < sPokedexView->pokemonListCount - 1))
{
scrollDir = 2;
selectedMon = GetNextPosition(0, selectedMon, 0, sPokedexView->pokemonListCount - 1);
@ -2605,7 +2605,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
CreateMonListEntry(2, selectedMon, ignored);
PlaySE(SE_DEX_SCROLL);
}
else if ((gMain.newKeys & DPAD_LEFT) && (selectedMon > 0))
else if ((JOY_NEW(DPAD_LEFT)) && (selectedMon > 0))
{
startingPos = selectedMon;
@ -2616,7 +2616,7 @@ static u16 TryDoPokedexScroll(u16 selectedMon, u16 ignored)
CreateMonSpritesAtPos(selectedMon, 0xE);
PlaySE(SE_DEX_PAGE);
}
else if ((gMain.newKeys & DPAD_RIGHT) && (selectedMon < sPokedexView->pokemonListCount - 1))
else if ((JOY_NEW(DPAD_RIGHT)) && (selectedMon < sPokedexView->pokemonListCount - 1))
{
startingPos = selectedMon;
for (i = 0; i < 7; i++)
@ -2665,7 +2665,7 @@ static bool8 TryDoInfoScreenScroll(void)
u16 nextPokemon;
u16 selectedPokemon = sPokedexView->selectedPokemon;
if ((gMain.newKeys & DPAD_UP) && selectedPokemon)
if ((JOY_NEW(DPAD_UP)) && selectedPokemon)
{
nextPokemon = selectedPokemon;
while (nextPokemon != 0)
@ -2688,7 +2688,7 @@ static bool8 TryDoInfoScreenScroll(void)
return TRUE;
}
}
else if ((gMain.newKeys & DPAD_DOWN) && selectedPokemon < sPokedexView->pokemonListCount - 1)
else if ((JOY_NEW(DPAD_DOWN)) && selectedPokemon < sPokedexView->pokemonListCount - 1)
{
nextPokemon = selectedPokemon;
while (nextPokemon < sPokedexView->pokemonListCount - 1)
@ -3355,14 +3355,14 @@ static void Task_HandleInfoScreenInput(u8 taskId)
PlaySE(SE_DEX_SCROLL);
return;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
gTasks[taskId].func = Task_ExitInfoScreen;
PlaySE(SE_PC_OFF);
return;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (sPokedexView->selectedScreen)
{
@ -3399,8 +3399,8 @@ static void Task_HandleInfoScreenInput(u8 taskId)
}
return;
}
if (((gMain.newKeys & DPAD_LEFT)
|| ((gMain.newKeys & L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if (((JOY_NEW(DPAD_LEFT))
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
&& sPokedexView->selectedScreen > 0)
{
sPokedexView->selectedScreen--;
@ -3408,8 +3408,8 @@ static void Task_HandleInfoScreenInput(u8 taskId)
PlaySE(SE_DEX_PAGE);
return;
}
if (((gMain.newKeys & DPAD_RIGHT)
|| ((gMain.newKeys & R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if (((JOY_NEW(DPAD_RIGHT))
|| ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
&& sPokedexView->selectedScreen < CANCEL_SCREEN)
{
sPokedexView->selectedScreen++;
@ -3629,7 +3629,7 @@ static void Task_HandleCryScreenInput(u8 taskId)
else
LoadPlayArrowPalette(FALSE);
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
LoadPlayArrowPalette(TRUE);
CryScreenPlayButton(NationalPokedexNumToSpecies(sPokedexListItem->dexNum));
@ -3637,7 +3637,7 @@ static void Task_HandleCryScreenInput(u8 taskId)
}
else if (!gPaletteFade.active)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK);
m4aMPlayContinue(&gMPlayInfo_BGM);
@ -3646,8 +3646,8 @@ static void Task_HandleCryScreenInput(u8 taskId)
PlaySE(SE_PC_OFF);
return;
}
if ((gMain.newKeys & DPAD_LEFT)
|| ((gMain.newKeys & L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if ((JOY_NEW(DPAD_LEFT))
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK);
m4aMPlayContinue(&gMPlayInfo_BGM);
@ -3656,8 +3656,8 @@ static void Task_HandleCryScreenInput(u8 taskId)
PlaySE(SE_DEX_PAGE);
return;
}
if ((gMain.newKeys & DPAD_RIGHT)
|| ((gMain.newKeys & R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
if ((JOY_NEW(DPAD_RIGHT))
|| ((JOY_NEW(R_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
if (!sPokedexListItem->owned)
{
@ -3809,15 +3809,15 @@ static void Task_LoadSizeScreen(u8 taskId)
static void Task_HandleSizeScreenInput(u8 taskId)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK);
sPokedexView->screenSwitchState = 1;
gTasks[taskId].func = Task_SwitchScreensFromSizeScreen;
PlaySE(SE_PC_OFF);
}
else if ((gMain.newKeys & DPAD_LEFT)
|| ((gMain.newKeys & L_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
else if ((JOY_NEW(DPAD_LEFT))
|| ((JOY_NEW(L_BUTTON)) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
BeginNormalPaletteFade(0xFFFFFFEB, 0, 0, 0x10, RGB_BLACK);
sPokedexView->screenSwitchState = 2;
@ -4009,7 +4009,7 @@ static void Task_DisplayCaughtMonDexPage(u8 taskId)
static void Task_HandleCaughtMonPageInput(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
BeginNormalPaletteFade(0x0000FFFF, 0, 0, 16, RGB_BLACK);
gSprites[gTasks[taskId].tMonSpriteId].callback = SpriteCB_SlideCaughtMonToCenter;
@ -4898,13 +4898,13 @@ static void Task_SwitchToSearchMenuTopBar(u8 taskId)
static void Task_HandleSearchTopBarInput(u8 taskId)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_PC_OFF);
gTasks[taskId].func = Task_ExitSearch;
return;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (gTasks[taskId].tTopBarItem)
{
@ -4925,7 +4925,7 @@ static void Task_HandleSearchTopBarInput(u8 taskId)
}
return;
}
if ((gMain.newKeys & DPAD_LEFT) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH)
if ((JOY_NEW(DPAD_LEFT)) && gTasks[taskId].tTopBarItem > SEARCH_TOPBAR_SEARCH)
{
PlaySE(SE_DEX_PAGE);
gTasks[taskId].tTopBarItem--;
@ -4933,7 +4933,7 @@ static void Task_HandleSearchTopBarInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((gMain.newKeys & DPAD_RIGHT) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL)
if ((JOY_NEW(DPAD_RIGHT)) && gTasks[taskId].tTopBarItem < SEARCH_TOPBAR_CANCEL)
{
PlaySE(SE_DEX_PAGE);
gTasks[taskId].tTopBarItem++;
@ -4972,14 +4972,14 @@ static void Task_HandleSearchMenuInput(u8 taskId)
movementMap = sSearchMovementMap_SearchNatDex;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_BALL);
SetDefaultSearchModeAndOrder(taskId);
gTasks[taskId].func = Task_SwitchToSearchMenuTopBar;
return;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (gTasks[taskId].tMenuItem == SEARCH_OK)
{
@ -5014,7 +5014,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
return;
}
if ((gMain.newKeys & DPAD_LEFT) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF)
if ((JOY_NEW(DPAD_LEFT)) && movementMap[gTasks[taskId].tMenuItem][0] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][0];
@ -5022,7 +5022,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((gMain.newKeys & DPAD_RIGHT) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF)
if ((JOY_NEW(DPAD_RIGHT)) && movementMap[gTasks[taskId].tMenuItem][1] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][1];
@ -5030,7 +5030,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((gMain.newKeys & DPAD_UP) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF)
if ((JOY_NEW(DPAD_UP)) && movementMap[gTasks[taskId].tMenuItem][2] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][2];
@ -5038,7 +5038,7 @@ static void Task_HandleSearchMenuInput(u8 taskId)
CopyWindowToVram(0, 2);
CopyBgTilemapBufferToVram(3);
}
if ((gMain.newKeys & DPAD_DOWN) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF)
if ((JOY_NEW(DPAD_DOWN)) && movementMap[gTasks[taskId].tMenuItem][3] != 0xFF)
{
PlaySE(SE_SELECT);
gTasks[taskId].tMenuItem = movementMap[gTasks[taskId].tMenuItem][3];
@ -5082,7 +5082,7 @@ static void Task_WaitAndCompleteSearch(u8 taskId)
static void Task_SearchCompleteWaitForInput(u8 taskId)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (sPokedexView->pokemonListCount != 0)
{
@ -5135,7 +5135,7 @@ static void Task_HandleSearchParameterInput(u8 taskId)
cursorPos = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataCursorPos];
scrollOffset = &gTasks[taskId].data[sSearchOptions[menuItem].taskDataScrollOffset];
maxOption = sSearchOptions[menuItem].numOptions - 1;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_PIN);
ClearSearchParameterBoxText();
@ -5145,7 +5145,7 @@ static void Task_HandleSearchParameterInput(u8 taskId)
CopyBgTilemapBufferToVram(3);
return;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_BALL);
ClearSearchParameterBoxText();
@ -5158,7 +5158,7 @@ static void Task_HandleSearchParameterInput(u8 taskId)
return;
}
moved = FALSE;
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
if (*cursorPos != 0)
{
@ -5184,7 +5184,7 @@ static void Task_HandleSearchParameterInput(u8 taskId)
}
return;
}
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
if (JOY_REPEAT(DPAD_DOWN))
{
if (*cursorPos < MAX_SEARCH_PARAM_CURSOR_POS && *cursorPos < maxOption)
{

View File

@ -723,12 +723,12 @@ static void Task_HandlePokedexAreaScreenInput(u8 taskId)
return;
break;
case 1:
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
gTasks[taskId].data[1] = 1;
PlaySE(SE_PC_OFF);
}
else if (gMain.newKeys & DPAD_RIGHT || (gMain.newKeys & R_BUTTON && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
else if (JOY_NEW(DPAD_RIGHT) || (JOY_NEW(R_BUTTON) && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR))
{
gTasks[taskId].data[1] = 2;
PlaySE(SE_DEX_PAGE);

View File

@ -1244,7 +1244,7 @@ static bool32 sub_802B8CC(void)
break;
// fall through
case 1:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
sub_802C164();
sub_802AE14(3);
@ -1335,7 +1335,7 @@ static bool32 sub_802BA58(void)
case 2:
case 5:
gUnknown_02022CFC->unk3C++;
if (gMain.newKeys & (A_BUTTON | B_BUTTON) || gUnknown_02022CFC->unk3C > 180)
if (JOY_NEW(A_BUTTON | B_BUTTON) || gUnknown_02022CFC->unk3C > 180)
{
sub_802DA14();
gUnknown_02022CFC->unkA++;
@ -3921,7 +3921,7 @@ static void Task_ShowPokemonJumpRecords(u8 taskId)
data[0]++;
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
rbox_fill_rectangle(data[1]);
CopyWindowToVram(data[1], 1);

View File

@ -1755,10 +1755,10 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
{
case MENU_NOTHING_CHOSEN:
task->data[3] = task->data[1];
if (gMain.newKeys & DPAD_UP && --task->data[3] < 0)
if (JOY_NEW(DPAD_UP) && --task->data[3] < 0)
task->data[3] = 4;
if (gMain.newKeys & DPAD_DOWN && ++task->data[3] > 4)
if (JOY_NEW(DPAD_DOWN) && ++task->data[3] > 4)
task->data[3] = 0;
if (task->data[1] != task->data[3])
{
@ -1797,13 +1797,13 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
}
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
FillWindowPixelBuffer(0, PIXEL_FILL(1));
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
else if (gMain.newKeys & DPAD_UP)
else if (JOY_NEW(DPAD_UP))
{
if (--task->data[1] < 0)
task->data[1] = 4;
@ -1813,7 +1813,7 @@ static void Task_PokemonStorageSystemPC(u8 taskId)
AddTextPrinterParameterized2(0, 1, gUnknown_085716C0[task->data[1]].desc, 0, NULL, 2, 1, 3);
task->data[0] = 2;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
if (++task->data[1] > 3)
task->data[1] = 0;
@ -1975,22 +1975,22 @@ static void sub_80C78E4(void)
static u8 HandleBoxChooseSelectionInput(void)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
return 201;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
return gUnknown_02039D04->curBox;
}
if (gMain.newKeys & DPAD_LEFT)
if (JOY_NEW(DPAD_LEFT))
{
PlaySE(SE_SELECT);
sub_80C7BB4();
}
else if (gMain.newKeys & DPAD_RIGHT)
else if (JOY_NEW(DPAD_RIGHT))
{
PlaySE(SE_SELECT);
sub_80C7B80();
@ -2392,7 +2392,7 @@ static void Cb_ReshowPSS(u8 taskId)
}
break;
case 2:
if (!IsDma3ManagerBusyWithBgCopy() && gMain.newKeys & (A_BUTTON | B_BUTTON))
if (!IsDma3ManagerBusyWithBgCopy() && JOY_NEW(A_BUTTON | B_BUTTON))
{
ClearBottomWindow();
sPSSData->state++;
@ -2614,7 +2614,7 @@ static void Cb_MainPSS(u8 taskId)
}
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sPSSData->state = 0;
@ -2631,7 +2631,7 @@ static void Cb_MainPSS(u8 taskId)
sPSSData->state = 6;
break;
case 6:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -2857,7 +2857,7 @@ static void Cb_OnSelectedMon(u8 taskId)
sPSSData->state = 6;
break;
case 6:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -2942,7 +2942,7 @@ static void Cb_WithdrawMon(u8 taskId)
}
break;
case 1:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -3033,7 +3033,7 @@ static void Cb_DepositMenu(u8 taskId)
}
break;
case 4:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
PrintStorageActionText(PC_TEXT_DEPOSIT_IN_WHICH_BOX);
sPSSData->state = 1;
@ -3094,14 +3094,14 @@ static void Cb_ReleaseMon(u8 taskId)
sPSSData->state++;
break;
case 4:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
PrintStorageActionText(PC_TEXT_BYE_BYE);
sPSSData->state++;
}
break;
case 5:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
if (sInPartyMenu)
@ -3133,14 +3133,14 @@ static void Cb_ReleaseMon(u8 taskId)
sPSSData->state++;
break;
case 9:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
PrintStorageActionText(PC_TEXT_SURPRISE);
sPSSData->state++;
}
break;
case 10:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sub_80CC064();
@ -3156,14 +3156,14 @@ static void Cb_ReleaseMon(u8 taskId)
}
break;
case 12:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
PrintStorageActionText(PC_TEXT_WORRIED);
sPSSData->state++;
}
break;
case 13:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -3256,7 +3256,7 @@ static void Cb_GiveMovingItemToMon(u8 taskId)
}
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sPSSData->state++;
@ -3295,7 +3295,7 @@ static void Cb_ItemToBag(u8 taskId)
}
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sub_80CE00C();
@ -3308,7 +3308,7 @@ static void Cb_ItemToBag(u8 taskId)
SetPSSCallback(Cb_MainPSS);
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -3348,7 +3348,7 @@ static void Cb_SwitchSelectedItem(u8 taskId)
}
break;
case 3:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sPSSData->state++;
@ -3387,7 +3387,7 @@ static void Cb_ShowItemInfo(u8 taskId)
sPSSData->state++;
break;
case 4:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
PlaySE(SE_WIN_OPEN);
sPSSData->state++;
@ -3437,7 +3437,7 @@ static void Cb_CloseBoxWhileHoldingItem(u8 taskId)
}
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sPSSData->state = 5;
@ -3493,7 +3493,7 @@ static void Cb_PrintCantStoreMail(u8 taskId)
sPSSData->state++;
break;
case 2:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
sPSSData->state++;
@ -3758,7 +3758,7 @@ static void Cb_OnCloseBoxPressed(u8 taskId)
}
break;
case 1:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -3819,7 +3819,7 @@ static void Cb_OnBPressed(u8 taskId)
}
break;
case 1:
if (gMain.newKeys & (A_BUTTON | B_BUTTON | DPAD_ANY))
if (JOY_NEW(A_BUTTON | B_BUTTON | DPAD_ANY))
{
ClearBottomWindow();
SetPSSCallback(Cb_MainPSS);
@ -5461,7 +5461,7 @@ static void sub_80CCA3C(const void *tilemap, s8 direction, u8 arg2)
if (direction == 0)
return;
else if (direction > 0)
if (direction > 0)
x *= 1, x += 0x14; // x * 1 is needed to match, but can be safely removed as it makes no functional difference
else
x -= 4;
@ -6939,7 +6939,7 @@ static u8 InBoxInput_Normal(void)
sPSSData->field_CD3 = 0;
sPSSData->field_CD7 = 0;
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
retVal = TRUE;
if (sBoxCursorPosition >= IN_BOX_ROWS)
@ -6953,7 +6953,7 @@ static u8 InBoxInput_Normal(void)
}
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
retVal = TRUE;
cursorPosition += IN_BOX_ROWS;
@ -6967,7 +6967,7 @@ static u8 InBoxInput_Normal(void)
}
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
else if (JOY_REPEAT(DPAD_LEFT))
{
retVal = TRUE;
if (sBoxCursorPosition % IN_BOX_ROWS != 0)
@ -6981,7 +6981,7 @@ static u8 InBoxInput_Normal(void)
}
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
retVal = TRUE;
if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0)
@ -6995,7 +6995,7 @@ static u8 InBoxInput_Normal(void)
}
break;
}
else if (gMain.newKeys & START_BUTTON)
else if (JOY_NEW(START_BUTTON))
{
retVal = TRUE;
cursorArea = CURSOR_AREA_BOX;
@ -7003,7 +7003,7 @@ static u8 InBoxInput_Normal(void)
break;
}
if ((gMain.newKeys & A_BUTTON) && sub_80CFA5C())
if ((JOY_NEW(A_BUTTON)) && sub_80CFA5C())
{
if (!sCanOnlyMove)
return 8;
@ -7037,18 +7037,18 @@ static u8 InBoxInput_Normal(void)
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
return 19;
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.heldKeys & L_BUTTON)
if (JOY_HELD(L_BUTTON))
return 10;
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
return 9;
}
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
sub_80CFDC4();
return 0;
@ -7066,9 +7066,9 @@ static u8 InBoxInput_Normal(void)
static u8 InBoxInput_GrabbingMultiple(void)
{
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
if (sBoxCursorPosition / IN_BOX_ROWS != 0)
{
@ -7080,7 +7080,7 @@ static u8 InBoxInput_GrabbingMultiple(void)
return 24;
}
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
if (sBoxCursorPosition + IN_BOX_ROWS < IN_BOX_COUNT)
{
@ -7092,7 +7092,7 @@ static u8 InBoxInput_GrabbingMultiple(void)
return 24;
}
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
else if (JOY_REPEAT(DPAD_LEFT))
{
if (sBoxCursorPosition % IN_BOX_ROWS != 0)
{
@ -7104,7 +7104,7 @@ static u8 InBoxInput_GrabbingMultiple(void)
return 24;
}
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
if ((sBoxCursorPosition + 1) % IN_BOX_ROWS != 0)
{
@ -7141,7 +7141,7 @@ static u8 InBoxInput_GrabbingMultiple(void)
static u8 InBoxInput_MovingMultiple(void)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
if (sub_80D0580(0))
{
@ -7153,7 +7153,7 @@ static u8 InBoxInput_MovingMultiple(void)
return 24;
}
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
if (sub_80D0580(1))
{
@ -7165,7 +7165,7 @@ static u8 InBoxInput_MovingMultiple(void)
return 24;
}
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
else if (JOY_REPEAT(DPAD_LEFT))
{
if (sub_80D0580(2))
{
@ -7177,7 +7177,7 @@ static u8 InBoxInput_MovingMultiple(void)
return 10;
}
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
if (sub_80D0580(3))
{
@ -7189,7 +7189,7 @@ static u8 InBoxInput_MovingMultiple(void)
return 9;
}
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (sub_80D0BC0())
{
@ -7202,7 +7202,7 @@ static u8 InBoxInput_MovingMultiple(void)
return 24;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return 24;
}
@ -7210,9 +7210,9 @@ static u8 InBoxInput_MovingMultiple(void)
{
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.heldKeys & L_BUTTON)
if (JOY_HELD(L_BUTTON))
return 10;
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
return 9;
}
@ -7237,7 +7237,7 @@ static u8 HandleInput_InParty(void)
gotoBox = FALSE;
retVal = 0;
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
if (--cursorPosition < 0)
cursorPosition = PARTY_SIZE;
@ -7245,7 +7245,7 @@ static u8 HandleInput_InParty(void)
retVal = 1;
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
if (++cursorPosition > PARTY_SIZE)
cursorPosition = 0;
@ -7253,14 +7253,14 @@ static u8 HandleInput_InParty(void)
retVal = 1;
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT && sBoxCursorPosition != 0)
else if (JOY_REPEAT(DPAD_LEFT) && sBoxCursorPosition != 0)
{
retVal = 1;
sPSSData->field_CD6 = sBoxCursorPosition;
cursorPosition = 0;
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
if (sBoxCursorPosition == 0)
{
@ -7276,7 +7276,7 @@ static u8 HandleInput_InParty(void)
break;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (sBoxCursorPosition == PARTY_SIZE)
{
@ -7312,7 +7312,7 @@ static u8 HandleInput_InParty(void)
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
if (sPSSData->boxOption == BOX_OPTION_DEPOSIT)
return 19;
@ -7326,7 +7326,7 @@ static u8 HandleInput_InParty(void)
cursorArea = CURSOR_AREA_IN_BOX;
cursorPosition = 0;
}
else if (gMain.newKeys & SELECT_BUTTON)
else if (JOY_NEW(SELECT_BUTTON))
{
sub_80CFDC4();
return 0;
@ -7355,7 +7355,7 @@ static u8 HandleInput_OnBox(void)
sPSSData->field_CD2 = 0;
sPSSData->field_CD7 = 0;
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
retVal = 1;
cursorArea = CURSOR_AREA_BUTTONS;
@ -7363,7 +7363,7 @@ static u8 HandleInput_OnBox(void)
sPSSData->field_CD7 = 1;
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
retVal = 1;
cursorArea = CURSOR_AREA_IN_BOX;
@ -7371,30 +7371,30 @@ static u8 HandleInput_OnBox(void)
break;
}
if (gMain.heldKeys & DPAD_LEFT)
if (JOY_HELD(DPAD_LEFT))
return 10;
if (gMain.heldKeys & DPAD_RIGHT)
if (JOY_HELD(DPAD_RIGHT))
return 9;
if (gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
{
if (gMain.heldKeys & L_BUTTON)
if (JOY_HELD(L_BUTTON))
return 10;
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
return 9;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
sub_80CD1A8(FALSE);
AddBoxMenu();
return 7;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
return 19;
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
sub_80CFDC4();
return 0;
@ -7428,7 +7428,7 @@ static u8 HandleInput_OnButtons(void)
sPSSData->field_CD2 = 0;
sPSSData->field_CD7 = 0;
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
retVal = 1;
cursorArea = CURSOR_AREA_IN_BOX;
@ -7440,7 +7440,8 @@ static u8 HandleInput_OnButtons(void)
sPSSData->field_CD7 = 1;
break;
}
else if (gMain.newAndRepeatedKeys & (DPAD_DOWN | START_BUTTON))
if (JOY_REPEAT(DPAD_DOWN | START_BUTTON))
{
retVal = 1;
cursorArea = CURSOR_AREA_BOX;
@ -7449,14 +7450,14 @@ static u8 HandleInput_OnButtons(void)
break;
}
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
if (JOY_REPEAT(DPAD_LEFT))
{
retVal = 1;
if (--cursorPosition < 0)
cursorPosition = 1;
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
retVal = 1;
if (++cursorPosition > 1)
@ -7464,12 +7465,12 @@ static u8 HandleInput_OnButtons(void)
break;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
return (cursorPosition == 0) ? 5 : 4;
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
return 19;
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
sub_80CFDC4();
return 0;
@ -7918,23 +7919,23 @@ static s16 sub_80D00AC(void)
do
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
textId = Menu_GetCursorPos();
break;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
textId = -1;
}
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
PlaySE(SE_SELECT);
Menu_MoveCursor(-1);
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
PlaySE(SE_SELECT);
Menu_MoveCursor(1);

View File

@ -1496,23 +1496,23 @@ static void Task_HandleInput(u8 taskId)
{
if (MenuHelpers_CallLinkSomething() != TRUE && !gPaletteFade.active)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
ChangeSummaryPokemon(taskId, -1);
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
ChangeSummaryPokemon(taskId, 1);
}
else if ((gMain.newKeys & DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
else if ((JOY_NEW(DPAD_LEFT)) || GetLRKeysPressed() == MENU_L_PRESSED)
{
ChangePage(taskId, -1);
}
else if ((gMain.newKeys & DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
else if ((JOY_NEW(DPAD_RIGHT)) || GetLRKeysPressed() == MENU_R_PRESSED)
{
ChangePage(taskId, 1);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (sMonSummaryScreen->currPageIndex != PSS_PAGE_SKILLS)
{
@ -1529,7 +1529,7 @@ static void Task_HandleInput(u8 taskId)
}
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
StopPokemonAnimations();
PlaySE(SE_SELECT);
@ -1877,17 +1877,17 @@ static void Task_HandleInput_MoveSelect(u8 taskId)
if (MenuHelpers_CallLinkSomething() != 1)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
data[0] = 4;
ChangeSelectedMove(data, -1, &sMonSummaryScreen->firstMoveIndex);
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
data[0] = 4;
ChangeSelectedMove(data, 1, &sMonSummaryScreen->firstMoveIndex);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (sMonSummaryScreen->lockMovesFlag == TRUE
|| (sMonSummaryScreen->newMove == MOVE_NONE && sMonSummaryScreen->firstMoveIndex == MAX_MON_MOVES))
@ -1905,7 +1905,7 @@ static void Task_HandleInput_MoveSelect(u8 taskId)
PlaySE(SE_FAILURE);
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
CloseMoveSelectMode(taskId);
@ -2017,24 +2017,24 @@ static void Task_HandleInput_MovePositionSwitch(u8 taskId)
if (MenuHelpers_CallLinkSomething() != TRUE)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
data[0] = 3;
ChangeSelectedMove(&data[0], -1, &sMonSummaryScreen->secondMoveIndex);
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
data[0] = 3;
ChangeSelectedMove(&data[0], 1, &sMonSummaryScreen->secondMoveIndex);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (sMonSummaryScreen->firstMoveIndex == sMonSummaryScreen->secondMoveIndex)
ExitMovePositionSwitchMode(taskId, FALSE);
else
ExitMovePositionSwitchMode(taskId, TRUE);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
ExitMovePositionSwitchMode(taskId, FALSE);
}
@ -2160,25 +2160,25 @@ static void Task_HandleReplaceMoveInput(u8 taskId)
{
if (gPaletteFade.active != TRUE)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
data[0] = 4;
ChangeSelectedMove(data, -1, &sMonSummaryScreen->firstMoveIndex);
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
data[0] = 4;
ChangeSelectedMove(data, 1, &sMonSummaryScreen->firstMoveIndex);
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
ChangePage(taskId, -1);
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
ChangePage(taskId, 1);
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (CanReplaceMove() == TRUE)
{
@ -2194,7 +2194,7 @@ static void Task_HandleReplaceMoveInput(u8 taskId)
ShowCantForgetHMsWindow(taskId);
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
StopPokemonAnimations();
PlaySE(SE_SELECT);
@ -2234,7 +2234,7 @@ static void Task_HandleInputCantForgetHMsMoves(u8 taskId)
u16 move;
if (FuncIsActiveTask(Task_ShowPowerAccWindow) != 1)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
data[1] = 1;
data[0] = 4;
@ -2242,7 +2242,7 @@ static void Task_HandleInputCantForgetHMsMoves(u8 taskId)
data[1] = 0;
gTasks[taskId].func = Task_HandleReplaceMoveInput;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
data[1] = 1;
data[0] = 4;
@ -2250,7 +2250,7 @@ static void Task_HandleInputCantForgetHMsMoves(u8 taskId)
data[1] = 0;
gTasks[taskId].func = Task_HandleReplaceMoveInput;
}
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysPressed() == MENU_L_PRESSED)
else if (JOY_NEW(DPAD_LEFT) || GetLRKeysPressed() == MENU_L_PRESSED)
{
if (sMonSummaryScreen->currPageIndex != PSS_PAGE_BATTLE_MOVES)
{
@ -2264,7 +2264,7 @@ static void Task_HandleInputCantForgetHMsMoves(u8 taskId)
HandleAppealJamTilemap(9, -2, move);
}
}
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysPressed() == MENU_R_PRESSED)
else if (JOY_NEW(DPAD_RIGHT) || GetLRKeysPressed() == MENU_R_PRESSED)
{
if (sMonSummaryScreen->currPageIndex != PSS_PAGE_CONTEST_MOVES)
{
@ -2278,7 +2278,7 @@ static void Task_HandleInputCantForgetHMsMoves(u8 taskId)
HandleAppealJamTilemap(9, -2, move);
}
}
else if (gMain.newKeys & (A_BUTTON | B_BUTTON))
else if (JOY_NEW(A_BUTTON | B_BUTTON))
{
ClearWindowTilemap(PSS_LABEL_WINDOW_PORTRAIT_SPECIES);
if (!gSprites[sMonSummaryScreen->spriteIds[SPRITE_ARR_ID_STATUS]].invisible)

View File

@ -79,16 +79,16 @@ static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *state)
{
int selection;
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
return POKENAV_MC_FUNC_UP;
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
if (JOY_REPEAT(DPAD_DOWN))
return POKENAV_MC_FUNC_DOWN;
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
if (JOY_REPEAT(DPAD_LEFT))
return POKENAV_MC_FUNC_PG_UP;
if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
if (JOY_REPEAT(DPAD_RIGHT))
return POKENAV_MC_FUNC_PG_DOWN;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
state->callback = CB2_HandleMatchCallOptionsInput;
state->optionCursorPos = 0;
@ -108,7 +108,7 @@ static u32 CB2_HandleMatchCallInput(struct Pokenav3Struct *state)
return POKENAV_MC_FUNC_SELECT;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
if (GetPokenavMode() != POKENAV_MODE_FORCE_CALL_READY)
{
@ -132,19 +132,19 @@ static u32 GetExitMatchCallMenuId(struct Pokenav3Struct *state)
static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *state)
{
if ((gMain.newKeys & DPAD_UP) && state->optionCursorPos)
if ((JOY_NEW(DPAD_UP)) && state->optionCursorPos)
{
state->optionCursorPos--;
return POKENAV_MC_FUNC_MOVE_OPTIONS_CURSOR;
}
if ((gMain.newKeys & DPAD_DOWN) && state->optionCursorPos < state->maxOptionId)
if ((JOY_NEW(DPAD_DOWN)) && state->optionCursorPos < state->maxOptionId)
{
state->optionCursorPos++;
return POKENAV_MC_FUNC_MOVE_OPTIONS_CURSOR;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (state->matchCallOptions[state->optionCursorPos])
{
@ -166,7 +166,7 @@ static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *state)
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
state->callback = CB2_HandleMatchCallInput;
return POKENAV_MC_FUNC_CANCEL;
@ -177,12 +177,12 @@ static u32 CB2_HandleMatchCallOptionsInput(struct Pokenav3Struct *state)
static u32 CB2_HandleCheckPageInput(struct Pokenav3Struct *state)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
return POKENAV_MC_FUNC_CHECK_PAGE_UP;
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
if (JOY_REPEAT(DPAD_DOWN))
return POKENAV_MC_FUNC_CHECK_PAGE_DOWN;
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
state->callback = CB2_HandleMatchCallInput;
return POKENAV_MC_FUNC_EXIT_CHECK_PAGE;
@ -193,7 +193,7 @@ static u32 CB2_HandleCheckPageInput(struct Pokenav3Struct *state)
static u32 CB2_HandleCallInput(struct Pokenav3Struct *state)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
state->callback = CB2_HandleMatchCallInput;
return POKENAV_MC_FUNC_10;

View File

@ -1125,7 +1125,7 @@ static void PrintMatchCallMessage(struct Pokenav4Struct *state)
static bool32 WaitForMatchCallMessageText(struct Pokenav4Struct *state)
{
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
gTextFlags.canABSpeedUpPrint = 1;
else
gTextFlags.canABSpeedUpPrint = 0;

View File

@ -216,7 +216,7 @@ static u32 HandleMainMenuInput(struct Pokenav1Struct *state)
if (UpdateMenuCursorPos(state))
return POKENAV_MENU_FUNC_MOVE_CURSOR;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
switch (sMenuItems[state->menuType][state->cursorPos])
{
@ -312,7 +312,7 @@ static u32 HandleMainMenuInputEndTutorial(struct Pokenav1Struct *state)
return -1;
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
return -1;
}
@ -329,7 +329,7 @@ static u32 HandleCantOpenRibbonsInput(struct Pokenav1Struct *state)
return POKENAV_MENU_FUNC_MOVE_CURSOR;
}
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
state->callback = GetMainMenuInputHandler();
return POKENAV_MENU_FUNC_RESHOW_DESCRIPTION;
@ -363,7 +363,7 @@ static u32 HandleConditionMenuInput(struct Pokenav1Struct *state)
return POKENAV_MENU_FUNC_RETURN_TO_MAIN;
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
if (state->cursorPos != sLastCursorPositions[state->menuType])
{
@ -404,7 +404,7 @@ static u32 HandleConditionSearchMenuInput(struct Pokenav1Struct *state)
return POKENAV_MENU_FUNC_RETURN_TO_CONDITION;
}
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
if (state->cursorPos != sLastCursorPositions[state->menuType])
{
@ -463,7 +463,7 @@ static void ReturnToConditionMenu(struct Pokenav1Struct *state)
static bool32 UpdateMenuCursorPos(struct Pokenav1Struct *state)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
if (--state->cursorPos < 0)
state->cursorPos = sLastCursorPositions[state->menuType];
@ -471,7 +471,7 @@ static bool32 UpdateMenuCursorPos(struct Pokenav1Struct *state)
state->currMenuItem = sMenuItems[state->menuType][state->cursorPos];
return TRUE;
}
else if (gMain.newKeys & DPAD_DOWN)
else if (JOY_NEW(DPAD_DOWN))
{
state->cursorPos++;
if (state->cursorPos > sLastCursorPositions[state->menuType])

View File

@ -219,7 +219,7 @@ static u32 HandleRegionMapInput(struct Pokenav5Struct *state)
static u32 HandleRegionMapInputZoomDisabled(struct Pokenav5Struct *state)
{
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
state->callback = GetExitRegionMapMenuId;
return POKENAV_MAP_FUNC_EXIT;

View File

@ -651,31 +651,31 @@ static u8 ProcessRegionMapInput_Full(void)
input = MAP_INPUT_NONE;
gRegionMap->cursorDeltaX = 0;
gRegionMap->cursorDeltaY = 0;
if (gMain.heldKeys & DPAD_UP && gRegionMap->cursorPosY > MAPCURSOR_Y_MIN)
if (JOY_HELD(DPAD_UP) && gRegionMap->cursorPosY > MAPCURSOR_Y_MIN)
{
gRegionMap->cursorDeltaY = -1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.heldKeys & DPAD_DOWN && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX)
if (JOY_HELD(DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX)
{
gRegionMap->cursorDeltaY = +1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.heldKeys & DPAD_LEFT && gRegionMap->cursorPosX > MAPCURSOR_X_MIN)
if (JOY_HELD(DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN)
{
gRegionMap->cursorDeltaX = -1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.heldKeys & DPAD_RIGHT && gRegionMap->cursorPosX < MAPCURSOR_X_MAX)
if (JOY_HELD(DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX)
{
gRegionMap->cursorDeltaX = +1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
input = MAP_INPUT_A_BUTTON;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
input = MAP_INPUT_B_BUTTON;
}
@ -730,31 +730,31 @@ static u8 ProcessRegionMapInput_Zoomed(void)
input = MAP_INPUT_NONE;
gRegionMap->zoomedCursorDeltaX = 0;
gRegionMap->zoomedCursorDeltaY = 0;
if (gMain.heldKeys & DPAD_UP && gRegionMap->scrollY > -0x34)
if (JOY_HELD(DPAD_UP) && gRegionMap->scrollY > -0x34)
{
gRegionMap->zoomedCursorDeltaY = -1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.heldKeys & DPAD_DOWN && gRegionMap->scrollY < 0x3c)
if (JOY_HELD(DPAD_DOWN) && gRegionMap->scrollY < 0x3c)
{
gRegionMap->zoomedCursorDeltaY = +1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.heldKeys & DPAD_LEFT && gRegionMap->scrollX > -0x2c)
if (JOY_HELD(DPAD_LEFT) && gRegionMap->scrollX > -0x2c)
{
gRegionMap->zoomedCursorDeltaX = -1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.heldKeys & DPAD_RIGHT && gRegionMap->scrollX < 0xac)
if (JOY_HELD(DPAD_RIGHT) && gRegionMap->scrollX < 0xac)
{
gRegionMap->zoomedCursorDeltaX = +1;
input = MAP_INPUT_MOVE_START;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
input = MAP_INPUT_A_BUTTON;
}
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
input = MAP_INPUT_B_BUTTON;
}

View File

@ -380,7 +380,7 @@ static void Task_ResetRtc_1(u8 taskId)
u8 selection = data[2];
const struct ResetRtcStruct *selectionInfo = &sUnknown_08510428[selection - 1];
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
gTasks[taskId].func = Task_ResetRtc_2;
data[1] = 0;
@ -389,7 +389,7 @@ static void Task_ResetRtc_1(u8 taskId)
return;
}
if (gMain.newKeys & DPAD_RIGHT)
if (JOY_NEW(DPAD_RIGHT))
{
if (selectionInfo->right)
{
@ -399,7 +399,7 @@ static void Task_ResetRtc_1(u8 taskId)
}
}
if (gMain.newKeys & DPAD_LEFT)
if (JOY_NEW(DPAD_LEFT))
{
if (selectionInfo->left)
{
@ -411,7 +411,7 @@ static void Task_ResetRtc_1(u8 taskId)
if (selection == 5)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
gLocalTime.days = data[3];
gLocalTime.hours = data[4];
@ -423,7 +423,7 @@ static void Task_ResetRtc_1(u8 taskId)
data[2] = 6;
}
}
else if (MoveTimeUpDown(&data[selectionInfo->dataIndex], selectionInfo->minVal, selectionInfo->maxVal, gMain.newAndRepeatedKeys & (DPAD_UP | DPAD_DOWN)))
else if (MoveTimeUpDown(&data[selectionInfo->dataIndex], selectionInfo->minVal, selectionInfo->maxVal, JOY_REPEAT(DPAD_UP | DPAD_DOWN)))
{
PlaySE(SE_SELECT);
PrintTime(data[8], 0, 1, data[3], data[4], data[5], data[6]);
@ -532,12 +532,12 @@ static void Task_ShowResetRtcPrompt(u8 taskId)
ScheduleBgCopyTilemapToVram(0);
data[0]++;
case 1:
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
DestroyTask(taskId);
DoSoftReset();
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
DestroyTask(taskId);
@ -620,7 +620,7 @@ static void Task_ResetRtcScreen(u8 taskId)
}
data[0] = 5;
case 5:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 1, 0, 0x10, RGB_WHITEALPHA);
data[0] = 6;

View File

@ -306,7 +306,7 @@ static void CB2_GameplayCannotBeContinued(void)
{
gSaveFailedClockInfo[CLOCK_RUNNING] = FALSE;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
FillWindowPixelBuffer(gSaveFailedWindowIds[TEXT_WIN_ID], PIXEL_FILL(1));
SaveFailedScreenTextPrint(gText_GamePlayCannotBeContinued, 1, 0);
@ -319,7 +319,7 @@ static void CB2_FadeAndReturnToTitleScreen(void)
{
gSaveFailedClockInfo[CLOCK_RUNNING] = FALSE;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
SetVBlankCallback(VBlankCB);

View File

@ -1325,9 +1325,9 @@ bool8 ScrCmd_closemessage(struct ScriptContext *ctx)
static bool8 WaitForAorBPress(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
return TRUE;
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
return TRUE;
return FALSE;
}

View File

@ -170,7 +170,7 @@ static void Task_HandleMultichoiceInput(u8 taskId)
else
selection = Menu_ProcessInput();
if (gMain.newKeys & (DPAD_UP | DPAD_DOWN))
if (JOY_NEW(DPAD_UP | DPAD_DOWN))
{
DrawLinkServicesMultichoiceMenu(tMultichoiceId);
}

View File

@ -1017,7 +1017,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
}
else
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(4, 0);
@ -1030,7 +1030,7 @@ static void Task_BuyHowManyDialogueHandleInput(u8 taskId)
ConvertIntToDecimalStringN(gStringVar3, gShopDataPtr->totalCost, STR_CONV_MODE_LEFT_ALIGN, 6);
BuyMenuDisplayMessage(taskId, gText_Var1AndYouWantedVar2, BuyMenuConfirmPurchase);
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrameToTransparent(4, 0);
@ -1106,7 +1106,7 @@ static void Task_ReturnToItemListAfterItemPurchase(u8 taskId)
{
s16 *data = gTasks[taskId].data;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
if (tItemId == ITEM_POKE_BALL && tItemCount > 9 && AddBagItem(ITEM_PREMIER_BALL, 1) == TRUE)
@ -1122,7 +1122,7 @@ static void Task_ReturnToItemListAfterItemPurchase(u8 taskId)
static void Task_ReturnToItemListAfterDecorationPurchase(u8 taskId)
{
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
BuyMenuReturnToItemList(taskId);

View File

@ -1945,7 +1945,7 @@ static bool8 AwardPayoutAction_GivePayoutToPlayer(struct Task *task)
if (sSlotMachine->coins < MAX_COINS)
sSlotMachine->coins++;
task->data[1] = 8;
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
task->data[1] = 4;
}
if (IsFanfareTaskInactive() && JOY_NEW(START_BUTTON))

View File

@ -550,19 +550,19 @@ void ShowStartMenu(void)
static bool8 HandleStartMenuInput(void)
{
if (gMain.newKeys & DPAD_UP)
if (JOY_NEW(DPAD_UP))
{
PlaySE(SE_SELECT);
sStartMenuCursorPos = Menu_MoveCursor(-1);
}
if (gMain.newKeys & DPAD_DOWN)
if (JOY_NEW(DPAD_DOWN))
{
PlaySE(SE_SELECT);
sStartMenuCursorPos = Menu_MoveCursor(1);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
if (sStartMenuItems[sCurrentStartMenuActions[sStartMenuCursorPos]].func.u8_void == StartMenuPokedexCallback)
@ -584,7 +584,7 @@ static bool8 HandleStartMenuInput(void)
return FALSE;
}
if (gMain.newKeys & (START_BUTTON | B_BUTTON))
if (JOY_NEW(START_BUTTON | B_BUTTON))
{
RemoveExtraStartMenuWindows();
HideStartMenu();
@ -906,12 +906,12 @@ static bool8 SaveSuccesTimer(void)
{
sSaveDialogTimer--;
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
{
PlaySE(SE_SELECT);
return TRUE;
}
else if (sSaveDialogTimer == 0)
if (sSaveDialogTimer == 0)
{
return TRUE;
}
@ -925,7 +925,7 @@ static bool8 SaveErrorTimer(void)
{
sSaveDialogTimer--;
}
else if (gMain.heldKeys & A_BUTTON)
else if (JOY_HELD(A_BUTTON))
{
return TRUE;
}

View File

@ -727,24 +727,24 @@ static void Task_TitleScreenPhase2(u8 taskId)
// Show Rayquaza silhouette and process main title screen input
static void Task_TitleScreenPhase3(u8 taskId)
{
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & START_BUTTON))
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(START_BUTTON)))
{
FadeOutBGM(4);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_WHITEALPHA);
SetMainCallback2(CB2_GoToMainMenu);
}
else if ((gMain.heldKeys & CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO)
else if (JOY_HELD(CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO)
{
SetMainCallback2(CB2_GoToClearSaveDataScreen);
}
else if ((gMain.heldKeys & RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO
else if (JOY_HELD(RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO
&& CanResetRTC() == TRUE)
{
FadeOutBGM(4);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
SetMainCallback2(CB2_GoToResetRtcScreen);
}
else if ((gMain.heldKeys & BERRY_UPDATE_BUTTON_COMBO) == BERRY_UPDATE_BUTTON_COMBO)
else if (JOY_HELD(BERRY_UPDATE_BUTTON_COMBO) == BERRY_UPDATE_BUTTON_COMBO)
{
FadeOutBGM(4);
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);

View File

@ -1352,24 +1352,24 @@ static void SetReadyToTrade(void)
static void TradeMenuProcessInput(void)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
TradeMenuMoveCursor(&sTradeMenuData->cursorPosition, 0);
}
else if (gMain.newAndRepeatedKeys & DPAD_DOWN)
else if (JOY_REPEAT(DPAD_DOWN))
{
TradeMenuMoveCursor(&sTradeMenuData->cursorPosition, 1);
}
else if (gMain.newAndRepeatedKeys & DPAD_LEFT)
else if (JOY_REPEAT(DPAD_LEFT))
{
TradeMenuMoveCursor(&sTradeMenuData->cursorPosition, 2);
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
TradeMenuMoveCursor(&sTradeMenuData->cursorPosition, 3);
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
@ -1450,7 +1450,7 @@ static void TradeMenuProcessInput_SelectedMon(void)
static void ChooseMonAfterButtonPress(void)
{
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
if ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON)))
{
PlaySE(SE_SELECT);
TradeMenuChooseMon();
@ -1625,7 +1625,7 @@ static void RedrawTradeMenuAfterPressA(void)
{
int i;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
PlaySE(SE_SELECT);
rbox_fill_rectangle(0);
@ -1697,7 +1697,7 @@ static void LinkTradeWaitForQueue(void)
static void PartnersMonWasInvalid(void)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
SetLinkData(LINKCMD_READY_CANCEL_TRADE, 0);
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_STANDBY;
@ -3727,7 +3727,7 @@ static bool8 AnimateTradeSequenceCable(void)
{
return TRUE;
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
sTradeData->state++;
}
@ -4242,7 +4242,7 @@ static bool8 AnimateTradeSequenceWireless(void)
{
return TRUE;
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
sTradeData->state++;
}

View File

@ -438,13 +438,13 @@ static void Task_TrainerCard(u8 taskId)
DrawTrainerCardWindow(1);
sData->timeColonNeedDraw = FALSE;
}
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
FlipTrainerCard();
PlaySE(SE_RG_CARD_FLIP);
sData->mainState = STATE_WAIT_FLIP_TO_BACK;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
if (gReceivedRemoteLinkPlayers && sData->isLink && InUnionRoom() == TRUE)
{
@ -465,7 +465,7 @@ static void Task_TrainerCard(u8 taskId)
}
break;
case STATE_HANDLE_INPUT_BACK:
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
if (gReceivedRemoteLinkPlayers && sData->isLink && InUnionRoom() == TRUE)
{
@ -483,7 +483,7 @@ static void Task_TrainerCard(u8 taskId)
PlaySE(SE_RG_CARD_FLIP);
}
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
if (gReceivedRemoteLinkPlayers && sData->isLink && InUnionRoom() == TRUE)
{

View File

@ -444,7 +444,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
break;
case LL_STATE_AWAIT_PLAYERS:
Leader_SetStateIfMemberListChanged(data, LL_STATE_ACCEPT_NEW_MEMBER_PROMPT, LL_STATE_MEMBER_LEFT);
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
if (data->playerCount == 1)
data->state = LL_STATE_SHUTDOWN_AND_FAIL;
@ -457,7 +457,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
&& data->playerCount > GROUP_MIN(sPlayerActivityGroupSize) - 1
&& GROUP_MAX(sPlayerActivityGroupSize) != 0
&& sub_8012240()
&& gMain.newKeys & START_BUTTON)
&& JOY_NEW(START_BUTTON))
{
data->state = LL_STATE_MEMBERS_OK_PROMPT;
LinkRfu_StopManagerAndFinalizeSlots();
@ -1004,7 +1004,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
break;
case 0:
id = ListMenu_ProcessInput(data->listTaskId);
if (gMain.newKeys & A_BUTTON && id != -1)
if (JOY_NEW(A_BUTTON) && id != -1)
{
// this unused variable along with the assignment is needed to match
u32 activity = data->field_0->arr[id].gname_uname.gname.activity;
@ -1031,7 +1031,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
PlaySE(SE_WALL_HIT);
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
data->state = LG_STATE_CANCEL_CHOOSE_LEADER;
}
@ -1134,7 +1134,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
break;
}
if (RfuGetStatus() == RFU_STATUS_OK && gMain.newKeys & B_BUTTON)
if (RfuGetStatus() == RFU_STATUS_OK && JOY_NEW(B_BUTTON))
data->state = LG_STATE_ASK_LEAVE_GROUP;
break;
case LG_STATE_ASK_LEAVE_GROUP:
@ -1888,7 +1888,7 @@ static void Task_MEvent_Leader(u8 taskId)
break;
case 4:
Leader_SetStateIfMemberListChanged(data, 5, 6);
if (gMain.newKeys & B_BUTTON)
if (JOY_NEW(B_BUTTON))
{
data->state = 13;
DestroyWirelessStatusIndicatorSprite();
@ -2103,7 +2103,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
break;
case 0:
id = ListMenu_ProcessInput(data->listTaskId);
if (gMain.newKeys & A_BUTTON && id != -1)
if (JOY_NEW(A_BUTTON) && id != -1)
{
// this unused variable along with the assignment is needed to match
u32 unusedVar;
@ -2125,7 +2125,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
PlaySE(SE_WALL_HIT);
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
data->state = 6;
}
@ -2288,7 +2288,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
}
}
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
data->state = 6;
data->refreshTimer = 0;
@ -2546,7 +2546,7 @@ static void Task_RunUnionRoom(u8 taskId)
}
else if (ScriptContext2_IsEnabled() != TRUE)
{
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
if (TryInteractWithUnionRoomMember(uroom->field_0, &taskData[0], &taskData[1], uroom->spriteIds))
{
@ -2880,7 +2880,7 @@ static void Task_RunUnionRoom(u8 taskId)
break;
case UR_STATE_HANDLE_CONTACT_DATA:
ReceiveUnionRoomActivityPacket(uroom);
if (UnionRoom_HandleContactFromOtherPlayer(uroom) && gMain.newKeys & B_BUTTON)
if (UnionRoom_HandleContactFromOtherPlayer(uroom) && JOY_NEW(B_BUTTON))
{
sub_8011DE0(1);
StringCopy(gStringVar4, sText_ChatEnded);

View File

@ -1017,12 +1017,12 @@ static void Chat_HandleInput(void)
switch (sChat->funcState)
{
case 0:
if (gMain.newKeys & START_BUTTON)
if (JOY_NEW(START_BUTTON))
{
if (sChat->bufferCursorPos)
SetChatFunction(CHAT_FUNC_SEND);
}
else if (gMain.newKeys & SELECT_BUTTON)
else if (JOY_NEW(SELECT_BUTTON))
{
SetChatFunction(CHAT_FUNC_SWITCH);
}
@ -1039,14 +1039,14 @@ static void Chat_HandleInput(void)
SetChatFunction(CHAT_FUNC_ASK_QUIT);
}
}
else if (gMain.newKeys & A_BUTTON)
else if (JOY_NEW(A_BUTTON))
{
AppendTextToMessage();
StartDisplaySubtask(CHATDISPLAY_FUNC_UPDATE_MSG, 0);
StartDisplaySubtask(CHATDISPLAY_FUNC_CURSOR_BLINK, 1);
sChat->funcState = 1;
}
else if (gMain.newKeys & R_BUTTON)
else if (JOY_NEW(R_BUTTON))
{
if (sChat->currentPage != UNION_ROOM_KB_PAGE_REGISTER)
{
@ -1100,7 +1100,7 @@ static void Chat_Switch(void)
shouldSwitchPages = FALSE;
break;
case MENU_NOTHING_CHOSEN:
if (gMain.newKeys & SELECT_BUTTON)
if (JOY_NEW(SELECT_BUTTON))
{
PlaySE(SE_SELECT);
Menu_MoveCursor(1);
@ -1420,13 +1420,13 @@ static void Chat_Register(void)
}
break;
case 1:
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
RegisterTextAtRow();
StartDisplaySubtask(CHATDISPLAY_FUNC_RETURN_TO_KB, 0);
sChat->funcState = 3;
}
else if (gMain.newKeys & B_BUTTON)
else if (JOY_NEW(B_BUTTON))
{
StartDisplaySubtask(CHATDISPLAY_FUNC_CANCEL_REGISTER, 0);
sChat->funcState = 4;
@ -1457,7 +1457,7 @@ static void Chat_Register(void)
sChat->funcState = 6;
break;
case 6:
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
{
StartDisplaySubtask(CHATDISPLAY_FUNC_DESTROY_YESNO, 0);
sChat->funcState = 4;
@ -1591,7 +1591,7 @@ static bool32 HandleDPadInput(void)
{
do
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
if (JOY_REPEAT(DPAD_UP))
{
if (sChat->currentRow > 0)
sChat->currentRow--;
@ -1599,7 +1599,7 @@ static bool32 HandleDPadInput(void)
sChat->currentRow = sKeyboardPageMaxRow[sChat->currentPage];
break;
}
if (gMain.newAndRepeatedKeys & DPAD_DOWN)
if (JOY_REPEAT(DPAD_DOWN))
{
if (sChat->currentRow < sKeyboardPageMaxRow[sChat->currentPage])
sChat->currentRow++;
@ -1609,7 +1609,7 @@ static bool32 HandleDPadInput(void)
}
if (sChat->currentPage != UNION_ROOM_KB_PAGE_REGISTER)
{
if (gMain.newAndRepeatedKeys & DPAD_LEFT)
if (JOY_REPEAT(DPAD_LEFT))
{
if (sChat->currentCol > 0)
sChat->currentCol--;
@ -1617,7 +1617,7 @@ static bool32 HandleDPadInput(void)
sChat->currentCol = 4;
break;
}
else if (gMain.newAndRepeatedKeys & DPAD_RIGHT)
else if (JOY_REPEAT(DPAD_RIGHT))
{
if (sChat->currentCol < 4)
sChat->currentCol++;

View File

@ -19,14 +19,14 @@ u16 Font6Func(struct TextPrinter *textPrinter)
switch (textPrinter->state)
{
case 0:
if (gMain.heldKeys & (A_BUTTON | B_BUTTON) && subStruct->hasPrintBeenSpedUp)
if (JOY_HELD(A_BUTTON | B_BUTTON) && subStruct->hasPrintBeenSpedUp)
{
textPrinter->delayCounter = 0;
}
if (textPrinter->delayCounter && textPrinter->textSpeed)
{
textPrinter->delayCounter --;
if (gTextFlags.canABSpeedUpPrint && gMain.newKeys & (A_BUTTON | B_BUTTON))
if (gTextFlags.canABSpeedUpPrint && JOY_NEW(A_BUTTON | B_BUTTON))
{
subStruct->hasPrintBeenSpedUp = TRUE;
textPrinter->delayCounter = 0;

View File

@ -795,7 +795,7 @@ static void Task_SetClock_HandleInput(u8 taskId)
{
gTasks[taskId].tMinuteHandAngle = gTasks[taskId].tMinutes * 6;
gTasks[taskId].tHourHandAngle = (gTasks[taskId].tHours % 12) * 30 + (gTasks[taskId].tMinutes / 10) * 5;
if (gMain.newKeys & A_BUTTON)
if (JOY_NEW(A_BUTTON))
{
gTasks[taskId].func = Task_SetClock_AskConfirm;
}
@ -803,10 +803,10 @@ static void Task_SetClock_HandleInput(u8 taskId)
{
gTasks[taskId].tMoveDir = MOVE_NONE;
if (gMain.heldKeys & DPAD_LEFT)
if (JOY_HELD(DPAD_LEFT))
gTasks[taskId].tMoveDir = MOVE_BACKWARD;
if (gMain.heldKeys & DPAD_RIGHT)
if (JOY_HELD(DPAD_RIGHT))
gTasks[taskId].tMoveDir = MOVE_FORWARD;
if (gTasks[taskId].tMoveDir != MOVE_NONE)
@ -878,7 +878,7 @@ static void Task_ViewClock_WaitFadeIn(u8 taskId)
static void Task_ViewClock_HandleInput(u8 taskId)
{
InitClockWithRtc(taskId);
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
if (JOY_NEW(A_BUTTON | B_BUTTON))
gTasks[taskId].func = Task_ViewClock_FadeOut;
}