pokeemerald/src/battle_controller_link_partner.c

1721 lines
62 KiB
C
Raw Normal View History

2017-10-23 14:24:54 +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-23 14:24:54 +02:00
#include "battle_ai_script_commands.h"
2017-10-23 16:38:11 +02:00
#include "battle_link_817C95C.h"
2017-10-23 14:24:54 +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-23 14:24:54 +02:00
#include "sound.h"
#include "window.h"
#include "m4a.h"
#include "palette.h"
#include "task.h"
#include "text.h"
#include "string_util.h"
#include "bg.h"
#include "reshow_battle_screen.h"
#include "pokeball.h"
2017-10-31 18:04:08 +01:00
#include "data2.h"
2017-10-23 14:24:54 +02:00
extern u32 gBattleExecBuffer;
2018-02-06 02:46:59 +01:00
extern u8 gActiveBattler;
extern u8 gBankSpriteIds[MAX_BATTLERS_COUNT];
extern u8 gActionSelectionCursor[MAX_BATTLERS_COUNT];
extern u8 gBattlersCount;
2017-10-23 14:24:54 +02:00
extern bool8 gDoingBattleAnim;
2018-02-06 02:46:59 +01:00
extern void (*gBattlerFuncs[MAX_BATTLERS_COUNT])(void);
2017-10-23 14:24:54 +02:00
extern void (*gPreBattleCallback1)(void);
2018-02-06 02:46:59 +01:00
extern u16 gBattlePartyID[MAX_BATTLERS_COUNT];
extern u8 gBattleBufferA[MAX_BATTLERS_COUNT][0x200];
extern u8 gBattleBufferB[MAX_BATTLERS_COUNT][0x200];
extern struct BattlePokemon gBattleMons[MAX_BATTLERS_COUNT];
2017-10-23 14:24:54 +02:00
extern struct SpriteTemplate gUnknown_0202499C;
2017-11-11 01:12:18 +01:00
extern u16 gSpecialVar_ItemId;
2018-02-06 02:46:59 +01:00
extern u8 gHealthBoxesIds[MAX_BATTLERS_COUNT];
2017-10-23 14:24:54 +02:00
extern u8 gBattleOutcome;
extern u16 gBattle_BG0_X;
extern u16 gBattle_BG0_Y;
extern u16 gUnknown_020243FC;
2018-02-06 02:46:59 +01:00
extern u8 gUnknown_03005D7C[MAX_BATTLERS_COUNT];
extern u8 gBattleMonForms[MAX_BATTLERS_COUNT];
2017-10-23 14:24:54 +02:00
extern u16 gPartnerTrainerId;
extern u8 GetFrontierTrainerFrontSpriteId(u16 trainerId);
2018-02-06 02:46:59 +01:00
extern u8 gBattleDefender;
extern u8 gAbsentBattlerFlags;
2017-10-23 14:24:54 +02:00
extern u8 gUnknown_020244B4[];
2018-02-06 02:46:59 +01:00
extern u32 gTransformedPersonalities[MAX_BATTLERS_COUNT];
2017-10-23 14:24:54 +02:00
extern struct UnusedControllerStruct gUnknown_02022D0C;
extern const struct CompressedSpritePalette gTrainerFrontPicPaletteTable[];
extern const struct CompressedSpritePalette gTrainerBackPicPaletteTable[];
extern const struct BattleMove gBattleMoves[];
extern void sub_8172EF0(u8 bank, struct Pokemon *mon);
extern void sub_806A068(u16, u8);
2017-10-23 16:38:11 +02:00
extern void sub_81851A8(u8 *);
2017-10-23 14:24:54 +02:00
// this file's functions
2017-10-23 16:38:11 +02:00
static void LinkPartnerHandleGetMonData(void);
static void LinkPartnerHandleGetRawMonData(void);
static void LinkPartnerHandleSetMonData(void);
static void LinkPartnerHandleSetRawMonData(void);
static void LinkPartnerHandleLoadMonSprite(void);
static void LinkPartnerHandleSwitchInAnim(void);
static void LinkPartnerHandleReturnMonToBall(void);
static void LinkPartnerHandleDrawTrainerPic(void);
static void LinkPartnerHandleTrainerSlide(void);
static void LinkPartnerHandleTrainerSlideBack(void);
static void LinkPartnerHandleFaintAnimation(void);
static void LinkPartnerHandlePaletteFade(void);
static void LinkPartnerHandleSuccessBallThrowAnim(void);
static void LinkPartnerHandleBallThrowAnim(void);
static void LinkPartnerHandlePause(void);
static void LinkPartnerHandleMoveAnimation(void);
static void LinkPartnerHandlePrintString(void);
static void LinkPartnerHandlePrintSelectionString(void);
2017-10-23 16:38:11 +02:00
static void LinkPartnerHandleChooseAction(void);
static void LinkPartnerHandleUnknownYesNoBox(void);
static void LinkPartnerHandleChooseMove(void);
static void LinkPartnerHandleChooseItem(void);
static void LinkPartnerHandleChoosePokemon(void);
static void LinkPartnerHandleCmd23(void);
static void LinkPartnerHandleHealthBarUpdate(void);
static void LinkPartnerHandleExpUpdate(void);
static void LinkPartnerHandleStatusIconUpdate(void);
static void LinkPartnerHandleStatusAnimation(void);
static void LinkPartnerHandleStatusXor(void);
static void LinkPartnerHandleDataTransfer(void);
static void LinkPartnerHandleDMA3Transfer(void);
static void LinkPartnerHandlePlayBGM(void);
static void LinkPartnerHandleCmd32(void);
static void LinkPartnerHandleTwoReturnValues(void);
static void LinkPartnerHandleChosenMonReturnValue(void);
static void LinkPartnerHandleOneReturnValue(void);
static void LinkPartnerHandleOneReturnValue_Duplicate(void);
static void LinkPartnerHandleCmd37(void);
static void LinkPartnerHandleCmd38(void);
static void LinkPartnerHandleCmd39(void);
static void LinkPartnerHandleCmd40(void);
static void LinkPartnerHandleHitAnimation(void);
static void LinkPartnerHandleCmd42(void);
static void LinkPartnerHandlePlaySE(void);
2017-10-23 16:38:11 +02:00
static void LinkPartnerHandlePlayFanfareOrBGM(void);
static void LinkPartnerHandleFaintingCry(void);
static void LinkPartnerHandleIntroSlide(void);
static void LinkPartnerHandleIntroTrainerBallThrow(void);
static void LinkPartnerHandleDrawPartyStatusSummary(void);
static void LinkPartnerHandleCmd49(void);
static void LinkPartnerHandleCmd50(void);
static void LinkPartnerHandleSpriteInvisibility(void);
static void LinkPartnerHandleBattleAnimation(void);
static void LinkPartnerHandleLinkStandbyMsg(void);
static void LinkPartnerHandleResetActionMoveSelection(void);
static void LinkPartnerHandleCmd55(void);
static void nullsub_113(void);
static void LinkPartnerBufferRunCommand(void);
static void LinkPartnerBufferExecCompleted(void);
static void sub_814B554(void);
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst);
static void SetLinkPartnerMonData(u8 monId);
static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit);
static void DoSwitchOutAnimation(void);
static void LinkPartnerDoMoveAnimation(void);
static void sub_814DCCC(u8 taskId);
static void sub_814DE9C(void);
2017-10-31 18:04:08 +01:00
static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
2017-10-23 14:24:54 +02:00
{
LinkPartnerHandleGetMonData,
LinkPartnerHandleGetRawMonData,
LinkPartnerHandleSetMonData,
LinkPartnerHandleSetRawMonData,
LinkPartnerHandleLoadMonSprite,
LinkPartnerHandleSwitchInAnim,
LinkPartnerHandleReturnMonToBall,
LinkPartnerHandleDrawTrainerPic,
LinkPartnerHandleTrainerSlide,
LinkPartnerHandleTrainerSlideBack,
LinkPartnerHandleFaintAnimation,
LinkPartnerHandlePaletteFade,
LinkPartnerHandleSuccessBallThrowAnim,
LinkPartnerHandleBallThrowAnim,
LinkPartnerHandlePause,
LinkPartnerHandleMoveAnimation,
LinkPartnerHandlePrintString,
LinkPartnerHandlePrintSelectionString,
2017-10-23 14:24:54 +02:00
LinkPartnerHandleChooseAction,
LinkPartnerHandleUnknownYesNoBox,
LinkPartnerHandleChooseMove,
LinkPartnerHandleChooseItem,
LinkPartnerHandleChoosePokemon,
LinkPartnerHandleCmd23,
LinkPartnerHandleHealthBarUpdate,
LinkPartnerHandleExpUpdate,
LinkPartnerHandleStatusIconUpdate,
LinkPartnerHandleStatusAnimation,
LinkPartnerHandleStatusXor,
LinkPartnerHandleDataTransfer,
LinkPartnerHandleDMA3Transfer,
LinkPartnerHandlePlayBGM,
LinkPartnerHandleCmd32,
LinkPartnerHandleTwoReturnValues,
LinkPartnerHandleChosenMonReturnValue,
LinkPartnerHandleOneReturnValue,
LinkPartnerHandleOneReturnValue_Duplicate,
LinkPartnerHandleCmd37,
LinkPartnerHandleCmd38,
LinkPartnerHandleCmd39,
LinkPartnerHandleCmd40,
LinkPartnerHandleHitAnimation,
LinkPartnerHandleCmd42,
LinkPartnerHandlePlaySE,
2017-10-23 14:24:54 +02:00
LinkPartnerHandlePlayFanfareOrBGM,
LinkPartnerHandleFaintingCry,
LinkPartnerHandleIntroSlide,
LinkPartnerHandleIntroTrainerBallThrow,
LinkPartnerHandleDrawPartyStatusSummary,
LinkPartnerHandleCmd49,
LinkPartnerHandleCmd50,
LinkPartnerHandleSpriteInvisibility,
LinkPartnerHandleBattleAnimation,
LinkPartnerHandleLinkStandbyMsg,
LinkPartnerHandleResetActionMoveSelection,
LinkPartnerHandleCmd55,
nullsub_113
};
2017-10-23 16:38:11 +02:00
static void nullsub_112(void)
2017-10-23 14:24:54 +02:00
{
}
2017-10-26 23:12:48 +02:00
void SetControllerToLinkPartner(void)
2017-10-23 14:24:54 +02:00
{
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand;
2017-10-23 14:24:54 +02:00
}
2017-10-23 16:38:11 +02:00
static void LinkPartnerBufferRunCommand(void)
2017-10-23 14:24:54 +02:00
{
2018-02-06 02:46:59 +01:00
if (gBattleExecBuffer & gBitTable[gActiveBattler])
2017-10-23 14:24:54 +02:00
{
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][0] < ARRAY_COUNT(sLinkPartnerBufferCommands))
sLinkPartnerBufferCommands[gBattleBufferA[gActiveBattler][0]]();
2017-10-23 14:24:54 +02:00
else
LinkPartnerBufferExecCompleted();
}
}
2017-10-23 16:38:11 +02:00
static void CompleteOnBankSpriteCallbackDummy(void)
{
2018-02-06 02:46:59 +01:00
if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void sub_814AF54(void)
{
2018-02-06 02:46:59 +01:00
if (gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 16:38:11 +02:00
{
nullsub_25(0);
2018-02-06 02:46:59 +01:00
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void sub_814AFBC(void)
{
2018-02-06 02:46:59 +01:00
if (--gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 == 0xFF)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0;
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void sub_814B004(void)
{
bool32 r6 = FALSE;
if (!IsDoubleBattle() || (IsDoubleBattle() && (gBattleTypeFlags & BATTLE_TYPE_MULTI)))
{
2018-02-06 02:46:59 +01:00
if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 16:38:11 +02:00
r6 = TRUE;
}
else
{
2018-02-06 02:46:59 +01:00
if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]].callback == SpriteCallbackDummy)
2017-10-23 16:38:11 +02:00
{
r6 = TRUE;
}
}
if (IsCryPlayingOrClearCrySongs())
r6 = FALSE;
if (r6)
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 3;
gBattlerFuncs[gActiveBattler] = sub_814AFBC;
2017-10-23 16:38:11 +02:00
}
}
static void sub_814B0E8(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler ^ BIT_FLANK].ballAnimActive
&& gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy
&& gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy
&& ++gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 != 1)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_9 = 0;
2017-10-23 16:38:11 +02:00
if (IsDoubleBattle() && !(gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
2018-02-06 02:46:59 +01:00
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler ^ BIT_FLANK]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK], &gPlayerParty[gBattlePartyID[gActiveBattler ^ BIT_FLANK]], HEALTHBOX_ALL);
sub_8076918(gActiveBattler ^ BIT_FLANK);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler ^ BIT_FLANK]);
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL);
sub_8076918(gActiveBattler);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]);
2017-10-23 16:38:11 +02:00
gBattleSpritesDataPtr->animationData->field_9_x1 = 0;
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = sub_814B004;
2017-10-23 16:38:11 +02:00
}
}
static void sub_814B290(void)
{
2018-02-06 02:46:59 +01:00
if (gSprites[gBankSpriteIds[gActiveBattler]].animEnded && gSprites[gBankSpriteIds[gActiveBattler]].pos2.x == 0)
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void CompleteOnHealthbarDone(void)
{
2018-02-06 02:46:59 +01:00
s16 hpValue = sub_8074AA0(gActiveBattler, gHealthBoxesIds[gActiveBattler], HEALTH_BAR, 0);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]);
2017-10-23 16:38:11 +02:00
if (hpValue != -1)
{
2018-02-06 02:46:59 +01:00
UpdateHpTextInHealthbox(gHealthBoxesIds[gActiveBattler], hpValue, HP_CURRENT);
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void sub_814B340(void)
{
2018-02-06 02:46:59 +01:00
if (gSprites[gBankSpriteIds[gActiveBattler]].pos1.y + gSprites[gBankSpriteIds[gActiveBattler]].pos2.y > DISPLAY_HEIGHT)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES);
2017-10-23 16:38:11 +02:00
nullsub_24(species);
2018-02-06 02:46:59 +01:00
FreeOamMatrix(gSprites[gBankSpriteIds[gActiveBattler]].oam.matrixNum);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]);
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void sub_814B3DC(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]);
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void CompleteOnInactiveTextPrinter(void)
{
if (!IsTextPrinterActive(0))
LinkPartnerBufferExecCompleted();
}
static void DoHitAnimBlinkSpriteEffect(void)
{
2018-02-06 02:46:59 +01:00
u8 spriteId = gBankSpriteIds[gActiveBattler];
2017-10-23 16:38:11 +02:00
2017-12-02 21:44:50 +01:00
if (gSprites[spriteId].data[1] == 32)
2017-10-23 16:38:11 +02:00
{
2017-12-02 21:44:50 +01:00
gSprites[spriteId].data[1] = 0;
2017-10-23 16:38:11 +02:00
gSprites[spriteId].invisible = 0;
gDoingBattleAnim = FALSE;
LinkPartnerBufferExecCompleted();
}
else
{
2017-12-02 21:44:50 +01:00
if ((gSprites[spriteId].data[1] % 4) == 0)
2017-10-23 16:38:11 +02:00
gSprites[spriteId].invisible ^= 1;
2017-12-02 21:44:50 +01:00
gSprites[spriteId].data[1]++;
2017-10-23 16:38:11 +02:00
}
}
static void sub_814B4E0(void)
{
2018-02-06 02:46:59 +01:00
if (gSprites[gHealthBoxesIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
CopyBattleSpriteInvisibility(gActiveBattler);
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute)
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = sub_814B554;
2017-10-23 16:38:11 +02:00
}
}
static void sub_814B554(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive
&& gSprites[gBankSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
2017-10-23 16:38:11 +02:00
{
LinkPartnerBufferExecCompleted();
}
}
static void sub_814B5A8(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80 = 0;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_1_x1 = 0;
2017-10-23 16:38:11 +02:00
FreeSpriteTilesByTag(0x27F9);
FreeSpritePaletteByTag(0x27F9);
CreateTask(c3_0802FDF4, 10);
2018-02-06 02:46:59 +01:00
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 0);
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_ALL);
sub_8076918(gActiveBattler);
SetHealthboxSpriteVisible(gHealthBoxesIds[gActiveBattler]);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = sub_814B4E0;
2017-10-23 16:38:11 +02:00
}
}
static void sub_814B69C(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x80
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
sub_8172EF0(gActiveBattler, &gPlayerParty[gBattlePartyID[gActiveBattler]]);
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
if (gSprites[gUnknown_03005D7C[gActiveBattler]].callback == SpriteCallbackDummy
&& !gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].ballAnimActive)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
DestroySprite(&gSprites[gUnknown_03005D7C[gActiveBattler]]);
gBattlerFuncs[gActiveBattler] = sub_814B5A8;
2017-10-23 16:38:11 +02:00
}
}
static void LinkPartnerBufferExecCompleted(void)
{
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand;
2017-10-23 16:38:11 +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-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
gBattleExecBuffer &= ~gBitTable[gActiveBattler];
2017-10-23 16:38:11 +02:00
}
}
static void CompleteOnFinishedStatusAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].statusAnimActive)
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void CompleteOnFinishedBattleAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleGetMonData(void)
{
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
u32 size = 0;
2017-10-31 18:04:08 +01:00
u8 monToCheck;
2017-10-23 16:38:11 +02:00
s32 i;
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][2] == 0)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
size += CopyLinkPartnerMonData(gBattlePartyID[gActiveBattler], monData);
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
monToCheck = gBattleBufferA[gActiveBattler][2];
2017-10-23 16:38:11 +02:00
for (i = 0; i < 6; i++)
{
2017-10-31 18:04:08 +01:00
if (monToCheck & 1)
2017-10-23 16:38:11 +02:00
size += CopyLinkPartnerMonData(i, monData + size);
2017-10-31 18:04:08 +01:00
monToCheck >>= 1;
2017-10-23 16:38:11 +02:00
}
}
EmitDataTransfer(1, size, monData);
LinkPartnerBufferExecCompleted();
}
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
{
struct BattlePokemon battleMon;
struct MovePpInfo moveData;
u8 nickname[20];
u8 *src;
s16 data16;
u32 data32;
s32 size = 0;
2018-02-06 02:46:59 +01:00
switch (gBattleBufferA[gActiveBattler][1])
2017-10-23 16:38:11 +02:00
{
case REQUEST_ALL_BATTLE:
battleMon.species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
battleMon.item = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
for (size = 0; size < 4; size++)
{
battleMon.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
battleMon.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
}
battleMon.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
battleMon.friendship = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
battleMon.experience = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
battleMon.hpIV = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
battleMon.attackIV = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
battleMon.defenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
2017-10-24 15:35:36 +02:00
battleMon.speedIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
2017-10-23 16:38:11 +02:00
battleMon.spAttackIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
battleMon.spDefenseIV = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
battleMon.personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
battleMon.status1 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
battleMon.level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
battleMon.hp = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
battleMon.maxHP = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
battleMon.attack = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
battleMon.defense = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
2017-10-24 15:35:36 +02:00
battleMon.speed = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
2017-10-23 16:38:11 +02:00
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY);
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);
GetMonData(&gPlayerParty[monId], MON_DATA_OT_NAME, battleMon.otName);
src = (u8 *)&battleMon;
for (size = 0; size < sizeof(battleMon); size++)
dst[size] = src[size];
break;
case REQUEST_SPECIES_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_HELDITEM_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_MOVES_PP_BATTLE:
for (size = 0; size < 4; size++)
{
moveData.moves[size] = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + size);
moveData.pp[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
}
moveData.ppBonuses = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
src = (u8*)(&moveData);
for (size = 0; size < sizeof(moveData); size++)
dst[size] = src[size];
break;
case REQUEST_MOVE1_BATTLE:
case REQUEST_MOVE2_BATTLE:
case REQUEST_MOVE3_BATTLE:
case REQUEST_MOVE4_BATTLE:
2018-02-06 02:46:59 +01:00
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE);
2017-10-23 16:38:11 +02:00
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_PP_DATA_BATTLE:
for (size = 0; size < 4; size++)
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + size);
dst[size] = GetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES);
size++;
break;
case REQUEST_PPMOVE1_BATTLE:
case REQUEST_PPMOVE2_BATTLE:
case REQUEST_PPMOVE3_BATTLE:
case REQUEST_PPMOVE4_BATTLE:
2018-02-06 02:46:59 +01:00
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE);
2017-10-23 16:38:11 +02:00
size = 1;
break;
case REQUEST_OTID_BATTLE:
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
dst[0] = (data32 & 0x000000FF);
dst[1] = (data32 & 0x0000FF00) >> 8;
dst[2] = (data32 & 0x00FF0000) >> 16;
size = 3;
break;
case REQUEST_EXP_BATTLE:
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_EXP);
dst[0] = (data32 & 0x000000FF);
dst[1] = (data32 & 0x0000FF00) >> 8;
dst[2] = (data32 & 0x00FF0000) >> 16;
size = 3;
break;
case REQUEST_HP_EV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_EV);
size = 1;
break;
case REQUEST_ATK_EV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV);
size = 1;
break;
case REQUEST_DEF_EV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV);
size = 1;
break;
case REQUEST_SPEED_EV_BATTLE:
2017-10-24 15:35:36 +02:00
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV);
2017-10-23 16:38:11 +02:00
size = 1;
break;
case REQUEST_SPATK_EV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV);
size = 1;
break;
case REQUEST_SPDEF_EV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV);
size = 1;
break;
case REQUEST_FRIENDSHIP_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP);
size = 1;
break;
case REQUEST_POKERUS_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKERUS);
size = 1;
break;
case REQUEST_MET_LOCATION_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION);
size = 1;
break;
case REQUEST_MET_LEVEL_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL);
size = 1;
break;
case REQUEST_MET_GAME_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME);
size = 1;
break;
case REQUEST_POKEBALL_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL);
size = 1;
break;
case REQUEST_ALL_IVS_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
dst[1] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
dst[2] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
2017-10-24 15:35:36 +02:00
dst[3] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
2017-10-23 16:38:11 +02:00
dst[4] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
dst[5] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
size = 6;
break;
case REQUEST_HP_IV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_HP_IV);
size = 1;
break;
case REQUEST_ATK_IV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV);
size = 1;
break;
case REQUEST_DEF_IV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV);
size = 1;
break;
case REQUEST_SPEED_IV_BATTLE:
2017-10-24 15:35:36 +02:00
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV);
2017-10-23 16:38:11 +02:00
size = 1;
break;
case REQUEST_SPATK_IV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV);
size = 1;
break;
case REQUEST_SPDEF_IV_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV);
size = 1;
break;
case REQUEST_PERSONALITY_BATTLE:
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY);
dst[0] = (data32 & 0x000000FF);
dst[1] = (data32 & 0x0000FF00) >> 8;
dst[2] = (data32 & 0x00FF0000) >> 16;
dst[3] = (data32 & 0xFF000000) >> 24;
size = 4;
break;
case REQUEST_CHECKSUM_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_STATUS_BATTLE:
data32 = GetMonData(&gPlayerParty[monId], MON_DATA_STATUS);
dst[0] = (data32 & 0x000000FF);
dst[1] = (data32 & 0x0000FF00) >> 8;
dst[2] = (data32 & 0x00FF0000) >> 16;
dst[3] = (data32 & 0xFF000000) >> 24;
size = 4;
break;
case REQUEST_LEVEL_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL);
size = 1;
break;
case REQUEST_HP_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_HP);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_MAX_HP_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_ATK_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_ATK);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_DEF_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_DEF);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_SPEED_BATTLE:
2017-10-24 15:35:36 +02:00
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPEED);
2017-10-23 16:38:11 +02:00
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_SPATK_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_SPDEF_BATTLE:
data16 = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
dst[0] = data16;
dst[1] = data16 >> 8;
size = 2;
break;
case REQUEST_COOL_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL);
size = 1;
break;
case REQUEST_BEAUTY_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY);
size = 1;
break;
case REQUEST_CUTE_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE);
size = 1;
break;
case REQUEST_SMART_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART);
size = 1;
break;
case REQUEST_TOUGH_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH);
size = 1;
break;
case REQUEST_SHEEN_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SHEEN);
size = 1;
break;
case REQUEST_COOL_RIBBON_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON);
size = 1;
break;
case REQUEST_BEAUTY_RIBBON_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON);
size = 1;
break;
case REQUEST_CUTE_RIBBON_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON);
size = 1;
break;
case REQUEST_SMART_RIBBON_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON);
size = 1;
break;
case REQUEST_TOUGH_RIBBON_BATTLE:
dst[0] = GetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON);
size = 1;
break;
}
return size;
}
static void LinkPartnerHandleGetRawMonData(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleSetMonData(void)
{
2017-10-31 18:04:08 +01:00
u8 monToCheck;
2017-10-23 16:38:11 +02:00
u8 i;
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][2] == 0)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
SetLinkPartnerMonData(gBattlePartyID[gActiveBattler]);
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
monToCheck = gBattleBufferA[gActiveBattler][2];
2017-10-23 16:38:11 +02:00
for (i = 0; i < 6; i++)
{
2017-10-31 18:04:08 +01:00
if (monToCheck & 1)
2017-10-23 16:38:11 +02:00
SetLinkPartnerMonData(i);
2017-10-31 18:04:08 +01:00
monToCheck >>= 1;
2017-10-23 16:38:11 +02:00
}
}
LinkPartnerBufferExecCompleted();
}
static void SetLinkPartnerMonData(u8 monId)
{
2018-02-06 02:46:59 +01:00
struct BattlePokemon *battlePokemon = (struct BattlePokemon *)&gBattleBufferA[gActiveBattler][3];
struct MovePpInfo *moveData = (struct MovePpInfo *)&gBattleBufferA[gActiveBattler][3];
2017-10-23 16:38:11 +02:00
s32 i;
2018-02-06 02:46:59 +01:00
switch (gBattleBufferA[gActiveBattler][1])
2017-10-23 16:38:11 +02:00
{
case REQUEST_ALL_BATTLE:
{
u8 iv;
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &battlePokemon->species);
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &battlePokemon->item);
for (i = 0; i < 4; i++)
{
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &battlePokemon->moves[i]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &battlePokemon->pp[i]);
}
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &battlePokemon->ppBonuses);
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &battlePokemon->friendship);
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &battlePokemon->experience);
iv = battlePokemon->hpIV;
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &iv);
iv = battlePokemon->attackIV;
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &iv);
iv = battlePokemon->defenseIV;
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &iv);
iv = battlePokemon->speedIV;
2017-10-24 15:35:36 +02:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &iv);
2017-10-23 16:38:11 +02:00
iv = battlePokemon->spAttackIV;
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &iv);
iv = battlePokemon->spDefenseIV;
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &iv);
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &battlePokemon->personality);
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &battlePokemon->status1);
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &battlePokemon->level);
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &battlePokemon->hp);
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &battlePokemon->maxHP);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &battlePokemon->attack);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &battlePokemon->defense);
2017-10-24 15:35:36 +02:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &battlePokemon->speed);
2017-10-23 16:38:11 +02:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &battlePokemon->spAttack);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &battlePokemon->spDefense);
}
break;
case REQUEST_SPECIES_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_HELDITEM_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_HELD_ITEM, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_MOVES_PP_BATTLE:
for (i = 0; i < 4; i++)
{
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + i, &moveData->moves[i]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + i, &moveData->pp[i]);
}
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &moveData->ppBonuses);
break;
case REQUEST_MOVE1_BATTLE:
case REQUEST_MOVE2_BATTLE:
case REQUEST_MOVE3_BATTLE:
case REQUEST_MOVE4_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_MOVE1 + gBattleBufferA[gActiveBattler][1] - REQUEST_MOVE1_BATTLE, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_PP_DATA_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_PP1, &gBattleBufferA[gActiveBattler][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP2, &gBattleBufferA[gActiveBattler][4]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP3, &gBattleBufferA[gActiveBattler][5]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP4, &gBattleBufferA[gActiveBattler][6]);
SetMonData(&gPlayerParty[monId], MON_DATA_PP_BONUSES, &gBattleBufferA[gActiveBattler][7]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_PPMOVE1_BATTLE:
case REQUEST_PPMOVE2_BATTLE:
case REQUEST_PPMOVE3_BATTLE:
case REQUEST_PPMOVE4_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_PP1 + gBattleBufferA[gActiveBattler][1] - REQUEST_PPMOVE1_BATTLE, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_OTID_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_OT_ID, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_EXP_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_EXP, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_HP_EV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_HP_EV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_ATK_EV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_EV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_DEF_EV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_EV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPEED_EV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_EV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPATK_EV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_EV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPDEF_EV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_EV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_FRIENDSHIP_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_FRIENDSHIP, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_POKERUS_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_POKERUS, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_MET_LOCATION_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LOCATION, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_MET_LEVEL_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_MET_LEVEL, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_MET_GAME_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_MET_GAME, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_POKEBALL_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_POKEBALL, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_ALL_IVS_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBattler][3]);
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBattler][4]);
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBattler][5]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBattler][6]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBattler][7]);
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBattler][8]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_HP_IV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_HP_IV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_ATK_IV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_ATK_IV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_DEF_IV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_DEF_IV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPEED_IV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED_IV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPATK_IV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK_IV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPDEF_IV_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF_IV, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_PERSONALITY_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_CHECKSUM_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_CHECKSUM, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_STATUS_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_STATUS, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_LEVEL_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_LEVEL, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_HP_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_HP, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_MAX_HP_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_MAX_HP, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_ATK_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_ATK, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_DEF_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_DEF, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPEED_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPEED, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPATK_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPATK, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SPDEF_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SPDEF, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_COOL_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_COOL, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_BEAUTY_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_CUTE_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SMART_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SMART, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_TOUGH_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SHEEN_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SHEEN, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_COOL_RIBBON_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_COOL_RIBBON, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_BEAUTY_RIBBON_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_BEAUTY_RIBBON, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_CUTE_RIBBON_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_CUTE_RIBBON, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_SMART_RIBBON_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_SMART_RIBBON, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
case REQUEST_TOUGH_RIBBON_BATTLE:
2018-02-06 02:46:59 +01:00
SetMonData(&gPlayerParty[monId], MON_DATA_TOUGH_RIBBON, &gBattleBufferA[gActiveBattler][3]);
2017-10-23 16:38:11 +02:00
break;
}
2018-02-06 02:46:59 +01:00
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
2017-10-23 16:38:11 +02:00
}
static void LinkPartnerHandleSetRawMonData(void)
{
2018-02-06 02:46:59 +01:00
u8 *dst = (u8 *)&gPlayerParty[gBattlePartyID[gActiveBattler]] + gBattleBufferA[gActiveBattler][1];
2017-10-23 16:38:11 +02:00
u8 i;
2018-02-06 02:46:59 +01:00
for (i = 0; i < gBattleBufferA[gActiveBattler][2]; i++)
dst[i] = gBattleBufferA[gActiveBattler][3 + i];
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleLoadMonSprite(void)
{
u16 species;
2018-02-06 02:46:59 +01:00
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES);
sub_806A068(species, GetBattlerPosition(gActiveBattler));
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C,
GetBankCoord(gActiveBattler, 2),
GetBankSpriteDefault_Y(gActiveBattler),
sub_80A82E4(gActiveBattler));
gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = -240;
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = gActiveBattler;
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]);
gBattlerFuncs[gActiveBattler] = sub_814B290;
2017-10-23 16:38:11 +02:00
}
static void LinkPartnerHandleSwitchInAnim(void)
{
2018-02-06 02:46:59 +01:00
ClearTemporarySpeciesSpriteData(gActiveBattler, gBattleBufferA[gActiveBattler][2]);
gBattlePartyID[gActiveBattler] = gBattleBufferA[gActiveBattler][1];
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
sub_814CC98(gActiveBattler, gBattleBufferA[gActiveBattler][2]);
gBattlerFuncs[gActiveBattler] = sub_814B69C;
2017-10-23 16:38:11 +02:00
}
static void sub_814CC98(u8 bank, bool8 dontClearSubstituteBit)
{
u16 species;
ClearTemporarySpeciesSpriteData(bank, dontClearSubstituteBit);
gBattlePartyID[bank] = gBattleBufferA[bank][1];
species = GetMonData(&gPlayerParty[gBattlePartyID[bank]], MON_DATA_SPECIES);
gUnknown_03005D7C[bank] = CreateInvisibleSpriteWithCallback(sub_805D714);
2018-02-06 02:46:59 +01:00
sub_806A068(species, GetBattlerPosition(bank));
2017-10-23 16:38:11 +02:00
gBankSpriteIds[bank] = CreateSprite(
&gUnknown_0202499C,
2018-01-16 21:01:31 +01:00
GetBankCoord(bank, 2),
2017-11-04 16:11:13 +01:00
GetBankSpriteDefault_Y(bank),
2017-10-23 16:38:11 +02:00
sub_80A82E4(bank));
2017-12-02 21:44:50 +01:00
gSprites[gUnknown_03005D7C[bank]].data[1] = gBankSpriteIds[bank];
gSprites[gUnknown_03005D7C[bank]].data[2] = bank;
2017-10-23 16:38:11 +02:00
2017-12-02 21:44:50 +01:00
gSprites[gBankSpriteIds[bank]].data[0] = bank;
gSprites[gBankSpriteIds[bank]].data[2] = species;
2017-10-23 16:38:11 +02:00
gSprites[gBankSpriteIds[bank]].oam.paletteNum = bank;
StartSpriteAnim(&gSprites[gBankSpriteIds[bank]], gBattleMonForms[bank]);
gSprites[gBankSpriteIds[bank]].invisible = TRUE;
gSprites[gBankSpriteIds[bank]].callback = SpriteCallbackDummy;
2017-12-02 21:44:50 +01:00
gSprites[gUnknown_03005D7C[bank]].data[0] = DoPokeballSendOutAnimation(0, POKEBALL_PLAYER_SENDOUT);
2017-10-23 16:38:11 +02:00
}
static void LinkPartnerHandleReturnMonToBall(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][1] == 0)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerFuncs[gActiveBattler] = DoSwitchOutAnimation;
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
FreeSpriteOamMatrix(&gSprites[gBankSpriteIds[gActiveBattler]]);
DestroySprite(&gSprites[gBankSpriteIds[gActiveBattler]]);
SetHealthboxSpriteInvisible(gHealthBoxesIds[gActiveBattler]);
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void DoSwitchOutAnimation(void)
{
2018-02-06 02:46:59 +01:00
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
2017-10-23 16:38:11 +02:00
{
case 0:
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute)
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
2017-10-23 16:38:11 +02:00
break;
case 1:
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
gBattlerFuncs[gActiveBattler] = sub_814B3DC;
2017-10-23 16:38:11 +02:00
}
break;
}
}
static void LinkPartnerHandleDrawTrainerPic(void)
{
s16 xPos;
u32 trainerPicId;
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
2018-02-06 02:46:59 +01:00
if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != 0) // second mon
2017-10-23 16:38:11 +02:00
xPos = 90;
else // first mon
xPos = 32;
}
else
{
xPos = 80;
}
2018-02-06 02:46:59 +01:00
if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED;
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN;
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender;
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
DecompressTrainerBackPic(trainerPicId, gActiveBattler);
sub_806A12C(trainerPicId, GetBattlerPosition(gActiveBattler));
gBankSpriteIds[gActiveBattler] = CreateSprite(&gUnknown_0202499C, xPos, (8 - gTrainerBackPicCoords[trainerPicId].coords) * 4 + 80, sub_80A82E4(gActiveBattler));
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler;
gSprites[gBankSpriteIds[gActiveBattler]].pos2.x = 240;
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = -2;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_805D7AC;
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = CompleteOnBankSpriteCallbackDummy;
2017-10-23 16:38:11 +02:00
}
static void LinkPartnerHandleTrainerSlide(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleTrainerSlideBack(void)
{
2018-02-06 02:46:59 +01:00
oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]);
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 35;
gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], SpriteCallbackDummy);
gBattlerFuncs[gActiveBattler] = sub_814AF54;
2017-10-23 16:38:11 +02:00
}
static void LinkPartnerHandleFaintAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute)
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
HandleLowHpMusicChange(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
2017-10-24 15:25:20 +02:00
PlaySE12WithPanning(SE_POKE_DEAD, PAN_SIDE_PLAYER);
2018-02-06 02:46:59 +01:00
gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0;
gSprites[gBankSpriteIds[gActiveBattler]].data[2] = 5;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_8039C00;
gBattlerFuncs[gActiveBattler] = sub_814B340;
2017-10-23 16:38:11 +02:00
}
}
}
static void LinkPartnerHandlePaletteFade(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleSuccessBallThrowAnim(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleBallThrowAnim(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandlePause(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleMoveAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!mplay_80342A4(gActiveBattler))
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleBufferA[gActiveBattler][3];
gAnimMovePower = gBattleBufferA[gActiveBattler][4] | (gBattleBufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleBufferA[gActiveBattler][6] | (gBattleBufferA[gActiveBattler][7] << 8) | (gBattleBufferA[gActiveBattler][8] << 16) | (gBattleBufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleBufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleBufferA[gActiveBattler][12] | (gBattleBufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleBufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
2017-10-23 16:38:11 +02:00
if (IsMoveWithoutAnimation(move, gAnimMoveTurn)) // always returns FALSE
{
LinkPartnerBufferExecCompleted();
}
else
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation;
2017-10-23 16:38:11 +02:00
sub_817E0FC(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
}
static void LinkPartnerDoMoveAnimation(void)
{
2018-02-06 02:46:59 +01:00
u16 move = gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleBufferA[gActiveBattler][11];
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
2017-10-23 16:38:11 +02:00
{
case 0:
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->bankData[gActiveBattler].flag_x8)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->bankData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
2017-10-23 16:38:11 +02:00
break;
case 1:
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 16:38:11 +02:00
{
sub_805EB9C(0);
DoMoveAnim(move);
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
2017-10-23 16:38:11 +02:00
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
sub_805EB9C(1);
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->bankData[gActiveBattler].behindSubstitute && multihit < 2)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->bankData[gActiveBattler].flag_x8 = 0;
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
2017-10-23 16:38:11 +02:00
}
break;
case 3:
2018-02-06 02:46:59 +01:00
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
2017-10-23 16:38:11 +02:00
{
2017-11-04 16:11:13 +01:00
CopyAllBattleSpritesInvisibilities();
2018-02-06 02:46:59 +01:00
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
break;
}
}
static void LinkPartnerHandlePrintString(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-23 16:38:11 +02:00
BufferStringBattle(*stringId);
BattleHandleAddTextPrinter(gDisplayedStringBattle, 0);
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = CompleteOnInactiveTextPrinter;
2017-10-23 16:38:11 +02:00
sub_817C95C(*stringId);
}
static void LinkPartnerHandlePrintSelectionString(void)
2017-10-23 16:38:11 +02:00
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleChooseAction(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleUnknownYesNoBox(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleChooseMove(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleChooseItem(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleChoosePokemon(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd23(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleHealthBarUpdate(void)
{
s16 hpVal;
LoadBattleBarGfx(0);
2018-02-06 02:46:59 +01:00
hpVal = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
2017-10-23 16:38:11 +02:00
if (hpVal != INSTANT_HP_BAR_DROP)
{
2018-02-06 02:46:59 +01:00
u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP);
u32 curHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_HP);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, curHP, hpVal);
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
u32 maxHP = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_MAX_HP);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
SetBattleBarStruct(gActiveBattler, gHealthBoxesIds[gActiveBattler], maxHP, 0, hpVal);
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = CompleteOnHealthbarDone;
2017-10-23 16:38:11 +02:00
}
static void LinkPartnerHandleExpUpdate(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleStatusIconUpdate(void)
{
2018-02-06 02:46:59 +01:00
if (!mplay_80342A4(gActiveBattler))
2017-10-23 16:38:11 +02:00
{
u8 bank;
2018-02-06 02:46:59 +01:00
UpdateHealthboxAttribute(gHealthBoxesIds[gActiveBattler], &gPlayerParty[gBattlePartyID[gActiveBattler]], HEALTHBOX_STATUS_ICON);
bank = gActiveBattler;
2017-10-23 16:38:11 +02:00
gBattleSpritesDataPtr->healthBoxesData[bank].statusAnimActive = 0;
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
2017-10-23 16:38:11 +02:00
}
}
static void LinkPartnerHandleStatusAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!mplay_80342A4(gActiveBattler))
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
InitAndLaunchChosenStatusAnimation(gBattleBufferA[gActiveBattler][1],
gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8) | (gBattleBufferA[gActiveBattler][4] << 16) | (gBattleBufferA[gActiveBattler][5] << 24));
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedStatusAnimation;
2017-10-23 16:38:11 +02:00
}
}
static void LinkPartnerHandleStatusXor(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleDataTransfer(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleDMA3Transfer(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandlePlayBGM(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd32(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleTwoReturnValues(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleChosenMonReturnValue(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleOneReturnValue(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleOneReturnValue_Duplicate(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd37(void)
{
gUnknown_02022D0C.field_0 = 0;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd38(void)
{
2018-02-06 02:46:59 +01:00
gUnknown_02022D0C.field_0 = gBattleBufferA[gActiveBattler][1];
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd39(void)
{
gUnknown_02022D0C.flag_x80 = 0;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd40(void)
{
gUnknown_02022D0C.flag_x80 ^= 1;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleHitAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (gSprites[gBankSpriteIds[gActiveBattler]].invisible == TRUE)
2017-10-23 16:38:11 +02:00
{
LinkPartnerBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
2018-02-06 02:46:59 +01:00
gSprites[gBankSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
2017-10-23 16:38:11 +02:00
}
}
static void LinkPartnerHandleCmd42(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandlePlaySE(void)
2017-10-23 16:38:11 +02:00
{
s8 pan;
2018-02-06 02:46:59 +01:00
if (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
2017-10-23 16:38:11 +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-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandlePlayFanfareOrBGM(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][3])
2017-10-23 16:38:11 +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-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
PlayFanfare(gBattleBufferA[gActiveBattler][1] | (gBattleBufferA[gActiveBattler][2] << 8));
2017-10-23 16:38:11 +02:00
}
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleFaintingCry(void)
{
2018-02-06 02:46:59 +01:00
u16 species = GetMonData(&gPlayerParty[gBattlePartyID[gActiveBattler]], MON_DATA_SPECIES);
2017-10-23 16:38:11 +02:00
PlayCry3(species, -25, 5);
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleIntroSlide(void)
{
2018-02-06 02:46:59 +01:00
HandleIntroSlide(gBattleBufferA[gActiveBattler][1]);
2017-10-23 16:38:11 +02:00
gUnknown_020243FC |= 1;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleIntroTrainerBallThrow(void)
{
u8 paletteNum;
u8 taskId;
u32 trainerPicId;
2018-02-06 02:46:59 +01:00
oamt_add_pos2_onto_pos1(&gSprites[gBankSpriteIds[gActiveBattler]]);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gSprites[gBankSpriteIds[gActiveBattler]].data[0] = 50;
gSprites[gBankSpriteIds[gActiveBattler]].data[2] = -40;
gSprites[gBankSpriteIds[gActiveBattler]].data[4] = gSprites[gBankSpriteIds[gActiveBattler]].pos1.y;
gSprites[gBankSpriteIds[gActiveBattler]].callback = sub_80A6EEC;
gSprites[gBankSpriteIds[gActiveBattler]].data[5] = gActiveBattler;
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
StoreSpriteCallbackInData6(&gSprites[gBankSpriteIds[gActiveBattler]], sub_805CC00);
StartSpriteAnim(&gSprites[gBankSpriteIds[gActiveBattler]], 1);
2017-10-23 16:38:11 +02:00
paletteNum = AllocSpritePalette(0xD6F9);
2018-02-06 02:46:59 +01:00
if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_FIRE_RED
|| (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_LEAF_GREEN)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RED;
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
else if ((gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_RUBY
|| (gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].version & 0xFF) == VERSION_SAPPHIRE)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender + BACK_PIC_RS_BRENDAN;
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
trainerPicId = gLinkPlayers[GetBankMultiplayerId(gActiveBattler)].gender;
2017-10-23 16:38:11 +02:00
}
LoadCompressedPalette(gTrainerBackPicPaletteTable[trainerPicId].data, 0x100 + paletteNum * 16, 32);
2018-02-06 02:46:59 +01:00
gSprites[gBankSpriteIds[gActiveBattler]].oam.paletteNum = paletteNum;
2017-10-23 16:38:11 +02:00
taskId = CreateTask(sub_814DCCC, 5);
2018-02-06 02:46:59 +01:00
gTasks[taskId].data[0] = gActiveBattler;
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30;
2017-10-23 16:38:11 +02:00
gBattleSpritesDataPtr->animationData->field_9_x1 = 1;
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = nullsub_112;
2017-10-23 16:38:11 +02:00
}
static void sub_814DCCC(u8 taskId)
{
if (gTasks[taskId].data[1] < 24)
{
gTasks[taskId].data[1]++;
}
else
{
2018-02-06 02:46:59 +01:00
u8 savedActiveBank = gActiveBattler;
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gActiveBattler = gTasks[taskId].data[0];
2017-10-23 16:38:11 +02:00
if (!IsDoubleBattle() || (gBattleTypeFlags & BATTLE_TYPE_MULTI))
{
2018-02-06 02:46:59 +01:00
gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler];
sub_814CC98(gActiveBattler, FALSE);
2017-10-23 16:38:11 +02:00
}
else
{
2018-02-06 02:46:59 +01:00
gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler];
sub_814CC98(gActiveBattler, FALSE);
gActiveBattler ^= BIT_FLANK;
gBattleBufferA[gActiveBattler][1] = gBattlePartyID[gActiveBattler];
BattleLoadPlayerMonSpriteGfx(&gPlayerParty[gBattlePartyID[gActiveBattler]], gActiveBattler);
sub_814CC98(gActiveBattler, FALSE);
gActiveBattler ^= BIT_FLANK;
2017-10-23 16:38:11 +02:00
}
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = sub_814B0E8;
gActiveBattler = savedActiveBank;
2017-10-23 16:38:11 +02:00
DestroyTask(taskId);
}
}
static void LinkPartnerHandleDrawPartyStatusSummary(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][1] != 0 && GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER)
2017-10-23 16:38:11 +02:00
{
LinkPartnerBufferExecCompleted();
}
else
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1 = 1;
gUnknown_020244B4[gActiveBattler] = CreatePartyStatusSummarySprites(gActiveBattler, (struct HpAndStatus *)&gBattleBufferA[gActiveBattler][4], gBattleBufferA[gActiveBattler][1], gBattleBufferA[gActiveBattler][2]);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
if (gBattleBufferA[gActiveBattler][2] != 0)
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0x5D;
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = sub_814DE9C;
2017-10-23 16:38:11 +02:00
}
}
static void sub_814DE9C(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5++ > 0x5C)
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].field_5 = 0;
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
}
static void LinkPartnerHandleCmd49(void)
{
2018-02-06 02:46:59 +01:00
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].flag_x1)
gTasks[gUnknown_020244B4[gActiveBattler]].func = sub_8073C30;
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd50(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleSpriteInvisibility(void)
{
2018-02-06 02:46:59 +01:00
if (IsBankSpritePresent(gActiveBattler))
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
gSprites[gBankSpriteIds[gActiveBattler]].invisible = gBattleBufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
2017-10-23 16:38:11 +02:00
}
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleBattleAnimation(void)
{
2018-02-06 02:46:59 +01:00
if (!mplay_80342A4(gActiveBattler))
2017-10-23 16:38:11 +02:00
{
2018-02-06 02:46:59 +01:00
u8 animationId = gBattleBufferA[gActiveBattler][1];
u16 argument = gBattleBufferA[gActiveBattler][2] | (gBattleBufferA[gActiveBattler][3] << 8);
2017-10-23 16:38:11 +02:00
2018-02-06 02:46:59 +01:00
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
else
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
2017-10-23 16:38:11 +02:00
sub_817E32C(animationId);
}
}
static void LinkPartnerHandleLinkStandbyMsg(void)
{
2018-02-06 02:46:59 +01:00
sub_81851A8(&gBattleBufferA[gActiveBattler][2]);
2017-10-23 16:38:11 +02:00
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleResetActionMoveSelection(void)
{
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleCmd55(void)
{
2018-02-06 02:46:59 +01:00
sub_81851A8(&gBattleBufferA[gActiveBattler][4]);
gBattleOutcome = gBattleBufferA[gActiveBattler][1];
gSaveBlock2Ptr->field_CA9_b = gBattleBufferA[gActiveBattler][2];
2017-10-23 16:38:11 +02:00
FadeOutMapMusic(5);
BeginFastPaletteFade(3);
LinkPartnerBufferExecCompleted();
2018-02-06 02:46:59 +01:00
gBattlerFuncs[gActiveBattler] = sub_80587B0;
2017-10-23 16:38:11 +02:00
}
static void nullsub_113(void)
{
}