]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - mathlib.c
fix checkextension based ODE detection for QC code
[xonotic/darkplaces.git] / mathlib.c
index d6170d28977c27645f71b9987887854670d34916..3bb17628dfd99a2e7f1c56bd10adbbc03795830d 100644 (file)
--- a/mathlib.c
+++ b/mathlib.c
@@ -203,6 +203,10 @@ void VectorVectors(const vec3_t forward, vec3_t right, vec3_t up)
        right[0] = forward[2];
        right[1] = -forward[0];
        right[2] = forward[1];
+       // BUG!
+       //   assume forward = {sqrt(1/3), sqrt(1/3), -sqrt(1/3)}
+       //   then right will be {-sqrt(1/3), -sqrt(1/3), sqrt(1/3)}
+       //   PROBLEM?
 
        d = DotProduct(forward, right);
        VectorMA(right, -d, forward, right);
@@ -756,3 +760,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;
+}
+