more controller functions

This commit is contained in:
DizzyEggg 2023-08-05 14:11:25 +02:00
parent a505cd7fb9
commit 1793b9e1da
11 changed files with 193 additions and 935 deletions

View File

@ -263,13 +263,21 @@ void BtlController_HandleSetMonData(void);
void BtlController_HandleSetRawMonData(void); void BtlController_HandleSetRawMonData(void);
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerCallback)(void)); void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerCallback)(void));
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(void)); void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(void));
void BtlController_HandleReturnMonToBall(u32 battler); void BtlController_HandleReturnMonToBall(void);
void BtlController_HandleFaintAnimation(u32 battler); void BtlController_HandleFaintAnimation(void);
void BtlController_HandleSuccessBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture); void BtlController_HandleSuccessBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture);
void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture); void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture);
void BtlController_HandleClearUnkVar(void);
void BtlController_HandleSetUnkVar(void);
void BtlController_HandleClearUnkFlag(void);
void BtlController_HandleToggleUnkFlag(void);
void BtlController_HandleHitAnimation(void);
void BtlController_HandlePlaySE(void); void BtlController_HandlePlaySE(void);
void BtlController_HandlePlayFanfareOrBGM(void); void BtlController_HandlePlayFanfareOrBGM(void);
void BtlController_HandleFaintingCry(void); void BtlController_HandleFaintingCry(void);
void BtlController_HandleIntroSlide(void);
void BtlController_HandleSpriteInvisibility(void);
void BtlController_HandleBattleAnimation(u32 battler, bool32 ignoreSE, bool32 updateTvData);
// player controller // player controller
void SetControllerToPlayer(void); void SetControllerToPlayer(void);

View File

@ -31,26 +31,17 @@
static void LinkOpponentHandleLoadMonSprite(void); static void LinkOpponentHandleLoadMonSprite(void);
static void LinkOpponentHandleSwitchInAnim(void); static void LinkOpponentHandleSwitchInAnim(void);
static void LinkOpponentHandleReturnMonToBall(void);
static void LinkOpponentHandleDrawTrainerPic(void); static void LinkOpponentHandleDrawTrainerPic(void);
static void LinkOpponentHandleTrainerSlide(void); static void LinkOpponentHandleTrainerSlide(void);
static void LinkOpponentHandleTrainerSlideBack(void); static void LinkOpponentHandleTrainerSlideBack(void);
static void LinkOpponentHandleFaintAnimation(void);
static void LinkOpponentHandleMoveAnimation(void); static void LinkOpponentHandleMoveAnimation(void);
static void LinkOpponentHandlePrintString(void); static void LinkOpponentHandlePrintString(void);
static void LinkOpponentHandleHealthBarUpdate(void); static void LinkOpponentHandleHealthBarUpdate(void);
static void LinkOpponentHandleStatusIconUpdate(void); static void LinkOpponentHandleStatusIconUpdate(void);
static void LinkOpponentHandleStatusAnimation(void); static void LinkOpponentHandleStatusAnimation(void);
static void LinkOpponentHandleClearUnkVar(void);
static void LinkOpponentHandleSetUnkVar(void);
static void LinkOpponentHandleClearUnkFlag(void);
static void LinkOpponentHandleToggleUnkFlag(void);
static void LinkOpponentHandleHitAnimation(void);
static void LinkOpponentHandleIntroSlide(void);
static void LinkOpponentHandleIntroTrainerBallThrow(void); static void LinkOpponentHandleIntroTrainerBallThrow(void);
static void LinkOpponentHandleDrawPartyStatusSummary(void); static void LinkOpponentHandleDrawPartyStatusSummary(void);
static void LinkOpponentHandleHidePartyStatusSummary(void); static void LinkOpponentHandleHidePartyStatusSummary(void);
static void LinkOpponentHandleSpriteInvisibility(void);
static void LinkOpponentHandleBattleAnimation(void); static void LinkOpponentHandleBattleAnimation(void);
static void LinkOpponentHandleLinkStandbyMsg(void); static void LinkOpponentHandleLinkStandbyMsg(void);
static void LinkOpponentHandleEndLinkBattle(void); static void LinkOpponentHandleEndLinkBattle(void);
@ -73,11 +64,11 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = LinkOpponentHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = LinkOpponentHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = LinkOpponentHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = LinkOpponentHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = LinkOpponentHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = LinkOpponentHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = LinkOpponentHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = LinkOpponentHandleTrainerSlide, [CONTROLLER_TRAINERSLIDE] = LinkOpponentHandleTrainerSlide,
[CONTROLLER_TRAINERSLIDEBACK] = LinkOpponentHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = LinkOpponentHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = LinkOpponentHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty, [CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
@ -104,21 +95,21 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
[CONTROLLER_CLEARUNKVAR] = LinkOpponentHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = LinkOpponentHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = LinkOpponentHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = LinkOpponentHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = LinkOpponentHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = LinkOpponentHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = LinkOpponentHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = LinkOpponentHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkOpponentHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkOpponentHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkOpponentHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkOpponentHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty, [CONTROLLER_ENDBOUNCE] = BtlController_Empty,
[CONTROLLER_SPRITEINVISIBILITY] = LinkOpponentHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = LinkOpponentHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg, [CONTROLLER_LINKSTANDBYMSG] = LinkOpponentHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
@ -365,25 +356,6 @@ static void CompleteOnInactiveTextPrinter(void)
LinkOpponentBufferExecCompleted(); LinkOpponentBufferExecCompleted();
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
LinkOpponentBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void SwitchIn_ShowSubstitute(void) static void SwitchIn_ShowSubstitute(void)
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -452,12 +424,6 @@ static void CompleteOnFinishedStatusAnimation(void)
LinkOpponentBufferExecCompleted(); LinkOpponentBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentBufferExecCompleted(void) static void LinkOpponentBufferExecCompleted(void)
{ {
gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand; gBattlerControllerFuncs[gActiveBattler] = LinkOpponentBufferRunCommand;
@ -484,11 +450,6 @@ static void LinkOpponentHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, FALSE, SwitchIn_TryShinyAnim); BtlController_HandleSwitchInAnim(gActiveBattler, FALSE, SwitchIn_TryShinyAnim);
} }
static void LinkOpponentHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
static void LinkOpponentHandleDrawTrainerPic(void) static void LinkOpponentHandleDrawTrainerPic(void)
@ -616,11 +577,6 @@ static void LinkOpponentHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void LinkOpponentHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void LinkOpponentHandleMoveAnimation(void) static void LinkOpponentHandleMoveAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) if (!IsBattleSEPlaying(gActiveBattler))
@ -750,52 +706,6 @@ static void LinkOpponentHandleStatusAnimation(void)
} }
} }
static void LinkOpponentHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
LinkOpponentBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void LinkOpponentHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleIntroTrainerBallThrow(void) static void LinkOpponentHandleIntroTrainerBallThrow(void)
{ {
u8 taskId; u8 taskId;
@ -899,30 +809,9 @@ static void LinkOpponentHandleHidePartyStatusSummary(void)
LinkOpponentBufferExecCompleted(); LinkOpponentBufferExecCompleted();
} }
static void LinkOpponentHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
LinkOpponentBufferExecCompleted();
}
static void LinkOpponentHandleBattleAnimation(void) static void LinkOpponentHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, TRUE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
LinkOpponentBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
BattleTv_SetDataBasedOnAnimation(animationId);
}
} }
static void LinkOpponentHandleLinkStandbyMsg(void) static void LinkOpponentHandleLinkStandbyMsg(void)

View File

