- else
- trace->startsolid = true;
- return true; // empty
- }
-
- if (num < hull->firstclipnode || num > hull->lastclipnode)
- Sys_Error ("SV_RecursiveHullCheck: bad node number");
-
-//
-// find the point distances
-//
- node = hull->clipnodes + num;
- plane = hull->planes + node->planenum;
-
- if (plane->type < 3)
- {
- t1 = p1[plane->type] - plane->dist;
- t2 = p2[plane->type] - plane->dist;
- }
- else
- {
- t1 = DotProduct (plane->normal, p1) - plane->dist;
- t2 = DotProduct (plane->normal, p2) - plane->dist;
- }
-
-#if 1
- if (t1 >= 0 && t2 >= 0)
- // LordHavoc: optimized recursion
-// return SV_RecursiveHullCheck (hull, node->children[0], p1f, p2f, p1, p2, trace);
- {
- num = node->children[0];
- goto loc0;
- }
- if (t1 < 0 && t2 < 0)
-// return SV_RecursiveHullCheck (hull, node->children[1], p1f, p2f, p1, p2, trace);
- {
- num = node->children[1];
- goto loc0;
- }
-#else
- if ( (t1 >= DIST_EPSILON && t2 >= DIST_EPSILON) || (t2 > t1 && t1 >= 0) )
- return SV_RecursiveHullCheck (hull, node->children[0], p1f, p2f, p1, p2, trace);
- if ( (t1 <= -DIST_EPSILON && t2 <= -DIST_EPSILON) || (t2 < t1 && t1 <= 0) )
- return SV_RecursiveHullCheck (hull, node->children[1], p1f, p2f, p1, p2, trace);
-#endif
-
-// put the crosspoint DIST_EPSILON pixels on the near side
- if (t1 < 0)
- frac = (t1 + DIST_EPSILON)/(t1-t2);
- else
- frac = (t1 - DIST_EPSILON)/(t1-t2);
- if (frac < 0)
- frac = 0;
- if (frac > 1)
- frac = 1;
-
- midf = p1f + (p2f - p1f)*frac;
- for (i=0 ; i<3 ; i++)
- mid[i] = p1[i] + frac*(p2[i] - p1[i]);
-
- side = (t1 < 0);
-
-// move up to the node
- if (!SV_RecursiveHullCheck (hull, node->children[side], p1f, midf, p1, mid, trace) )
- return false;
-
-#ifdef PARANOID
- if (SV_HullPointContents (hull, node->children[side], mid) == CONTENTS_SOLID)
- {
- Con_Printf ("mid PointInHullSolid\n");
- return false;
- }
-#endif
-
- if (SV_HullPointContents (hull, node->children[side^1], mid) != CONTENTS_SOLID)
-// go past the node
- return SV_RecursiveHullCheck (hull, node->children[side^1], midf, p2f, mid, p2, trace);
- // mid would need to be duplicated during recursion...
- /*
- {
- p1f = midf;
- p1 = mid;
- num = node->children[side^1];
- goto loc0;