<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">[PATCH] world.c cleanups

Mostly whitespace cleanups in the world.c's, and a little one in pmovetst.c
since it's largely copied from world.c. This is mainly to keep the differences
between NQ/QW versions as small as possible.

The only (minor) code changes are a little cleanup of SV_TestEntityPosition
(should be semantically the same) and changing the "backup past 0" message to
be developer only.

diff -urN a/NQ/world.c head/NQ/world.c
--- a/NQ/world.c	2006-03-09 19:56:59.000000000 +1030
+++ head/NQ/world.c	2006-03-09 20:00:10.000000000 +1030
@@ -312,7 +312,6 @@
 	pr_global_struct-&gt;self = EDICT_TO_PROG(touch);
 	pr_global_struct-&gt;other = EDICT_TO_PROG(ent);
 	pr_global_struct-&gt;time = sv.time;
-
 	PR_ExecuteProgram(touch-&gt;v.touch);
 
 	/* the PR_ExecuteProgram above can alter the linked edicts */
@@ -401,22 +400,24 @@
     if (ent-&gt;free)
 	return;
 
-    // set the abs box
+    /* set the abs box */
     VectorAdd(ent-&gt;v.origin, ent-&gt;v.mins, ent-&gt;v.absmin);
     VectorAdd(ent-&gt;v.origin, ent-&gt;v.maxs, ent-&gt;v.absmax);
 
-    //
-    // to make items easier to pick up and allow them to be grabbed off
-    // of shelves, the abs sizes are expanded
-    //
+    /*
+     * To make items easier to pick up and allow them to be grabbed off of
+     * shelves, the abs sizes are expanded
+     */
     if ((int)ent-&gt;v.flags &amp; FL_ITEM) {
 	ent-&gt;v.absmin[0] -= 15;
 	ent-&gt;v.absmin[1] -= 15;
 	ent-&gt;v.absmax[0] += 15;
 	ent-&gt;v.absmax[1] += 15;
     } else {
-	// because movement is clipped an epsilon away from an actual edge,
-	// we must fully check even when bounding boxes don't quite touch
+	/*
+	 * because movement is clipped an epsilon away from an actual edge, we
+	 * must fully check even when bounding boxes don't quite touch
+	 */
 	ent-&gt;v.absmin[0] -= 1;
 	ent-&gt;v.absmin[1] -= 1;
 	ent-&gt;v.absmin[2] -= 1;
@@ -425,7 +426,7 @@
 	ent-&gt;v.absmax[2] += 1;
     }
 
-    // link to PVS leafs
+    /* link to PVS leafs */
     ent-&gt;num_leafs = 0;
     if (ent-&gt;v.modelindex)
 	SV_FindTouchedLeafs(ent, sv.worldmodel-&gt;nodes);
@@ -433,7 +434,7 @@
     if (ent-&gt;v.solid == SOLID_NOT)
 	return;
 
-    // find the first node that the ent's box crosses
+    /* find the first node that the ent's box crosses */
     node = sv_areanodes;
     while (1) {
 	if (node-&gt;axis == -1)
@@ -446,14 +447,14 @@
 	    break;		// crosses the node
     }
 
-    // link it in
+    /* link it in */
     if (ent-&gt;v.solid == SOLID_TRIGGER)
 	InsertLinkBefore(&amp;ent-&gt;area, &amp;node-&gt;trigger_edicts);
     else
 	InsertLinkBefore(&amp;ent-&gt;area, &amp;node-&gt;solid_edicts);
 
-    // if touch_triggers, touch all entities at this node and decend for more
     if (touch_triggers)
+	/* touch all entities at this node and decend for more */
 	SV_TouchLinks(ent, sv_areanodes);
 }
 