@ -31,25 +31,16 @@
static void LinkPartnerHandleLoadMonSprite(void); static void LinkPartnerHandleLoadMonSprite(void);
static void LinkPartnerHandleSwitchInAnim(void); static void LinkPartnerHandleSwitchInAnim(void);
static void LinkPartnerHandleReturnMonToBall(void);
static void LinkPartnerHandleDrawTrainerPic(void); static void LinkPartnerHandleDrawTrainerPic(void);
static void LinkPartnerHandleTrainerSlideBack(void); static void LinkPartnerHandleTrainerSlideBack(void);
static void LinkPartnerHandleFaintAnimation(void);
static void LinkPartnerHandleMoveAnimation(void); static void LinkPartnerHandleMoveAnimation(void);
static void LinkPartnerHandlePrintString(void); static void LinkPartnerHandlePrintString(void);
static void LinkPartnerHandleHealthBarUpdate(void); static void LinkPartnerHandleHealthBarUpdate(void);
static void LinkPartnerHandleStatusIconUpdate(void); static void LinkPartnerHandleStatusIconUpdate(void);
static void LinkPartnerHandleStatusAnimation(void); static void LinkPartnerHandleStatusAnimation(void);
static void LinkPartnerHandleClearUnkVar(void);
static void LinkPartnerHandleSetUnkVar(void);
static void LinkPartnerHandleClearUnkFlag(void);
static void LinkPartnerHandleToggleUnkFlag(void);
static void LinkPartnerHandleHitAnimation(void);
static void LinkPartnerHandleIntroSlide(void);
static void LinkPartnerHandleIntroTrainerBallThrow(void); static void LinkPartnerHandleIntroTrainerBallThrow(void);
static void LinkPartnerHandleDrawPartyStatusSummary(void); static void LinkPartnerHandleDrawPartyStatusSummary(void);
static void LinkPartnerHandleHidePartyStatusSummary(void); static void LinkPartnerHandleHidePartyStatusSummary(void);
static void LinkPartnerHandleSpriteInvisibility(void);
static void LinkPartnerHandleBattleAnimation(void); static void LinkPartnerHandleBattleAnimation(void);
static void LinkPartnerHandleLinkStandbyMsg(void); static void LinkPartnerHandleLinkStandbyMsg(void);
static void LinkPartnerHandleEndLinkBattle(void); static void LinkPartnerHandleEndLinkBattle(void);
@ -71,11 +62,11 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = LinkPartnerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = LinkPartnerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = LinkPartnerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = LinkPartnerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = LinkPartnerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = LinkPartnerHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = LinkPartnerHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDE] = BtlController_Empty,
[CONTROLLER_TRAINERSLIDEBACK] = LinkPartnerHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = LinkPartnerHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = LinkPartnerHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty, [CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
@ -102,21 +93,21 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
[CONTROLLER_CLEARUNKVAR] = LinkPartnerHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = LinkPartnerHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = LinkPartnerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = LinkPartnerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = LinkPartnerHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = LinkPartnerHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = LinkPartnerHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = LinkPartnerHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkPartnerHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = LinkPartnerHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkPartnerHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = LinkPartnerHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty, [CONTROLLER_ENDBOUNCE] = BtlController_Empty,
[CONTROLLER_SPRITEINVISIBILITY] = LinkPartnerHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = LinkPartnerHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = LinkPartnerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = LinkPartnerHandleLinkStandbyMsg, [CONTROLLER_LINKSTANDBYMSG] = LinkPartnerHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
@ -258,25 +249,6 @@ static void CompleteOnInactiveTextPrinter(void)
LinkPartnerBufferExecCompleted(); LinkPartnerBufferExecCompleted();
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
LinkPartnerBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void SwitchIn_ShowSubstitute(void) static void SwitchIn_ShowSubstitute(void)
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -357,12 +329,6 @@ static void CompleteOnFinishedStatusAnimation(void)
LinkPartnerBufferExecCompleted(); LinkPartnerBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleLoadMonSprite(void) static void LinkPartnerHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad); BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
@ -373,11 +339,6 @@ static void LinkPartnerHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim); BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim);
} }
static void LinkPartnerHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
static void LinkPartnerHandleDrawTrainerPic(void) static void LinkPartnerHandleDrawTrainerPic(void)
@ -437,11 +398,6 @@ static void LinkPartnerHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void LinkPartnerHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void LinkPartnerHandleMoveAnimation(void) static void LinkPartnerHandleMoveAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) if (!IsBattleSEPlaying(gActiveBattler))
@ -571,52 +527,6 @@ static void LinkPartnerHandleStatusAnimation(void)
} }
} }
static void LinkPartnerHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
LinkPartnerBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void LinkPartnerHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleIntroTrainerBallThrow(void) static void LinkPartnerHandleIntroTrainerBallThrow(void)
{ {
u8 paletteNum; u8 paletteNum;
@ -732,30 +642,9 @@ static void LinkPartnerHandleHidePartyStatusSummary(void)
LinkPartnerBufferExecCompleted(); LinkPartnerBufferExecCompleted();
} }
static void LinkPartnerHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
LinkPartnerBufferExecCompleted();
}
static void LinkPartnerHandleBattleAnimation(void) static void LinkPartnerHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, TRUE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
LinkPartnerBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
BattleTv_SetDataBasedOnAnimation(animationId);
}
} }
static void LinkPartnerHandleLinkStandbyMsg(void) static void LinkPartnerHandleLinkStandbyMsg(void)

View File

