Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#define B_ACTION_FINISHED 12
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
#define B_ACTION_UNK_14 14
#define B_ACTION_UNK_15 15
#define B_ACTION_NONE 0xFF

#define MOVE_TARGET_SELECTED 0
Expand Down
12 changes: 6 additions & 6 deletions src/battle_controller_opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1552,7 +1552,7 @@ static void OpponentHandleChooseMove(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace());
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, ChooseMoveAndTargetInBattlePalace());
OpponentBufferExecCompleted();
}
else
Expand All @@ -1575,7 +1575,7 @@ static void OpponentHandleChooseMove(void)
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_RUN, 0);
break;
case 6:
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 15, gBattlerTarget);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_UNK_15, gBattlerTarget);
break;
default:
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
Expand All @@ -1586,7 +1586,7 @@ static void OpponentHandleChooseMove(void)
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
gBattlerTarget = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
}
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, (chosenMoveId) | (gBattlerTarget << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, (chosenMoveId) | (gBattlerTarget << 8));
break;
}
OpponentBufferExecCompleted();
Expand All @@ -1601,11 +1601,11 @@ static void OpponentHandleChooseMove(void)
} while (move == MOVE_NONE);

if (gBattleMoves[move].target & (MOVE_TARGET_USER_OR_SELECTED | MOVE_TARGET_USER))
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, (chosenMoveId) | (gActiveBattler << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, (chosenMoveId) | (gActiveBattler << 8));
else if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, (chosenMoveId) | (GetBattlerAtPosition(Random() & 2) << 8));
else
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, (chosenMoveId) | (GetBattlerAtPosition(B_POSITION_PLAYER_LEFT) << 8));

OpponentBufferExecCompleted();
}
Expand Down
14 changes: 7 additions & 7 deletions src/battle_controller_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static void HandleInputChooseTarget(void)
{
PlaySE(SE_SELECT);
gSprites[gBattlerSpriteIds[gMultiUsePlayerCursor]].callback = SpriteCB_HideAsMoveTarget;
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
EndBounceEffect(gMultiUsePlayerCursor, BOUNCE_HEALTHBOX);
PlayerBufferExecCompleted();
}
Expand Down Expand Up @@ -523,7 +523,7 @@ static void HandleInputChooseMove(void)

if (!canSelectTarget)
{
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, gMoveSelectionCursor[gActiveBattler] | (gMultiUsePlayerCursor << 8));
PlayerBufferExecCompleted();
}
else
Expand All @@ -543,7 +543,7 @@ static void HandleInputChooseMove(void)
else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59)
{
PlaySE(SE_SELECT);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, 0xFFFF);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, 0xFFFF);
PlayerBufferExecCompleted();
}
else if (JOY_NEW(DPAD_LEFT))
Expand Down Expand Up @@ -1439,9 +1439,9 @@ static void PlayerHandleYesNoInput(void)
PlaySE(SE_SELECT);

if (gMultiUsePlayerCursor != 0)
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 0xE, 0);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_UNK_14, 0);
else
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 0xD, 0);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_NOTHING_FAINTED, 0);

PlayerBufferExecCompleted();
}
Expand Down Expand Up @@ -2621,7 +2621,7 @@ static void PlayerChooseMoveInBattlePalace(void)
if (--*(gBattleStruct->arenaMindPoints + gActiveBattler) == 0)
{
gBattlePalaceMoveSelectionRngValue = gRngValue;
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace());
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, ChooseMoveAndTargetInBattlePalace());
PlayerBufferExecCompleted();
}
}
Expand Down Expand Up @@ -2828,7 +2828,7 @@ static void PlayerHandleCmd32(void)

static void PlayerHandleTwoReturnValues(void)
{
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 0, 0);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_USE_MOVE, 0);
PlayerBufferExecCompleted();
}

Expand Down
2 changes: 1 addition & 1 deletion src/battle_controller_player_partner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ static void PlayerPartnerHandleChooseMove(void)
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
}

BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, chosenMoveId | (gBattlerTarget << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, chosenMoveId | (gBattlerTarget << 8));
PlayerPartnerBufferExecCompleted();
}

Expand Down
4 changes: 2 additions & 2 deletions src/battle_controller_recorded_opponent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1415,13 +1415,13 @@ static void RecordedOpponentHandleChooseMove(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace());
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, ChooseMoveAndTargetInBattlePalace());
}
else
{
u8 moveIndex = RecordedBattle_GetBattlerAction(gActiveBattler);
u8 target = RecordedBattle_GetBattlerAction(gActiveBattler);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, moveIndex | (target << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, moveIndex | (target << 8));
}

RecordedOpponentBufferExecCompleted();
Expand Down
4 changes: 2 additions & 2 deletions src/battle_controller_recorded_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,13 +1441,13 @@ static void RecordedPlayerHandleChooseMove(void)
{
if (gBattleTypeFlags & BATTLE_TYPE_PALACE)
{
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, ChooseMoveAndTargetInBattlePalace());
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, ChooseMoveAndTargetInBattlePalace());
}
else
{
u8 moveIndex = RecordedBattle_GetBattlerAction(gActiveBattler);
u8 target = RecordedBattle_GetBattlerAction(gActiveBattler);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, moveIndex | (target << 8));
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, moveIndex | (target << 8));
}

RecordedPlayerBufferExecCompleted();
Expand Down
2 changes: 1 addition & 1 deletion src/battle_controller_wally.c
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ static void WallyHandleChooseMove(void)
if (--gBattleStruct->wallyMoveFrames == 0)
{
PlaySE(SE_SELECT);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, 10, 0x100);
BtlController_EmitTwoReturnValues(B_COMM_TO_ENGINE, B_ACTION_EXEC_SCRIPT, 0x100);
WallyBufferExecCompleted();
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/recorded_battle.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ u8 RecordedBattle_GetBattlerAction(u8 battler)
ResetPaletteFadeControl();
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
SetMainCallback2(CB2_QuitRecordedBattle);
return 0xFF;
return B_ACTION_NONE;
}
else
{
Expand Down