@@ -545,18 +546,16 @@
 SV_TestEntityPosition(edict_t *ent)
 {
     trace_t trace;
+    entvars_t *v = &amp;ent-&gt;v;
+    edict_t *ret = NULL;
 
-    trace =
-	SV_Move(ent-&gt;v.origin, ent-&gt;v.mins, ent-&gt;v.maxs, ent-&gt;v.origin, 0,
-		ent);
-
+    trace = SV_Move(v-&gt;origin, v-&gt;mins, v-&gt;maxs, v-&gt;origin, 0, ent);
     if (trace.startsolid)
-	return sv.edicts;
+	ret = sv.edicts;
 
-    return NULL;
+    return ret;
 }
 
-
 /*
 ===============================================================================
 
@@ -684,8 +683,8 @@
 	trace-&gt;plane.dist = -plane-&gt;dist;
     }
 
-    while (SV_HullPointContents(hull, hull-&gt;firstclipnode, mid)
-	   == CONTENTS_SOLID) {	// shouldn't really happen, but does occasionally
+    /* shouldn't really happen, but does occasionally */
+    while (SV_HullPointContents(hull, hull-&gt;firstclipnode, mid) == CONTENTS_SOLID) {
 	frac -= 0.1;
 	if (frac &lt; 0) {
 	    trace-&gt;fraction = midf;
diff -urN a/QW/common/pmovetst.c head/QW/common/pmovetst.c
--- a/QW/common/pmovetst.c	2006-03-09 19:56:59.000000000 +1030
+++ head/QW/common/pmovetst.c	2006-03-09 17:59:40.000000000 +1030
@@ -308,8 +308,8 @@
 	trace-&gt;plane.dist = -plane-&gt;dist;
     }
 
-    while (PM_HullPointContents(hull, hull-&gt;firstclipnode, mid)
-	   == CONTENTS_SOLID) {	// shouldn't really happen, but does occasionally
+    /* shouldn't really happen, but does occasionally */
+    while (PM_HullPointContents(hull, hull-&gt;firstclipnode, mid) == CONTENTS_SOLID) {
 	frac -= 0.1;
 	if (frac &lt; 0) {
 	    trace-&gt;fraction = midf;
diff -urN a/QW/server/world.c head/QW/server/world.c
--- a/QW/server/world.c	2006-03-09 19:56:59.000000000 +1030
+++ head/QW/server/world.c	2006-03-09 20:00:16.000000000 +1030
@@ -94,7 +94,6 @@
 	box_planes[i].type = i &gt;&gt; 1;
 	box_planes[i].normal[i &gt;&gt; 1] = 1;
     }
-
 }
 
 
@@ -160,8 +159,8 @@
 // calculate an offset value to center the origin
 	VectorSubtract(hull-&gt;clip_mins, mins, offset);
 	VectorAdd(offset, ent-&gt;v.origin, offset);
-    } else {			// create a temp hull from bounding box sizes
-
+    } else {
+	/* create a temp hull from bounding box sizes */
 	VectorSubtract(ent-&gt;v.mins, maxs, hullmins);
 	VectorSubtract(ent-&gt;v.maxs, mins, hullmaxs);
 	hull = SV_HullForBox(hullmins, hullmaxs);
@@ -169,7 +168,6 @@
 	VectorCopy(ent-&gt;v.origin, offset);
     }
 
-
     return hull;
 }
 
@@ -307,7 +305,6 @@
 	    Con_DPrintf("Warning: fixed up link in %s\n", __func__);
 	    next = l-&gt;next;
 	}
-
 	pr_global_struct-&gt;self = old_self;
 	pr_global_struct-&gt;other = old_other;
     }
@@ -386,21 +383,24 @@
     if (ent-&gt;free)
 	return;
 
-// set the abs box
+    /* set the abs box */
     VectorAdd(ent-&gt;v.origin, ent-&gt;v.mins, ent-&gt;v.absmin);
     VectorAdd(ent-&gt;v.origin, ent-&gt;v.maxs, ent-&gt;v.absmax);
 