@ -41,11 +41,9 @@
static void OpponentHandleLoadMonSprite(void); static void OpponentHandleLoadMonSprite(void);
static void OpponentHandleSwitchInAnim(void); static void OpponentHandleSwitchInAnim(void);
static void OpponentHandleReturnMonToBall(void);
static void OpponentHandleDrawTrainerPic(void); static void OpponentHandleDrawTrainerPic(void);
static void OpponentHandleTrainerSlide(void); static void OpponentHandleTrainerSlide(void);
static void OpponentHandleTrainerSlideBack(void); static void OpponentHandleTrainerSlideBack(void);
static void OpponentHandleFaintAnimation(void);
static void OpponentHandleMoveAnimation(void); static void OpponentHandleMoveAnimation(void);
static void OpponentHandlePrintString(void); static void OpponentHandlePrintString(void);
static void OpponentHandleChooseAction(void); static void OpponentHandleChooseAction(void);
@ -55,16 +53,9 @@ static void OpponentHandleChoosePokemon(void);
static void OpponentHandleHealthBarUpdate(void); static void OpponentHandleHealthBarUpdate(void);
static void OpponentHandleStatusIconUpdate(void); static void OpponentHandleStatusIconUpdate(void);
static void OpponentHandleStatusAnimation(void); static void OpponentHandleStatusAnimation(void);
static void OpponentHandleClearUnkVar(void);
static void OpponentHandleSetUnkVar(void);
static void OpponentHandleClearUnkFlag(void);
static void OpponentHandleToggleUnkFlag(void);
static void OpponentHandleHitAnimation(void);
static void OpponentHandleIntroSlide(void);
static void OpponentHandleIntroTrainerBallThrow(void); static void OpponentHandleIntroTrainerBallThrow(void);
static void OpponentHandleDrawPartyStatusSummary(void); static void OpponentHandleDrawPartyStatusSummary(void);
static void OpponentHandleHidePartyStatusSummary(void); static void OpponentHandleHidePartyStatusSummary(void);
static void OpponentHandleSpriteInvisibility(void);
static void OpponentHandleBattleAnimation(void); static void OpponentHandleBattleAnimation(void);
static void OpponentHandleEndLinkBattle(void); static void OpponentHandleEndLinkBattle(void);
static u8 CountAIAliveNonEggMonsExcept(u8 slotToIgnore); static u8 CountAIAliveNonEggMonsExcept(u8 slotToIgnore);
@ -87,11 +78,11 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = OpponentHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = OpponentHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = OpponentHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = OpponentHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = OpponentHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = OpponentHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = OpponentHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = OpponentHandleTrainerSlide, [CONTROLLER_TRAINERSLIDE] = OpponentHandleTrainerSlide,
[CONTROLLER_TRAINERSLIDEBACK] = OpponentHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = OpponentHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = OpponentHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty, [CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
@ -118,21 +109,21 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
[CONTROLLER_CLEARUNKVAR] = OpponentHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = OpponentHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = OpponentHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = OpponentHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = OpponentHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = OpponentHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = OpponentHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = OpponentHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = OpponentHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = OpponentHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = OpponentHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = OpponentHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty, [CONTROLLER_ENDBOUNCE] = BtlController_Empty,
[CONTROLLER_SPRITEINVISIBILITY] = OpponentHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = OpponentHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = OpponentHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
@ -392,25 +383,6 @@ static void CompleteOnInactiveTextPrinter(void)
OpponentBufferExecCompleted(); OpponentBufferExecCompleted();
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
OpponentBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void SwitchIn_ShowSubstitute(void) static void SwitchIn_ShowSubstitute(void)
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -473,12 +445,6 @@ static void CompleteOnFinishedStatusAnimation(void)
OpponentBufferExecCompleted(); OpponentBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
OpponentBufferExecCompleted();
}
static void OpponentBufferExecCompleted(void) static void OpponentBufferExecCompleted(void)
{ {
gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand; gBattlerControllerFuncs[gActiveBattler] = OpponentBufferRunCommand;
@ -506,11 +472,6 @@ static void OpponentHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, FALSE, SwitchIn_TryShinyAnim); BtlController_HandleSwitchInAnim(gActiveBattler, FALSE, SwitchIn_TryShinyAnim);
} }
static void OpponentHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
static void OpponentHandleDrawTrainerPic(void) static void OpponentHandleDrawTrainerPic(void)
@ -681,11 +642,6 @@ static void OpponentHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void OpponentHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void OpponentHandleMoveAnimation(void) static void OpponentHandleMoveAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) if (!IsBattleSEPlaying(gActiveBattler))
@ -1017,52 +973,6 @@ static void OpponentHandleStatusAnimation(void)
} }
} }
static void OpponentHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
OpponentBufferExecCompleted();
}
static void OpponentHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
OpponentBufferExecCompleted();
}
static void OpponentHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
OpponentBufferExecCompleted();
}
static void OpponentHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
OpponentBufferExecCompleted();
}
static void OpponentHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
OpponentBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void OpponentHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
OpponentBufferExecCompleted();
}
static void OpponentHandleIntroTrainerBallThrow(void) static void OpponentHandleIntroTrainerBallThrow(void)
{ {
u8 taskId; u8 taskId;
@ -1171,28 +1081,9 @@ static void OpponentHandleHidePartyStatusSummary(void)
OpponentBufferExecCompleted(); OpponentBufferExecCompleted();
} }
static void OpponentHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
OpponentBufferExecCompleted();
}
static void OpponentHandleBattleAnimation(void) static void OpponentHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, FALSE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
OpponentBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
}
} }
static void OpponentHandleEndLinkBattle(void) static void OpponentHandleEndLinkBattle(void)

View File

@ -40,11 +40,9 @@
static void PlayerBufferExecCompleted(void); static void PlayerBufferExecCompleted(void);
static void PlayerHandleLoadMonSprite(void); static void PlayerHandleLoadMonSprite(void);
static void PlayerHandleSwitchInAnim(void); static void PlayerHandleSwitchInAnim(void);
static void PlayerHandleReturnMonToBall(void);
static void PlayerHandleDrawTrainerPic(void); static void PlayerHandleDrawTrainerPic(void);
static void PlayerHandleTrainerSlide(void); static void PlayerHandleTrainerSlide(void);
static void PlayerHandleTrainerSlideBack(void); static void PlayerHandleTrainerSlideBack(void);
static void PlayerHandleFaintAnimation(void);
static void PlayerHandlePaletteFade(void); static void PlayerHandlePaletteFade(void);
static void PlayerHandleSuccessBallThrowAnim(void); static void PlayerHandleSuccessBallThrowAnim(void);
static void PlayerHandleBallThrowAnim(void); static void PlayerHandleBallThrowAnim(void);
@ -69,17 +67,10 @@ static void PlayerHandleTwoReturnValues(void);
static void PlayerHandleChosenMonReturnValue(void); static void PlayerHandleChosenMonReturnValue(void);
static void PlayerHandleOneReturnValue(void); static void PlayerHandleOneReturnValue(void);
static void PlayerHandleOneReturnValue_Duplicate(void); static void PlayerHandleOneReturnValue_Duplicate(void);
static void PlayerHandleClearUnkVar(void);
static void PlayerHandleSetUnkVar(void);
static void PlayerHandleClearUnkFlag(void);
static void PlayerHandleToggleUnkFlag(void);
static void PlayerHandleHitAnimation(void);
static void PlayerHandleIntroSlide(void);
static void PlayerHandleIntroTrainerBallThrow(void); static void PlayerHandleIntroTrainerBallThrow(void);
static void PlayerHandleDrawPartyStatusSummary(void); static void PlayerHandleDrawPartyStatusSummary(void);
static void PlayerHandleHidePartyStatusSummary(void); static void PlayerHandleHidePartyStatusSummary(void);
static void PlayerHandleEndBounceEffect(void); static void PlayerHandleEndBounceEffect(void);
static void PlayerHandleSpriteInvisibility(void);
static void PlayerHandleBattleAnimation(void); static void PlayerHandleBattleAnimation(void);
static void PlayerHandleLinkStandbyMsg(void); static void PlayerHandleLinkStandbyMsg(void);
static void PlayerHandleResetActionMoveSelection(void); static void PlayerHandleResetActionMoveSelection(void);
@ -119,11 +110,11 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = PlayerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = PlayerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = PlayerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = PlayerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = PlayerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = PlayerHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = PlayerHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = PlayerHandleTrainerSlide, [CONTROLLER_TRAINERSLIDE] = PlayerHandleTrainerSlide,
[CONTROLLER_TRAINERSLIDEBACK] = PlayerHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = PlayerHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = PlayerHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = PlayerHandlePaletteFade, [CONTROLLER_PALETTEFADE] = PlayerHandlePaletteFade,
[CONTROLLER_SUCCESSBALLTHROWANIM] = PlayerHandleSuccessBallThrowAnim, [CONTROLLER_SUCCESSBALLTHROWANIM] = PlayerHandleSuccessBallThrowAnim,
[CONTROLLER_BALLTHROWANIM] = PlayerHandleBallThrowAnim, [CONTROLLER_BALLTHROWANIM] = PlayerHandleBallThrowAnim,
@ -150,21 +141,21 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CHOSENMONRETURNVALUE] = PlayerHandleChosenMonReturnValue, [CONTROLLER_CHOSENMONRETURNVALUE] = PlayerHandleChosenMonReturnValue,
[CONTROLLER_ONERETURNVALUE] = PlayerHandleOneReturnValue, [CONTROLLER_ONERETURNVALUE] = PlayerHandleOneReturnValue,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = PlayerHandleOneReturnValue_Duplicate, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = PlayerHandleOneReturnValue_Duplicate,
[CONTROLLER_CLEARUNKVAR] = PlayerHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = PlayerHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = PlayerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = PlayerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = PlayerHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = PlayerHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = PlayerHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = PlayerHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = PlayerHandleEndBounceEffect, [CONTROLLER_ENDBOUNCE] = PlayerHandleEndBounceEffect,
[CONTROLLER_SPRITEINVISIBILITY] = PlayerHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = PlayerHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = PlayerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = PlayerHandleLinkStandbyMsg, [CONTROLLER_LINKSTANDBYMSG] = PlayerHandleLinkStandbyMsg,
[CONTROLLER_RESETACTIONMOVESELECTION] = PlayerHandleResetActionMoveSelection, [CONTROLLER_RESETACTIONMOVESELECTION] = PlayerHandleResetActionMoveSelection,
@ -1574,25 +1565,6 @@ static void CompleteWhenChoseItem(void)
} }
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
PlayerBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void PlayerHandleYesNoInput(void) static void PlayerHandleYesNoInput(void)
{ {
if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0) if (JOY_NEW(DPAD_UP) && gMultiUsePlayerCursor != 0)
@ -1739,12 +1711,6 @@ static void CompleteOnFinishedStatusAnimation(void)
PlayerBufferExecCompleted(); PlayerBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
PlayerBufferExecCompleted();
}
static void PrintLinkStandbyMsg(void) static void PrintLinkStandbyMsg(void)
{ {
if (gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_LINK)
@ -1769,11 +1735,6 @@ static void PlayerHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnimShowHealthbox); BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnimShowHealthbox);
} }
static void PlayerHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
// In emerald it's possible to have a tag battle in the battle frontier facilities with AI // In emerald it's possible to have a tag battle in the battle frontier facilities with AI
@ -1914,11 +1875,6 @@ static void PlayerHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void PlayerHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void PlayerHandlePaletteFade(void) static void PlayerHandlePaletteFade(void)
{ {
BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK); BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK);
@ -2329,52 +2285,6 @@ static void PlayerHandleOneReturnValue_Duplicate(void)
PlayerBufferExecCompleted(); PlayerBufferExecCompleted();
} }
static void PlayerHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
PlayerBufferExecCompleted();
}
static void PlayerHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
PlayerBufferExecCompleted();
}
static void PlayerHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
PlayerBufferExecCompleted();
}
static void PlayerHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
PlayerBufferExecCompleted();
}
static void PlayerHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
PlayerBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void PlayerHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
PlayerBufferExecCompleted();
}
// Task data for Task_StartSendOutAnim // Task data for Task_StartSendOutAnim
#define tBattlerId data[0] #define tBattlerId data[0]
#define tStartTimer data[1] #define tStartTimer data[1]
@ -2506,30 +2416,9 @@ static void PlayerHandleEndBounceEffect(void)
PlayerBufferExecCompleted(); PlayerBufferExecCompleted();
} }
static void PlayerHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
PlayerBufferExecCompleted();
}
static void PlayerHandleBattleAnimation(void) static void PlayerHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, TRUE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
PlayerBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
BattleTv_SetDataBasedOnAnimation(animationId);
}
} }
static void PlayerHandleLinkStandbyMsg(void) static void PlayerHandleLinkStandbyMsg(void)

