diff --git a/include/battle_controllers.h b/include/battle_controllers.h index b1f22efeb..da2ccaff0 100644 --- a/include/battle_controllers.h +++ b/include/battle_controllers.h @@ -267,6 +267,9 @@ void BtlController_HandleReturnMonToBall(u32 battler); void BtlController_HandleFaintAnimation(u32 battler); void BtlController_HandleSuccessBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture); void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture); +void BtlController_HandlePlaySE(void); +void BtlController_HandlePlayFanfareOrBGM(void); +void BtlController_HandleFaintingCry(void); // player controller void SetControllerToPlayer(void); diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 2958905bd..4434f2dcd 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -49,9 +49,6 @@ static void LinkOpponentHandleSetUnkVar(void); static void LinkOpponentHandleClearUnkFlag(void); static void LinkOpponentHandleToggleUnkFlag(void); static void LinkOpponentHandleHitAnimation(void); -static void LinkOpponentHandlePlaySE(void); -static void LinkOpponentHandlePlayFanfareOrBGM(void); -static void LinkOpponentHandleFaintingCry(void); static void LinkOpponentHandleIntroSlide(void); static void LinkOpponentHandleIntroTrainerBallThrow(void); static void LinkOpponentHandleDrawPartyStatusSummary(void); @@ -116,9 +113,9 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = LinkOpponentHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = LinkOpponentHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = LinkOpponentHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = LinkOpponentHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = LinkOpponentHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkOpponentHandleDrawPartyStatusSummary, @@ -810,42 +807,6 @@ static void LinkOpponentHandleHitAnimation(void) } } -static void LinkOpponentHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - LinkOpponentBufferExecCompleted(); -} - -static void LinkOpponentHandleFaintingCry(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, 25, CRY_MODE_FAINT); - LinkOpponentBufferExecCompleted(); -} - static void LinkOpponentHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 40f302419..6fc1620ca 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -48,9 +48,6 @@ static void LinkPartnerHandleSetUnkVar(void); static void LinkPartnerHandleClearUnkFlag(void); static void LinkPartnerHandleToggleUnkFlag(void); static void LinkPartnerHandleHitAnimation(void); -static void LinkPartnerHandlePlaySE(void); -static void LinkPartnerHandlePlayFanfareOrBGM(void); -static void LinkPartnerHandleFaintingCry(void); static void LinkPartnerHandleIntroSlide(void); static void LinkPartnerHandleIntroTrainerBallThrow(void); static void LinkPartnerHandleDrawPartyStatusSummary(void); @@ -114,9 +111,9 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TOGGLEUNKFLAG] = LinkPartnerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = LinkPartnerHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = LinkPartnerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = LinkPartnerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = LinkPartnerHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = LinkPartnerHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = LinkPartnerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkPartnerHandleDrawPartyStatusSummary, @@ -631,42 +628,6 @@ static void LinkPartnerHandleHitAnimation(void) } } -static void LinkPartnerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - LinkPartnerBufferExecCompleted(); -} - -static void LinkPartnerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - LinkPartnerBufferExecCompleted(); -} - static void LinkPartnerHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index f018bc84a..d721f9d3b 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -64,9 +64,6 @@ static void OpponentHandleSetUnkVar(void); static void OpponentHandleClearUnkFlag(void); static void OpponentHandleToggleUnkFlag(void); static void OpponentHandleHitAnimation(void); -static void OpponentHandlePlaySE(void); -static void OpponentHandlePlayFanfareOrBGM(void); -static void OpponentHandleFaintingCry(void); static void OpponentHandleIntroSlide(void); static void OpponentHandleIntroTrainerBallThrow(void); static void OpponentHandleDrawPartyStatusSummary(void); @@ -131,9 +128,9 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TOGGLEUNKFLAG] = OpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = OpponentHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = OpponentHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = OpponentHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = OpponentHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = OpponentHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = OpponentHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = OpponentHandleDrawPartyStatusSummary, @@ -1083,42 +1080,6 @@ static void OpponentHandleHitAnimation(void) } } -static void OpponentHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - OpponentBufferExecCompleted(); -} - -static void OpponentHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - OpponentBufferExecCompleted(); -} - -static void OpponentHandleFaintingCry(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, 25, CRY_MODE_FAINT); - OpponentBufferExecCompleted(); -} - static void OpponentHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 886329680..774ef5eb4 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -78,9 +78,6 @@ static void PlayerHandleSetUnkVar(void); static void PlayerHandleClearUnkFlag(void); static void PlayerHandleToggleUnkFlag(void); static void PlayerHandleHitAnimation(void); -static void PlayerHandlePlaySE(void); -static void PlayerHandlePlayFanfareOrBGM(void); -static void PlayerHandleFaintingCry(void); static void PlayerHandleIntroSlide(void); static void PlayerHandleIntroTrainerBallThrow(void); static void PlayerHandleDrawPartyStatusSummary(void); @@ -163,9 +160,9 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TOGGLEUNKFLAG] = PlayerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = PlayerHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = PlayerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = PlayerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = PlayerHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = PlayerHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = PlayerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerHandleDrawPartyStatusSummary, @@ -2395,42 +2392,6 @@ static void PlayerHandleHitAnimation(void) } } -static void PlayerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - PlayerBufferExecCompleted(); -} - -static void PlayerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - PlayerBufferExecCompleted(); -} - -static void PlayerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - PlayerBufferExecCompleted(); -} - static void PlayerHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index a6af9b6da..22d566ef3 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -54,9 +54,6 @@ static void PlayerPartnerHandleSetUnkVar(void); static void PlayerPartnerHandleClearUnkFlag(void); static void PlayerPartnerHandleToggleUnkFlag(void); static void PlayerPartnerHandleHitAnimation(void); -static void PlayerPartnerHandlePlaySE(void); -static void PlayerPartnerHandlePlayFanfareOrBGM(void); -static void PlayerPartnerHandleFaintingCry(void); static void PlayerPartnerHandleIntroSlide(void); static void PlayerPartnerHandleIntroTrainerBallThrow(void); static void PlayerPartnerHandleDrawPartyStatusSummary(void); @@ -124,9 +121,9 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TOGGLEUNKFLAG] = PlayerPartnerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = PlayerPartnerHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = PlayerPartnerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = PlayerPartnerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = PlayerPartnerHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = PlayerPartnerHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = PlayerPartnerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerPartnerHandleDrawPartyStatusSummary, @@ -921,42 +918,6 @@ static void PlayerPartnerHandleHitAnimation(void) } } -static void PlayerPartnerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - PlayerPartnerBufferExecCompleted(); -} - -static void PlayerPartnerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - PlayerPartnerBufferExecCompleted(); -} - static void PlayerPartnerHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index c8372fde2..dbb6825da 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -55,9 +55,6 @@ static void RecordedOpponentHandleSetUnkVar(void); static void RecordedOpponentHandleClearUnkFlag(void); static void RecordedOpponentHandleToggleUnkFlag(void); static void RecordedOpponentHandleHitAnimation(void); -static void RecordedOpponentHandlePlaySE(void); -static void RecordedOpponentHandlePlayFanfareOrBGM(void); -static void RecordedOpponentHandleFaintingCry(void); static void RecordedOpponentHandleIntroSlide(void); static void RecordedOpponentHandleIntroTrainerBallThrow(void); static void RecordedOpponentHandleDrawPartyStatusSummary(void); @@ -121,9 +118,9 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void [CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = RecordedOpponentHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = RecordedOpponentHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = RecordedOpponentHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = RecordedOpponentHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedOpponentHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedOpponentHandleDrawPartyStatusSummary, @@ -796,42 +793,6 @@ static void RecordedOpponentHandleHitAnimation(void) } } -static void RecordedOpponentHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - RecordedOpponentBufferExecCompleted(); -} - -static void RecordedOpponentHandleFaintingCry(void) -{ - u16 species = GetMonData(&gEnemyParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, 25, CRY_MODE_FAINT); - RecordedOpponentBufferExecCompleted(); -} - static void RecordedOpponentHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index ac659c6e5..ef3606998 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -51,9 +51,6 @@ static void RecordedPlayerHandleSetUnkVar(void); static void RecordedPlayerHandleClearUnkFlag(void); static void RecordedPlayerHandleToggleUnkFlag(void); static void RecordedPlayerHandleHitAnimation(void); -static void RecordedPlayerHandlePlaySE(void); -static void RecordedPlayerHandlePlayFanfareOrBGM(void); -static void RecordedPlayerHandleFaintingCry(void); static void RecordedPlayerHandleIntroSlide(void); static void RecordedPlayerHandleIntroTrainerBallThrow(void); static void RecordedPlayerHandleDrawPartyStatusSummary(void); @@ -116,9 +113,9 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) [CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, [CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = RecordedPlayerHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = RecordedPlayerHandlePlayFanfareOrBGM, - [CONTROLLER_FAINTINGCRY] = RecordedPlayerHandleFaintingCry, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, + [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_INTROSLIDE] = RecordedPlayerHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedPlayerHandleIntroTrainerBallThrow, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedPlayerHandleDrawPartyStatusSummary, @@ -810,42 +807,6 @@ static void RecordedPlayerHandleHitAnimation(void) } } -static void RecordedPlayerHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - RecordedPlayerBufferExecCompleted(); -} - -static void RecordedPlayerHandleFaintingCry(void) -{ - u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - - PlayCry_ByMode(species, -25, CRY_MODE_FAINT); - RecordedPlayerBufferExecCompleted(); -} - static void RecordedPlayerHandleIntroSlide(void) { HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 19bdb4283..84b8488e0 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -32,8 +32,6 @@ static void SafariHandlePrintSelectionString(void); static void SafariHandleChooseAction(void); static void SafariHandleChooseItem(void); static void SafariHandleStatusIconUpdate(void); -static void SafariHandlePlaySE(void); -static void SafariHandlePlayFanfareOrBGM(void); static void SafariHandleFaintingCry(void); static void SafariHandleIntroSlide(void); static void SafariHandleIntroTrainerBallThrow(void); @@ -90,8 +88,8 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_TOGGLEUNKFLAG] = BtlController_Empty, [CONTROLLER_HITANIMATION] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty, - [CONTROLLER_PLAYSE] = SafariHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = SafariHandlePlayFanfareOrBGM, + [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry, [CONTROLLER_INTROSLIDE] = SafariHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = SafariHandleIntroTrainerBallThrow, @@ -352,34 +350,8 @@ static void SafariHandleStatusIconUpdate(void) SafariBufferExecCompleted(); } -static void SafariHandlePlaySE(void) -{ - s8 pan; - - if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) - pan = SOUND_PAN_ATTACKER; - else - pan = SOUND_PAN_TARGET; - - PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); - SafariBufferExecCompleted(); -} - -static void SafariHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - SafariBufferExecCompleted(); -} - +// All of the other controllers(except Wally's) use CRY_MODE_FAINT. +// Player is not a pokemon, so it can't really faint in the Safari anyway. static void SafariHandleFaintingCry(void) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 27d512a03..c4bcc8c72 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -50,7 +50,6 @@ static void WallyHandleChooseItem(void); static void WallyHandleHealthBarUpdate(void); static void WallyHandleHitAnimation(void); static void WallyHandlePlaySE(void); -static void WallyHandlePlayFanfareOrBGM(void); static void WallyHandleFaintingCry(void); static void WallyHandleIntroSlide(void); static void WallyHandleIntroTrainerBallThrow(void); @@ -113,7 +112,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) = [CONTROLLER_HITANIMATION] = WallyHandleHitAnimation, [CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_PLAYSE] = WallyHandlePlaySE, - [CONTROLLER_PLAYFANFAREORBGM] = WallyHandlePlayFanfareOrBGM, + [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry, [CONTROLLER_INTROSLIDE] = WallyHandleIntroSlide, [CONTROLLER_INTROTRAINERBALLTHROW] = WallyHandleIntroTrainerBallThrow, @@ -614,33 +613,19 @@ static void WallyHandleHitAnimation(void) } } +// For some reason Wally's SE don't take side into account and pan is always the same. Possibly a bug static void WallyHandlePlaySE(void) { PlaySE(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); WallyBufferExecCompleted(); } -static void WallyHandlePlayFanfareOrBGM(void) -{ - if (gBattleResources->bufferA[gActiveBattler][3]) - { - BattleStopLowHpSound(); - PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - else - { - PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); - } - - WallyBufferExecCompleted(); -} - +// All of the other controllers use CRY_MODE_FAINT. +// Wally's Pokémon during the tutorial is never intended to faint, so that's probably why it's different here. static void WallyHandleFaintingCry(void) { u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES); - // Seems that it doesn't bother using CRY_MODE_FAINT because - // Wally's Pokémon during the tutorial is never intended to faint. PlayCry_Normal(species, 25); WallyBufferExecCompleted(); } diff --git a/src/battle_controllers.c b/src/battle_controllers.c index c8027fd18..ef51be8bd 100644 --- a/src/battle_controllers.c +++ b/src/battle_controllers.c @@ -2376,3 +2376,46 @@ void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool gBattleSpritesDataPtr->animationData->ballThrowCaseId = gBattleResources->bufferA[battler][1]; HandleBallThrow(battler, target, animId, allowCriticalCapture); } + +void BtlController_HandlePlaySE(void) +{ + s8 pan = (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) ? SOUND_PAN_ATTACKER : SOUND_PAN_TARGET; + + PlaySE12WithPanning(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8), pan); + BattleControllerComplete(gActiveBattler); +} + +void BtlController_HandlePlayFanfareOrBGM(void) +{ + if (gBattleResources->bufferA[gActiveBattler][3]) + { + BattleStopLowHpSound(); + PlayBGM(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); + } + else + { + PlayFanfare(gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8)); + } + + BattleControllerComplete(gActiveBattler); +} + +void BtlController_HandleFaintingCry(void) +{ + struct Pokemon *party; + s8 pan; + + if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) + { + party = gPlayerParty; + pan = -25; + } + else + { + party = gEnemyParty; + pan = 25; + } + + PlayCry_ByMode(GetMonData(&party[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES), pan, CRY_MODE_FAINT); + BattleControllerComplete(gActiveBattler); +}