mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
[Critical] fix memory corruption when handling trigger sprites (#3238)
Co-authored-by: sbird <sbird@no.tld>
This commit is contained in:
parent
dba28cf93f
commit
cd90fdec5d
@ -1409,11 +1409,10 @@ bool32 IsMegaTriggerSpriteActive(void)
|
|||||||
|
|
||||||
void HideMegaTriggerSprite(void)
|
void HideMegaTriggerSprite(void)
|
||||||
{
|
{
|
||||||
if (gBattleStruct->mega.triggerSpriteId != 0xFF)
|
if (gBattleStruct->mega.triggerSpriteId >= MAX_SPRITES)
|
||||||
{
|
return;
|
||||||
ChangeMegaTriggerSprite(gBattleStruct->mega.triggerSpriteId, 0);
|
ChangeMegaTriggerSprite(gBattleStruct->mega.triggerSpriteId, 0);
|
||||||
gSprites[gBattleStruct->mega.triggerSpriteId].tHide = TRUE;
|
gSprites[gBattleStruct->mega.triggerSpriteId].tHide = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HideTriggerSprites(void)
|
void HideTriggerSprites(void)
|
||||||
|
@ -345,9 +345,12 @@ bool32 IsZMoveTriggerSpriteActive(void)
|
|||||||
|
|
||||||
void HideZMoveTriggerSprite(void)
|
void HideZMoveTriggerSprite(void)
|
||||||
{
|
{
|
||||||
struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
|
struct Sprite *sprite;
|
||||||
sprite->tHide = TRUE;
|
|
||||||
gBattleStruct->zmove.viable = FALSE;
|
gBattleStruct->zmove.viable = FALSE;
|
||||||
|
if (gBattleStruct->zmove.triggerSpriteId >= MAX_SPRITES)
|
||||||
|
return;
|
||||||
|
sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId];
|
||||||
|
sprite->tHide = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ShowZMoveTriggerSprite(u8 battlerId)
|
static void ShowZMoveTriggerSprite(u8 battlerId)
|
||||||
|
Loading…
Reference in New Issue
Block a user