[PATCH] Prepare r_bsp.c files for merge

Remove unnecessary differences between the two r_bsp.c files. A few missed
statics in NQ, numerous whitespace/comment formatting differences and one hack
for the cl_entities[0] vs. r_worldentity disparity.

diff -urN -X exclude a/NQ/r_bsp.c head/NQ/r_bsp.c
--- a/NQ/r_bsp.c	2004-07-25 15:59:53.000000000 +0930
+++ head/NQ/r_bsp.c	2006-05-28 14:59:13.000000000 +0930
@@ -36,7 +36,7 @@
 
 vec3_t r_entorigin;	// the currently rendering entity in world coordinates
 
-float entity_rotation[3][3];
+static float entity_rotation[3][3];
 
 vec3_t r_worldmodelorg;
 
@@ -63,7 +63,7 @@
 R_EntityRotate
 ================
 */
-void
+static void
 R_EntityRotate(vec3_t vec)
 {
     vec3_t tvec;
@@ -106,7 +106,6 @@
     temp1[2][1] = 0;
     temp1[2][2] = 1;
 
-
 // pitch
     angle = currententity->angles[PITCH];
     angle = angle * M_PI * 2 / 360;
@@ -160,7 +159,7 @@
 R_RecursiveClipBPoly
 ================
 */
-void
+static void
 R_RecursiveClipBPoly(bedge_t *pedges, mnode_t *pnode, msurface_t *psurf)
 {
     bedge_t *psideedges[2], *pnextedge, *ptedge;
@@ -281,7 +280,8 @@
 
 	numbedges += 2;
     }
-// draw or recurse further
+
+    /* draw or recurse further */
     for (i = 0; i < 2; i++) {
 	if (psideedges[i]) {
 	    /*
@@ -369,10 +369,8 @@
 			pbedge[j].v[0] = &r_pcurrentvertbase[pedge->v[1]];
 			pbedge[j].v[1] = &r_pcurrentvertbase[pedge->v[0]];
 		    }
-
 		    pbedge[j].pnext = &pbedge[j + 1];
 		}
-
 		pbedge[j - 1].pnext = NULL;	// mark end of edges
 
 		R_RecursiveClipBPoly(pbedge, currententity->topnode, psurf);
@@ -477,7 +475,8 @@
 		clipflags &= ~(1 << i);	// node is entirely on screen
 	}
     }
-// if a leaf node, draw stuff
+
+    /* if a leaf node, draw stuff */
     if (node->contents < 0) {
 	pleaf = (mleaf_t *)node;
 
@@ -490,6 +489,7 @@
 		mark++;
 	    } while (--c);
 	}
+
 	// deal with model fragments in this leaf
 	if (pleaf->efrags) {
 	    R_StoreEfrags(&pleaf->efrags);
@@ -501,7 +501,6 @@
 	// node is just a decision point, so go down the apropriate sides
 	// find which side of the node we are on
 	plane = node->plane;
-
 	switch (plane->type) {
 	case PLANE_X:
 	    dot = modelorg[0] - plane->dist;
@@ -516,11 +515,7 @@
 	    dot = DotProduct(modelorg, plane->normal) - plane->dist;
 	    break;
 	}
-
-	if (dot >= 0)
-	    side = 0;
-	else
-	    side = 1;
+	side = (dot >= 0) ? 0 : 1;
 
 	// recurse down the children, front side first
 	R_RecursiveWorldNode(node->children[side], clipflags);
@@ -550,7 +545,6 @@
 			    R_RenderFace(surf, clipflags);
 			}
 		    }
-
 		    surf++;
 		} while (--c);
 	    } else if (dot > BACKFACE_EPSILON) {
@@ -572,7 +566,6 @@
 			    R_RenderFace(surf, clipflags);
 			}
 		    }
-
 		    surf++;
 		} while (--c);
 	    }
@@ -600,7 +593,12 @@
 
     pbtofpolys = btofpolys;
 
+#ifdef NQ_HACK
     currententity = &cl_entities[0];
