]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - collision.c
got rid of dlightradius variable which was never actually used
[xonotic/darkplaces.git] / collision.c
index 05c0f70ec0ac26eca068af22124adffa98f74bbd..a22c8fb9a988487542ee9053e29b1907499e463f 100644 (file)
@@ -33,8 +33,6 @@ static int RecursiveHullCheck (RecursiveHullCheckTraceInfo_t *t, int num, double
        int ret;
        mplane_t *plane;
        double t1, t2;
-       //double frac;
-       //double mid[3];
 
        // variables that need to be stored on the stack when recursing
        dclipnode_t *node;
@@ -167,9 +165,11 @@ loc0:
        return HULLCHECKSTATE_DONE;
 }
 
+/*
 // used if start and end are the same
 static void RecursiveHullCheckPoint (RecursiveHullCheckTraceInfo_t *t, int num)
 {
+       // If you can read this, you understand BSP trees
        while (num >= 0)
                num = t->hull->clipnodes[num].children[((t->hull->planes[t->hull->clipnodes[num].planenum].type < 3) ? (t->start[t->hull->planes[t->hull->clipnodes[num].planenum].type]) : (DotProduct(t->hull->planes[t->hull->clipnodes[num].planenum].normal, t->start))) < t->hull->planes[t->hull->clipnodes[num].planenum].dist];
 
@@ -204,6 +204,7 @@ static void RecursiveHullCheckPoint (RecursiveHullCheckTraceInfo_t *t, int num)
                }
        }
 }
+*/
 
 void Collision_RoundUpToHullSize(const model_t *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs)
 {
@@ -377,10 +378,10 @@ void Collision_ClipTrace (trace_t *trace, const void *cent, const model_t *cmode
                VectorCopy(endd, rhc.end);
                VectorCopy(rhc.end, rhc.trace->endpos);
                VectorSubtract(rhc.end, rhc.start, rhc.dist);
-               if (DotProduct(rhc.dist, rhc.dist) > 0.00001)
+               //if (DotProduct(rhc.dist, rhc.dist) > 0.00001)
                        RecursiveHullCheck (&rhc, rhc.hull->firstclipnode, 0, 1, rhc.start, rhc.end);
-               else
-                       RecursiveHullCheckPoint (&rhc, rhc.hull->firstclipnode);
+               //else
+               //      RecursiveHullCheckPoint (&rhc, rhc.hull->firstclipnode);
 
                // if we hit, unrotate endpos and normal, and store the entity we hit
                if (rhc.trace->fraction != 1)
@@ -401,12 +402,12 @@ void Collision_ClipTrace (trace_t *trace, const void *cent, const model_t *cmode
                                rhc.trace->plane.normal[1] = DotProduct (tempd, left);
                                rhc.trace->plane.normal[2] = DotProduct (tempd, up);
                        }
-                       // fix offset
-                       VectorAdd (rhc.trace->endpos, offset, rhc.trace->endpos);
                        rhc.trace->ent = (void *) cent;
                }
                else if (rhc.trace->allsolid || rhc.trace->startsolid)
                        rhc.trace->ent = (void *) cent;
+               // fix offset
+               VectorAdd (rhc.trace->endpos, offset, rhc.trace->endpos);
        }
        else
        {
@@ -415,14 +416,14 @@ void Collision_ClipTrace (trace_t *trace, const void *cent, const model_t *cmode
                rhc.hull = HullForBBoxEntity (corigin, cmins, cmaxs, mins, maxs, offset);
 
                // trace a line through the generated clipping hull
-               VectorCopy(startd, rhc.start);
-               VectorCopy(endd, rhc.end);
+               VectorSubtract(start, offset, rhc.start);
+               VectorSubtract(end, offset, rhc.end);
                VectorCopy(rhc.end, rhc.trace->endpos);
                VectorSubtract(rhc.end, rhc.start, rhc.dist);
-               if (DotProduct(rhc.dist, rhc.dist) > 0.00001)
+               //if (DotProduct(rhc.dist, rhc.dist) > 0.00001)
                        RecursiveHullCheck (&rhc, rhc.hull->firstclipnode, 0, 1, rhc.start, rhc.end);
-               else
-                       RecursiveHullCheckPoint (&rhc, rhc.hull->firstclipnode);
+               //else
+               //      RecursiveHullCheckPoint (&rhc, rhc.hull->firstclipnode);
 
                // if we hit, store the entity we hit
                if (rhc.trace->fraction != 1)
@@ -435,3 +436,4 @@ void Collision_ClipTrace (trace_t *trace, const void *cent, const model_t *cmode
                        rhc.trace->ent = (void *) cent;
        }
 }
+