mirror of
https://github.com/pret/pokeemerald.git
synced 2026-04-26 17:38:12 -05:00
battle-anim:fix UB by subtracting by 16
The current code follows the nonsensical asm generated by agbcc, which converted a subtraction by 16 into an addition by a halfword value of -16. This conversion happened at the portion of the compiler that does platform-specific transformations. This code in C is UB, as it relies on overflowing of a negative value. Signed-off-by:Arven
This commit is contained in:
parent
6d6a876dbd
commit
6a65d8d532
|
|
@ -493,7 +493,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
|
||||||
y *= -1;
|
y *= -1;
|
||||||
|
|
||||||
if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER)
|
if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER)
|
||||||
y += 0xFFF0;
|
y -= 16;
|
||||||
|
|
||||||
sprite->x += x;
|
sprite->x += x;
|
||||||
sprite->y += y;
|
sprite->y += y;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user