From 6785bb7c165b1d5be87ebf414d877c774eeac708 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 8 Dec 2013 13:08:56 +0100 Subject: Fixed normalizing large angles. --- src/Defines.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/Defines.h') diff --git a/src/Defines.h b/src/Defines.h index 5b27f4b3f..534802d55 100644 --- a/src/Defines.h +++ b/src/Defines.h @@ -416,6 +416,22 @@ inline float GetSpecialSignf( float a_Val ) // tolua_begin + +/// Normalizes an angle in degrees to the [-180, +180) range: +inline double NormalizeAngleDegrees(const double a_Degrees) +{ + double Norm = fmod(a_Degrees + 180, 360); + if (Norm < 0) + { + Norm += 360; + } + return Norm - 180; +} + + + + + namespace ItemCategory { inline bool IsPickaxe(short a_ItemID) -- cgit v1.2.3