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:
AreaZeroArven 2023-01-06 11:19:13 -05:00 committed by GitHub
parent 6d6a876dbd
commit 6a65d8d532
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -493,7 +493,7 @@ static void AnimFistOrFootRandomPos(struct Sprite *sprite)
y *= -1;
if (GET_BATTLER_SIDE2(battler) == B_SIDE_PLAYER)
y += 0xFFF0;
y -= 16;
sprite->x += x;
sprite->y += y;