handle move anim

This commit is contained in:
DizzyEggg 2023-08-07 09:26:03 +02:00
parent e8d6c99e6d
commit 546b0c7e97
10 changed files with 81 additions and 536 deletions

View File

@ -272,6 +272,7 @@ void BtlController_HandleTrainerSlideBack(u32 battlerId, s16 data0, bool32 start
void BtlController_HandleFaintAnimation(void);
void BtlController_HandleSuccessBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture);
void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool32 allowCriticalCapture);
void BtlController_HandleMoveAnimation(u32 battler, bool32 updateTvData);
void BtlController_HandlePrintString(u32 battler, bool32 updateTvData, bool32 arenaPtsDeduct);
void DoStatusIconUpdate(u32 battler);
void BtlController_HandleStatusIconUpdate(void);

View File

@ -46,9 +46,6 @@ static void LinkOpponentHandleEndLinkBattle(void);
static void LinkOpponentBufferRunCommand(void);
static void LinkOpponentBufferExecCompleted(void);
static void SwitchIn_HandleSoundAndEnd(void);
static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst);
static void SetLinkOpponentMonData(u8 monId);
static void LinkOpponentDoMoveAnimation(void);
static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -501,71 +498,7 @@ static void LinkOpponentHandleTrainerSlideBack(void)
static void LinkOpponentHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = LinkOpponentDoMoveAnimation;
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
static void LinkOpponentDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
LinkOpponentBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, TRUE);
}
static void LinkOpponentHandlePrintString(void)

View File

@ -45,10 +45,6 @@ static void LinkPartnerHandleEndLinkBattle(void);
static void LinkPartnerBufferRunCommand(void);
static void LinkPartnerBufferExecCompleted(void);
static void SwitchIn_WaitAndEnd(void);
static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst);
static void SetLinkPartnerMonData(u8 monId);
static void LinkPartnerDoMoveAnimation(void);
static void Task_StartSendOutAnim(u8 taskId);
static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -266,71 +262,7 @@ static void LinkPartnerHandleTrainerSlideBack(void)
static void LinkPartnerHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = LinkPartnerDoMoveAnimation;
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
static void LinkPartnerDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
LinkPartnerBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, TRUE);
}
static void LinkPartnerHandlePrintString(void)

View File

@ -60,11 +60,6 @@ static u8 CountAIAliveNonEggMonsExcept(u8 slotToIgnore);
static void OpponentBufferRunCommand(void);
static void OpponentBufferExecCompleted(void);
static void SwitchIn_HandleSoundAndEnd(void);
static u32 GetOpponentMonData(u8 monId, u8 *dst);
static void SetOpponentMonData(u8 monId);
static void OpponentDoMoveAnimation(void);
static void SpriteCB_FreeOpponentSprite(struct Sprite *sprite);
static void Task_StartSendOutAnim(u8 taskId);
static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -516,70 +511,7 @@ static void OpponentHandleTrainerSlideBack(void)
static void OpponentHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = OpponentDoMoveAnimation;
}
}
static void OpponentDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
OpponentBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, FALSE);
}
static void OpponentHandlePrintString(void)

View File

@ -1712,6 +1712,7 @@ static void PlayerHandleDrawTrainerPic(void)
s16 xPos, yPos;
u32 trainerPicId, gender;
trainerPicId = PlayerGetTrainerBackPicId();
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
{
if ((GetBattlerPosition(gActiveBattler) & BIT_FLANK) != B_FLANK_LEFT) // Second mon, on the right.
@ -1744,7 +1745,6 @@ static void PlayerHandleDrawTrainerPic(void)
}
else // Use back pic in all the other usual circumstances.
{
trainerPicId = PlayerGetTrainerBackPicId();
isFrontPic = FALSE;
}
@ -1790,71 +1790,7 @@ static void PlayerHandlePause(void)
static void PlayerHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = PlayerDoMoveAnimation;
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
static void PlayerDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlayerBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, TRUE);
}
static void PlayerHandlePrintString(void)

View File

@ -54,10 +54,6 @@ static void Task_PrepareToGiveExpWithExpBar(u8 taskId);
static void Task_GiveExpWithExpBar(u8 taskId);
static void Task_UpdateLvlInHealthbox(u8 taskId);
static void SwitchIn_WaitAndEnd(void);
static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst);
static void SetPlayerPartnerMonData(u8 monId);
static void PlayerPartnerDoMoveAnimation(void);
static void Task_StartSendOutAnim(u8 taskId);
static void (*const sPlayerPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -356,70 +352,7 @@ static void PlayerPartnerHandleTrainerSlideBack(void)
static void PlayerPartnerHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = PlayerPartnerDoMoveAnimation;
}
}
static void PlayerPartnerDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
PlayerPartnerBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, FALSE);
}
static void PlayerPartnerHandlePrintString(void)

View File

@ -53,10 +53,6 @@ static void RecordedOpponentHandleEndLinkBattle(void);
static void RecordedOpponentBufferRunCommand(void);
static void RecordedOpponentBufferExecCompleted(void);
static void SwitchIn_HandleSoundAndEnd(void);
static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst);
static void SetRecordedOpponentMonData(u8 monId);
static void RecordedOpponentDoMoveAnimation(void);
static void EndDrawPartyStatusSummary(void);
static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -454,70 +450,7 @@ static void RecordedOpponentHandleTrainerSlideBack(void)
static void RecordedOpponentHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = RecordedOpponentDoMoveAnimation;
}
}
static void RecordedOpponentDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
RecordedOpponentBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, FALSE);
}
static void RecordedOpponentHandlePrintString(void)