View File

@ -33,10 +33,8 @@
static void PlayerPartnerHandleLoadMonSprite(void); static void PlayerPartnerHandleLoadMonSprite(void);
static void PlayerPartnerHandleSwitchInAnim(void); static void PlayerPartnerHandleSwitchInAnim(void);
static void PlayerPartnerHandleReturnMonToBall(void);
static void PlayerPartnerHandleDrawTrainerPic(void); static void PlayerPartnerHandleDrawTrainerPic(void);
static void PlayerPartnerHandleTrainerSlideBack(void); static void PlayerPartnerHandleTrainerSlideBack(void);
static void PlayerPartnerHandleFaintAnimation(void);
static void PlayerPartnerHandleMoveAnimation(void); static void PlayerPartnerHandleMoveAnimation(void);
static void PlayerPartnerHandlePrintString(void); static void PlayerPartnerHandlePrintString(void);
static void PlayerPartnerHandleChooseAction(void); static void PlayerPartnerHandleChooseAction(void);
@ -46,16 +44,9 @@ static void PlayerPartnerHandleHealthBarUpdate(void);
static void PlayerPartnerHandleExpUpdate(void); static void PlayerPartnerHandleExpUpdate(void);
static void PlayerPartnerHandleStatusIconUpdate(void); static void PlayerPartnerHandleStatusIconUpdate(void);
static void PlayerPartnerHandleStatusAnimation(void); static void PlayerPartnerHandleStatusAnimation(void);
static void PlayerPartnerHandleClearUnkVar(void);
static void PlayerPartnerHandleSetUnkVar(void);
static void PlayerPartnerHandleClearUnkFlag(void);
static void PlayerPartnerHandleToggleUnkFlag(void);
static void PlayerPartnerHandleHitAnimation(void);
static void PlayerPartnerHandleIntroSlide(void);
static void PlayerPartnerHandleIntroTrainerBallThrow(void); static void PlayerPartnerHandleIntroTrainerBallThrow(void);
static void PlayerPartnerHandleDrawPartyStatusSummary(void); static void PlayerPartnerHandleDrawPartyStatusSummary(void);
static void PlayerPartnerHandleHidePartyStatusSummary(void); static void PlayerPartnerHandleHidePartyStatusSummary(void);
static void PlayerPartnerHandleSpriteInvisibility(void);
static void PlayerPartnerHandleBattleAnimation(void); static void PlayerPartnerHandleBattleAnimation(void);
static void PlayerPartnerHandleEndLinkBattle(void); static void PlayerPartnerHandleEndLinkBattle(void);
@ -81,11 +72,11 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = PlayerPartnerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = PlayerPartnerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = PlayerPartnerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = PlayerPartnerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = PlayerPartnerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = PlayerPartnerHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = PlayerPartnerHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDE] = BtlController_Empty,
[CONTROLLER_TRAINERSLIDEBACK] = PlayerPartnerHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = PlayerPartnerHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = PlayerPartnerHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty, [CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
@ -112,21 +103,21 @@ static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
[CONTROLLER_CLEARUNKVAR] = PlayerPartnerHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = PlayerPartnerHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = PlayerPartnerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = PlayerPartnerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = PlayerPartnerHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = PlayerPartnerHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = PlayerPartnerHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = PlayerPartnerHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerPartnerHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = PlayerPartnerHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerPartnerHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = PlayerPartnerHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty, [CONTROLLER_ENDBOUNCE] = BtlController_Empty,
[CONTROLLER_SPRITEINVISIBILITY] = PlayerPartnerHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = PlayerPartnerHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = PlayerPartnerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
@ -440,25 +431,6 @@ static void CompleteOnInactiveTextPrinter2(void)
PlayerPartnerBufferExecCompleted(); PlayerPartnerBufferExecCompleted();
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
PlayerPartnerBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void SwitchIn_ShowSubstitute(void) static void SwitchIn_ShowSubstitute(void)
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -539,12 +511,6 @@ static void CompleteOnFinishedStatusAnimation(void)
PlayerPartnerBufferExecCompleted(); PlayerPartnerBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleLoadMonSprite(void) static void PlayerPartnerHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad); BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
@ -555,11 +521,6 @@ static void PlayerPartnerHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim); BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim);
} }
static void PlayerPartnerHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
// some explanation here // some explanation here
@ -632,11 +593,6 @@ static void PlayerPartnerHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void PlayerPartnerHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void PlayerPartnerHandleMoveAnimation(void) static void PlayerPartnerHandleMoveAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) if (!IsBattleSEPlaying(gActiveBattler))
@ -861,52 +817,6 @@ static void PlayerPartnerHandleStatusAnimation(void)
} }
} }
static void PlayerPartnerHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
PlayerPartnerBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void PlayerPartnerHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleIntroTrainerBallThrow(void) static void PlayerPartnerHandleIntroTrainerBallThrow(void)
{ {
u8 paletteNum; u8 paletteNum;
@ -1020,28 +930,9 @@ static void PlayerPartnerHandleHidePartyStatusSummary(void)
PlayerPartnerBufferExecCompleted(); PlayerPartnerBufferExecCompleted();
} }
static void PlayerPartnerHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
PlayerPartnerBufferExecCompleted();
}
static void PlayerPartnerHandleBattleAnimation(void) static void PlayerPartnerHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, FALSE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
PlayerPartnerBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
}
} }
static void PlayerPartnerHandleEndLinkBattle(void) static void PlayerPartnerHandleEndLinkBattle(void)

