fix angle overflow freeze

Would freeze upon angle reaching about -367.5 or 416.2 likely due to
numerical error. Reported and reproduced by Rainning_Tacos1.
This commit is contained in:
Lephenixnoir 2024-04-30 12:04:54 +02:00
parent d1587f03eb
commit a2c4fbcfd1
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 2 additions and 2 deletions

View File

@ -282,9 +282,9 @@ int main(void)
if(keydown(KEY_DOWN))
move_dir += -dir;
if(keydown(KEY_RIGHT))
angle += .1_n;
angle = (angle + .1_n) % 6.28319_n;
if(keydown(KEY_LEFT))
angle -= .1_n;
angle = (angle - .1_n + 6.28319_n) % 6.28319_n;
if(keydown(KEY_PLUS))
pos.y = min(pos.y + .1_n, 1_n);
if(keydown(KEY_MINUS))