+#endif
+#ifdef QW_HACK
+    currententity = &r_worldentity;
+#endif
     VectorCopy(r_origin, modelorg);
     clmodel = currententity->model;
     r_pcurrentvertbase = clmodel->vertexes;
diff -urN -X exclude a/QW/client/r_bsp.c head/QW/client/r_bsp.c
--- a/QW/client/r_bsp.c	2004-07-25 15:59:55.000000000 +0930
+++ head/QW/client/r_bsp.c	2006-05-28 14:59:04.000000000 +0930
@@ -29,13 +29,12 @@
 //
 qboolean insubmodel;
 entity_t *currententity;
-vec3_t modelorg, base_modelorg;
 
 // modelorg is the viewpoint reletive to
 // the currently rendering entity
+vec3_t modelorg, base_modelorg;
 
-vec3_t r_entorigin;	// the currently rendering entity in world
-			// coordinates
+vec3_t r_entorigin;	// the currently rendering entity in world coordinates
 
 static float entity_rotation[3][3];
 
@@ -282,11 +281,13 @@
 	numbedges += 2;
     }
 
-// draw or recurse further
+    /* draw or recurse further */
     for (i = 0; i < 2; i++) {
 	if (psideedges[i]) {
-	    // draw if we've reached a non-solid leaf, done if all that's left
-	    // is a solid leaf, and continue down the tree if it's not a leaf
+	    /*
+	     * draw if we've reached a non-solid leaf, done if all that's left
+	     * is a solid leaf, and continue down the tree if it's not a leaf
+	     */
 	    pn = pnode->children[i];
 
 	    // we're done with this branch if the node or leaf isn't in the PVS
@@ -343,8 +344,10 @@
 	    // copy the edges to bedges, flipping if necessary so always
 	    // clockwise winding
 
-	    // FIXME: if edges and vertices get caches, these assignments must
-	    // move outside the loop, and overflow checking must be done here
+	    /*
+	     * FIXME: if edges and vertices get caches, these assignments must
+	     * move outside the loop, and overflow checking must be done here
+	     */
 	    pbverts = bverts;
 	    pbedges = bedges;
 	    numbverts = numbedges = 0;
@@ -437,9 +440,9 @@
     if (node->visframe != r_visframecount)
 	return;
 
-    // cull the clipping planes if not trivial accept
-    // FIXME: the compiler is doing a lousy job of optimizing here; it could be
-    //  twice as fast in ASM
+// cull the clipping planes if not trivial accept
+// FIXME: the compiler is doing a lousy job of optimizing here; it could be
+//  twice as fast in ASM
     if (clipflags) {
 	for (i = 0; i < 4; i++) {
 	    if (!(clipflags & (1 << i)))
@@ -473,7 +476,7 @@
 	}
     }
 
-    // if a leaf node, draw stuff
+    /* if a leaf node, draw stuff */
     if (node->contents < 0) {
 	pleaf = (mleaf_t *)node;
 
@@ -496,10 +499,8 @@
 	r_currentkey++;		// all bmodels in a leaf share the same key
     } else {
 	// node is just a decision point, so go down the apropriate sides
-
 	// find which side of the node we are on
 	plane = node->plane;
-
 	switch (plane->type) {
 	case PLANE_X:
 	    dot = modelorg[0] - plane->dist;
@@ -514,7 +515,6 @@
 	    dot = DotProduct(modelorg, plane->normal) - plane->dist;
 	    break;
 	}
-
 	side = (dot >= 0) ? 0 : 1;
 
 	// recurse down the children, front side first
@@ -593,7 +593,12 @@
 
     pbtofpolys = btofpolys;
 
+#ifdef NQ_HACK
+    currententity = &cl_entities[0];
+#endif
+#ifdef QW_HACK
     currententity = &r_worldentity;
+#endif
     VectorCopy(r_origin, modelorg);
     clmodel = currententity->model;
     r_pcurrentvertbase = clmodel->vertexes;