View File

@ -34,10 +34,8 @@
static void RecordedOpponentHandleLoadMonSprite(void); static void RecordedOpponentHandleLoadMonSprite(void);
static void RecordedOpponentHandleSwitchInAnim(void); static void RecordedOpponentHandleSwitchInAnim(void);
static void RecordedOpponentHandleReturnMonToBall(void);
static void RecordedOpponentHandleDrawTrainerPic(void); static void RecordedOpponentHandleDrawTrainerPic(void);
static void RecordedOpponentHandleTrainerSlideBack(void); static void RecordedOpponentHandleTrainerSlideBack(void);
static void RecordedOpponentHandleFaintAnimation(void);
static void RecordedOpponentHandleMoveAnimation(void); static void RecordedOpponentHandleMoveAnimation(void);
static void RecordedOpponentHandlePrintString(void); static void RecordedOpponentHandlePrintString(void);
static void RecordedOpponentHandleChooseAction(void); static void RecordedOpponentHandleChooseAction(void);
@ -47,16 +45,9 @@ static void RecordedOpponentHandleChoosePokemon(void);
static void RecordedOpponentHandleHealthBarUpdate(void); static void RecordedOpponentHandleHealthBarUpdate(void);
static void RecordedOpponentHandleStatusIconUpdate(void); static void RecordedOpponentHandleStatusIconUpdate(void);
static void RecordedOpponentHandleStatusAnimation(void); static void RecordedOpponentHandleStatusAnimation(void);
static void RecordedOpponentHandleClearUnkVar(void);
static void RecordedOpponentHandleSetUnkVar(void);
static void RecordedOpponentHandleClearUnkFlag(void);
static void RecordedOpponentHandleToggleUnkFlag(void);
static void RecordedOpponentHandleHitAnimation(void);
static void RecordedOpponentHandleIntroSlide(void);
static void RecordedOpponentHandleIntroTrainerBallThrow(void); static void RecordedOpponentHandleIntroTrainerBallThrow(void);
static void RecordedOpponentHandleDrawPartyStatusSummary(void); static void RecordedOpponentHandleDrawPartyStatusSummary(void);
static void RecordedOpponentHandleHidePartyStatusSummary(void); static void RecordedOpponentHandleHidePartyStatusSummary(void);
static void RecordedOpponentHandleSpriteInvisibility(void);
static void RecordedOpponentHandleBattleAnimation(void); static void RecordedOpponentHandleBattleAnimation(void);
static void RecordedOpponentHandleEndLinkBattle(void); static void RecordedOpponentHandleEndLinkBattle(void);
@ -78,11 +69,11 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = RecordedOpponentHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = RecordedOpponentHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = RecordedOpponentHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = RecordedOpponentHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = RecordedOpponentHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = RecordedOpponentHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = RecordedOpponentHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDE] = BtlController_Empty,
[CONTROLLER_TRAINERSLIDEBACK] = RecordedOpponentHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = RecordedOpponentHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = RecordedOpponentHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty, [CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
@ -109,21 +100,21 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
[CONTROLLER_CLEARUNKVAR] = RecordedOpponentHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = RecordedOpponentHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = RecordedOpponentHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = RecordedOpponentHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = RecordedOpponentHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = RecordedOpponentHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = RecordedOpponentHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedOpponentHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedOpponentHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedOpponentHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedOpponentHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedOpponentHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty, [CONTROLLER_ENDBOUNCE] = BtlController_Empty,
[CONTROLLER_SPRITEINVISIBILITY] = RecordedOpponentHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = RecordedOpponentHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
@ -357,25 +348,6 @@ static void CompleteOnInactiveTextPrinter(void)
RecordedOpponentBufferExecCompleted(); RecordedOpponentBufferExecCompleted();
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
RecordedOpponentBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void SwitchIn_ShowSubstitute(void) static void SwitchIn_ShowSubstitute(void)
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -443,12 +415,6 @@ static void CompleteOnFinishedStatusAnimation(void)
RecordedOpponentBufferExecCompleted(); RecordedOpponentBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentBufferExecCompleted(void) static void RecordedOpponentBufferExecCompleted(void)
{ {
gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand; gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentBufferRunCommand;
@ -475,11 +441,6 @@ static void RecordedOpponentHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, FALSE, SwitchIn_TryShinyAnim); BtlController_HandleSwitchInAnim(gActiveBattler, FALSE, SwitchIn_TryShinyAnim);
} }
static void RecordedOpponentHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
static void RecordedOpponentHandleDrawTrainerPic(void) static void RecordedOpponentHandleDrawTrainerPic(void)
@ -548,11 +509,6 @@ static void RecordedOpponentHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void RecordedOpponentHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void RecordedOpponentHandleMoveAnimation(void) static void RecordedOpponentHandleMoveAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) if (!IsBattleSEPlaying(gActiveBattler))
@ -736,52 +692,6 @@ static void RecordedOpponentHandleStatusAnimation(void)
} }
} }
static void RecordedOpponentHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
RecordedOpponentBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void RecordedOpponentHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleIntroTrainerBallThrow(void) static void RecordedOpponentHandleIntroTrainerBallThrow(void)
{ {
u8 taskId; u8 taskId;
@ -885,28 +795,9 @@ static void RecordedOpponentHandleHidePartyStatusSummary(void)
RecordedOpponentBufferExecCompleted(); RecordedOpponentBufferExecCompleted();
} }
static void RecordedOpponentHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
RecordedOpponentBufferExecCompleted();
}
static void RecordedOpponentHandleBattleAnimation(void) static void RecordedOpponentHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, FALSE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
RecordedOpponentBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
}
} }
static void RecordedOpponentHandleEndLinkBattle(void) static void RecordedOpponentHandleEndLinkBattle(void)

View File

