<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">[PATCH] Colour for all dlights

This patch adds a colour field to NQ dlights, removing one more difference
between the NQ and QW source bases.

diff -urN a/NQ/cl_main.c b/NQ/cl_main.c
--- a/NQ/cl_main.c	2004-08-11 22:35:12.000000000 +0930
+++ b/NQ/cl_main.c	2005-03-06 13:03:19.000000000 +1030
@@ -536,6 +536,11 @@
 	if (ent-&gt;model-&gt;flags &amp; EF_ROTATE)
 	    ent-&gt;angles[1] = bobjrotate;
 
+	/*
+	 * FIXME - Some of these entity effects may be mutually exclusive?
+	 * work out which bits can be done better (e.g. I've already done the
+	 * RED|BLUE bit a little better...)
+	 */
 	if (ent-&gt;effects &amp; EF_BRIGHTFIELD)
 	    R_EntityParticles(ent);
 	if (ent-&gt;effects &amp; EF_MUZZLEFLASH) {
@@ -550,6 +555,10 @@
 	    dl-&gt;radius = 200 + (rand() &amp; 31);
 	    dl-&gt;minlight = 32;
 	    dl-&gt;die = cl.time + 0.1;
+	    dl-&gt;color[0] = 0.2;
+	    dl-&gt;color[1] = 0.1;
+	    dl-&gt;color[2] = 0.05;
+	    dl-&gt;color[3] = 0.7;
 	}
 	if (ent-&gt;effects &amp; EF_BRIGHTLIGHT) {
 	    dl = CL_AllocDlight(i);
@@ -557,12 +566,48 @@
 	    dl-&gt;origin[2] += 16;
 	    dl-&gt;radius = 400 + (rand() &amp; 31);
 	    dl-&gt;die = cl.time + 0.001;
+	    dl-&gt;color[0] = 0.2;
+	    dl-&gt;color[1] = 0.1;
+	    dl-&gt;color[2] = 0.05;
+	    dl-&gt;color[3] = 0.7;
 	}
 	if (ent-&gt;effects &amp; EF_DIMLIGHT) {
 	    dl = CL_AllocDlight(i);
 	    VectorCopy(ent-&gt;origin, dl-&gt;origin);
 	    dl-&gt;radius = 200 + (rand() &amp; 31);
 	    dl-&gt;die = cl.time + 0.001;
+	    dl-&gt;color[0] = 0.2;
+	    dl-&gt;color[1] = 0.1;
+	    dl-&gt;color[2] = 0.05;
+	    dl-&gt;color[3] = 0.7;
+	}
+	if ((ent-&gt;effects &amp; (EF_RED | EF_BLUE)) == (EF_RED | EF_BLUE)) {
+	    dl = CL_AllocDlight(i);
+	    VectorCopy(ent-&gt;origin, dl-&gt;origin);
+	    dl-&gt;radius = 200 + (rand() &amp; 31);
+	    dl-&gt;die = cl.time + 0.001;
+	    dl-&gt;color[0] = 0.5;
+	    dl-&gt;color[1] = 0.05;
+	    dl-&gt;color[2] = 0.4;
+	    dl-&gt;color[3] = 0.7;
+	} else if (ent-&gt;effects &amp; EF_BLUE) {
+	    dl = CL_AllocDlight(i);
+	    VectorCopy(ent-&gt;origin, dl-&gt;origin);
+	    dl-&gt;radius = 200 + (rand() &amp; 31);
+	    dl-&gt;die = cl.time + 0.001;
+	    dl-&gt;color[0] = 0.05;
+	    dl-&gt;color[1] = 0.05;
+	    dl-&gt;color[2] = 0.3;
+	    dl-&gt;color[3] = 0.7;
+	} else if (ent-&gt;effects &amp; EF_RED) {
+	    dl = CL_AllocDlight(i);
+	    VectorCopy(ent-&gt;origin, dl-&gt;origin);
+	    dl-&gt;radius = 200 + (rand() &amp; 31);
+	    dl-&gt;die = cl.time + 0.001;
+	    dl-&gt;color[0] = 0.5;
+	    dl-&gt;color[1] = 0.05;
+	    dl-&gt;color[2] = 0.05;
+	    dl-&gt;color[3] = 0.7;
 	}
 
 	if (ent-&gt;model-&gt;flags &amp; EF_GIB)
diff -urN a/NQ/client.h b/NQ/client.h
--- a/NQ/client.h	2004-07-25 15:59:53.000000000 +0930
+++ b/NQ/client.h	2005-03-06 13:03:19.000000000 +1030
@@ -48,6 +48,7 @@
     float die;			// stop lighting after this time
     float decay;		// drop this each second
     float minlight;		// don't add when contributing less
+    float color[4];
 } dlight_t;
 
 typedef struct {
diff -urN a/NQ/gl_model.h b/NQ/gl_model.h
--- a/NQ/gl_model.h	2005-01-15 15:48:49.000000000 +1030
+++ b/NQ/gl_model.h	2005-03-06 13:03:19.000000000 +1030
@@ -41,6 +41,9 @@
 #define	EF_BRIGHTLIGHT 	4
 #define	EF_DIMLIGHT 	8
 
+#define EF_BLUE		64
+#define EF_RED		128
+
 /*
 ==============================================================================
 
diff -urN a/common/gl_rlight.c b/common/gl_rlight.c
--- a/common/gl_rlight.c	2005-01-09 10:57:12.000000000 +1030
+++ b/common/gl_rlight.c	2005-03-06 13:03:19.000000000 +1030
@@ -124,14 +124,9 @@
     }
 
     glBegin(GL_TRIANGLE_FAN);
-#ifdef NQ_HACK
-    glColor3f(0.2, 0.1, 0.0);
-#endif
-    //glColor3f(0.2, 0.1, 0.05); // changed dimlight effect
-#ifdef QW_HACK
     glColor4f(light-&gt;color[0], light-&gt;color[1], light-&gt;color[2],
 	      light-&gt;color[3]);
-#endif
+
     for (i = 0; i &lt; 3; i++)
 	v[i] = light-&gt;origin[i] - vpn[i] * rad;
     glVertex3fv(v);
</pre></body></html>