-//
-// to make items easier to pick up and allow them to be grabbed off
-// of shelves, the abs sizes are expanded
-//
+    /*
+     * To make items easier to pick up and allow them to be grabbed off of
+     * shelves, the abs sizes are expanded
+     */
     if ((int)ent-&gt;v.flags &amp; FL_ITEM) {
 	ent-&gt;v.absmin[0] -= 15;
 	ent-&gt;v.absmin[1] -= 15;
 	ent-&gt;v.absmax[0] += 15;
 	ent-&gt;v.absmax[1] += 15;
-    } else {			// because movement is clipped an epsilon away from an actual edge,
-	// we must fully check even when bounding boxes don't quite touch
+    } else {
+	/*
+	 * because movement is clipped an epsilon away from an actual edge, we
+	 * must fully check even when bounding boxes don't quite touch
+	 */
 	ent-&gt;v.absmin[0] -= 1;
 	ent-&gt;v.absmin[1] -= 1;
 	ent-&gt;v.absmin[2] -= 1;
@@ -409,7 +409,7 @@
 	ent-&gt;v.absmax[2] += 1;
     }
 
-// link to PVS leafs
+    /* link to PVS leafs */
     ent-&gt;num_leafs = 0;
     if (ent-&gt;v.modelindex)
 	SV_FindTouchedLeafs(ent, sv.worldmodel-&gt;nodes);
@@ -417,7 +417,7 @@
     if (ent-&gt;v.solid == SOLID_NOT)
 	return;
 
-// find the first node that the ent's box crosses
+    /* find the first node that the ent's box crosses */
     node = sv_areanodes;
     while (1) {
 	if (node-&gt;axis == -1)
@@ -430,15 +430,14 @@
 	    break;		// crosses the node
     }
 
-// link it in
-
+    /* link it in */
     if (ent-&gt;v.solid == SOLID_TRIGGER)
 	InsertLinkBefore(&amp;ent-&gt;area, &amp;node-&gt;trigger_edicts);
     else
 	InsertLinkBefore(&amp;ent-&gt;area, &amp;node-&gt;solid_edicts);
 
-// if touch_triggers, touch all entities at this node and decend for more
     if (touch_triggers)
+	/* touch all entities at this node and decend for more */
 	SV_TouchLinks(ent, sv_areanodes);
 }
 
@@ -447,12 +446,12 @@
 /*
 ===============================================================================
 
-POINT TESTING IN HULLS
+				POINT TESTING IN HULLS
 
 ===============================================================================
 */
 
-#if	!id386
+#if !id386
 
 /*
 ==================
@@ -520,15 +519,14 @@
 SV_TestEntityPosition(edict_t *ent)
 {
     trace_t trace;
+    entvars_t *v = &amp;ent-&gt;v;
+    edict_t *ret = NULL;
 
-    trace =
-	SV_Move(ent-&gt;v.origin, ent-&gt;v.mins, ent-&gt;v.maxs, ent-&gt;v.origin, 0,
-		ent);
-
+    trace = SV_Move(v-&gt;origin, v-&gt;mins, v-&gt;maxs, v-&gt;origin, 0, ent);
     if (trace.startsolid)
-	return sv.edicts;
+	ret = sv.edicts;
 
-    return NULL;
+    return ret;
 }
 
 /*
@@ -658,13 +656,13 @@
 	trace-&gt;plane.dist = -plane-&gt;dist;
     }
 
-    while (SV_HullPointContents(hull, hull-&gt;firstclipnode, mid)
-	   == CONTENTS_SOLID) {	// shouldn't really happen, but does occasionally
+    /* shouldn't really happen, but does occasionally */
+    while (SV_HullPointContents(hull, hull-&gt;firstclipnode, mid) == CONTENTS_SOLID) {
 	frac -= 0.1;
 	if (frac &lt; 0) {
 	    trace-&gt;fraction = midf;
 	    VectorCopy(mid, trace-&gt;endpos);
-	    Con_Printf("backup past 0\n");
+	    Con_DPrintf("backup past 0\n");
 	    return false;
 	}
 	midf = p1f + (p2f - p1f) * frac;
</pre></body></html>