mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
up to return mon to ball
This commit is contained in:
parent
7ba8a0216f
commit
7360a4a18a
@ -197,6 +197,7 @@ enum
|
||||
};
|
||||
|
||||
extern struct UnusedControllerStruct gUnusedControllerStruct;
|
||||
extern void (*gBattlerControllerEndFuncs[MAX_BATTLERS_COUNT])(void);
|
||||
|
||||
// general functions
|
||||
void HandleLinkBattleSetup(void);
|
||||
@ -253,12 +254,13 @@ void BtlController_EmitDebugMenu(u8 bufferId);
|
||||
|
||||
void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit);
|
||||
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void));
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerFunc)(void));
|
||||
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerFunc)(void));
|
||||
void BtlController_HandleReturnMonToBall(u32 battler);
|
||||
|
||||
// player controller
|
||||
void SetControllerToPlayer(void);
|
||||
|
@ -93,7 +93,6 @@ static void LinkOpponentBufferExecCompleted(void);
|
||||
static void SwitchIn_HandleSoundAndEnd(void);
|
||||
static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst);
|
||||
static void SetLinkOpponentMonData(u8 monId);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void LinkOpponentDoMoveAnimation(void);
|
||||
static void Task_StartSendOutAnim(u8 taskId);
|
||||
static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite);
|
||||
@ -167,6 +166,7 @@ static void LinkOpponentDummy(void)
|
||||
|
||||
void SetControllerToLinkOpponent(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = LinkOpponentBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand;
|
||||
}
|
||||
|
||||
@ -401,18 +401,6 @@ static void HideHealthboxAfterMonFaint(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
HideBattlerShadowSprite(gActiveBattler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -530,7 +518,7 @@ static void LinkOpponentBufferExecCompleted(void)
|
||||
|
||||
static void LinkOpponentHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty, LinkOpponentBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleGetRawMonData(void)
|
||||
@ -540,12 +528,12 @@ static void LinkOpponentHandleGetRawMonData(void)
|
||||
|
||||
static void LinkOpponentHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty, LinkOpponentBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty, LinkOpponentBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandleLoadMonSprite(void)
|
||||
@ -560,40 +548,7 @@ static void LinkOpponentHandleSwitchInAnim(void)
|
||||
|
||||
static void LinkOpponentHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
HideBattlerShadowSprite(gActiveBattler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -93,7 +93,6 @@ static void LinkPartnerBufferExecCompleted(void);
|
||||
static void SwitchIn_WaitAndEnd(void);
|
||||
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst);
|
||||
static void SetLinkPartnerMonData(u8 monId);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void LinkPartnerDoMoveAnimation(void);
|
||||
static void Task_StartSendOutAnim(u8 taskId);
|
||||
static void EndDrawPartyStatusSummary(void);
|
||||
@ -166,6 +165,7 @@ static void SpriteCB_Null2(void)
|
||||
|
||||
void SetControllerToLinkPartner(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = LinkPartnerBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = LinkPartnerBufferRunCommand;
|
||||
}
|
||||
|
||||
@ -300,17 +300,6 @@ static void FreeMonSpriteAfterFaintAnim(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -424,7 +413,7 @@ static void CompleteOnFinishedBattleAnimation(void)
|
||||
|
||||
static void LinkPartnerHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, LinkPartnerBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleGetRawMonData(void)
|
||||
@ -434,12 +423,12 @@ static void LinkPartnerHandleGetRawMonData(void)
|
||||
|
||||
static void LinkPartnerHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, LinkPartnerBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, LinkPartnerBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void LinkPartnerHandleLoadMonSprite(void)
|
||||
@ -454,39 +443,7 @@ static void LinkPartnerHandleSwitchInAnim(void)
|
||||
|
||||
static void LinkPartnerHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -104,7 +104,6 @@ static void OpponentBufferExecCompleted(void);
|
||||
static void SwitchIn_HandleSoundAndEnd(void);
|
||||
static u32 GetOpponentMonData(u8 monId, u8 *dst);
|
||||
static void SetOpponentMonData(u8 monId);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void OpponentDoMoveAnimation(void);
|
||||
static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite);
|
||||
static void Task_StartSendOutAnim(u8 taskId);
|
||||
@ -172,15 +171,13 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
[CONTROLLER_TERMINATOR_NOP] = OpponentCmdEnd
|
||||
};
|
||||
|
||||
// unknown unused data
|
||||
static const u8 sUnused[] = {0xB0, 0xB0, 0xC8, 0x98, 0x28, 0x28, 0x28, 0x20};
|
||||
|
||||
static void OpponentDummy(void)
|
||||
{
|
||||
}
|
||||
|
||||
void SetControllerToOpponent(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = OpponentBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand;
|
||||
}
|
||||
|
||||
@ -428,18 +425,6 @@ static void HideHealthboxAfterMonFaint(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
HideBattlerShadowSprite(gActiveBattler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -551,22 +536,22 @@ static void OpponentBufferExecCompleted(void)
|
||||
|
||||
static void OpponentHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void OpponentHandleGetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void OpponentHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void OpponentHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty, OpponentBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void OpponentHandleLoadMonSprite(void)
|
||||
@ -582,40 +567,7 @@ static void OpponentHandleSwitchInAnim(void)
|
||||
|
||||
static void OpponentHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
HideBattlerShadowSprite(gActiveBattler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/rgb.h"
|
||||
|
||||
static void PlayerBufferExecCompleted(void);
|
||||
static void PlayerHandleGetMonData(void);
|
||||
static void PlayerHandleGetRawMonData(void);
|
||||
static void PlayerHandleSetMonData(void);
|
||||
@ -115,7 +116,6 @@ static void Task_UpdateLvlInHealthbox(u8);
|
||||
static void PrintLinkStandbyMsg(void);
|
||||
static u32 CopyPlayerMonData(u8, u8 *);
|
||||
static void SetPlayerMonData(u8);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void PlayerDoMoveAnimation(void);
|
||||
static void Task_StartSendOutAnim(u8);
|
||||
static void EndDrawPartyStatusSummary(void);
|
||||
@ -184,15 +184,13 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
[CONTROLLER_TERMINATOR_NOP] = PlayerCmdEnd
|
||||
};
|
||||
|
||||
// unknown unused data
|
||||
static const u8 sUnused[] = {0x48, 0x48, 0x20, 0x5a, 0x50, 0x50, 0x50, 0x58};
|
||||
|
||||
void BattleControllerDummy(void)
|
||||
{
|
||||
}
|
||||
|
||||
void SetControllerToPlayer(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = PlayerBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = PlayerBufferRunCommand;
|
||||
gDoingBattleAnim = FALSE;
|
||||
gPlayerDpadHoldFrames = 0;
|
||||
@ -1545,17 +1543,6 @@ static void FreeMonSpriteAfterFaintAnim(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter2(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -1801,22 +1788,22 @@ static void PrintLinkStandbyMsg(void)
|
||||
|
||||
static void PlayerHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerHandleGetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, PlayerBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerHandleLoadMonSprite(void)
|
||||
@ -1835,40 +1822,7 @@ static void PlayerHandleSwitchInAnim(void)
|
||||
|
||||
static void PlayerHandleReturnMonToBall(void)
|
||||
{
|
||||
if (!gBattleResources->bufferA[gActiveBattler][1])
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skip animation, just remove battler
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -100,7 +100,6 @@ static void Task_UpdateLvlInHealthbox(u8 taskId);
|
||||
static void SwitchIn_WaitAndEnd(void);
|
||||
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst);
|
||||
static void SetPlayerPartnerMonData(u8 monId);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void PlayerPartnerDoMoveAnimation(void);
|
||||
static void Task_StartSendOutAnim(u8 taskId);
|
||||
static void EndDrawPartyStatusSummary(void);
|
||||
@ -167,21 +166,13 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
||||
[CONTROLLER_TERMINATOR_NOP] = PlayerPartnerCmdEnd
|
||||
};
|
||||
|
||||
// unknown unused data
|
||||
static const u8 sUnused[] =
|
||||
{
|
||||
0x83, 0x4d, 0xf3, 0x5f, 0x6f, 0x4f, 0xeb, 0x3e,
|
||||
0x67, 0x2e, 0x10, 0x46, 0x8c, 0x3d, 0x28, 0x35,
|
||||
0xc5, 0x2c, 0x15, 0x7f, 0xb5, 0x56, 0x9d, 0x53,
|
||||
0x3b, 0x43, 0xda, 0x36, 0x79, 0x2a, 0x0e, 0x53,
|
||||
};
|
||||
|
||||
static void PlayerPartnerDummy(void)
|
||||
{
|
||||
}
|
||||
|
||||
void SetControllerToPlayerPartner(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = PlayerPartnerBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerBufferRunCommand;
|
||||
}
|
||||
|
||||
@ -488,17 +479,6 @@ static void FreeMonSpriteAfterFaintAnim(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter2(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -612,7 +592,7 @@ static void CompleteOnFinishedBattleAnimation(void)
|
||||
|
||||
static void PlayerPartnerHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, PlayerPartnerBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleGetRawMonData(void)
|
||||
@ -622,12 +602,12 @@ static void PlayerPartnerHandleGetRawMonData(void)
|
||||
|
||||
static void PlayerPartnerHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, PlayerPartnerBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, PlayerPartnerBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void PlayerPartnerHandleLoadMonSprite(void)
|
||||
@ -642,39 +622,7 @@ static void PlayerPartnerHandleSwitchInAnim(void)
|
||||
|
||||
static void PlayerPartnerHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -96,7 +96,6 @@ static void RecordedOpponentBufferExecCompleted(void);
|
||||
static void SwitchIn_HandleSoundAndEnd(void);
|
||||
static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst);
|
||||
static void SetRecordedOpponentMonData(u8 monId);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void RecordedOpponentDoMoveAnimation(void);
|
||||
static void Task_StartSendOutAnim(u8 taskId);
|
||||
static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite);
|
||||
@ -170,6 +169,7 @@ static void RecordedOpponentDummy(void)
|
||||
|
||||
void SetControllerToRecordedOpponent(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = RecordedOpponentBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand;
|
||||
}
|
||||
|
||||
@ -391,18 +391,6 @@ static void HideHealthboxAfterMonFaint(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
HideBattlerShadowSprite(gActiveBattler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -519,7 +507,7 @@ static void RecordedOpponentBufferExecCompleted(void)
|
||||
|
||||
static void RecordedOpponentHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty, RecordedOpponentBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleGetRawMonData(void)
|
||||
@ -529,12 +517,12 @@ static void RecordedOpponentHandleGetRawMonData(void)
|
||||
|
||||
static void RecordedOpponentHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty, RecordedOpponentBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty, RecordedOpponentBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gEnemyParty);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandleLoadMonSprite(void)
|
||||
@ -549,40 +537,7 @@ static void RecordedOpponentHandleSwitchInAnim(void)
|
||||
|
||||
static void RecordedOpponentHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
HideBattlerShadowSprite(gActiveBattler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_OPPONENT_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -91,7 +91,6 @@ static void RecordedPlayerBufferExecCompleted(void);
|
||||
static void SwitchIn_WaitAndEnd(void);
|
||||
static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst);
|
||||
static void SetRecordedPlayerMonData(u8 monId);
|
||||
static void DoSwitchOutAnimation(void);
|
||||
static void RecordedPlayerDoMoveAnimation(void);
|
||||
static void Task_StartSendOutAnim(u8 taskId);
|
||||
static void EndDrawPartyStatusSummary(void);
|
||||
@ -163,6 +162,7 @@ static void RecordedPlayerDummy(void)
|
||||
|
||||
void SetControllerToRecordedPlayer(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = RecordedPlayerBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerBufferRunCommand;
|
||||
}
|
||||
|
||||
@ -376,17 +376,6 @@ static void FreeMonSpriteAfterFaintAnim(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -500,7 +489,7 @@ static void CompleteOnFinishedBattleAnimation(void)
|
||||
|
||||
static void RecordedPlayerHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, RecordedPlayerBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleGetRawMonData(void)
|
||||
@ -510,12 +499,12 @@ static void RecordedPlayerHandleGetRawMonData(void)
|
||||
|
||||
static void RecordedPlayerHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, RecordedPlayerBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleSetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty, RecordedPlayerBufferExecCompleted);
|
||||
BtlController_HandleSetRawMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void RecordedPlayerHandleLoadMonSprite(void)
|
||||
@ -530,39 +519,7 @@ static void RecordedPlayerHandleSwitchInAnim(void)
|
||||
|
||||
static void RecordedPlayerHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -155,6 +155,7 @@ static void SpriteCB_Null4(void)
|
||||
|
||||
void SetControllerToSafari(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = SafariBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand;
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,7 @@ static void SpriteCB_Null7(void)
|
||||
|
||||
void SetControllerToWally(void)
|
||||
{
|
||||
gBattlerControllerEndFuncs[gActiveBattler] = WallyBufferExecCompleted;
|
||||
gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand;
|
||||
gBattleStruct->wallyBattleState = 0;
|
||||
gBattleStruct->wallyMovesState = 0;
|
||||
@ -380,17 +381,6 @@ static void DoHitAnimBlinkSpriteEffect(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnBankSpriteCallbackDummy2(void)
|
||||
{
|
||||
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
|
||||
@ -427,17 +417,17 @@ static void CompleteOnFinishedStatusAnimation(void)
|
||||
|
||||
static void WallyHandleGetMonData(void)
|
||||
{
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty, WallyBufferExecCompleted);
|
||||
BtlController_HandleGetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void WallyHandleGetRawMonData(void)
|
||||
{
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty, WallyBufferExecCompleted);
|
||||
BtlController_HandleGetRawMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void WallyHandleSetMonData(void)
|
||||
{
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty, WallyBufferExecCompleted);
|
||||
BtlController_HandleSetMonData(gActiveBattler, gPlayerParty);
|
||||
}
|
||||
|
||||
static void WallyHandleSetRawMonData(void)
|
||||
@ -457,18 +447,7 @@ static void WallyHandleSwitchInAnim(void)
|
||||
|
||||
static void WallyHandleReturnMonToBall(void)
|
||||
{
|
||||
if (gBattleResources->bufferA[gActiveBattler][1] == 0)
|
||||
{
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
WallyBufferExecCompleted();
|
||||
}
|
||||
BtlController_HandleReturnMonToBall(gActiveBattler);
|
||||
}
|
||||
|
||||
#define sSpeedX data[0]
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "battle_anim.h"
|
||||
#include "battle_controllers.h"
|
||||
#include "battle_gfx_sfx_util.h"
|
||||
#include "battle_interface.h"
|
||||
#include "battle_message.h"
|
||||
#include "battle_setup.h"
|
||||
#include "cable_club.h"
|
||||
@ -18,7 +19,7 @@
|
||||
|
||||
static EWRAM_DATA u8 sLinkSendTaskId = 0;
|
||||
static EWRAM_DATA u8 sLinkReceiveTaskId = 0;
|
||||
static EWRAM_DATA u8 sUnused = 0; // Debug? Never read
|
||||
EWRAM_DATA void (*gBattlerControllerEndFuncs[MAX_BATTLERS_COUNT])(void) = {NULL}; // Controller's buffer complete function for each battler
|
||||
EWRAM_DATA struct UnusedControllerStruct gUnusedControllerStruct = {}; // Debug? Unused code that writes to it, never read
|
||||
static EWRAM_DATA u8 sBattleBuffersTransferData[0x100] = {};
|
||||
|
||||
@ -696,8 +697,6 @@ static void CreateTasksForSendRecvLinkBuffers(void)
|
||||
gTasks[sLinkReceiveTaskId].data[13] = 0;
|
||||
gTasks[sLinkReceiveTaskId].data[14] = 0;
|
||||
gTasks[sLinkReceiveTaskId].data[15] = 0;
|
||||
|
||||
sUnused = 0;
|
||||
}
|
||||
|
||||
enum
|
||||
@ -1550,6 +1549,11 @@ void BtlController_EmitDebugMenu(u8 bufferId)
|
||||
}
|
||||
|
||||
// Standardized Controller functions
|
||||
void BattleControllerComplete(u32 battler)
|
||||
{
|
||||
gBattlerControllerEndFuncs[battler]();
|
||||
}
|
||||
|
||||
static u32 GetBattlerMonData(u32 battler, struct Pokemon *party, u32 monId, u8 *dst)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
@ -2109,7 +2113,46 @@ void StartSendOutAnim(u32 battler, bool32 dontClearSubstituteBit)
|
||||
gSprites[gBattleControllerData[battler]].data[0] = DoPokeballSendOutAnimation(0, (side == B_SIDE_OPPONENT) ? POKEBALL_OPPONENT_SENDOUT : POKEBALL_PLAYER_SENDOUT);
|
||||
}
|
||||
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
static void FreeMonSprite(u32 battler)
|
||||
{
|
||||
FreeSpriteOamMatrix(&gSprites[gBattlerSpriteIds[battler]]);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[battler]]);
|
||||
if (GetBattlerSide(battler) == B_SIDE_OPPONENT)
|
||||
HideBattlerShadowSprite(battler);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[battler]);
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
FreeMonSprite(gActiveBattler);
|
||||
BattleControllerComplete(gActiveBattler);
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
case 0:
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
|
||||
break;
|
||||
case 1:
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) ? B_ANIM_SWITCH_OUT_OPPONENT_MON : B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party)
|
||||
{
|
||||
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;
|
||||
@ -2131,10 +2174,10 @@ void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party, void (*
|
||||
}
|
||||
}
|
||||
BtlController_EmitDataTransfer(BUFFER_B, size, monData);
|
||||
execCompleteFunc();
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party)
|
||||
{
|
||||
struct BattlePokemon battleMon;
|
||||
u8 *src = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1];
|
||||
@ -2145,10 +2188,10 @@ void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party, void
|
||||
dst[i] = src[i];
|
||||
|
||||
BtlController_EmitDataTransfer(BUFFER_B, gBattleResources->bufferA[battler][2], dst);
|
||||
execCompleteFunc();
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party)
|
||||
{
|
||||
u32 i, monToCheck;
|
||||
|
||||
@ -2166,10 +2209,10 @@ void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party, void (*
|
||||
monToCheck >>= 1;
|
||||
}
|
||||
}
|
||||
execCompleteFunc();
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party, void (*execCompleteFunc)(void))
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party)
|
||||
{
|
||||
u32 i;
|
||||
u8 *dst = (u8 *)&party[gBattlerPartyIndexes[battler]] + gBattleResources->bufferA[battler][1];
|
||||
@ -2177,7 +2220,7 @@ void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party, void
|
||||
for (i = 0; i < gBattleResources->bufferA[battler][2]; i++)
|
||||
dst[i] = gBattleResources->bufferA[battler][3 + i];
|
||||
|
||||
execCompleteFunc();
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerFunc)(void))
|
||||
@ -2213,3 +2256,17 @@ void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*c
|
||||
StartSendOutAnim(battler, gBattleResources->bufferA[battler][2]);
|
||||
gBattlerControllerFuncs[battler] = controllerFunc;
|
||||
}
|
||||
|
||||
void BtlController_HandleReturnMonToBall(u32 battler)
|
||||
{
|
||||
if (gBattleResources->bufferA[battler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0;
|
||||
gBattlerControllerFuncs[battler] = DoSwitchOutAnimation;
|
||||
}
|
||||
else
|
||||
{
|
||||
FreeMonSprite(battler);
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user