All pastes #917366 Raw Edit

Anonymous

public text v1 · immutable
#917366 ·published 2008-02-25 09:50 UTC
rendered paste body
Index: cmodel.c
===================================================================
--- cmodel.c	(revision 15241)
+++ cmodel.c	(working copy)
@@ -687,13 +687,16 @@
 	trace_t trace;
 	cBspModel_t *model;
 	const char **name;
+	int worldFound;
 
 	/* trace against world first */
 	if (CM_TestLine(start, stop))
-		return 1;
+		worldFound = 1;
+	else
+		worldFound = 0;
 	/* no local models */
 	if (!inlineList)
-		return 0;
+		return worldFound;
 
 	for (name = inlineList; *name; name++) {
 		/* check whether this is really an inline model */
@@ -710,7 +713,7 @@
 	}
 
 	/* not blocked */
-	return 0;
+	return worldFound;
 }
 
 
@@ -2184,7 +2187,7 @@
 		/* FIXME: What about visibility checks - should LEVEL_ACTORCLIP
 		 * be removed here, too? Problem is, the tnode functions are used
 		 * for pathfinding, too */
-		if (level <= LEVEL_WEAPONCLIP) {
+		if (level <= LEVEL_LASTVISIBLE) {
 			curTile->cheads[curTile->numcheads].cnode = node;
 			curTile->cheads[curTile->numcheads].level = level;
 			curTile->numcheads++;
@@ -2219,7 +2222,12 @@
 		curTile->numtheads++;
 		assert(curTile->numtheads < LEVEL_MAX);
 
-		BuildTracingNode_r(curTile->cmodels[i].headnode, i);
+		/*
+		If this level (i) is the last visible level or earlier, then trace it.
+		Otherwise don't; we have separate checks for entities.
+		*/
+		if (i <= LEVEL_LASTVISIBLE)
+			BuildTracingNode_r(curTile->cmodels[i].headnode, i);
 	}
 }
 
@@ -3027,6 +3035,9 @@
 	}
 	inlineList = list;
 
+	/* Update the tracing nodes to ensure that we have the shortest paths */
+	CM_MakeTracingNodes();
+
 	/* get dimensions */
 	if (VectorNotEmpty(angles)) {
 		vec3_t minVec, maxVec;