mirror of https://github.com/pret/pokeemerald.git
Document undefined sprite template behavior
This commit is contained in:
parent
b2d8c6793d
commit
072a98ca9a
|
@ -878,12 +878,14 @@ void ResetAllSprites(void)
|
||||||
ResetSprite(&gSprites[i]);
|
ResetSprite(&gSprites[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UB: template pointer may point to freed temporary storage
|
||||||
void FreeSpriteTiles(struct Sprite *sprite)
|
void FreeSpriteTiles(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
if (sprite->template->tileTag != 0xFFFF)
|
if (sprite->template->tileTag != 0xFFFF)
|
||||||
FreeSpriteTilesByTag(sprite->template->tileTag);
|
FreeSpriteTilesByTag(sprite->template->tileTag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UB: template pointer may point to freed temporary storage
|
||||||
void FreeSpritePalette(struct Sprite *sprite)
|
void FreeSpritePalette(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
FreeSpritePaletteByTag(sprite->template->paletteTag);
|
FreeSpritePaletteByTag(sprite->template->paletteTag);
|
||||||
|
|
|
@ -182,6 +182,10 @@ struct SpriteTemplate
|
||||||
SpriteCallback callback;
|
SpriteCallback callback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// UB: template pointer is often used to point to temporary storage,
|
||||||
|
// then later dereferenced after being freed. Usually this won't
|
||||||
|
// be visible in-game, but this is (part of) what causes the item
|
||||||
|
// icon palette to flicker when changing items in the bag.
|
||||||
struct Sprite
|
struct Sprite
|
||||||
{
|
{
|
||||||
/*0x00*/ struct OamData oam;
|
/*0x00*/ struct OamData oam;
|
||||||
|
|
|
@ -484,11 +484,15 @@ static void sub_801B7D8(u32 command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest == NULL)
|
if (dest == NULL)
|
||||||
|
{
|
||||||
AGB_ASSERT(0);
|
AGB_ASSERT(0);
|
||||||
|
}
|
||||||
else if (++(*dest) > 999)
|
else if (++(*dest) > 999)
|
||||||
|
{
|
||||||
*dest = 999;
|
*dest = 999;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
u16 mevent_081445C0(u32 command)
|
u16 mevent_081445C0(u32 command)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue