]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mathlib.c
use checkdisk flag on model loading after ingame download, this should
[xonotic/darkplaces.git] / mathlib.c
index cbd57db1d5d68458324733e17218a62cd512b8e4..dae0de50ba070a4f144e6830e47e5fa4da125700 100644 (file)
--- a/mathlib.c
+++ b/mathlib.c
@@ -523,8 +523,16 @@ void AnglesFromVectors (vec3_t angles, const vec3_t forward, const vec3_t up, qb
 {
        if (forward[0] == 0 && forward[1] == 0)
        {
-               angles[PITCH] = forward[2] > 0 ? -M_PI * 0.5 : M_PI * 0.5;
-               angles[YAW] = up ? atan2(-up[1], -up[0]) : 0;
+               if(forward[2] > 0)
+               {
+                       angles[PITCH] = -M_PI * 0.5;
+                       angles[YAW] = up ? atan2(-up[1], -up[0]) : 0;
+               }
+               else
+               {
+                       angles[PITCH] = M_PI * 0.5;
+                       angles[YAW] = up ? atan2(up[1], up[0]) : 0;
+               }
                angles[ROLL] = 0;
        }
        else
@@ -748,3 +756,12 @@ void BoxFromPoints(vec3_t mins, vec3_t maxs, int numpoints, vec_t *point3f)
        }
 }
 
+// LordHavoc: this has to be done right or you get severe precision breakdown
+int LoopingFrameNumberFromDouble(double t, int loopframes)
+{
+       if (loopframes)
+               return (int)(t - floor(t/loopframes)*loopframes);
+       else
+               return (int)t;
+}
+