mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
fix hp boxes not dissapearing
This commit is contained in:
parent
7a237595c9
commit
6139b12a49
@ -74,7 +74,7 @@ void SetHealthboxSpriteInvisible(u8 healthboxSpriteId);
|
||||
void SetHealthboxSpriteVisible(u8 healthboxSpriteId);
|
||||
void DestoryHealthboxSprite(u8 healthboxSpriteId);
|
||||
void DummyBattleInterfaceFunc(u8 healthboxSpriteId, bool8 isDoubleBattleBankOnly);
|
||||
void UpdateOamPriorityInAllHealthboxes(u8 priority);
|
||||
void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHpBoxes);
|
||||
void InitBattlerHealthboxCoords(u8 battler);
|
||||
void UpdateHpTextInHealthbox(u8 healthboxSpriteId, s16 value, u8 maxOrCurrent);
|
||||
void SwapHpBarsWithHpText(void);
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "task.h"
|
||||
#include "constants/battle_anim.h"
|
||||
#include "constants/battle_config.h"
|
||||
#include "constants/battle_moves.h"
|
||||
|
||||
#define ANIM_SPRITE_INDEX_COUNT 8
|
||||
|
||||
@ -2198,11 +2199,32 @@ void DoMoveAnim(u16 move)
|
||||
void LaunchBattleAnimation(const u8 *const animsTable[], u16 tableId, bool8 isMoveAnim)
|
||||
{
|
||||
s32 i;
|
||||
bool32 hideHpBoxes = (tableId == MOVE_TRANSFORM) ? FALSE : TRUE;
|
||||
|
||||
if (!isMoveAnim)
|
||||
{
|
||||
switch (tableId)
|
||||
{
|
||||
case B_ANIM_TURN_TRAP:
|
||||
case B_ANIM_LEECH_SEED_DRAIN:
|
||||
case B_ANIM_MON_HIT:
|
||||
case B_ANIM_SNATCH_MOVE:
|
||||
case B_ANIM_FUTURE_SIGHT_HIT:
|
||||
case B_ANIM_DOOM_DESIRE_HIT:
|
||||
case B_ANIM_WISH_HEAL:
|
||||
case B_ANIM_MEGA_EVOLUTION:
|
||||
hideHpBoxes = TRUE;
|
||||
break;
|
||||
default:
|
||||
hideHpBoxes = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IsContest())
|
||||
{
|
||||
sub_80A8278();
|
||||
UpdateOamPriorityInAllHealthboxes(0);
|
||||
UpdateOamPriorityInAllHealthboxes(0, hideHpBoxes);
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerSide(i) != B_SIDE_PLAYER)
|
||||
@ -2511,7 +2533,7 @@ static void ScriptCmd_end(void)
|
||||
if (!IsContest())
|
||||
{
|
||||
sub_80A8278();
|
||||
UpdateOamPriorityInAllHealthboxes(1);
|
||||
UpdateOamPriorityInAllHealthboxes(1, TRUE);
|
||||
}
|
||||
gAnimScriptActive = FALSE;
|
||||
}
|
||||
|
@ -1332,7 +1332,7 @@ static void SpriteCB_Ball_Capture_Step(struct Sprite *sprite)
|
||||
else if (sprite->sTimer == 95)
|
||||
{
|
||||
gDoingBattleAnim = FALSE;
|
||||
UpdateOamPriorityInAllHealthboxes(1);
|
||||
UpdateOamPriorityInAllHealthboxes(1, FALSE);
|
||||
m4aMPlayAllStop();
|
||||
PlaySE(MUS_RG_CAUGHT_INTRO);
|
||||
}
|
||||
@ -1515,7 +1515,7 @@ static void SpriteCB_Ball_Release_Wait(struct Sprite *sprite)
|
||||
sprite->sFrame = 0;
|
||||
sprite->callback = DestroySpriteAfterOneFrame;
|
||||
gDoingBattleAnim = 0;
|
||||
UpdateOamPriorityInAllHealthboxes(1);
|
||||
UpdateOamPriorityInAllHealthboxes(1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1557,7 +1557,7 @@ static void SpriteCB_Ball_Block_Step(struct Sprite *sprite)
|
||||
sprite->sFrame = 0;
|
||||
sprite->callback = DestroySpriteAfterOneFrame;
|
||||
gDoingBattleAnim = 0;
|
||||
UpdateOamPriorityInAllHealthboxes(1);
|
||||
UpdateOamPriorityInAllHealthboxes(1, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -944,39 +944,6 @@ static void TryToggleHealboxVisibility(u8 priority, u8 healthboxLeftSpriteId, u8
|
||||
u8 spriteIds[4] = {healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId};
|
||||
int i;
|
||||
|
||||
switch (gBattleResources->bufferA[gBattleAnimAttacker][0])
|
||||
{
|
||||
case CONTROLLER_MOVEANIMATION:
|
||||
if (gBattleResources->bufferA[gBattleAnimAttacker][1] == MOVE_TRANSFORM)
|
||||
return;
|
||||
break;
|
||||
case CONTROLLER_BALLTHROWANIM:
|
||||
return; //throwing ball does not hide hp boxes
|
||||
case CONTROLLER_BATTLEANIMATION:
|
||||
//check special anims that hide health boxes
|
||||
switch (gBattleResources->bufferA[gBattleAnimAttacker][1])
|
||||
{
|
||||
case B_ANIM_TURN_TRAP:
|
||||
case B_ANIM_LEECH_SEED_DRAIN:
|
||||
case B_ANIM_MON_HIT:
|
||||
case B_ANIM_SNATCH_MOVE:
|
||||
case B_ANIM_FUTURE_SIGHT_HIT:
|
||||
case B_ANIM_DOOM_DESIRE_HIT:
|
||||
case B_ANIM_WISH_HEAL:
|
||||
//new
|
||||
case B_ANIM_MEGA_EVOLUTION:
|
||||
case B_ANIM_TERRAIN_MISTY:
|
||||
case B_ANIM_TERRAIN_GRASSY:
|
||||
case B_ANIM_TERRAIN_ELECTRIC:
|
||||
case B_ANIM_TERRAIN_PSYCHIC:
|
||||
break;
|
||||
}
|
||||
return; //all other special anims dont hide
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// if we've reached here, we should hide hp boxes
|
||||
for (i = 0; i < NELEMS(spriteIds); i++)
|
||||
{
|
||||
if (spriteIds[i] == 0xFF)
|
||||
@ -994,7 +961,7 @@ static void TryToggleHealboxVisibility(u8 priority, u8 healthboxLeftSpriteId, u8
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateOamPriorityInAllHealthboxes(u8 priority)
|
||||
void UpdateOamPriorityInAllHealthboxes(u8 priority, bool32 hideHPBoxes)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@ -1012,7 +979,7 @@ void UpdateOamPriorityInAllHealthboxes(u8 priority)
|
||||
gSprites[indicatorSpriteId].oam.priority = priority;
|
||||
|
||||
#if B_HIDE_HEALTHBOXES_DURING_ANIMS
|
||||
if (IsBattlerAlive(i))
|
||||
if (hideHPBoxes && IsBattlerAlive(i))
|
||||
TryToggleHealboxVisibility(priority, healthboxLeftSpriteId, healthboxRightSpriteId, healthbarSpriteId, indicatorSpriteId);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user