From 77ac3bb2655ec922d62159ea93db73aaae8701e3 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 4 Sep 2016 08:33:19 +0200 Subject: [PATCH] - fixed angle range checks in A_CheckIfTargetInLOS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The fixed point version had a mostly useless check that excluded ANGLE_MAX, this got incorrectly converted to floating point. Note that this version will clamp the angle to 360°, not merely overflow like it did with the fixed point code --- src/thingdef/thingdef_codeptr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 1f24a35c71..83db1fdaa1 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -4501,7 +4501,9 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIfTargetInLOS) else { target = viewport; viewport = self; } } - if (fov > 0 && (fov < 360.)) + fov = MIN(fov, 360.); + + if (fov > 0) { DAngle an = absangle(viewport->AngleTo(target), viewport->Angles.Yaw);