summaryrefslogtreecommitdiffstats
path: root/src/Defines.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Defines.h')
-rw-r--r--src/Defines.h16
1 files changed, 16 insertions, 0 deletions
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)