mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
faint animation
This commit is contained in:
parent
7360a4a18a
commit
c72bb27325
@ -258,9 +258,10 @@ void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleGetRawMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleSetMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party);
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerFunc)(void));
|
||||
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerFunc)(void));
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerCallback)(void));
|
||||
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(void));
|
||||
void BtlController_HandleReturnMonToBall(u32 battler);
|
||||
void BtlController_HandleFaintAnimation(u32 battler);
|
||||
|
||||
// player controller
|
||||
void SetControllerToPlayer(void);
|
||||
|
@ -392,15 +392,6 @@ static void CompleteOnHealthbarDone(void)
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void HideHealthboxAfterMonFaint(void)
|
||||
{
|
||||
if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse)
|
||||
{
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
LinkOpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -680,22 +671,7 @@ static void LinkOpponentHandleTrainerSlideBack(void)
|
||||
|
||||
static void LinkOpponentHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
static void LinkOpponentHandlePaletteFade(void)
|
||||
|
@ -286,20 +286,6 @@ static void CompleteOnHealthbarDone(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterFaintAnim(void)
|
||||
{
|
||||
if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT)
|
||||
{
|
||||
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleGfxSfxDummy2(species);
|
||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
LinkPartnerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -510,35 +496,11 @@ static void LinkPartnerHandleTrainerSlideBack(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
|
||||
}
|
||||
|
||||
#define sSpeedX data[1]
|
||||
#define sSpeedY data[2]
|
||||
|
||||
static void LinkPartnerHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim;
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
#undef sSpeedX
|
||||
#undef sSpeedY
|
||||
|
||||
static void LinkPartnerHandlePaletteFade(void)
|
||||
{
|
||||
LinkPartnerBufferExecCompleted();
|
||||
|
@ -416,15 +416,6 @@ static void CompleteOnHealthbarDone(void)
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void HideHealthboxAfterMonFaint(void)
|
||||
{
|
||||
if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse)
|
||||
{
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
OpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -742,22 +733,7 @@ static void OpponentHandleTrainerSlideBack(void)
|
||||
|
||||
static void OpponentHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
static void OpponentHandlePaletteFade(void)
|
||||
|
@ -1529,20 +1529,6 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterFaintAnim(void)
|
||||
{
|
||||
if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT)
|
||||
{
|
||||
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleGfxSfxDummy2(species);
|
||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
PlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter2(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -1965,35 +1951,11 @@ static void PlayerHandleTrainerSlideBack(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
|
||||
}
|
||||
|
||||
#define sSpeedX data[1]
|
||||
#define sSpeedY data[2]
|
||||
|
||||
static void PlayerHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim;
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
#undef sSpeedX
|
||||
#undef sSpeedY
|
||||
|
||||
static void PlayerHandlePaletteFade(void)
|
||||
{
|
||||
BeginNormalPaletteFade(PALETTES_ALL, 2, 0, 16, RGB_BLACK);
|
||||
|
@ -465,20 +465,6 @@ static void DestroyExpTaskAndCompleteOnInactiveTextPrinter(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterFaintAnim(void)
|
||||
{
|
||||
if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT)
|
||||
{
|
||||
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleGfxSfxDummy2(species);
|
||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter2(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -702,35 +688,11 @@ static void PlayerPartnerHandleTrainerSlideBack(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
|
||||
}
|
||||
|
||||
#define sSpeedX data[1]
|
||||
#define sSpeedY data[2]
|
||||
|
||||
static void PlayerPartnerHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim;
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
#undef sSpeedX
|
||||
#undef sSpeedY
|
||||
|
||||
static void PlayerPartnerHandlePaletteFade(void)
|
||||
{
|
||||
PlayerPartnerBufferExecCompleted();
|
||||
|
@ -382,15 +382,6 @@ static void CompleteOnHealthbarDone(void)
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
|
||||
static void HideHealthboxAfterMonFaint(void)
|
||||
{
|
||||
if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse)
|
||||
{
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
RecordedOpponentBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -615,22 +606,7 @@ static void RecordedOpponentHandleTrainerSlideBack(void)
|
||||
|
||||
static void RecordedOpponentHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[gActiveBattler] = HideHealthboxAfterMonFaint;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
static void RecordedOpponentHandlePaletteFade(void)
|
||||
|
@ -362,20 +362,6 @@ static void CompleteOnHealthbarDone(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterFaintAnim(void)
|
||||
{
|
||||
if (gSprites[gBattlerSpriteIds[gActiveBattler]].y + gSprites[gBattlerSpriteIds[gActiveBattler]].y2 > DISPLAY_HEIGHT)
|
||||
{
|
||||
u16 species = GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES);
|
||||
|
||||
BattleGfxSfxDummy2(species);
|
||||
FreeOamMatrix(gSprites[gBattlerSpriteIds[gActiveBattler]].oam.matrixNum);
|
||||
DestroySprite(&gSprites[gBattlerSpriteIds[gActiveBattler]]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
}
|
||||
}
|
||||
|
||||
static void CompleteOnInactiveTextPrinter(void)
|
||||
{
|
||||
if (!IsTextPrinterActive(B_WIN_MSG))
|
||||
@ -613,35 +599,11 @@ static void RecordedPlayerHandleTrainerSlideBack(void)
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeTrainerSpriteAfterSlide;
|
||||
}
|
||||
|
||||
#define sSpeedX data[1]
|
||||
#define sSpeedY data[2]
|
||||
|
||||
static void RecordedPlayerHandleFaintAnimation(void)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[gActiveBattler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], gActiveBattler);
|
||||
PlaySE12WithPanning(SE_FAINT, -64);
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 0;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedY = 5;
|
||||
gSprites[gBattlerSpriteIds[gActiveBattler]].callback = SpriteCB_FaintSlideAnim;
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterFaintAnim;
|
||||
}
|
||||
}
|
||||
BtlController_HandleFaintAnimation(gActiveBattler);
|
||||
}
|
||||
|
||||
#undef sSpeedX
|
||||
#undef sSpeedY
|
||||
|
||||
static void RecordedPlayerHandlePaletteFade(void)
|
||||
{
|
||||
RecordedPlayerBufferExecCompleted();
|
||||
|
@ -13,9 +13,11 @@
|
||||
#include "party_menu.h"
|
||||
#include "recorded_battle.h"
|
||||
#include "string_util.h"
|
||||
#include "sound.h"
|
||||
#include "task.h"
|
||||
#include "util.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
static EWRAM_DATA u8 sLinkSendTaskId = 0;
|
||||
static EWRAM_DATA u8 sLinkReceiveTaskId = 0;
|
||||
@ -2122,7 +2124,7 @@ static void FreeMonSprite(u32 battler)
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[battler]);
|
||||
}
|
||||
|
||||
static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
static void Controller_ReturnMonToBall2(void)
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].specialAnimActive)
|
||||
{
|
||||
@ -2131,7 +2133,7 @@ static void FreeMonSpriteAfterSwitchOutAnim(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void DoSwitchOutAnimation(void)
|
||||
static void Controller_ReturnMonToBall(void)
|
||||
{
|
||||
switch (gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState)
|
||||
{
|
||||
@ -2146,12 +2148,35 @@ static void DoSwitchOutAnimation(void)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[gActiveBattler].animationState = 0;
|
||||
InitAndLaunchSpecialAnimation(gActiveBattler, gActiveBattler, gActiveBattler, (GetBattlerSide(gActiveBattler) == B_SIDE_OPPONENT) ? B_ANIM_SWITCH_OUT_OPPONENT_MON : B_ANIM_SWITCH_OUT_PLAYER_MON);
|
||||
gBattlerControllerFuncs[gActiveBattler] = FreeMonSpriteAfterSwitchOutAnim;
|
||||
gBattlerControllerFuncs[gActiveBattler] = Controller_ReturnMonToBall2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void Controller_FaintPlayerMon(void)
|
||||
{
|
||||
u32 spriteId = gBattlerSpriteIds[gActiveBattler];
|
||||
if (gSprites[spriteId].y + gSprites[spriteId].y2 > DISPLAY_HEIGHT)
|
||||
{
|
||||
BattleGfxSfxDummy2(GetMonData(&gPlayerParty[gBattlerPartyIndexes[gActiveBattler]], MON_DATA_SPECIES));
|
||||
FreeOamMatrix(gSprites[spriteId].oam.matrixNum);
|
||||
DestroySprite(&gSprites[spriteId]);
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
BattleControllerComplete(gActiveBattler);
|
||||
}
|
||||
}
|
||||
|
||||
static void Controller_FaintOpponentMon(void)
|
||||
{
|
||||
if (!gSprites[gBattlerSpriteIds[gActiveBattler]].inUse)
|
||||
{
|
||||
SetHealthboxSpriteInvisible(gHealthboxSpriteIds[gActiveBattler]);
|
||||
BattleControllerComplete(gActiveBattler);
|
||||
}
|
||||
}
|
||||
|
||||
// Handlers of all the controller commands
|
||||
void BtlController_HandleGetMonData(u32 battler, struct Pokemon *party)
|
||||
{
|
||||
u8 monData[sizeof(struct Pokemon) * 2 + 56]; // this allows to get full data of two pokemon, trying to get more will result in overwriting data
|
||||
@ -2223,7 +2248,7 @@ void BtlController_HandleSetRawMonData(u32 battler, struct Pokemon *party)
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerFunc)(void))
|
||||
void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void (*controllerCallback)(void))
|
||||
{
|
||||
u16 species = GetMonData(&party[gBattlerPartyIndexes[battler]], MON_DATA_SPECIES);
|
||||
|
||||
@ -2243,10 +2268,10 @@ void BtlController_HandleLoadMonSprite(u32 battler, struct Pokemon *party, void
|
||||
|
||||
SetBattlerShadowSpriteCallback(battler, species);
|
||||
|
||||
gBattlerControllerFuncs[battler] = controllerFunc;
|
||||
gBattlerControllerFuncs[battler] = controllerCallback;
|
||||
}
|
||||
|
||||
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerFunc)(void))
|
||||
void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*controllerCallback)(void))
|
||||
{
|
||||
if (isPlayerSide)
|
||||
ClearTemporarySpeciesSpriteData(battler, gBattleResources->bufferA[battler][2]);
|
||||
@ -2254,7 +2279,7 @@ void BtlController_HandleSwitchInAnim(u32 battler, bool32 isPlayerSide, void (*c
|
||||
if (isPlayerSide)
|
||||
BattleLoadMonSpriteGfx(&gPlayerParty[gBattlerPartyIndexes[battler]], battler);
|
||||
StartSendOutAnim(battler, gBattleResources->bufferA[battler][2]);
|
||||
gBattlerControllerFuncs[battler] = controllerFunc;
|
||||
gBattlerControllerFuncs[battler] = controllerCallback;
|
||||
}
|
||||
|
||||
void BtlController_HandleReturnMonToBall(u32 battler)
|
||||
@ -2262,7 +2287,7 @@ void BtlController_HandleReturnMonToBall(u32 battler)
|
||||
if (gBattleResources->bufferA[battler][1] == 0)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0;
|
||||
gBattlerControllerFuncs[battler] = DoSwitchOutAnimation;
|
||||
gBattlerControllerFuncs[battler] = Controller_ReturnMonToBall;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2270,3 +2295,43 @@ void BtlController_HandleReturnMonToBall(u32 battler)
|
||||
BattleControllerComplete(battler);
|
||||
}
|
||||
}
|
||||
|
||||
#define sSpeedX data[1]
|
||||
#define sSpeedY data[2]
|
||||
|
||||
void BtlController_HandleFaintAnimation(u32 battler)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].animationState == 0)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute)
|
||||
InitAndLaunchSpecialAnimation(battler, battler, battler, B_ANIM_SUBSTITUTE_TO_MON);
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].animationState++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[battler].specialAnimActive)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].animationState = 0;
|
||||
if (GetBattlerSide(battler) == B_SIDE_PLAYER)
|
||||
{
|
||||
HandleLowHpMusicChange(&gPlayerParty[gBattlerPartyIndexes[battler]], battler);
|
||||
gSprites[gBattlerSpriteIds[battler]].sSpeedX = 0;
|
||||
gSprites[gBattlerSpriteIds[battler]].sSpeedY = 5;
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_ATTACKER);
|
||||
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_FaintSlideAnim;
|
||||
gBattlerControllerFuncs[battler] = Controller_FaintPlayerMon;
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySE12WithPanning(SE_FAINT, SOUND_PAN_TARGET);
|
||||
gSprites[gBattlerSpriteIds[battler]].callback = SpriteCB_FaintOpponentMon;
|
||||
gBattlerControllerFuncs[battler] = Controller_FaintOpponentMon;
|
||||
}
|
||||
// The player's sprite callback just slides the mon, the opponent's removes the sprite.
|
||||
// The player's sprite is removed in Controller_FaintPlayerMon. Controller_FaintOpponentMon only removes the healthbox once the sprite is removed by SpriteCB_FaintOpponentMon.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef sSpeedX
|
||||
#undef sSpeedY
|
||||
|
@ -565,8 +565,8 @@ static void CB2_InitBattleInternal(void)
|
||||
gBattle_BG3_X = 0;
|
||||
gBattle_BG3_Y = 0;
|
||||
|
||||
#if DEBUG_OVERWORLD_MENU == FALSE
|
||||
|
||||
#if DEBUG_OVERWORLD_MENU == FALSE
|
||||
|
||||
gBattleTerrain = BattleSetup_GetTerrainId();
|
||||
#else
|
||||
if (!gIsDebugBattle)
|
||||
@ -594,7 +594,7 @@ static void CB2_InitBattleInternal(void)
|
||||
else
|
||||
SetMainCallback2(CB2_HandleStartBattle);
|
||||
|
||||
#if DEBUG_OVERWORLD_MENU == FALSE
|
||||
#if DEBUG_OVERWORLD_MENU == FALSE
|
||||
if (!(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED)))
|
||||
{
|
||||
CreateNPCTrainerParty(&gEnemyParty[0], gTrainerBattleOpponent_A, TRUE);
|
||||
@ -2815,8 +2815,6 @@ void SpriteCB_FaintOpponentMon(struct Sprite *sprite)
|
||||
else
|
||||
species = sprite->sSpeciesId;
|
||||
|
||||
GetMonData(&gEnemyParty[gBattlerPartyIndexes[battler]], MON_DATA_PERSONALITY); // Unused return value.
|
||||
|
||||
if (species == SPECIES_UNOWN)
|
||||
{
|
||||
species = GetUnownSpeciesId(personality);
|
||||
|
Loading…
Reference in New Issue
Block a user