mirror of
https://github.com/pret/pokeemerald.git
synced 2026-09-30 22:07:24 -05:00
Fixes gimmick icon flying off the screen (#6401)
This commit is contained in:
@@ -204,6 +204,7 @@ static void SpriteCb_GimmickTrigger(struct Sprite *sprite)
|
||||
{
|
||||
s32 xSlide, xPriority, xOptimal;
|
||||
s32 yDiff;
|
||||
s32 xHealthbox = gSprites[gHealthboxSpriteIds[sprite->tBattler]].x;
|
||||
|
||||
if (IsDoubleBattle())
|
||||
{
|
||||
@@ -222,25 +223,29 @@ static void SpriteCb_GimmickTrigger(struct Sprite *sprite)
|
||||
|
||||
if (sprite->tHide)
|
||||
{
|
||||
if (sprite->x != gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xSlide)
|
||||
if (sprite->x < xHealthbox - xSlide)
|
||||
sprite->x++;
|
||||
|
||||
if (sprite->x >= gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xPriority)
|
||||
if (sprite->x >= xHealthbox - xPriority)
|
||||
sprite->oam.priority = 2;
|
||||
else
|
||||
sprite->oam.priority = 1;
|
||||
|
||||
sprite->y = gSprites[gHealthboxSpriteIds[sprite->tBattler]].y - yDiff;
|
||||
sprite->y2 = gSprites[gHealthboxSpriteIds[sprite->tBattler]].y2 - yDiff;
|
||||
if (sprite->x == gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xSlide)
|
||||
if (sprite->x == xHealthbox - xSlide)
|
||||
DestroyGimmickTriggerSprite();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sprite->x != gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xOptimal)
|
||||
// Edge case: in doubles, if selecting move and next mon's action too fast, the second battler's gimmick icon uses the x from the first battler's gimmick icon
|
||||
if (sprite->y != gSprites[gHealthboxSpriteIds[sprite->tBattler]].y - yDiff)
|
||||
sprite->x = xHealthbox - xSlide;
|
||||
|
||||
if (sprite->x > xHealthbox - xOptimal)
|
||||
sprite->x--;
|
||||
|
||||
if (sprite->x >= gSprites[gHealthboxSpriteIds[sprite->tBattler]].x - xPriority)
|
||||
if (sprite->x >= xHealthbox - xPriority)
|
||||
sprite->oam.priority = 2;
|
||||
else
|
||||
sprite->oam.priority = 1;
|
||||
|
||||
Reference in New Issue
Block a user