@ -30,10 +30,8 @@
static void RecordedPlayerHandleLoadMonSprite(void); static void RecordedPlayerHandleLoadMonSprite(void);
static void RecordedPlayerHandleSwitchInAnim(void); static void RecordedPlayerHandleSwitchInAnim(void);
static void RecordedPlayerHandleReturnMonToBall(void);
static void RecordedPlayerHandleDrawTrainerPic(void); static void RecordedPlayerHandleDrawTrainerPic(void);
static void RecordedPlayerHandleTrainerSlideBack(void); static void RecordedPlayerHandleTrainerSlideBack(void);
static void RecordedPlayerHandleFaintAnimation(void);
static void RecordedPlayerHandleMoveAnimation(void); static void RecordedPlayerHandleMoveAnimation(void);
static void RecordedPlayerHandlePrintString(void); static void RecordedPlayerHandlePrintString(void);
static void RecordedPlayerHandleChooseAction(void); static void RecordedPlayerHandleChooseAction(void);
@ -43,16 +41,9 @@ static void RecordedPlayerHandleChoosePokemon(void);
static void RecordedPlayerHandleHealthBarUpdate(void); static void RecordedPlayerHandleHealthBarUpdate(void);
static void RecordedPlayerHandleStatusIconUpdate(void); static void RecordedPlayerHandleStatusIconUpdate(void);
static void RecordedPlayerHandleStatusAnimation(void); static void RecordedPlayerHandleStatusAnimation(void);
static void RecordedPlayerHandleClearUnkVar(void);
static void RecordedPlayerHandleSetUnkVar(void);
static void RecordedPlayerHandleClearUnkFlag(void);
static void RecordedPlayerHandleToggleUnkFlag(void);
static void RecordedPlayerHandleHitAnimation(void);
static void RecordedPlayerHandleIntroSlide(void);
static void RecordedPlayerHandleIntroTrainerBallThrow(void); static void RecordedPlayerHandleIntroTrainerBallThrow(void);
static void RecordedPlayerHandleDrawPartyStatusSummary(void); static void RecordedPlayerHandleDrawPartyStatusSummary(void);
static void RecordedPlayerHandleHidePartyStatusSummary(void); static void RecordedPlayerHandleHidePartyStatusSummary(void);
static void RecordedPlayerHandleSpriteInvisibility(void);
static void RecordedPlayerHandleBattleAnimation(void); static void RecordedPlayerHandleBattleAnimation(void);
static void RecordedPlayerHandleEndLinkBattle(void); static void RecordedPlayerHandleEndLinkBattle(void);
@ -73,11 +64,11 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
[CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData, [CONTROLLER_SETRAWMONDATA] = BtlController_HandleSetRawMonData,
[CONTROLLER_LOADMONSPRITE] = RecordedPlayerHandleLoadMonSprite, [CONTROLLER_LOADMONSPRITE] = RecordedPlayerHandleLoadMonSprite,
[CONTROLLER_SWITCHINANIM] = RecordedPlayerHandleSwitchInAnim, [CONTROLLER_SWITCHINANIM] = RecordedPlayerHandleSwitchInAnim,
[CONTROLLER_RETURNMONTOBALL] = RecordedPlayerHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = RecordedPlayerHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = RecordedPlayerHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = BtlController_Empty, [CONTROLLER_TRAINERSLIDE] = BtlController_Empty,
[CONTROLLER_TRAINERSLIDEBACK] = RecordedPlayerHandleTrainerSlideBack, [CONTROLLER_TRAINERSLIDEBACK] = RecordedPlayerHandleTrainerSlideBack,
[CONTROLLER_FAINTANIMATION] = RecordedPlayerHandleFaintAnimation, [CONTROLLER_FAINTANIMATION] = BtlController_HandleFaintAnimation,
[CONTROLLER_PALETTEFADE] = BtlController_Empty, [CONTROLLER_PALETTEFADE] = BtlController_Empty,
[CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty, [CONTROLLER_SUCCESSBALLTHROWANIM] = BtlController_Empty,
[CONTROLLER_BALLTHROWANIM] = BtlController_Empty, [CONTROLLER_BALLTHROWANIM] = BtlController_Empty,
@ -104,21 +95,21 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void)
[CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty, [CONTROLLER_CHOSENMONRETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE] = BtlController_Empty,
[CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty, [CONTROLLER_ONERETURNVALUE_DUPLICATE] = BtlController_Empty,
[CONTROLLER_CLEARUNKVAR] = RecordedPlayerHandleClearUnkVar, [CONTROLLER_CLEARUNKVAR] = BtlController_HandleClearUnkVar,
[CONTROLLER_SETUNKVAR] = RecordedPlayerHandleSetUnkVar, [CONTROLLER_SETUNKVAR] = BtlController_HandleSetUnkVar,
[CONTROLLER_CLEARUNKFLAG] = RecordedPlayerHandleClearUnkFlag, [CONTROLLER_CLEARUNKFLAG] = BtlController_HandleClearUnkFlag,
[CONTROLLER_TOGGLEUNKFLAG] = RecordedPlayerHandleToggleUnkFlag, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_HandleToggleUnkFlag,
[CONTROLLER_HITANIMATION] = RecordedPlayerHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry, [CONTROLLER_FAINTINGCRY] = BtlController_HandleFaintingCry,
[CONTROLLER_INTROSLIDE] = RecordedPlayerHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = RecordedPlayerHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = RecordedPlayerHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedPlayerHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = RecordedPlayerHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedPlayerHandleHidePartyStatusSummary, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = RecordedPlayerHandleHidePartyStatusSummary,
[CONTROLLER_ENDBOUNCE] = BtlController_Empty, [CONTROLLER_ENDBOUNCE] = BtlController_Empty,
[CONTROLLER_SPRITEINVISIBILITY] = RecordedPlayerHandleSpriteInvisibility, [CONTROLLER_SPRITEINVISIBILITY] = BtlController_HandleSpriteInvisibility,
[CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation, [CONTROLLER_BATTLEANIMATION] = RecordedPlayerHandleBattleAnimation,
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, [CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, [CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
@ -339,25 +330,6 @@ static void CompleteOnInactiveTextPrinter(void)
RecordedPlayerBufferExecCompleted(); RecordedPlayerBufferExecCompleted();
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
RecordedPlayerBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void SwitchIn_ShowSubstitute(void) static void SwitchIn_ShowSubstitute(void)
{ {
if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gHealthboxSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -438,12 +410,6 @@ static void CompleteOnFinishedStatusAnimation(void)
RecordedPlayerBufferExecCompleted(); RecordedPlayerBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleLoadMonSprite(void) static void RecordedPlayerHandleLoadMonSprite(void)
{ {
BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad); BtlController_HandleLoadMonSprite(gActiveBattler, gPlayerParty, WaitForMonAnimAfterLoad);
@ -454,11 +420,6 @@ static void RecordedPlayerHandleSwitchInAnim(void)
BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim); BtlController_HandleSwitchInAnim(gActiveBattler, TRUE, SwitchIn_TryShinyAnim);
} }
static void RecordedPlayerHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
static void RecordedPlayerHandleDrawTrainerPic(void) static void RecordedPlayerHandleDrawTrainerPic(void)
@ -545,11 +506,6 @@ static void RecordedPlayerHandleTrainerSlideBack(void)
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide; gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
} }
static void RecordedPlayerHandleFaintAnimation(void)
{
BtlController_HandleFaintAnimation(gActiveBattler);
}
static void RecordedPlayerHandleMoveAnimation(void) static void RecordedPlayerHandleMoveAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) if (!IsBattleSEPlaying(gActiveBattler))
@ -750,52 +706,6 @@ static void RecordedPlayerHandleStatusAnimation(void)
} }
} }
static void RecordedPlayerHandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
RecordedPlayerBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
static void RecordedPlayerHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleIntroTrainerBallThrow(void) static void RecordedPlayerHandleIntroTrainerBallThrow(void)
{ {
u8 paletteNum; u8 paletteNum;
@ -900,28 +810,9 @@ static void RecordedPlayerHandleHidePartyStatusSummary(void)
RecordedPlayerBufferExecCompleted(); RecordedPlayerBufferExecCompleted();
} }
static void RecordedPlayerHandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
RecordedPlayerBufferExecCompleted();
}
static void RecordedPlayerHandleBattleAnimation(void) static void RecordedPlayerHandleBattleAnimation(void)
{ {
if (!IsBattleSEPlaying(gActiveBattler)) BtlController_HandleBattleAnimation(gActiveBattler, FALSE, FALSE);
{
u8 animationId = gBattleResources->bufferA[gActiveBattler][1];
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
RecordedPlayerBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
}
} }
static void RecordedPlayerHandleEndLinkBattle(void) static void RecordedPlayerHandleEndLinkBattle(void)

View File

