pokeemerald/src/battle_controller_safari.c

697 lines
18 KiB
C
Raw Normal View History

2017-10-22 20:38:23 +02:00
#include "global.h"
#include "battle.h"
#include "battle_controllers.h"
#include "battle_message.h"
#include "battle_interface.h"
#include "battle_anim.h"
2017-12-31 16:28:57 +01:00
#include "constants/battle_anim.h"
2017-10-22 20:38:23 +02:00
#include "pokemon.h"
#include "link.h"
#include "util.h"
#include "main.h"
2017-12-11 19:27:51 +01:00
#include "constants/songs.h"
2017-10-22 20:38:23 +02:00
#include "sound.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
#include "task.h"
#include "text.h"
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
2017-10-31 18:04:08 +01:00
#include "data2.h"
2017-12-16 00:08:23 +01:00
#include "pokeblock.h"
2018-02-08 00:00:25 +01:00
#include "item_use.h"
2017-10-22 20:38:23 +02:00
extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y;
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern void sub_81358F4(void);
// this file's functions
static void SafariHandleGetMonData(void);
static void SafariHandleGetRawMonData(void);
static void SafariHandleSetMonData(void);
static void SafariHandleSetRawMonData(void);
static void SafariHandleLoadMonSprite(void);
static void SafariHandleSwitchInAnim(void);
static void SafariHandleReturnMonToBall(void);
static void SafariHandleDrawTrainerPic(void);
static void SafariHandleTrainerSlide(void);
static void SafariHandleTrainerSlideBack(void);
static void SafariHandleFaintAnimation(void);
static void SafariHandlePaletteFade(void);
static void SafariHandleSuccessBallThrowAnim(void);
static void SafariHandleBallThrowAnim(void);
static void SafariHandlePause(void);
static void SafariHandleMoveAnimation(void);
static void SafariHandlePrintString(void);
static void SafariHandlePrintSelectionString(void);
2017-10-22 20:38:23 +02:00
static void SafariHandleChooseAction(void);
static void SafariHandleUnknownYesNoBox(void);
static void SafariHandleChooseMove(void);
static void SafariHandleChooseItem(void);
static void SafariHandleChoosePokemon(void);
static void SafariHandleCmd23(void);
static void SafariHandleHealthBarUpdate(void);
static void SafariHandleExpUpdate(void);
static void SafariHandleStatusIconUpdate(void);
static void SafariHandleStatusAnimation(void);
static void SafariHandleStatusXor(void);
static void SafariHandleDataTransfer(void);
static void SafariHandleDMA3Transfer(void);
static void SafariHandlePlayBGM(void);
static void SafariHandleCmd32(void);
static void SafariHandleTwoReturnValues(void);
static void SafariHandleChosenMonReturnValue(void);
static void SafariHandleOneReturnValue(void);
static void SafariHandleOneReturnValue_Duplicate(void);
static void SafariHandleCmd37(void);
static void SafariHandleCmd38(void);
static void SafariHandleCmd39(void);
static void SafariHandleCmd40(void);
static void SafariHandleHitAnimation(void);
static void SafariHandleCmd42(void);
static void SafariHandlePlaySE(void);
2017-10-22 20:38:23 +02:00
static void SafariHandlePlayFanfareOrBGM(void);
static void SafariHandleFaintingCry(void);
static void SafariHandleIntroSlide(void);
static void SafariHandleIntroTrainerBallThrow(void);
static void SafariHandleDrawPartyStatusSummary(void);
2018-06-28 21:06:32 +02:00
static void SafariHandleHidePartyStatusSummary(void);
2018-06-20 23:07:51 +02:00
static void SafariHandleEndBounceEffect(void);
2017-10-22 20:38:23 +02:00
static void SafariHandleSpriteInvisibility(void);
static void SafariHandleBattleAnimation(void);
static void SafariHandleLinkStandbyMsg(void);
static void SafariHandleResetActionMoveSelection(void);
static void SafariHandleCmd55(void);
static void nullsub_115(void);
static void SafariBufferRunCommand(void);
static void SafariBufferExecCompleted(void);
static void CompleteWhenChosePokeblock(void);
2017-10-31 18:04:08 +01:00
static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
2017-10-22 20:38:23 +02:00
{
SafariHandleGetMonData,
SafariHandleGetRawMonData,
SafariHandleSetMonData,
SafariHandleSetRawMonData,
SafariHandleLoadMonSprite,
SafariHandleSwitchInAnim,
SafariHandleReturnMonToBall,
SafariHandleDrawTrainerPic,
SafariHandleTrainerSlide,
SafariHandleTrainerSlideBack,
SafariHandleFaintAnimation,
SafariHandlePaletteFade,
SafariHandleSuccessBallThrowAnim,
SafariHandleBallThrowAnim,
SafariHandlePause,
SafariHandleMoveAnimation,
SafariHandlePrintString,
SafariHandlePrintSelectionString,
2017-10-22 20:38:23 +02:00
SafariHandleChooseAction,
SafariHandleUnknownYesNoBox,
SafariHandleChooseMove,
SafariHandleChooseItem,
SafariHandleChoosePokemon,
SafariHandleCmd23,
SafariHandleHealthBarUpdate,
SafariHandleExpUpdate,
SafariHandleStatusIconUpdate,
SafariHandleStatusAnimation,
SafariHandleStatusXor,
SafariHandleDataTransfer,
SafariHandleDMA3Transfer,
SafariHandlePlayBGM,
SafariHandleCmd32,
SafariHandleTwoReturnValues,
SafariHandleChosenMonReturnValue,
SafariHandleOneReturnValue,
SafariHandleOneReturnValue_Duplicate,
SafariHandleCmd37,
SafariHandleCmd38,
SafariHandleCmd39,
SafariHandleCmd40,
SafariHandleHitAnimation,
SafariHandleCmd42,
SafariHandlePlaySE,
2017-10-22 20:38:23 +02:00
SafariHandlePlayFanfareOrBGM,
SafariHandleFaintingCry,
SafariHandleIntroSlide,
SafariHandleIntroTrainerBallThrow,
SafariHandleDrawPartyStatusSummary,
2018-06-28 21:06:32 +02:00
SafariHandleHidePartyStatusSummary,
2018-06-20 23:07:51 +02:00
SafariHandleEndBounceEffect,
2017-10-22 20:38:23 +02:00
SafariHandleSpriteInvisibility,
SafariHandleBattleAnimation,
SafariHandleLinkStandbyMsg,
SafariHandleResetActionMoveSelection,
SafariHandleCmd55,
nullsub_115
};
static void nullsub_114(void)
{
}
2017-10-26 23:12:48 +02:00
void SetControllerToSafari(void)
2017-10-22 20:38:23 +02:00
{
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand;
2017-10-22 20:38:23 +02:00
}
static void SafariBufferRunCommand(void)
{
2018-02-06 20:48:02 +01:00
if (gBattleControllerExecFlags & gBitTable[gActiveBattler])
2017-10-22 20:38:23 +02:00
{
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sSafariBufferCommands))
sSafariBufferCommands[gBattleBufferA[gActiveBattler][0]]();
2017-10-22 20:38:23 +02:00
else
SafariBufferExecCompleted();
}
}
static void HandleInputChooseAction(void)
{
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
2018-02-06 02:46:59 +01:00
switch (gActionSelectionCursor[gActiveBattler])
2017-10-22 20:38:23 +02:00
{
case 0:
2018-02-06 23:09:39 +01:00
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_BALL, 0);
2017-10-22 20:38:23 +02:00
break;
case 1:
2018-02-06 23:09:39 +01:00
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_POKEBLOCK, 0);
2017-10-22 20:38:23 +02:00
break;
case 2:
2018-02-06 23:09:39 +01:00
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_GO_NEAR, 0);
2017-10-22 20:38:23 +02:00
break;
case 3:
2018-02-06 23:09:39 +01:00
BtlController_EmitTwoReturnValues(1, B_ACTION_SAFARI_RUN, 0);
2017-10-22 20:38:23 +02:00
break;
}
SafariBufferExecCompleted();
}
else if (gMain.newKeys & DPAD_LEFT)
{
2018-02-06 02:46:59 +01:00
if (gActionSelectionCursor[gActiveBattler] & 1)
2017-10-22 20:38:23 +02:00
{
PlaySE(SE_SELECT);
2018-02-06 02:46:59 +01:00
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 1;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
2017-10-22 20:38:23 +02:00
}
}
else if (gMain.newKeys & DPAD_RIGHT)
{
2018-02-06 02:46:59 +01:00
if (!(gActionSelectionCursor[gActiveBattler] & 1))
2017-10-22 20:38:23 +02:00
{
PlaySE(SE_SELECT);
2018-02-06 02:46:59 +01:00
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 1;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
2017-10-22 20:38:23 +02:00
}
}
else if (gMain.newKeys & DPAD_UP)
{
2018-02-06 02:46:59 +01:00
if (gActionSelectionCursor[gActiveBattler] & 2)
2017-10-22 20:38:23 +02:00
{
PlaySE(SE_SELECT);
2018-02-06 02:46:59 +01:00
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 2;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
2017-10-22 20:38:23 +02:00
}
}
else if (gMain.newKeys & DPAD_DOWN)
{
2018-02-06 02:46:59 +01:00
if (!(gActionSelectionCursor[gActiveBattler] & 2))
2017-10-22 20:38:23 +02:00
{
PlaySE(SE_SELECT);
2018-02-06 02:46:59 +01:00
ActionSelectionDestroyCursorAt(gActionSelectionCursor[gActiveBattler]);
gActionSelectionCursor[gActiveBattler] ^= 2;
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
2017-10-22 20:38:23 +02:00
}
}
}
static void CompleteOnBattlerSpriteCallbackDummy(void)
2017-10-22 20:38:23 +02:00
{
2018-02-06 20:48:02 +01:00
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void CompleteOnInactiveTextPrinter(void)
{
if (!IsTextPrinterActive(0))
SafariBufferExecCompleted();
}
static void CompleteOnHealthboxSpriteCallbackDummy(void)
{
2018-02-06 20:48:02 +01:00
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void sub_81595E4(void)
{
if (!gPaletteFade.active)
{
gMain.inBattle = FALSE;
gMain.callback1 = gPreBattleCallback1;
SetMainCallback2(gMain.savedCallback);
}
}
static void CompleteOnSpecialAnimDone(void)
{
2018-02-06 02:46:59 +01:00
if (!gDoingBattleAnim || !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
2017-12-16 00:08:23 +01:00
static void SafariOpenPokeblockCase(void)
2017-10-22 20:38:23 +02:00
{
if (!gPaletteFade.active)
{
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = CompleteWhenChosePokeblock;
2017-10-22 20:38:23 +02:00
FreeAllWindowBuffers();
2017-12-16 00:08:23 +01:00
OpenPokeblockCaseInBattle();
2017-10-22 20:38:23 +02:00
}
}
static void CompleteWhenChosePokeblock(void)
{
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
{
2018-02-06 20:48:02 +01:00
BtlController_EmitOneReturnValue(1, gSpecialVar_ItemId);
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
}
static void CompleteOnFinishedBattleAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void SafariBufferExecCompleted(void)
{
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand;
2017-10-22 20:38:23 +02:00
if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{
u8 playerId = GetMultiplayerId();
PrepareBufferDataTransferLink(2, 4, &playerId);
2018-02-06 02:46:59 +01:00
gBattleBufferA[gActiveBattler][0] = CONTROLLER_TERMINATOR_NOP;
2017-10-22 20:38:23 +02:00
}
else
{
2018-02-06 20:48:02 +01:00
gBattleControllerExecFlags &= ~gBitTable[gActiveBattler];
2017-10-22 20:38:23 +02:00
}
}
static void CompleteOnFinishedStatusAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive)
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void SafariHandleGetMonData(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleGetRawMonData(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleSetMonData(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleSetRawMonData(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleLoadMonSprite(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleSwitchInAnim(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleReturnMonToBall(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleDrawTrainerPic(void)
{
2018-02-06 02:46:59 +01:00
DecompressTrainerBackPic(gSaveBlock2Ptr->playerGender, gActiveBattler);
SetMultiuseSpriteTemplateToTrainerBack(gSaveBlock2Ptr->playerGender, GetBattlerPosition(gActiveBattler));
2018-02-06 20:48:02 +01:00
gBattlerSpriteIds[gActiveBattler] = CreateSprite(
&gMultiuseSpriteTemplate,
2017-10-22 20:38:23 +02:00
80,
(8 - gTrainerBackPicCoords[gSaveBlock2Ptr->playerGender].coords) * 4 + 80,
30);
2018-02-06 20:48:02 +01:00
gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = sub_805D7AC;
gBattlerControllerFuncs[gActiveBattler] = CompleteOnBattlerSpriteCallbackDummy;
2017-10-22 20:38:23 +02:00
}
static void SafariHandleTrainerSlide(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleTrainerSlideBack(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleFaintAnimation(void)
{
SafariBufferExecCompleted();
}
static void SafariHandlePaletteFade(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleSuccessBallThrowAnim(void)
{
gBattleSpritesDataPtr->animationData->ballThrowCaseId = BALL_3_SHAKES_SUCCESS;
gDoingBattleAnim = TRUE;
2018-02-06 02:46:59 +01:00
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone;
2017-10-22 20:38:23 +02:00
}
static void SafariHandleBallThrowAnim(void)
{
2018-02-06 02:46:59 +01:00
u8 ballThrowCaseId = gBattleBufferA[gActiveBattler][1];
2017-10-22 20:38:23 +02:00
gBattleSpritesDataPtr->animationData->ballThrowCaseId = ballThrowCaseId;
gDoingBattleAnim = TRUE;
2018-02-06 02:46:59 +01:00
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, GetBattlerAtPosition(B_POSITION_OPPONENT_LEFT), B_ANIM_SAFARI_BALL_THROW);
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = CompleteOnSpecialAnimDone;
2017-10-22 20:38:23 +02:00
}
static void SafariHandlePause(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleMoveAnimation(void)
{
SafariBufferExecCompleted();
}
static void SafariHandlePrintString(void)
{
u16 *stringId;
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
2018-02-06 02:46:59 +01:00
stringId = (u16*)(&gBattleBufferA[gActiveBattler][2]);
2017-10-22 20:38:23 +02:00
BufferStringBattle(*stringId);
2018-06-17 16:48:58 +02:00
BattlePutTextOnWindow(gDisplayedStringBattle, 0);
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
2017-10-22 20:38:23 +02:00
}
static void SafariHandlePrintSelectionString(void)
2017-10-22 20:38:23 +02:00
{
2018-02-06 02:46:59 +01:00
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
2017-10-22 20:38:23 +02:00
SafariHandlePrintString();
else
SafariBufferExecCompleted();
}
static void HandleChooseActionAfterDma3(void)
{
if (!IsDma3ManagerBusyWithBgCopy())
{
gBattle_BG0_X = 0;
gBattle_BG0_Y = 160;
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction;
2017-10-22 20:38:23 +02:00
}
}
static void SafariHandleChooseAction(void)
{
s32 i;
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = HandleChooseActionAfterDma3;
2018-06-17 16:48:58 +02:00
BattlePutTextOnWindow(gText_SafariZoneMenu, 2);
2017-10-22 20:38:23 +02:00
for (i = 0; i < 4; i++)
ActionSelectionDestroyCursorAt(i);
2018-02-06 02:46:59 +01:00
ActionSelectionCreateCursorAt(gActionSelectionCursor[gActiveBattler], 0);
2017-10-22 20:38:23 +02:00
BattleStringExpandPlaceholdersToDisplayedString(gText_WhatWillPkmnDo2);
2018-06-17 16:48:58 +02:00
BattlePutTextOnWindow(gDisplayedStringBattle, 1);
2017-10-22 20:38:23 +02:00
}
static void SafariHandleUnknownYesNoBox(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleChooseMove(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleChooseItem(void)
{
s32 i;
2018-07-15 13:23:38 +02:00
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, 0);
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = SafariOpenPokeblockCase;
2018-02-07 22:53:40 +01:00
gBattlerInMenuId = gActiveBattler;
2017-10-22 20:38:23 +02:00
}
static void SafariHandleChoosePokemon(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd23(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleHealthBarUpdate(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleExpUpdate(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleStatusIconUpdate(void)
{
2018-02-06 20:48:02 +01:00
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_BALLS_TEXT);
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void SafariHandleStatusAnimation(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleStatusXor(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleDataTransfer(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleDMA3Transfer(void)
{
SafariBufferExecCompleted();
}
static void SafariHandlePlayBGM(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd32(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleTwoReturnValues(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleChosenMonReturnValue(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleOneReturnValue(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleOneReturnValue_Duplicate(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd37(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd38(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd39(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd40(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleHitAnimation(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd42(void)
{
SafariBufferExecCompleted();
}
static void SafariHandlePlaySE(void)
2017-10-22 20:38:23 +02:00
{
s8 pan;
2018-02-06 02:46:59 +01:00
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
2017-10-22 20:38:23 +02:00
pan = PAN_SIDE_PLAYER;
else
pan = PAN_SIDE_OPPONENT;
2018-02-06 02:46:59 +01:00
PlaySE12WithPanning(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8), pan);
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void SafariHandlePlayFanfareOrBGM(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][3])
2017-10-22 20:38:23 +02:00
{
2017-11-04 16:11:13 +01:00
BattleStopLowHpSound();
2018-02-06 02:46:59 +01:00
PlayBGM(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
2017-10-22 20:38:23 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
PlayFanfare(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
2017-10-22 20:38:23 +02:00
}
SafariBufferExecCompleted();
}
static void SafariHandleFaintingCry(void)
{
2018-02-06 20:48:02 +01:00
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
2017-10-22 20:38:23 +02:00
PlayCry1(species, 25);
SafariBufferExecCompleted();
}
static void SafariHandleIntroSlide(void)
{
2018-02-06 02:46:59 +01:00
HandleIntroSlide(gBattleBufferA[gActiveBattler][1]);
2018-02-08 11:17:41 +01:00
gIntroSlideFlags |= 1;
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
}
static void SafariHandleIntroTrainerBallThrow(void)
{
2018-02-06 20:48:02 +01:00
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT);
2018-02-06 02:46:59 +01:00
sub_8076918(gActiveBattler);
2018-02-06 20:48:02 +01:00
SetHealthboxSpriteVisible(gHealthboxSpriteIds[gActiveBattler]);
gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthboxSpriteCallbackDummy;
2017-10-22 20:38:23 +02:00
}
static void SafariHandleDrawPartyStatusSummary(void)
{
SafariBufferExecCompleted();
}
2018-06-28 21:06:32 +02:00
static void SafariHandleHidePartyStatusSummary(void)
2017-10-22 20:38:23 +02:00
{
SafariBufferExecCompleted();
}
2018-06-20 23:07:51 +02:00
static void SafariHandleEndBounceEffect(void)
2017-10-22 20:38:23 +02:00
{
SafariBufferExecCompleted();
}
static void SafariHandleSpriteInvisibility(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleBattleAnimation(void)
{
2018-02-06 02:46:59 +01:00
u8 animationId = gBattleBufferA[gActiveBattler][1];
u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
2017-10-22 20:38:23 +02:00
2018-02-06 02:46:59 +01:00
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
2017-10-22 20:38:23 +02:00
SafariBufferExecCompleted();
else
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
2017-10-22 20:38:23 +02:00
}
static void SafariHandleLinkStandbyMsg(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleResetActionMoveSelection(void)
{
SafariBufferExecCompleted();
}
static void SafariHandleCmd55(void)
{
2018-02-06 02:46:59 +01:00
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
2017-10-22 20:38:23 +02:00
FadeOutMapMusic(5);
BeginFastPaletteFade(3);
SafariBufferExecCompleted();
if ((gBattleTypeFlags & BATTLE_TYPE_LINK) && !(gBattleTypeFlags & BATTLE_TYPE_WILD))
2018-02-06 20:48:02 +01:00
gBattlerControllerFuncs[gActiveBattler] = sub_81595E4;
2017-10-22 20:38:23 +02:00
}
static void nullsub_115(void)
{
}