mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Add UBFIX for division by zero in SpriteCB_PokedexListMonSprite
This commit is contained in:
parent
bafbf9240d
commit
127bb97c0e
@ -3037,7 +3037,15 @@ static void SpriteCB_PokedexListMonSprite(struct Sprite *sprite)
|
||||
u32 var;
|
||||
|
||||
sprite->pos2.y = gSineTable[(u8)sprite->data[5]] * 76 / 256;
|
||||
// UB: possible division by zero
|
||||
#ifdef UBFIX
|
||||
if (gSineTable[sprite->data[5] + 64] != 0)
|
||||
var = 0x10000 / gSineTable[sprite->data[5] + 64];
|
||||
else
|
||||
var = 0xFFFF;
|
||||
#else
|
||||
var = 0x10000 / gSineTable[sprite->data[5] + 64];
|
||||
#endif //UBFIX
|
||||
if (var > 0xFFFF)
|
||||
var = 0xFFFF;
|
||||
SetOamMatrix(sprite->data[1] + 1, 0x100, 0, 0, var);
|
||||
|
Loading…
Reference in New Issue
Block a user