sovereignx/src/battle_controller_player_partner.c

724 lines
30 KiB
C
Raw Normal View History

2017-10-22 19:49:21 +01:00
#include "global.h"
#include "battle.h"
2020-12-20 21:47:20 +00:00
#include "battle_ai_main.h"
#include "battle_ai_util.h"
2018-11-14 00:01:50 +00:00
#include "battle_anim.h"
2017-10-22 19:49:21 +01:00
#include "battle_controllers.h"
#include "battle_message.h"
#include "battle_interface.h"
2018-11-14 00:01:50 +00:00
#include "battle_setup.h"
#include "battle_tower.h"
2020-12-01 18:43:15 +00:00
#include "battle_z_move.h"
2018-11-14 00:01:50 +00:00
#include "bg.h"
2019-04-04 22:53:06 +01:00
#include "data.h"
2018-11-14 00:01:50 +00:00
#include "item_use.h"
2017-10-22 19:49:21 +01:00
#include "link.h"
#include "main.h"
#include "m4a.h"
#include "palette.h"
#include "party_menu.h"
2018-11-14 00:01:50 +00:00
#include "pokeball.h"
#include "pokemon.h"
#include "reshow_battle_screen.h"
#include "sound.h"
#include "string_util.h"
2017-10-22 19:49:21 +01:00
#include "task.h"
#include "text.h"
2018-11-14 00:01:50 +00:00
#include "util.h"
#include "window.h"
#include "constants/battle_anim.h"
#include "constants/songs.h"
#include "constants/party_menu.h"
2018-11-14 00:01:50 +00:00
#include "constants/trainers.h"
2017-10-22 19:49:21 +01:00
2017-10-23 10:07:36 +01:00
static void PlayerPartnerHandleLoadMonSprite(void);
static void PlayerPartnerHandleSwitchInAnim(void);
static void PlayerPartnerHandleDrawTrainerPic(void);
static void PlayerPartnerHandleTrainerSlideBack(void);
static void PlayerPartnerHandleMoveAnimation(void);
static void PlayerPartnerHandlePrintString(void);
static void PlayerPartnerHandleChooseAction(void);
static void PlayerPartnerHandleChooseMove(void);
static void PlayerPartnerHandleChoosePokemon(void);
static void PlayerPartnerHandleHealthBarUpdate(void);
static void PlayerPartnerHandleIntroTrainerBallThrow(void);
static void PlayerPartnerHandleDrawPartyStatusSummary(void);
2018-06-28 20:06:32 +01:00
static void PlayerPartnerHandleHidePartyStatusSummary(void);
2017-10-23 10:07:36 +01:00
static void PlayerPartnerHandleBattleAnimation(void);
static void PlayerPartnerHandleEndLinkBattle(void);
2017-10-23 10:07:36 +01:00
static void PlayerPartnerBufferRunCommand(void);
static void PlayerPartnerBufferExecCompleted(void);
static void Task_LaunchLvlUpAnim(u8 taskId);
2017-10-23 10:07:36 +01:00
static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId);
static void Task_PrepareToGiveExpWithExpBar(u8 taskId);
static void Task_GiveExpWithExpBar(u8 taskId);
static void Task_UpdateLvlInHealthbox(u8 taskId);
static void SwitchIn_WaitAndEnd(void);
2017-10-23 10:07:36 +01:00
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst);
static void SetPlayerPartnerMonData(u8 monId);
static void PlayerPartnerDoMoveAnimation(void);
static void Task_StartSendOutAnim(u8 taskId);
2021-01-23 01:03:21 +00:00
static void EndDrawPartyStatusSummary(void);
2017-10-23 10:07:36 +01:00
2017-10-31 17:04:08 +00:00
static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
2017-10-22 19:49:21 +01:00
{
[CONTROLLER_GETMONDATA] = BtlController_HandleGetMonData,
[CONTROLLER_GETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_SETMONDATA] = BtlController_HandleSetMonData,
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
2020-12-29 21:51:44 +00:00
[CONTROLLER_LOADMONSPRITE] = PlayerPartnerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = PlayerPartnerHandleSwitchInAnim,
2023-08-05 13:11:25 +01:00
[CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
2020-12-29 21:51:44 +00:00
[CONTROLLER_DRAWTRAINERPIC] = PlayerPartnerHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = BtlController_Empty,
2020-12-29 21:51:44 +00:00
[CONTROLLER_TRAINERSLIDEBACK] = PlayerPartnerHandleTrainerSlideBack,
2023-08-05 13:11:25 +01:00
[CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_PAUSE] = BtlController_Empty,
2020-12-29 21:51:44 +00:00
[CONTROLLER_MOVEANIMATION] = PlayerPartnerHandleMoveAnimation,
[CONTROLLER_PRINTSTRING] = PlayerPartnerHandlePrintString,
[CONTROLLER_PRINTSTRINGPLAYERONLY] = BtlController_Empty,
2020-12-29 21:51:44 +00:00
[CONTROLLER_CHOOSEACTION] = PlayerPartnerHandleChooseAction,
[CONTROLLER_YESNOBOX] = BtlController_Empty,
2020-12-29 21:51:44 +00:00
[CONTROLLER_CHOOSEMOVE] = PlayerPartnerHandleChooseMove,
[CONTROLLER_OPENBAG] = BtlController_Empty,
2020-12-29 21:51:44 +00:00
[CONTROLLER_CHOOSEPOKEMON] = PlayerPartnerHandleChoosePokemon,
[CONTROLLER_23] = BtlController_Empty,
2020-12-29 21:51:44 +00:00
[CONTROLLER_HEALTHBARUPDATE] = PlayerPartnerHandleHealthBarUpdate,
[CONTROLLER_EXPUPDATE] = PlayerHandleExpUpdate,
2023-08-05 19:42:19 +01:00
[CONTROLLER_STATUSICONUPDATE] = BtlController_HandleStatusIconUpdate,
[CONTROLLER_STATUSANIMATION] = BtlController_HandleStatusAnimation,
[CONTROLLER_STATUSXOR] = BtlController_Empty,
[CONTROLLER_DATATRANSFER] = BtlController_Empty,
[CONTROLLER_DMA3TRANSFER] = BtlController_Empty,
[CONTROLLER_PLAYBGM] = BtlController_Empty,
[CONTROLLER_32] = BtlController_Empty,
[CONTROLLER_TWORETURNVALUES] = BtlController_Empty,
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
2023-08-05 13:11:25 +01:00
[CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty,
2023-08-05 11:13:50 +01:00
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
2023-08-05 13:11:25 +01:00
[CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
2020-12-29 21:51:44 +00:00
[CONTROLLER_INTROTRAINERBALLTHROW] = PlayerPartnerHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerPartnerHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerPartnerHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty,
2023-08-05 13:11:25 +01:00
[CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
2020-12-29 21:51:44 +00:00
[CONTROLLER_BATTLEANIMATION] = PlayerPartnerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
[CONTROLLER_ENDLINKBATTLE] = PlayerPartnerHandleEndLinkBattle,
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop
2017-10-22 19:49:21 +01:00
};
static void PlayerPartnerDummy(void)
2017-10-22 19:49:21 +01:00
{
}
2017-10-26 22:12:48 +01:00
void SetControllerToPlayerPartner(void)
2017-10-22 19:49:21 +01:00
{
2023-08-04 16:29:29 +01:00
gBattlerControllerEndFuncs[gActiveBattler] = PlayerPartnerBufferExecCompleted;
2018-02-06 19:48:02 +00:00
gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand;
2017-10-22 19:49:21 +01:00
}
2017-10-23 10:07:36 +01:00
static void PlayerPartnerBufferRunCommand(void)
2017-10-22 19:49:21 +01:00
{
2018-02-06 19:48:02 +00:00
if (gBattleControllerExecFlags & gBitTable[gActiveBattler])
2017-10-22 19:49:21 +01:00
{
if (gBattleResources->bufferA[gActiveBattler][0] < ARRAY_COUNT(sPlayerPartnerBufferCommands))
sPlayerPartnerBufferCommands[gBattleResources->bufferA[gActiveBattler][0]]();
2017-10-22 19:49:21 +01:00
else
PlayerPartnerBufferExecCompleted();
}
}
static void CompleteOnBattlerSpriteCallbackDummy(void)
2017-10-23 10:07:36 +01:00
{
2018-02-06 19:48:02 +00:00
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void FreeTrainerSpriteAfterSlide(void)
2017-10-23 10:07:36 +01:00
{
2018-02-06 19:48:02 +00:00
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
BattleGfxSfxDummy3(MALE);
2018-02-06 19:48:02 +00:00
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
}
static void Intro_DelayAndEnd(void)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay == (u8)-1)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0;
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
}
static void Intro_WaitForHealthbox(void)
2017-10-23 10:07:36 +01:00
{
bool32 finished = FALSE;
2017-10-23 10:07:36 +01:00
if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI)))
{
2018-02-06 19:48:02 +00:00
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
finished = TRUE;
2017-10-23 10:07:36 +01:00
}
else
{
2018-02-06 19:48:02 +00:00
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
2022-08-27 06:26:13 +01:00
&& gSprites[gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]].callback == SpriteCallbackDummy)
2017-10-23 10:07:36 +01:00
{
finished = TRUE;
2017-10-23 10:07:36 +01:00
}
}
if (IsCryPlayingOrClearCrySongs())
finished = FALSE;
2017-10-23 10:07:36 +01:00
if (finished)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 3;
gBattlerControllerFuncs[gActiveBattler] = Intro_DelayAndEnd;
2017-10-23 10:07:36 +01:00
}
}
static void Intro_ShowHealthbox(void)
2017-10-23 10:07:36 +01:00
{
2018-02-06 01:46:59 +00:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
2022-08-27 06:26:13 +01:00
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(gActiveBattler)].ballAnimActive
2021-01-23 01:03:21 +00:00
&& gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
2018-02-06 19:48:02 +00:00
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
2021-01-23 01:03:21 +00:00
&& ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay != 1)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].introEndDelay = 0;
2017-10-23 10:07:36 +01:00
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
2022-08-27 06:26:13 +01:00
DestroySprite(&gSprites[gBattleControllerData[BATTLE_PARTNER(gActiveBattler)]]);
UpdateHealthboxAttribute(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)], &gPlayerParty[gBattlerPartyIndexes[BATTLE_PARTNER(gActiveBattler)]], HEALTHBOX_ALL);
StartHealthboxSlideIn(BATTLE_PARTNER(gActiveBattler));
SetHealthboxSpriteVisible(gHealthboxSpriteIds[BATTLE_PARTNER(gActiveBattler)]);
2017-10-23 10:07:36 +01:00
}
2021-01-23 01:03:21 +00:00
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
2018-02-06 19:48:02 +00:00
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
2021-01-23 01:03:21 +00:00
StartHealthboxSlideIn(gActiveBattler);
2018-02-06 19:48:02 +00:00
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
2017-10-23 10:07:36 +01:00
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->animationData->introAnimActive = FALSE;
2017-10-23 10:07:36 +01:00
gBattlerControllerFuncs[gActiveBattler] = Intro_WaitForHealthbox;
2017-10-23 10:07:36 +01:00
}
}
static void WaitForMonAnimAfterLoad(void)
2017-10-23 10:07:36 +01:00
{
2021-07-07 14:11:52 +01:00
if (gSprites[gBattlerSpriteIds[gActiveBattler]].animEnded && gSprites[gBattlerSpriteIds[gActiveBattler]].x2 == 0)
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void CompleteOnHealthbarDone(void)
{
2018-06-18 23:43:15 +01:00
s16 hpValue = MoveBattleBar(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], HEALTH_BAR, 0);
2017-10-23 10:07:36 +01:00
2018-02-06 19:48:02 +00:00
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
2017-10-23 10:07:36 +01:00
if (hpValue != -1)
{
2022-08-25 16:37:47 +01:00
UpdateHpTextInHealthbox(gHealthboxSpriteIds[gActiveBattler], HP_CURRENT, hpValue, gBattleMons[gActiveBattler].maxHP);
2017-10-23 10:07:36 +01:00
}
else
{
2018-02-06 19:48:02 +00:00
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
}
static void CompleteOnInactiveTextPrinter(void)
{
2021-10-08 21:50:52 +01:00
if (!IsTextPrinterActive(B_WIN_MSG))
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void CompleteOnInactiveTextPrinter2(void)
{
2021-10-08 21:50:52 +01:00
if (!IsTextPrinterActive(B_WIN_MSG))
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void SwitchIn_ShowSubstitute(void)
2017-10-23 10:07:36 +01:00
{
2018-02-06 19:48:02 +00:00
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 10:07:36 +01:00
{
2018-02-06 01:46:59 +00:00
CopyBattleSpriteInvisibility(gActiveBattler);
2018-02-06 22:09:39 +00:00
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
2018-02-06 01:46:59 +00:00
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
2017-10-23 10:07:36 +01:00
gBattlerControllerFuncs[gActiveBattler] = SwitchIn_WaitAndEnd;
2017-10-23 10:07:36 +01:00
}
}
static void SwitchIn_WaitAndEnd(void)
2017-10-23 10:07:36 +01:00
{
2018-02-06 01:46:59 +00:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive
2018-02-06 19:48:02 +00:00
&& gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 10:07:36 +01:00
{
PlayerPartnerBufferExecCompleted();
}
}
static void SwitchIn_ShowHealthbox(void)
2017-10-23 10:07:36 +01:00
{
2020-08-30 20:11:44 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim)
2017-10-23 10:07:36 +01:00
{
2020-08-30 20:11:44 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim = FALSE;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].finishedShinyMonAnim = FALSE;
2017-10-23 10:07:36 +01:00
2021-01-23 01:03:21 +00:00
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
2017-10-23 10:07:36 +01:00
2021-01-23 01:03:21 +00:00
CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10);
2018-02-06 19:48:02 +00:00
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 0);
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_ALL);
2021-01-23 01:03:21 +00:00
StartHealthboxSlideIn(gActiveBattler);
2018-02-06 19:48:02 +00:00
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
2017-10-23 10:07:36 +01:00
gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowSubstitute;
2017-10-23 10:07:36 +01:00
}
}
static void SwitchIn_TryShinyAnim(void)
2017-10-23 10:07:36 +01:00
{
2020-08-30 20:11:44 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].triedShinyMonAnim
2018-02-06 01:46:59 +00:00
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
2017-10-23 10:07:36 +01:00
{
TryShinyAnimation(gActiveBattler, &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]]);
2017-10-23 10:07:36 +01:00
}
2021-01-23 01:03:21 +00:00
if (gSprites[gBattleControllerData[gActiveBattler]].callback == SpriteCallbackDummy
2018-02-06 01:46:59 +00:00
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
DestroySprite(&gSprites[gBattleControllerData[gActiveBattler]]);
gBattlerControllerFuncs[gActiveBattler] = SwitchIn_ShowHealthbox;
2017-10-23 10:07:36 +01:00
}
}
static void PlayerPartnerBufferExecCompleted(void)
{
2018-02-06 19:48:02 +00:00
gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand;
2017-10-23 10:07:36 +01:00
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
gBattleResources->bufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP;
2017-10-23 10:07:36 +01:00
}
else
{
2018-02-06 19:48:02 +00:00
gBattleControllerExecFlags &= ~gBitTable[gActiveBattler];
2017-10-23 10:07:36 +01:00
}
}
static void PlayerPartnerHandleLoadMonSprite(void)
{
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
2017-10-23 10:07:36 +01:00
}
static void PlayerPartnerHandleSwitchInAnim(void)
{
2023-08-04 12:42:40 +01:00
BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim);
2017-10-23 10:07:36 +01:00
}
2021-01-23 01:03:21 +00:00
#define sSpeedX data[0]
2017-10-23 10:07:36 +01:00
// some explanation here
// in emerald it's possible to have a tag battle in the battle frontier facilities with AI
// which use the front sprite for both the player and the partner as opposed to any other battles (including the one with Steven) that use the back pic as well as animate it
static void PlayerPartnerHandleDrawTrainerPic(void)
{
s16 xPos, yPos;
u32 trainerPicId;
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
2017-10-23 10:07:36 +01:00
{
trainerPicId = TRAINER_BACK_PIC_STEVEN;
2017-10-23 10:07:36 +01:00
xPos = 90;
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
2017-10-23 10:07:36 +01:00
}
2018-11-24 00:02:02 +00:00
else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
{
trainerPicId = gPartnerSpriteId;
xPos = 90;
2019-01-05 09:14:20 +00:00
yPos = (8 - gTrainerBackPicCoords[trainerPicId].size) * 4 + 80;
2018-11-24 00:02:02 +00:00
}
2017-10-23 10:07:36 +01:00
else
{
trainerPicId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
xPos = 32;
yPos = (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 80;
2017-10-23 10:07:36 +01:00
}
// Use back pic only if the partner is Steven
2018-11-24 00:02:02 +00:00
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER || gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
2017-10-23 10:07:36 +01:00
{
2018-02-06 01:46:59 +00:00
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(trainerPicId, GetBattlerPosition(gActiveBattler));
2018-12-18 04:08:08 +00:00
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler));
2018-02-06 01:46:59 +00:00
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
2021-07-07 14:11:52 +01:00
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH;
2021-01-23 01:03:21 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn;
2017-10-23 10:07:36 +01:00
}
else // otherwise use front sprite
{
2018-02-06 01:46:59 +00:00
DecompressTrainerFrontPic(trainerPicId, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerFront(trainerPicId, GetBattlerPosition(gActiveBattler));
2018-12-18 04:08:08 +00:00
gBattlerSpriteIds[gActiveBattler] = CreateSprite(&gMultiuseSpriteTemplate, xPos, yPos, GetBattlerSpriteSubpriority(gActiveBattler));
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag);
2021-07-07 14:11:52 +01:00
gSprites[gBattlerSpriteIds[gActiveBattler]].x2 = DISPLAY_WIDTH;
gSprites[gBattlerSpriteIds[gActiveBattler]].y2 = 48;
2021-01-23 01:03:21 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_TrainerSlideIn;
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineMode = ST_OAM_AFFINE_OFF;
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].hFlip = 1;
2017-10-23 10:07:36 +01:00
}
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
2017-10-23 10:07:36 +01:00
}
2021-01-23 01:03:21 +00:00
#undef sSpeedX
2017-10-23 10:07:36 +01:00
static void PlayerPartnerHandleTrainerSlideBack(void)
{
2019-02-06 19:17:09 +00:00
SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
2021-07-07 14:11:52 +01:00
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y;
2018-11-25 23:00:18 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
2018-02-06 19:48:02 +00:00
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
2017-10-23 10:07:36 +01:00
}
static void PlayerPartnerHandleMoveAnimation(void)
{
2021-01-23 01:03:21 +00:00
if (!IsBattleSEPlaying(gActiveBattler))
2017-10-23 10:07:36 +01:00
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
2018-02-06 01:46:59 +00:00
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
2018-02-06 01:46:59 +00:00
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
2022-06-03 15:24:57 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDoMoveAnimation;
2017-10-23 10:07:36 +01:00
}
}
static void PlayerPartnerDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
2017-10-23 10:07:36 +01:00
2018-02-06 01:46:59 +00:00
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
2017-10-23 10:07:36 +01:00
{
case 0:
2018-02-06 22:09:39 +00:00
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
2017-10-23 10:07:36 +01:00
{
2018-02-06 22:09:39 +00:00
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
2018-02-06 01:46:59 +00:00
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
2017-10-23 10:07:36 +01:00
}
2018-02-06 01:46:59 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
2017-10-23 10:07:36 +01:00
break;
case 1:
2018-02-06 01:46:59 +00:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
2017-10-23 10:07:36 +01:00
DoMoveAnim(move);
2018-02-06 01:46:59 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
2017-10-23 10:07:36 +01:00
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
2021-01-23 01:03:21 +00:00
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
2018-02-06 22:09:39 +00:00
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
2017-10-23 10:07:36 +01:00
{
2018-02-06 01:46:59 +00:00
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
2018-02-06 22:09:39 +00:00
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
2017-10-23 10:07:36 +01:00
}
2018-02-06 01:46:59 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
2017-10-23 10:07:36 +01:00
}
break;
case 3:
2018-02-06 01:46:59 +00:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 10:07:36 +01:00
{
2017-11-04 15:11:13 +00:00
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
2018-02-06 01:46:59 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
break;
}
}
static void PlayerPartnerHandlePrintString(void)
{
u16 *stringId;
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
stringId = (u16 *)(&gBattleResources->bufferA[gActiveBattler][2]);
2017-10-23 10:07:36 +01:00
BufferStringBattle(*stringId);
2021-10-08 21:50:52 +01:00
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
2018-02-06 19:48:02 +00:00
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter2;
2017-10-23 10:07:36 +01:00
}
static void PlayerPartnerHandleChooseAction(void)
{
AI_TrySwitchOrUseItem();
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleChooseMove(void)
{
u8 chosenMoveId;
struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[gActiveBattler][4]);
2017-10-23 10:07:36 +01:00
chosenMoveId = gBattleStruct->aiMoveOrAction[gActiveBattler];
gBattlerTarget = gBattleStruct->aiChosenTarget[gActiveBattler];
2021-12-17 03:57:30 +00:00
2018-02-26 12:24:46 +00:00
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & (MOVE_TARGET_USER | MOVE_TARGET_USER_OR_SELECTED))
2018-02-06 22:09:39 +00:00
gBattlerTarget = gActiveBattler;
2017-10-23 10:07:36 +01:00
if (gBattleMoves[moveInfo->moves[chosenMoveId]].target & MOVE_TARGET_BOTH)
{
2018-02-06 22:09:39 +00:00
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT);
if (gAbsentBattlerFlags & gBitTable[gBattlerTarget])
gBattlerTarget = GetBattlerAtPosition(B_POSITION_OPPONENT_RIGHT);
2017-10-23 10:07:36 +01:00
}
2022-08-25 16:37:47 +01:00
if (ShouldUseZMove(gActiveBattler, gBattlerTarget, moveInfo->moves[chosenMoveId]))
2020-12-01 18:43:15 +00:00
QueueZMove(gActiveBattler, moveInfo->moves[chosenMoveId]);
2017-10-23 10:07:36 +01:00
// If partner can mega evolve, do it.
if (CanMegaEvolve(gActiveBattler))
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (RET_MEGA_EVOLUTION) | (gBattlerTarget << 8));
else
BtlController_EmitTwoReturnValues(BUFFER_B, 10, (chosenMoveId) | (gBattlerTarget << 8));
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleChoosePokemon(void)
{
s32 chosenMonId;
// Choosing Revival Blessing target
if ((gBattleResources->bufferA[gActiveBattler][1] & 0xF) == PARTY_ACTION_CHOOSE_FAINTED_MON)
2017-10-23 10:07:36 +01:00
{
chosenMonId = gSelectedMonPartyId = GetFirstFaintedPartyIndex(gActiveBattler);
}
// Switching out
else
{
chosenMonId = GetMostSuitableMonToSwitchInto();
if (chosenMonId == PARTY_SIZE) // just switch to the next mon
2017-10-23 10:07:36 +01:00
{
u8 playerMonIdentity = GetBattlerAtPosition(B_POSITION_PLAYER_LEFT);
u8 selfIdentity = GetBattlerAtPosition(B_POSITION_PLAYER_RIGHT);
for (chosenMonId = PARTY_SIZE / 2; chosenMonId < PARTY_SIZE; chosenMonId++)
2017-10-23 10:07:36 +01:00
{
if (GetMonData(&gPlayerParty[chosenMonId], MON_DATA_HP) != 0
&& chosenMonId != gBattlerPartyIndexes[playerMonIdentity]
&& chosenMonId != gBattlerPartyIndexes[selfIdentity])
{
break;
}
2017-10-23 10:07:36 +01:00
}
}
*(gBattleStruct->monToSwitchIntoId + gActiveBattler) = chosenMonId;
2017-10-23 10:07:36 +01:00
}
BtlController_EmitChosenMonReturnValue(BUFFER_B, chosenMonId, NULL);
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleHealthBarUpdate(void)
{
s16 hpVal;
LoadBattleBarGfx(0);
hpVal = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
2017-10-23 10:07:36 +01:00
if (hpVal != INSTANT_HP_BAR_DROP)
{
2018-02-06 19:48:02 +00:00
u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP);
u32 curHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_HP);
2017-10-23 10:07:36 +01:00
2018-02-06 19:48:02 +00:00
SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, curHP, hpVal);
2017-10-23 10:07:36 +01:00
}
else
{
2018-02-06 19:48:02 +00:00
u32 maxHP = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_MAX_HP);
2017-10-23 10:07:36 +01:00
2018-02-06 19:48:02 +00:00
SetBattleBarStruct(gActiveBattler, gHealthboxSpriteIds[gActiveBattler], maxHP, 0, hpVal);
2017-10-23 10:07:36 +01:00
}
2018-02-06 19:48:02 +00:00
gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone;
2017-10-23 10:07:36 +01:00
}
#undef tExpTask_monId
#undef tExpTask_gainedExp
#undef tExpTask_bank
#undef tExpTask_frames
static void PlayerPartnerHandleIntroTrainerBallThrow(void)
{
u8 paletteNum;
u8 taskId;
2019-02-06 19:17:09 +00:00
SetSpritePrimaryCoordsFromSecondaryCoords(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
2017-10-23 10:07:36 +01:00
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = -40;
2021-07-07 14:11:52 +01:00
gSprites[gBattlerSpriteIds[gActiveBattler]].data[4] = gSprites[gBattlerSpriteIds[gActiveBattler]].y;
2018-11-25 23:00:18 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = StartAnimLinearTranslation;
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
2017-10-23 10:07:36 +01:00
2021-01-23 01:03:21 +00:00
StoreSpriteCallbackInData6(&gSprites[gBattlerSpriteIds[gActiveBattler]], SpriteCB_FreePlayerSpriteLoadMonSprite);
2018-02-06 19:48:02 +00:00
StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], 1);
2017-10-23 10:07:36 +01:00
paletteNum = AllocSpritePalette(0xD6F9);
if (gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
2017-10-23 10:07:36 +01:00
{
u8 spriteId = TRAINER_BACK_PIC_STEVEN;
2022-08-19 15:29:35 +01:00
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
2017-10-23 10:07:36 +01:00
}
2018-11-24 00:02:02 +00:00
else if (gPartnerTrainerId >= TRAINER_CUSTOM_PARTNER)
{
u8 spriteId = gPartnerSpriteId;
LoadCompressedPalette(gTrainerBackPicPaletteTable[spriteId].data, 0x100 + paletteNum * 16, 32);
}
2017-10-23 10:07:36 +01:00
else
{
u8 spriteId = GetFrontierTrainerFrontSpriteId(gPartnerTrainerId);
2022-08-19 15:29:35 +01:00
LoadCompressedPalette(gTrainerFrontPicPaletteTable[spriteId].data, OBJ_PLTT_ID(paletteNum), PLTT_SIZE_4BPP);
2017-10-23 10:07:36 +01:00
}
2018-02-06 19:48:02 +00:00
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;
2017-10-23 10:07:36 +01:00
taskId = CreateTask(Task_StartSendOutAnim, 5);
2018-02-06 01:46:59 +00:00
gTasks[taskId].data[0] = gActiveBattler;
2017-10-23 10:07:36 +01:00
2018-06-28 20:06:32 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
2017-10-23 10:07:36 +01:00
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->animationData->introAnimActive = TRUE;
gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDummy;
2017-10-23 10:07:36 +01:00
}
static void Task_StartSendOutAnim(u8 taskId)
2017-10-23 10:07:36 +01:00
{
if (gTasks[taskId].data[1] < 24)
{
gTasks[taskId].data[1]++;
}
else
{
2018-02-06 01:46:59 +00:00
u8 savedActiveBank = gActiveBattler;
2017-10-23 10:07:36 +01:00
2018-02-06 01:46:59 +00:00
gActiveBattler = gTasks[taskId].data[0];
2017-10-23 10:07:36 +01:00
if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
StartSendOutAnim(gActiveBattler, FALSE);
2017-10-23 10:07:36 +01:00
}
else
{
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
StartSendOutAnim(gActiveBattler, FALSE);
2018-02-06 01:46:59 +00:00
gActiveBattler ^= BIT_FLANK;
gBattleResources->bufferA[gActiveBattler][1] = gBattlerPartyIndexes[gActiveBattler];
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
StartSendOutAnim(gActiveBattler, FALSE);
2018-02-06 01:46:59 +00:00
gActiveBattler ^= BIT_FLANK;
2017-10-23 10:07:36 +01:00
}
gBattlerControllerFuncs[gActiveBattler] = Intro_ShowHealthbox;
2018-02-06 01:46:59 +00:00
gActiveBattler = savedActiveBank;
2017-10-23 10:07:36 +01:00
DestroyTask(taskId);
}
}
static void PlayerPartnerHandleDrawPartyStatusSummary(void)
{
if (gBattleResources->bufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
2017-10-23 10:07:36 +01:00
{
PlayerPartnerBufferExecCompleted();
}
else
{
2018-06-28 20:06:32 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown = 1;
gBattlerStatusSummaryTaskId[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleResources->bufferA[gActiveBattler][4], gBattleResources->bufferA[gActiveBattler][1], gBattleResources->bufferA[gActiveBattler][2]);
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0;
2017-10-23 10:07:36 +01:00
if (gBattleResources->bufferA[gActiveBattler][2] != 0)
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 93;
2017-10-23 10:07:36 +01:00
2021-01-23 01:03:21 +00:00
gBattlerControllerFuncs[gActiveBattler] = EndDrawPartyStatusSummary;
2017-10-23 10:07:36 +01:00
}
}
2021-01-23 01:03:21 +00:00
static void EndDrawPartyStatusSummary(void)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer++ > 92)
2017-10-23 10:07:36 +01:00
{
2021-01-23 01:03:21 +00:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusDelayTimer = 0;
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
}
2018-06-28 20:06:32 +01:00
static void PlayerPartnerHandleHidePartyStatusSummary(void)
2017-10-23 10:07:36 +01:00
{
2018-06-28 20:06:32 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].partyStatusSummaryShown)
gTasks[gBattlerStatusSummaryTaskId[gActiveBattler]].func = Task_HidePartyStatusSummary;
2017-10-23 10:07:36 +01:00
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleBattleAnimation(void)
{
2023-08-05 13:11:25 +01:00
BtlController_HandleBattleAnimation(gActiveBattler, FALSE, FALSE);
2017-10-23 10:07:36 +01:00
}
static void PlayerPartnerHandleEndLinkBattle(void)
2017-10-23 10:07:36 +01:00
{
gBattleOutcome = gBattleResources->bufferA[gActiveBattler][1];
2017-10-23 10:07:36 +01:00
FadeOutMapMusic(5);
BeginFastPaletteFade(3);
PlayerPartnerBufferExecCompleted();
2021-01-23 01:03:21 +00:00
gBattlerControllerFuncs[gActiveBattler] = SetBattleEndCallbacks;
2017-10-23 10:07:36 +01:00
}