@ -33,7 +33,6 @@ static void SafariHandleChooseAction(void);
static void SafariHandleChooseItem(void); static void SafariHandleChooseItem(void);
static void SafariHandleStatusIconUpdate(void); static void SafariHandleStatusIconUpdate(void);
static void SafariHandleFaintingCry(void); static void SafariHandleFaintingCry(void);
static void SafariHandleIntroSlide(void);
static void SafariHandleIntroTrainerBallThrow(void); static void SafariHandleIntroTrainerBallThrow(void);
static void SafariHandleBattleAnimation(void); static void SafariHandleBattleAnimation(void);
static void SafariHandleEndLinkBattle(void); static void SafariHandleEndLinkBattle(void);
@ -91,7 +90,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_PLAYSE] = BtlController_HandlePlaySE, [CONTROLLER_PLAYSE] = BtlController_HandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = SafariHandleFaintingCry,
[CONTROLLER_INTROSLIDE] = SafariHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = SafariHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = SafariHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = BtlController_Empty, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = BtlController_Empty,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_Empty, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_Empty,
@ -234,12 +233,6 @@ static void CompleteWhenChosePokeblock(void)
} }
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
SafariBufferExecCompleted();
}
static void SafariBufferExecCompleted(void) static void SafariBufferExecCompleted(void)
{ {
gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand; gBattlerControllerFuncs[gActiveBattler] = SafariBufferRunCommand;
@ -360,13 +353,6 @@ static void SafariHandleFaintingCry(void)
SafariBufferExecCompleted(); SafariBufferExecCompleted();
} }
static void SafariHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
SafariBufferExecCompleted();
}
static void SafariHandleIntroTrainerBallThrow(void) static void SafariHandleIntroTrainerBallThrow(void)
{ {
UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT); UpdateHealthboxAttribute(gHealthboxSpriteIds[gActiveBattler], &gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], HEALTHBOX_SAFARI_ALL_TEXT);
@ -377,13 +363,7 @@ static void SafariHandleIntroTrainerBallThrow(void)
static void SafariHandleBattleAnimation(void) static void SafariHandleBattleAnimation(void)
{ {
u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; BtlController_HandleBattleAnimation(gActiveBattler, TRUE, FALSE);
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
SafariBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
} }
static void SafariHandleEndLinkBattle(void) static void SafariHandleEndLinkBattle(void)

View File

