From 952c57895728705756be48c3a571dc6b926a7467 Mon Sep 17 00:00:00 2001 From: NY00123 Date: Sat, 11 Apr 2020 14:52:22 +0300 Subject: [PATCH] SW (DoPlayerTurn): The 180-degrees turns should be clockwise --- source/sw/src/player.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/sw/src/player.cpp b/source/sw/src/player.cpp index ef4f043a4..053e8396b 100644 --- a/source/sw/src/player.cpp +++ b/source/sw/src/player.cpp @@ -1572,7 +1572,9 @@ DoPlayerTurn(PLAYERp pp, fix16_t *pq16ang, fix16_t q16avel) if (PEDANTIC_MODE) *pq16ang = fix16_from_int(NORM_ANGLE(fix16_to_int(*pq16ang) + (labs(delta_ang) >> TURN_SHIFT))); else - *pq16ang = NORM_Q16ANGLE(fix16_sadd(*pq16ang, fix16_from_float(scaleAdjustmentToInterval(labs(delta_ang) >> TURN_SHIFT)))); + // Add at least 1 unit to ensure the turn direction is clockwise + *pq16ang = NORM_Q16ANGLE(fix16_sadd(*pq16ang, + fix16_max(fix16_one,fix16_from_float(scaleAdjustmentToInterval(labs(delta_ang) >> TURN_SHIFT))))); SET(pp->Flags, PF_TURN_180); }