Fix shiny stars being freed before shiny animation was played (#7917)
Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
parent
798bf0a322
commit
ca53ccb55e
@ -438,4 +438,6 @@ void BtlController_HandleSwitchInSoundAndEnd(u32 battler);
|
||||
void BtlController_HandleSwitchInShowSubstitute(u32 battler);
|
||||
|
||||
bool32 ShouldBattleRestrictionsApply(u32 battler);
|
||||
void FreeShinyStars(void);
|
||||
|
||||
#endif // GUARD_BATTLE_CONTROLLERS_H
|
||||
|
||||
@ -150,8 +150,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE;
|
||||
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -163,8 +162,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
|
||||
if (GetBattlerPosition(battler) == B_POSITION_OPPONENT_RIGHT)
|
||||
{
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -159,8 +159,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE;
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -174,8 +173,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
if (!gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim
|
||||
&& !gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim)
|
||||
{
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -1247,8 +1247,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE;
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
|
||||
HandleLowHpMusicChange(GetBattlerMon(battler), battler);
|
||||
|
||||
|
||||
@ -170,8 +170,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE;
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
}
|
||||
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].introEndDelay = 3;
|
||||
|
||||
@ -147,8 +147,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE;
|
||||
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
|
||||
HandleLowHpMusicChange(GetBattlerMon(battler), battler);
|
||||
if (IsDoubleBattle())
|
||||
|
||||
@ -255,8 +255,7 @@ static void Intro_WaitForShinyAnimAndHealthbox(u32 battler)
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[BATTLE_PARTNER(battler)].finishedShinyMonAnim = FALSE;
|
||||
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
|
||||
CreateTask(Task_PlayerController_RestoreBgmAfterCry, 10);
|
||||
HandleLowHpMusicChange(GetBattlerMon(battler), battler);
|
||||
|
||||
@ -2940,8 +2940,7 @@ void TryShinyAnimAfterMonAnim(u32 battler)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE;
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
BtlController_Complete(battler);
|
||||
}
|
||||
}
|
||||
@ -3012,8 +3011,7 @@ void BtlController_HandleSwitchInShowHealthbox(u32 battler)
|
||||
{
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE;
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
|
||||
if (side == B_SIDE_PLAYER)
|
||||
{
|
||||
@ -3043,8 +3041,7 @@ static void SwitchIn_CleanShinyAnimShowSubstitute(u32 battler)
|
||||
// Reset shiny anim (even if it didn't occur)
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim = FALSE;
|
||||
gBattleSpritesDataPtr->healthBoxesData[battler].finishedShinyMonAnim = FALSE;
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeShinyStars();
|
||||
|
||||
// Check if Substitute should be shown
|
||||
if (gBattleSpritesDataPtr->battlerData[battler].behindSubstitute)
|
||||
@ -3129,3 +3126,14 @@ bool32 ShouldBattleRestrictionsApply(u32 battler)
|
||||
{
|
||||
return IsControllerPlayer(battler);
|
||||
}
|
||||
|
||||
void FreeShinyStars(void)
|
||||
{
|
||||
for (u32 battler = 0; battler < gBattlersCount; battler++)
|
||||
{
|
||||
if (gBattleSpritesDataPtr->healthBoxesData[battler].triedShinyMonAnim)
|
||||
return;
|
||||
}
|
||||
FreeSpriteTilesByTag(ANIM_TAG_GOLD_STARS);
|
||||
FreeSpritePaletteByTag(ANIM_TAG_GOLD_STARS);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user