summaryrefslogtreecommitdiff
path: root/src/battle_controller_player.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle_controller_player.c')
-rw-r--r--src/battle_controller_player.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c
index d8005e808..7c34efd44 100644
--- a/src/battle_controller_player.c
+++ b/src/battle_controller_player.c
@@ -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);