View File

@ -50,10 +50,6 @@ static void RecordedPlayerHandleEndLinkBattle(void);
static void RecordedPlayerBufferRunCommand(void);
static void RecordedPlayerBufferExecCompleted(void);
static void SwitchIn_WaitAndEnd(void);
static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst);
static void SetRecordedPlayerMonData(u8 monId);
static void RecordedPlayerDoMoveAnimation(void);
static void Task_StartSendOutAnim(u8 taskId);
static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -443,70 +439,7 @@ static void RecordedPlayerHandleTrainerSlideBack(void)
static void RecordedPlayerHandleMoveAnimation(void)
{
if (!IsBattleSEPlaying(gActiveBattler))
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = RecordedPlayerDoMoveAnimation;
}
}
static void RecordedPlayerDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
RecordedPlayerBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, FALSE);
}
static void RecordedPlayerHandlePrintString(void)

View File

@ -54,9 +54,6 @@ static void WallyBufferRunCommand(void);
static void WallyBufferExecCompleted(void);
static void CompleteOnChosenItem(void);
static void Intro_WaitForShinyAnimAndHealthbox(void);
static u32 CopyWallyMonData(u8 monId, u8 *dst);
static void SetWallyMonData(u8 monId);
static void WallyDoMoveAnimation(void);
static void (*const sWallyBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
{
@ -346,63 +343,7 @@ static void WallyHandleBallThrowAnim(void)
static void WallyHandleMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[gActiveBattler][3];
gAnimMovePower = gBattleResources->bufferA[gActiveBattler][4] | (gBattleResources->bufferA[gActiveBattler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[gActiveBattler][6] | (gBattleResources->bufferA[gActiveBattler][7] << 8) | (gBattleResources->bufferA[gActiveBattler][8] << 16) | (gBattleResources->bufferA[gActiveBattler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[gActiveBattler][10];
gWeatherMoveAnim = gBattleResources->bufferA[gActiveBattler][12] | (gBattleResources->bufferA[gActiveBattler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[gActiveBattler][16];
gTransformedPersonalities[gActiveBattler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[gActiveBattler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
gBattlerControllerFuncs[gActiveBattler] = WallyDoMoveAnimation;
}
static void WallyDoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
WallyBufferExecCompleted();
}
break;
}
BtlController_HandleMoveAnimation(gActiveBattler, FALSE);
}
static void WallyHandlePrintString(void)

View File

@ -2185,6 +2185,56 @@ static void Controller_FaintOpponentMon(void)
}
}
static void Controller_DoMoveAnimation(void)
{
u16 move = gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8);
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
{
case 0:
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute
&& !gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8)
{
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 1;
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 1;
break;
case 1:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_OFF);
DoMoveAnim(move);
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 2;
}
break;
case 2:
gAnimScriptCallback();
if (!gAnimScriptActive)
{
u8 multihit = gBattleResources->bufferA[gActiveBattler][11];
SetBattlerSpriteAffineMode(ST_OAM_AFFINE_NORMAL);
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute && multihit < 2)
{
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_MON_TO_SUBSTITUTE);
gBattleSpritesDataPtr->battlerData[gActiveBattler].flag_x8 = 0;
}
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 3;
}
break;
case 3:
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
{
CopyAllBattleSpritesInvisibilities();
TrySetBehindSubstituteSpriteBit(gActiveBattler, gBattleResources->bufferA[gActiveBattler][1] | (gBattleResources->bufferA[gActiveBattler][2] << 8));
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
BattleControllerComplete(gActiveBattler);
}
break;
}
}
static void Controller_HandleTrainerSlideBack(void)
{
if (gSprites[gBattlerSpriteIds[gActiveBattler]].callback == SpriteCallbackDummy)
@ -2571,6 +2621,27 @@ void BtlController_HandleBallThrowAnim(u32 battler, u32 target, u32 animId, bool
HandleBallThrow(battler, target, animId, allowCriticalCapture);
}
void BtlController_HandleMoveAnimation(u32 battler, bool32 updateTvData)
{
if (!IsBattleSEPlaying(battler))
{
u16 move = gBattleResources->bufferA[battler][1] | (gBattleResources->bufferA[battler][2] << 8);
gAnimMoveTurn = gBattleResources->bufferA[battler][3];
gAnimMovePower = gBattleResources->bufferA[battler][4] | (gBattleResources->bufferA[battler][5] << 8);
gAnimMoveDmg = gBattleResources->bufferA[battler][6] | (gBattleResources->bufferA[battler][7] << 8) | (gBattleResources->bufferA[battler][8] << 16) | (gBattleResources->bufferA[battler][9] << 24);
gAnimFriendship = gBattleResources->bufferA[battler][10];
gWeatherMoveAnim = gBattleResources->bufferA[battler][12] | (gBattleResources->bufferA[battler][13] << 8);
gAnimDisableStructPtr = (struct DisableStruct *)&gBattleResources->bufferA[battler][16];
gTransformedPersonalities[battler] = gAnimDisableStructPtr->transformedMonPersonality;
gTransformedOtIds[battler] = gAnimDisableStructPtr->transformedMonOtId;
gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0;
gBattlerControllerFuncs[battler] = Controller_DoMoveAnimation;
if (updateTvData)
BattleTv_SetDataBasedOnMove(move, gWeatherMoveAnim, gAnimDisableStructPtr);
}
}
void BtlController_HandlePrintString(u32 battler, bool32 updateTvData, bool32 arenaPtsDeduct)
{
u16 *stringId;