shithub: qk1

Download patch

ref: 70ad28fbebef4f98ddb2ca5ff2ebb839430bd347
parent: f636a9deaf4598ff7e48209b1a4b1f04f294a00a
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Wed Nov 1 18:29:59 EDT 2023

remove more crap

--- a/d_iface.h
+++ b/d_iface.h
@@ -88,17 +88,9 @@
 	int		color;
 } zpointdesc_t;
 
-extern cvar_t	r_drawflat;
 extern int		d_spanpixcount;
 extern int		r_framecount;		// sequence # of current frame since Quake
 									//  started
-extern qboolean	r_drawpolys;		// 1 if driver wants clipped polygons
-									//  rather than a span list
-extern qboolean	r_drawculledpolys;	// 1 if driver wants clipped polygons that
-									//  have been culled by the edge list
-extern qboolean	r_worldpolysbacktofront;	// 1 if driver wants polygons
-											//  delivered back to front rather
-											//  than front to back
 extern qboolean	r_recursiveaffinetriangles;	// true if a driver wants to use
 											//  recursive triangular subdivison
 											//  and vertex drawing via
--- a/d_init.c
+++ b/d_init.c
@@ -31,8 +31,6 @@
 	Cvar_RegisterVariable (&d_mipcap);
 	Cvar_RegisterVariable (&d_mipscale);
 
-	r_drawpolys = false;
-	r_worldpolysbacktofront = false;
 	r_recursiveaffinetriangles = true;
 	r_aliasuvscale = 1.0;
 }
--- a/r_bsp.c
+++ b/r_bsp.c
@@ -519,10 +519,7 @@
 			break;
 		}
 	
-		if (dot >= 0)
-			side = 0;
-		else
-			side = 1;
+		side = dot < 0;
 
 	// recurse down the children, front side first
 		R_RecursiveWorldNode (node->children[side], clipflags);
@@ -530,75 +527,21 @@
 	// draw stuff
 		c = node->numsurfaces;
 
