shithub: qk1

Download patch

ref: f447b03876ddf74796f10c04450d880c966b3042
parent: 2f05d0cc81d8f7af5816cab71bf531698c6f2125
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Mon Oct 16 08:30:01 EDT 2023

detect fence-like textures but ignore them when drawing - they look like shit

--- a/d_edge.c
+++ b/d_edge.c
@@ -185,6 +185,9 @@
 			if (!s->spans)
 				continue;
 
+			if (s->flags & SURF_TRANS)
+				continue;
+
 			r_drawnpolycount++;
 
 			d_zistepu = s->d_zistepu;
--- a/d_modech.c
+++ b/d_modech.c
@@ -9,7 +9,7 @@
 int	d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift;
 
 int		d_scantable[MAXHEIGHT];
-uzint	*zspantable[MAXHEIGHT]; 
+uzint	*zspantable[MAXHEIGHT];
 
 /*
 ================
--- a/d_zpoint.c
+++ b/d_zpoint.c
@@ -25,4 +25,3 @@
 		*pdest = r_zpointdesc.color;
 	}
 }
-
--- a/model.c
+++ b/model.c
@@ -776,16 +776,17 @@
 		out->samples = (i = le32(in)) < 0 ? nil : loadmodel->lightdata + i;
 
 	// set the drawing flags flag
-		
+
 		if(strncmp(out->texinfo->texture->name, "sky", 3) == 0)
 			out->flags |= SURF_DRAWSKY | SURF_DRAWTILED;
-		else if(strncmp(out->texinfo->texture->name, "*", 1) == 0){	// turbulent
+		else if(out->texinfo->texture->name[0] == '*'){	// turbulent
 			out->flags |= SURF_DRAWTURB | SURF_DRAWTILED;
 			for (i=0 ; i<2 ; i++){
 				out->extents[i] = 16384;
 				out->texturemins[i] = -8192;
 			}
-		}
+		}else if(out->texinfo->texture->name[0] == '{')
+			out->flags |= SURF_TRANS | SURF_FENCE;
 	}
 }
 
--- a/model.h
+++ b/model.h
@@ -55,13 +55,16 @@
 	unsigned	offsets[MIPLEVELS];		// four mip maps stored
 } texture_t;
 
-
-#define	SURF_PLANEBACK		2
-#define	SURF_DRAWSKY		4
-#define SURF_DRAWSPRITE		8
-#define SURF_DRAWTURB		0x10
-#define SURF_DRAWTILED		0x20
-#define SURF_DRAWBACKGROUND	0x40
+enum {
+	SURF_PLANEBACK = 1<<1,
+	SURF_DRAWSKY = 1<<2,
+	SURF_DRAWSPRITE = 1<<3,
+	SURF_DRAWTURB = 1<<4,
+	SURF_DRAWTILED = 1<<5,
+	SURF_DRAWBACKGROUND = 1<<6,
+	SURF_TRANS = 1<<8,
+	SURF_FENCE = 1<<9,
+};
 
 // !!! if this is changed, it must be changed in asm_draw.h too !!!
 typedef struct
--- a/r_bsp.c
+++ b/r_bsp.c
@@ -327,6 +327,8 @@
 
 	for (i=0 ; i<numsurfaces ; i++, psurf++)
 	{
+		if(psurf->flags & SURF_TRANS)
+			continue;
 	// find which side of the node we are on
 		pplane = psurf->plane;
 
@@ -404,6 +406,9 @@
 
 	for (i=0 ; i<numsurfaces ; i++, psurf++)
 	{
+		if(psurf->flags & SURF_TRANS)
+			continue;
+
 	// find which side of the node we are on
 		pplane = psurf->plane;
 
--- a/r_draw.c
+++ b/r_draw.c
@@ -382,6 +382,9 @@
 		return;
 	}
 
+	if(fa->flags & SURF_TRANS)
+		return;
+
 	c_faceclip++;
 
 // set up clip planes