@ -32,7 +32,6 @@
#include "constants/trainers.h" #include "constants/trainers.h"
#include "constants/rgb.h" #include "constants/rgb.h"
static void WallyHandleReturnMonToBall(void);
static void WallyHandleDrawTrainerPic(void); static void WallyHandleDrawTrainerPic(void);
static void WallyHandleTrainerSlide(void); static void WallyHandleTrainerSlide(void);
static void WallyHandleSuccessBallThrowAnim(void); static void WallyHandleSuccessBallThrowAnim(void);
@ -44,10 +43,8 @@ static void WallyHandleChooseAction(void);
static void WallyHandleChooseMove(void); static void WallyHandleChooseMove(void);
static void WallyHandleChooseItem(void); static void WallyHandleChooseItem(void);
static void WallyHandleHealthBarUpdate(void); static void WallyHandleHealthBarUpdate(void);
static void WallyHandleHitAnimation(void);
static void WallyHandlePlaySE(void); static void WallyHandlePlaySE(void);
static void WallyHandleFaintingCry(void); static void WallyHandleFaintingCry(void);
static void WallyHandleIntroSlide(void);
static void WallyHandleIntroTrainerBallThrow(void); static void WallyHandleIntroTrainerBallThrow(void);
static void WallyHandleDrawPartyStatusSummary(void); static void WallyHandleDrawPartyStatusSummary(void);
static void WallyHandleBattleAnimation(void); static void WallyHandleBattleAnimation(void);
@ -70,7 +67,7 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETRAWMONDATA] = BtlController_Empty, [CONTROLLER_SETRAWMONDATA] = BtlController_Empty,
[CONTROLLER_LOADMONSPRITE] = BtlController_Empty, [CONTROLLER_LOADMONSPRITE] = BtlController_Empty,
[CONTROLLER_SWITCHINANIM] = BtlController_Empty, [CONTROLLER_SWITCHINANIM] = BtlController_Empty,
[CONTROLLER_RETURNMONTOBALL] = WallyHandleReturnMonToBall, [CONTROLLER_RETURNMONTOBALL] = BtlController_HandleReturnMonToBall,
[CONTROLLER_DRAWTRAINERPIC] = WallyHandleDrawTrainerPic, [CONTROLLER_DRAWTRAINERPIC] = WallyHandleDrawTrainerPic,
[CONTROLLER_TRAINERSLIDE] = WallyHandleTrainerSlide, [CONTROLLER_TRAINERSLIDE] = WallyHandleTrainerSlide,
[CONTROLLER_TRAINERSLIDEBACK] = BtlController_Empty, [CONTROLLER_TRAINERSLIDEBACK] = BtlController_Empty,
@ -105,12 +102,12 @@ static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
[CONTROLLER_SETUNKVAR] = BtlController_Empty, [CONTROLLER_SETUNKVAR] = BtlController_Empty,
[CONTROLLER_CLEARUNKFLAG] = BtlController_Empty, [CONTROLLER_CLEARUNKFLAG] = BtlController_Empty,
[CONTROLLER_TOGGLEUNKFLAG] = BtlController_Empty, [CONTROLLER_TOGGLEUNKFLAG] = BtlController_Empty,
[CONTROLLER_HITANIMATION] = WallyHandleHitAnimation, [CONTROLLER_HITANIMATION] = BtlController_HandleHitAnimation,
[CONTROLLER_CANTSWITCH] = BtlController_Empty, [CONTROLLER_CANTSWITCH] = BtlController_Empty,
[CONTROLLER_PLAYSE] = WallyHandlePlaySE, [CONTROLLER_PLAYSE] = WallyHandlePlaySE,
[CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM, [CONTROLLER_PLAYFANFAREORBGM] = BtlController_HandlePlayFanfareOrBGM,
[CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry, [CONTROLLER_FAINTINGCRY] = WallyHandleFaintingCry,
[CONTROLLER_INTROSLIDE] = WallyHandleIntroSlide, [CONTROLLER_INTROSLIDE] = BtlController_HandleIntroSlide,
[CONTROLLER_INTROTRAINERBALLTHROW] = WallyHandleIntroTrainerBallThrow, [CONTROLLER_INTROTRAINERBALLTHROW] = WallyHandleIntroTrainerBallThrow,
[CONTROLLER_DRAWPARTYSTATUSSUMMARY] = WallyHandleDrawPartyStatusSummary, [CONTROLLER_DRAWPARTYSTATUSSUMMARY] = WallyHandleDrawPartyStatusSummary,
[CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_Empty, [CONTROLLER_HIDEPARTYSTATUSSUMMARY] = BtlController_Empty,
@ -317,37 +314,12 @@ static void CompleteOnHealthbarDone(void)
} }
} }
static void DoHitAnimBlinkSpriteEffect(void)
{
u8 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
WallyBufferExecCompleted();
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
static void CompleteOnBankSpriteCallbackDummy2(void) static void CompleteOnBankSpriteCallbackDummy2(void)
{ {
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy) if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
WallyBufferExecCompleted(); WallyBufferExecCompleted();
} }
static void CompleteOnFinishedBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
WallyBufferExecCompleted();
}
static void WallyBufferExecCompleted(void) static void WallyBufferExecCompleted(void)
{ {
gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand; gBattlerControllerFuncs[gActiveBattler] = WallyBufferRunCommand;
@ -364,11 +336,6 @@ static void WallyBufferExecCompleted(void)
} }
} }
static void WallyHandleReturnMonToBall(void)
{
BtlController_HandleReturnMonToBall(gActiveBattler);
}
#define sSpeedX data[0] #define sSpeedX data[0]
static void WallyHandleDrawTrainerPic(void) static void WallyHandleDrawTrainerPic(void)
@ -579,21 +546,6 @@ static void WallyHandleHealthBarUpdate(void)
gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone; gBattlerControllerFuncs[gActiveBattler] = CompleteOnHealthbarDone;
} }
static void WallyHandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
WallyBufferExecCompleted();
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = DoHitAnimBlinkSpriteEffect;
}
}
// For some reason Wally's SE don't take side into account and pan is always the same. Possibly a bug // For some reason Wally's SE don't take side into account and pan is always the same. Possibly a bug
static void WallyHandlePlaySE(void) static void WallyHandlePlaySE(void)
{ {
@ -611,13 +563,6 @@ static void WallyHandleFaintingCry(void)
WallyBufferExecCompleted(); WallyBufferExecCompleted();
} }
static void WallyHandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
WallyBufferExecCompleted();
}
static void WallyHandleIntroTrainerBallThrow(void) static void WallyHandleIntroTrainerBallThrow(void)
{ {
u8 paletteNum; u8 paletteNum;
@ -683,13 +628,7 @@ static void WallyHandleDrawPartyStatusSummary(void)
static void WallyHandleBattleAnimation(void) static void WallyHandleBattleAnimation(void)
{ {
u8 animationId = gBattleResources->bufferA[gActiveBattler][1]; BtlController_HandleBattleAnimation(gActiveBattler, TRUE, FALSE);
u16 argument = gBattleResources->bufferA[gActiveBattler][2] | (gBattleResources->bufferA[gActiveBattler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(gActiveBattler, gActiveBattler, gActiveBattler, animationId, argument))
WallyBufferExecCompleted();
else
gBattlerControllerFuncs[gActiveBattler] = CompleteOnFinishedBattleAnimation;
} }
static void WallyHandleEndLinkBattle(void) static void WallyHandleEndLinkBattle(void)

View File

@ -7,6 +7,7 @@
#include "battle_interface.h" #include "battle_interface.h"
#include "battle_message.h" #include "battle_message.h"
#include "battle_setup.h" #include "battle_setup.h"
#include "battle_tv.h"
#include "cable_club.h" #include "cable_club.h"
#include "link.h" #include "link.h"
#include "link_rfu.h" #include "link_rfu.h"
@ -2184,6 +2185,31 @@ static void Controller_WaitForBallThrow(void)
BattleControllerComplete(gActiveBattler); BattleControllerComplete(gActiveBattler);
} }
static void Controller_WaitForBattleAnimation(void)
{
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animFromTableActive)
BattleControllerComplete(gActiveBattler);
}
static void Controller_HitAnimation(void)
{
u32 spriteId = gBattlerSpriteIds[gActiveBattler];
if (gSprites[spriteId].data[1] == 32)
{
gSprites[spriteId].data[1] = 0;
gSprites[spriteId].invisible = FALSE;
gDoingBattleAnim = FALSE;
BattleControllerComplete(gActiveBattler);
}
else
{
if ((gSprites[spriteId].data[1] % 4) == 0)
gSprites[spriteId].invisible ^= 1;
gSprites[spriteId].data[1]++;
}
}
// Used for all the commands which do nothing. // Used for all the commands which do nothing.
void BtlController_Empty(void) void BtlController_Empty(void)
{ {
@ -2310,25 +2336,26 @@ void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*c
gBattlerControllerFuncs[battler] = controllerCallback; gBattlerControllerFuncs[battler] = controllerCallback;
} }
void BtlController_HandleReturnMonToBall(u32 battler) void BtlController_HandleReturnMonToBall(void)
{ {
if (gBattleResources->bufferA[battler][1] == 0) if (gBattleResources->bufferA[gActiveBattler][1] == 0)
{ {
gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0; gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[battler] = Controller_ReturnMonToBall; gBattlerControllerFuncs[gActiveBattler] = Controller_ReturnMonToBall;
} }
else else
{ {
FreeMonSprite(battler); FreeMonSprite(gActiveBattler);
BattleControllerComplete(battler); BattleControllerComplete(gActiveBattler);
} }
} }
#define sSpeedX data[1] #define sSpeedX data[1]
#define sSpeedY data[2] #define sSpeedY data[2]
void BtlController_HandleFaintAnimation(u32 battler) void BtlController_HandleFaintAnimation(void)
{ {
u32 battler = gActiveBattler;
if (gBattleSpritesDataPtr->healthBoxesData[battler].animationState == 0) if (gBattleSpritesDataPtr->healthBoxesData[battler].animationState == 0)
{ {
if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute) if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute)
@ -2386,6 +2413,45 @@ void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool
HandleBallThrow(battler, target, animId, allowCriticalCapture); HandleBallThrow(battler, target, animId, allowCriticalCapture);
} }
void BtlController_HandleClearUnkVar(void)
{
gUnusedControllerStruct.unk = 0;
BattleControllerComplete(gActiveBattler);
}
void BtlController_HandleSetUnkVar(void)
{
gUnusedControllerStruct.unk = gBattleResources->bufferA[gActiveBattler][1];
BattleControllerComplete(gActiveBattler);
}
void BtlController_HandleClearUnkFlag(void)
{
gUnusedControllerStruct.flag = 0;
BattleControllerComplete(gActiveBattler);
}
void BtlController_HandleToggleUnkFlag(void)
{
gUnusedControllerStruct.flag ^= 1;
BattleControllerComplete(gActiveBattler);
}
void BtlController_HandleHitAnimation(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].invisible == TRUE)
{
BattleControllerComplete(gActiveBattler);
}
else
{
gDoingBattleAnim = TRUE;
gSprites[gBattlerSpriteIds[gActiveBattler]].data[1] = 0;
DoHitAnimHealthboxEffect(gActiveBattler);
gBattlerControllerFuncs[gActiveBattler] = Controller_HitAnimation;
}
}
void BtlController_HandlePlaySE(void) void BtlController_HandlePlaySE(void)
{ {
s8 pan = (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) ? SOUND_PAN_ATTACKER : SOUND_PAN_TARGET; s8 pan = (GetBattlerSide(gActiveBattler) == B_SIDE_PLAYER) ? SOUND_PAN_ATTACKER : SOUND_PAN_TARGET;
@ -2428,3 +2494,37 @@ void BtlController_HandleFaintingCry(void)
PlayCry_ByMode(GetMonData(&party[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES), pan, CRY_MODE_FAINT); PlayCry_ByMode(GetMonData(&party[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES), pan, CRY_MODE_FAINT);
BattleControllerComplete(gActiveBattler); BattleControllerComplete(gActiveBattler);
} }
void BtlController_HandleIntroSlide(void)
{
HandleIntroSlide(gBattleResources->bufferA[gActiveBattler][1]);
gIntroSlideFlags |= 1;
BattleControllerComplete(gActiveBattler);
}
void BtlController_HandleSpriteInvisibility(void)
{
if (IsBattlerSpritePresent(gActiveBattler))
{
gSprites[gBattlerSpriteIds[gActiveBattler]].invisible = gBattleResources->bufferA[gActiveBattler][1];
CopyBattleSpriteInvisibility(gActiveBattler);
}
BattleControllerComplete(gActiveBattler);
}
void BtlController_HandleBattleAnimation(u32 battler, bool32 ignoreSE, bool32 updateTvData)
{
if (ignoreSE || !IsBattleSEPlaying(battler))
{
u8 animationId = gBattleResources->bufferA[battler][1];
u16 argument = gBattleResources->bufferA[battler][2] | (gBattleResources->bufferA[battler][3] << 8);
if (TryHandleLaunchBattleTableAnimation(battler, battler, battler, animationId, argument))
BattleControllerComplete(battler);
else
gBattlerControllerFuncs[battler] = Controller_WaitForBattleAnimation;
if (updateTvData)
BattleTv_SetDataBasedOnAnimation(animationId);
}
}