Use JOY_HELD across the repo

This commit is contained in:
Eduardo Quezada 2026-02-12 19:08:09 -03:00
parent b3853ed26b
commit feaa908e8f
22 changed files with 55 additions and 55 deletions

View File

@ -967,7 +967,7 @@ void BattleMainCB2(void)
BuildOamBuffer();
#if DEBUG
if ((gMain.heldKeys & (R_BUTTON | SELECT_BUTTON)) == ((R_BUTTON | SELECT_BUTTON)))
if (JOY_HELD(R_BUTTON | SELECT_BUTTON) == ((R_BUTTON | SELECT_BUTTON)))
{
gSpecialVar_Result = gBattleOutcome = 1;
gMain.inBattle = FALSE;

View File

@ -376,12 +376,12 @@ static void sub_80830E4(u8 taskId)
ShowFieldAutoScrollMessage(gUnknown_081A4932);
gTasks[taskId].func = sub_8082FEC;
}
else if (gMain.heldKeys & B_BUTTON)
else if (JOY_HELD(B_BUTTON))
{
ShowFieldAutoScrollMessage(gUnknown_081A4932);
gTasks[taskId].func = sub_8082FEC;
}
else if (gMain.heldKeys & A_BUTTON)
else if (JOY_HELD(A_BUTTON))
{
PlaySE(SE_SELECT);
sub_8007F4C();

View File

@ -436,7 +436,7 @@ static void CB2_Credits(void)
BuildOamBuffer();
UpdatePaletteFade();
if ((gMain.heldKeys & B_BUTTON)
if (JOY_HELD(B_BUTTON)
&& gHasHallOfFameRecords != 0
&& gTasks[sSavedTaskId].func == Task_CreditsMain)
{

View File

@ -2161,7 +2161,7 @@ static void RNGTest_AdjustAndPrintNumAtLine(u16 * a0, s8 a1, u8 a2)
static bool8 RNGTest_HandleJoypad(void)
{
s8 r5 = gMain.heldKeys & R_BUTTON ? 100 : 1;
s8 r5 = JOY_HELD(R_BUTTON) ? 100 : 1;
s8 r4;
if (gMain.newAndRepeatedKeys & DPAD_UP)

View File

@ -310,7 +310,7 @@ bool8 Task_ProcessSoundCheckMenuInput(u8 taskId)
}
return TRUE;
}
else if (gMain.heldKeys & SELECT_BUTTON)
else if (JOY_HELD(SELECT_BUTTON))
{
gUnknown_020387B0 = 1;
}

View File

@ -825,7 +825,7 @@ void debug_80C3D2C(u8 taskId)
{
if (gTasks[taskId].data[8])
{
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
gTasks[taskId].data[6] += 16;
else
gTasks[taskId].data[6] += 1;
@ -834,7 +834,7 @@ void debug_80C3D2C(u8 taskId)
}
else
{
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
gTasks[taskId].data[7] += 16;
else
gTasks[taskId].data[7] += 1;
@ -846,7 +846,7 @@ void debug_80C3D2C(u8 taskId)
{
if (gTasks[taskId].data[8])
{
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
gTasks[taskId].data[6] -= 16;
else
gTasks[taskId].data[6] -= 1;
@ -855,7 +855,7 @@ void debug_80C3D2C(u8 taskId)
}
else
{
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
gTasks[taskId].data[7] -= 16;
else
gTasks[taskId].data[7] -= 1;

View File

@ -2688,7 +2688,7 @@ bool8 sub_810038C(u8 taskId)
bool8 sub_8100430(void)
{
if ((gMain.heldKeys & DPAD_ANY) != DPAD_UP && (gMain.heldKeys & DPAD_ANY) != DPAD_DOWN && (gMain.heldKeys & DPAD_ANY) != DPAD_LEFT && (gMain.heldKeys & DPAD_ANY) != DPAD_RIGHT)
if (JOY_HELD(DPAD_ANY) != DPAD_UP && JOY_HELD(DPAD_ANY) != DPAD_DOWN && JOY_HELD(DPAD_ANY) != DPAD_LEFT && JOY_HELD(DPAD_ANY) != DPAD_RIGHT)
{
return FALSE;
}
@ -2715,28 +2715,28 @@ void sub_8100494(u8 taskId)
gUnknown_083EC96C[gTasks[taskId].data[12]].noFunc(taskId);
return;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_UP)
if (JOY_HELD(DPAD_ANY) == DPAD_UP)
{
gUnknown_020391AA = DIR_SOUTH;
gSprites[gUnknown_020391A8].data[2] = 0;
gSprites[gUnknown_020391A8].data[3] = -2;
gTasks[taskId].data[1]--;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_DOWN)
if (JOY_HELD(DPAD_ANY) == DPAD_DOWN)
{
gUnknown_020391AA = DIR_NORTH;
gSprites[gUnknown_020391A8].data[2] = 0;
gSprites[gUnknown_020391A8].data[3] = 2;
gTasks[taskId].data[1]++;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_LEFT)
if (JOY_HELD(DPAD_ANY) == DPAD_LEFT)
{
gUnknown_020391AA = DIR_WEST;
gSprites[gUnknown_020391A8].data[2] = -2;
gSprites[gUnknown_020391A8].data[3] = 0;
gTasks[taskId].data[0]--;
}
if ((gMain.heldKeys & DPAD_ANY) == DPAD_RIGHT)
if (JOY_HELD(DPAD_ANY) == DPAD_RIGHT)
{
gUnknown_020391AA = DIR_EAST;
gSprites[gUnknown_020391A8].data[2] = 2;

View File

@ -330,7 +330,7 @@ static void PlayerAllowForcedMovementIfMovingSameDirection(void)
static bool8 TryDoMetatileBehaviorForcedMovement(void)
{
#if DEBUG
if (gUnknown_020297ED != 0 && (gMain.heldKeys & R_BUTTON))
if (gUnknown_020297ED != 0 && JOY_HELD(R_BUTTON))
return 0;
#endif
return sForcedMovementFuncs[GetForcedMovementByMetatileBehavior()]();
@ -1826,7 +1826,7 @@ static void AlignFishingAnimationFrames(void)
u8 debug_sub_805F2B0(u8 a)
{
if (gMain.heldKeys & 0x100)
if (JOY_HELD(R_BUTTON))
return debug_sub_805F2DC(a);
else
return 0;

View File

@ -405,7 +405,7 @@ static void LinkTestProcessKeyInput(void)
{
if (JOY_NEW(A_BUTTON))
gShouldAdvanceLinkState = 1;
if (gMain.heldKeys & B_BUTTON)
if (JOY_HELD(B_BUTTON))
InitBlockSend(gSharedMem + 0x4000, 0x2004);
if (JOY_NEW(L_BUTTON))
BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(2, 0, 0));

View File

@ -253,7 +253,7 @@ static void ReadKeys(void)
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

@ -422,7 +422,7 @@ void debug_sub_815D1D8(void)
case 1:
if (!gPaletteFade.active)
{
if (gMain.heldKeys & 0x100)
if (JOY_HELD(R_BUTTON))
gUnknown_Debug_30030E0++;
MenuPrintMessage(Str_843DA70, 4, 15);
gMain.state++;

View File

@ -1298,7 +1298,7 @@ void debug_sub_8058C00(void)
ScriptContext1_Init();
ScriptContext2_Disable();
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
gFieldCallback = ExecuteTruckSequence;
else
gFieldCallback = sub_8080B60;
@ -1467,7 +1467,7 @@ void CB2_ContinueSavedGame(void)
FieldClearVBlankHBlankCallbacks();
StopMapMusic();
#if DEBUG
if (gMain.heldKeys & R_BUTTON)
if (JOY_HELD(R_BUTTON))
gUnknown_020297ED = TRUE;
#endif
ResetSafariZoneFlag_();
@ -2075,19 +2075,19 @@ void sub_8055280(u16 a1)
u16 sub_80552B0(u32 a1)
{
if (gMain.heldKeys & DPAD_UP)
if (JOY_HELD(DPAD_UP))
{
return 19;
}
else if (gMain.heldKeys & DPAD_DOWN)
else if (JOY_HELD(DPAD_DOWN))
{
return 18;
}
else if (gMain.heldKeys & DPAD_LEFT)
else if (JOY_HELD(DPAD_LEFT))
{
return 20;
}
else if (gMain.heldKeys & DPAD_RIGHT)
else if (JOY_HELD(DPAD_RIGHT))
{
return 21;
}

View File

@ -2397,10 +2397,10 @@ static u16 TryDoPokedexScroll(u16 a, u16 b)
u16 r6;
u8 r10 = 0;
if (!((gMain.heldKeys & 0x40) && (a > 0)))
if (!(JOY_HELD(DPAD_UP) && (a > 0)))
{
//_0808E4B6
if (!((gMain.heldKeys & 0x80) && (a < gPokedexView->pokemonListCount - 1)))
if (!(JOY_HELD(DPAD_DOWN) && (a < gPokedexView->pokemonListCount - 1)))
//_0808E4CE
{
if (JOY_NEW(DPAD_LEFT) && (a > 0))

View File

@ -2103,16 +2103,16 @@ u8 sub_809C85C(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 (gSaveBlock2.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;
}

View File

@ -2478,7 +2478,7 @@ void sub_80ED858(void)
}
break;
case 4:
if (({gMain.heldKeys & DPAD_UP;}))
if (JOY_HELD(DPAD_UP))
{
if (gPokenavStructPtr->unk87CB && (
gPokenavStructPtr->unk76AA == 0
@ -2492,7 +2492,7 @@ void sub_80ED858(void)
break;
}
}
if (({gMain.heldKeys & DPAD_DOWN;}))
if (JOY_HELD(DPAD_DOWN))
{
if (gPokenavStructPtr->unk87CB && (
gPokenavStructPtr->unk76AA == 0
@ -3144,13 +3144,13 @@ void sub_80EE658()
gPokenavStructPtr->unk304++;
break;
case 8:
if ((gMain.heldKeys & 0x40) && gPokenavStructPtr->unk87DC)
if (JOY_HELD(0x40) && gPokenavStructPtr->unk87DC)
{
PlaySE(SE_SELECT);
sub_80F708C(-1);
gPokenavStructPtr->unk304 = 0x10;
}
else if ((gMain.heldKeys & 0x80) && gPokenavStructPtr->unk87DC < gPokenavStructPtr->unk8774)
else if (JOY_HELD(0x80) && gPokenavStructPtr->unk87DC < gPokenavStructPtr->unk8774)
{
PlaySE(SE_SELECT);
sub_80F708C(1);

View File

@ -211,22 +211,22 @@ static u8 sub_80FAB78(void)
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;
event = INPUT_EVENT_DPAD;
}
if ((gMain.heldKeys & DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX)
if (JOY_HELD(DPAD_DOWN) && gRegionMap->cursorPosY < MAPCURSOR_Y_MAX)
{
gRegionMap->cursorDeltaY = 1;
event = INPUT_EVENT_DPAD;
}
if ((gMain.heldKeys & DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN)
if (JOY_HELD(DPAD_LEFT) && gRegionMap->cursorPosX > MAPCURSOR_X_MIN)
{
gRegionMap->cursorDeltaX = -1;
event = INPUT_EVENT_DPAD;
}
if ((gMain.heldKeys & DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX)
if (JOY_HELD(DPAD_RIGHT) && gRegionMap->cursorPosX < MAPCURSOR_X_MAX)
{
gRegionMap->cursorDeltaX = 1;
event = INPUT_EVENT_DPAD;
@ -282,22 +282,22 @@ static u8 sub_80FAD04(void)
gRegionMap->unk6A = 0;
gRegionMap->unk68 = 0;
if ((gMain.heldKeys & DPAD_UP) && gRegionMap->scrollY > -52)
if (JOY_HELD(DPAD_UP) && gRegionMap->scrollY > -52)
{
gRegionMap->unk68 = -1;
event = INPUT_EVENT_DPAD;
}
if ((gMain.heldKeys & DPAD_DOWN) && gRegionMap->scrollY < 60)
if (JOY_HELD(DPAD_DOWN) && gRegionMap->scrollY < 60)
{
gRegionMap->unk68 = 1;
event = INPUT_EVENT_DPAD;
}
if ((gMain.heldKeys & DPAD_LEFT) && gRegionMap->scrollX > -44)
if (JOY_HELD(DPAD_LEFT) && gRegionMap->scrollX > -44)
{
gRegionMap->unk6A = -1;
event = INPUT_EVENT_DPAD;
}
if ((gMain.heldKeys & DPAD_RIGHT) && gRegionMap->scrollX < 172)
if (JOY_HELD(DPAD_RIGHT) && gRegionMap->scrollX < 172)
{
gRegionMap->unk6A = 1;
event = INPUT_EVENT_DPAD;

View File

@ -672,7 +672,7 @@ static bool8 sub_8101E3C(struct Task *task)
#if DEBUG
if (unk_debug_bss_1_1 != 0 && unk_debug_bss_1_4 != 0)
{
if (sSlotMachine->coins <= 3 || (gMain.heldKeys & B_BUTTON))
if (sSlotMachine->coins <= 3 || JOY_HELD(B_BUTTON))
{
unk_debug_bss_1_4 = 0;
}
@ -1543,7 +1543,7 @@ static bool8 sub_8102AD0(struct Task *task)
if (sSlotMachine->coins < 9999)
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

@ -666,7 +666,7 @@ static void SaveDialogStartTimeout(void)
static bool8 SaveDialogCheckForTimeoutOrKeypress(void)
{
saveDialogTimer--;
if (gMain.heldKeys & A_BUTTON)
if (JOY_HELD(A_BUTTON))
{
PlaySE(SE_SELECT);
return TRUE;
@ -680,7 +680,7 @@ static bool8 SaveDialogCheckForTimeoutAndKeypress(void)
{
if (saveDialogTimer != 0)
saveDialogTimer--;
else if (gMain.heldKeys & A_BUTTON)
else if (JOY_HELD(A_BUTTON))
return TRUE;
return FALSE;
}

View File

@ -2429,7 +2429,7 @@ static u8 UpdateWindowText(struct Window *win)
case WIN_STATE_CHAR_DELAY:
// Allow the player to speed up text by holding a button
if (PlayerCanInterruptDelay(win)
&& (gMain.heldKeys & (A_BUTTON | B_BUTTON))
&& JOY_HELD(A_BUTTON | B_BUTTON)
&& gMain.watchedKeysPressed == TRUE)
{
win->delayCounter = 0;

View File

@ -727,9 +727,9 @@ static void Task_TitleScreenPhase3(u8 taskId)
}
else
{
if ((gMain.heldKeys & CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO)
if (JOY_HELD(CLEAR_SAVE_BUTTON_COMBO) == CLEAR_SAVE_BUTTON_COMBO)
SetMainCallback2(CB2_GoToClearSaveDataScreen);
if ((gMain.heldKeys & RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO
if (JOY_HELD(RESET_RTC_BUTTON_COMBO) == RESET_RTC_BUTTON_COMBO
&& CanResetRTC() == 1)
{
FadeOutBGM(4);

View File

@ -374,14 +374,14 @@ static void sub_8136638(void)
switch (gUnknown_02039304->unk50)
{
case 0:
if (gMain.heldKeys & DPAD_UP)
if (JOY_HELD(DPAD_UP))
{
PlaySE(SE_SELECT);
sub_80F5060(TRUE);
move_anim_execute();
gUnknown_02039304->unk50 = 1;
}
else if (gMain.heldKeys & DPAD_DOWN)
else if (JOY_HELD(DPAD_DOWN))
{
PlaySE(SE_SELECT);
sub_80F5060(FALSE);

View File

@ -745,9 +745,9 @@ static void Task_SetClock2(u8 taskId)
else
{
gTasks[taskId].tMvmtDir = JOY_NEW(A_BUTTON);
if (gMain.heldKeys & DPAD_LEFT)
if (JOY_HELD(DPAD_LEFT))
gTasks[taskId].tMvmtDir = MVMT_BACKWARD;
if (gMain.heldKeys & DPAD_RIGHT)
if (JOY_HELD(DPAD_RIGHT))
gTasks[taskId].tMvmtDir = MVMT_FORWARD;
if (gTasks[taskId].tMvmtDir)
{