-		if (c)
-		{
+		if(c){
 			surf = cl.worldmodel->surfaces + node->firstsurface;
 
-			if (dot < -BACKFACE_EPSILON)
-			{
-				do
-				{
-					if ((surf->flags & SURF_PLANEBACK) &&
-						(surf->visframe == r_framecount))
-					{
-						if (r_drawpolys)
-						{
-							if (r_worldpolysbacktofront)
-							{
-								if (numbtofpolys < MAX_BTOFPOLYS)
-								{
-									pbtofpolys[numbtofpolys].clipflags =
-											clipflags;
-									pbtofpolys[numbtofpolys].psurf = surf;
-									numbtofpolys++;
-								}
-							}
-							else
-							{
-								R_RenderPoly (surf, clipflags);
-							}
-						}
-						else
-						{
-							R_RenderFace (surf, clipflags);
-						}
-					}
-
+			if(dot < -BACKFACE_EPSILON){
+				do{
+					if((surf->flags & SURF_PLANEBACK) && surf->visframe == r_framecount)
+						R_RenderFace (surf, clipflags);
 					surf++;
-				} while (--c);
-			}
-			else if (dot > BACKFACE_EPSILON)
-			{
-				do
-				{
-					if (!(surf->flags & SURF_PLANEBACK) &&
-						(surf->visframe == r_framecount))
-					{
-						if (r_drawpolys)
-						{
-							if (r_worldpolysbacktofront)
-							{
-								if (numbtofpolys < MAX_BTOFPOLYS)
-								{
-									pbtofpolys[numbtofpolys].clipflags =
-											clipflags;
-									pbtofpolys[numbtofpolys].psurf = surf;
-									numbtofpolys++;
-								}
-							}
-							else
-							{
-								R_RenderPoly (surf, clipflags);
-							}
-						}
-						else
-						{
-							R_RenderFace (surf, clipflags);
-						}
-					}
-
+				}while(--c);
+			}else if(dot > BACKFACE_EPSILON){
+				do{
+					if(!(surf->flags & SURF_PLANEBACK) && surf->visframe == r_framecount)
+						R_RenderFace(surf, clipflags);
 					surf++;
-				} while (--c);
+				}while(--c);
 			}
 
 		// all surfaces on the same node share the same sequence number
@@ -619,12 +562,8 @@
 */
 void R_RenderWorld (void)
 {
-	int			i;
 	model_t		*clmodel;
-	btofpoly_t	btofpolys[MAX_BTOFPOLYS];
 
-	pbtofpolys = btofpolys;
-
 	currententity = &cl_entities[0];
 	VectorCopy (r_origin, modelorg);
 	clmodel = currententity->model;
@@ -631,16 +570,6 @@
 	r_pcurrentvertbase = clmodel->vertexes;
 
 	R_RecursiveWorldNode (clmodel->nodes, 15);
-
-// if the driver wants the polygons back to front, play the visible ones back
-// in that order
-	if (r_worldpolysbacktofront)
-	{
-		for (i=numbtofpolys-1 ; i>=0 ; i--)
-		{
-			R_RenderPoly (btofpolys[i].psurf, btofpolys[i].clipflags);
-		}
-	}
 }
 
 
--- a/r_edge.c
+++ b/r_edge.c
@@ -53,48 +53,6 @@
 
 /*
 ==============
-R_DrawCulledPolys
-==============
-*/
-void R_DrawCulledPolys (void)
-{
-	surf_t			*s;
-	msurface_t		*pface;
-
-	currententity = &cl_entities[0];
-
-	if (r_worldpolysbacktofront)
-	{
-		for (s=surface_p-1 ; s>&surfaces[1] ; s--)
-		{
-			if (!s->spans)
-				continue;
-
-			if (!(s->flags & SURF_DRAWBACKGROUND))
-			{
-				pface = (msurface_t *)s->data;
-				R_RenderPoly (pface, 15);
-			}
-		}
-	}
-	else
-	{
-		for (s = &surfaces[1] ; s<surface_p ; s++)
-		{
-			if (!s->spans)
-				continue;
-
-			if (!(s->flags & SURF_DRAWBACKGROUND))
-			{
-				pface = (msurface_t *)s->data;
-				R_RenderPoly (pface, 15);
-			}
-		}
-	}
-}
-
-/*
-==============
 R_BeginEdgeFrame
 ==============
 */
@@ -649,14 +607,7 @@
 		if (span_p >= max_span_p)
 		{
 			r_outofspans++;
-			if (r_drawculledpolys)
-			{
-				R_DrawCulledPolys ();
-			}
-			else
-			{
-				D_DrawSurfaces ();
-			}
+			D_DrawSurfaces ();
 
 		// clear the surface span pointers
 			for (s = &surfaces[1] ; s<surface_p ; s++)
@@ -686,10 +637,7 @@
 	(*pdrawfunc) ();
 
 // draw whatever's left in the span list
-	if (r_drawculledpolys)
-		R_DrawCulledPolys ();
-	else
-		D_DrawSurfaces ();
+	D_DrawSurfaces ();
 }
 
 
--- a/r_local.h
+++ b/r_local.h
@@ -175,16 +175,6 @@
 extern int		r_currentkey;
 extern int		r_currentbkey;
 
-typedef struct btofpoly_s {
-	int			clipflags;
-	msurface_t	*psurf;
-} btofpoly_t;
-
-#define MAX_BTOFPOLYS	5000	// FIXME: tune this
-
-extern int			numbtofpolys;
-extern btofpoly_t	*pbtofpolys;
-
 void	R_InitTurb (void);
 void	R_ZDrawSubmodelPolys (model_t *clmodel);
 
--- a/r_main.c
+++ b/r_main.c
@@ -13,9 +13,6 @@
 int			r_numallocatededges;
 int			r_numallocatedbasespans;
 byte		*r_basespans;
-qboolean	r_drawpolys;
-qboolean	r_drawculledpolys;
-qboolean	r_worldpolysbacktofront;
 qboolean	r_recursiveaffinetriangles = true;
 float		r_aliasuvscale = 1.0;
 int			r_outofsurfaces;
@@ -24,8 +21,6 @@
 
 qboolean	r_dowarp, r_dowarpold, r_viewchanged;
 
-int			numbtofpolys;
-btofpoly_t	*pbtofpolys;
 mvertex_t	*r_pcurrentvertbase;
 
 int			c_surf;
@@ -580,41 +575,34 @@
 			}
 		}
 
-		// if the driver wants polygons, deliver those. Z-buffering is on
-		// at this point, so no clipping to the world tree is needed, just
-		// frustum clipping
-		if(r_drawpolys || r_drawculledpolys){
-			R_ZDrawSubmodelPolys(clmodel);
-		}else{
-			r_pefragtopnode = nil;
+		r_pefragtopnode = nil;
 
-			for(j = 0; j < 3; j++){
-				r_emins[j] = minmaxs[j];
-				r_emaxs[j] = minmaxs[3+j];
-			}
+		for(j = 0; j < 3; j++){
+			r_emins[j] = minmaxs[j];
+			r_emaxs[j] = minmaxs[3+j];
+		}
 
-			R_SplitEntityOnNode2(cl.worldmodel->nodes);
+		R_SplitEntityOnNode2(cl.worldmodel->nodes);
 
-			if(r_pefragtopnode){
-				e->topnode = r_pefragtopnode;
+		if(r_pefragtopnode){
+			e->topnode = r_pefragtopnode;
 
-				if(r_drawflags & DRAW_BLEND)
-					R_BeginEdgeFrame();
-				if(r_pefragtopnode->contents >= 0){
-					// not a leaf; has to be clipped to the world BSP
-					r_clipflags = clipflags;
-					R_DrawSolidClippedSubmodelPolygons(clmodel);
-				}else{
-					// falls entirely in one leaf, so we just put all the
-					// edges in the edge list and let 1/z sorting handle
-					// drawing order
-					R_DrawSubmodelPolygons(clmodel, clipflags);
-				}
-				if(r_drawflags & DRAW_BLEND)
-					R_ScanEdges();
-
-				e->topnode = nil;
+			if(r_drawflags & DRAW_BLEND)
+				R_BeginEdgeFrame();
+			if(r_pefragtopnode->contents >= 0){
+				// not a leaf; has to be clipped to the world BSP
+				r_clipflags = clipflags;
+				R_DrawSolidClippedSubmodelPolygons(clmodel);
+			}else{
+				// falls entirely in one leaf, so we just put all the
+				// edges in the edge list and let 1/z sorting handle
+				// drawing order
+				R_DrawSubmodelPolygons(clmodel, clipflags);
 			}
+			if(r_drawflags & DRAW_BLEND)
+				R_ScanEdges();
+
+			e->topnode = nil;
 		}
 
 		// put back world rotation and frustum clipping		
@@ -753,7 +741,6 @@
 	R_DrawParticles ();
 
 	r_drawflags = DRAW_BLEND;
-	r_worldpolysbacktofront = true;
 	R_EdgeDrawing();
 	for(i = 0; i < cl_numvisedicts; i++)
 		R_DrawEntity(cl_visedicts[i]);
--- a/r_misc.c
+++ b/r_misc.c
@@ -182,8 +182,6 @@
 
 	r_framecount++;
 
-	numbtofpolys = 0;
-
 /* debugging
 r_refdef.vieworg[0]=  80;
 r_refdef.vieworg[1]=      64;