From f0ad36004dba8b74d7f9700d441bc8aff2804103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sat, 22 Jun 2019 04:15:10 +0200 Subject: [PATCH] Fix car rotations --- programs/city.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/city.c b/programs/city.c index 4de8e89..18e34e4 100644 --- a/programs/city.c +++ b/programs/city.c @@ -272,12 +272,14 @@ int main() if (state[SDL_SCANCODE_LEFT]) { models[1].transform.rotation.y += stepRotation; - models[1].transform.rotation.z = S3L_min(velocity / 64, models[1].transform.rotation.z + 1); + models[1].transform.rotation.z = + S3L_min(S3L_abs(velocity) / 64, models[1].transform.rotation.z + 1); } else if (state[SDL_SCANCODE_RIGHT]) { models[1].transform.rotation.y -= stepRotation; - models[1].transform.rotation.z = S3L_max(-velocity / 64, models[1].transform.rotation.z - 1); + models[1].transform.rotation.z = + S3L_max(-S3L_abs(velocity) / 64, models[1].transform.rotation.z - 1); } else models[1].transform.rotation.z = (models[1].transform.rotation.z * 3) / 4;