From 9ed98327896cfeaf94e705d38cb1f80a26b814f8 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 3 May 2004 06:21:39 +0000 Subject: [PATCH] bring back the alpha setting for dlights (finally found out what it was for) and "fix" the wayward dlights in mvds: caused by svc_muzzleflash being written before the player updates. Should probably fix properly that in the server too. --- include/QF/render.h | 2 +- libs/video/renderer/gl/gl_dyn_lights.c | 2 +- nq/source/cl_main.c | 18 ++++++++++-------- nq/source/cl_tent.c | 3 +++ qw/include/cl_parse.h | 1 + qw/source/cl_ents.c | 19 +++++++++++-------- qw/source/cl_parse.c | 4 +++- qw/source/cl_tent.c | 3 +++ 8 files changed, 33 insertions(+), 19 deletions(-) diff --git a/include/QF/render.h b/include/QF/render.h index ebcac5f5d..ef06c88b7 100644 --- a/include/QF/render.h +++ b/include/QF/render.h @@ -44,7 +44,7 @@ typedef struct dlight_s float die; // stop lighting after this time float decay; // drop this each second float minlight; // don't add when contributing less - float color[3]; // Don't use alpha --KB + float color[4]; } dlight_t; extern dlight_t *r_dlights; diff --git a/libs/video/renderer/gl/gl_dyn_lights.c b/libs/video/renderer/gl/gl_dyn_lights.c index d789ad975..b316b86a9 100644 --- a/libs/video/renderer/gl/gl_dyn_lights.c +++ b/libs/video/renderer/gl/gl_dyn_lights.c @@ -90,7 +90,7 @@ R_RenderDlight (dlight_t *light) qfglBegin (GL_TRIANGLE_FAN); - qfglColor3fv (light->color); + qfglColor4fv (light->color); VectorSubtract (r_origin, light->origin, v); VectorNormalize (v); diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 9b0403b9b..8e4774e63 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -400,10 +400,10 @@ CL_NewDlight (int key, vec3_t org, int effects) float radius; float time = 0.1; dlight_t *dl; - static vec3_t normal = {0.4, 0.2, 0.05}; - static vec3_t red = {0.5, 0.05, 0.05}; - static vec3_t blue = {0.05, 0.05, 0.5}; - static vec3_t purple = {0.5, 0.05, 0.5}; + static quat_t normal = {0.4, 0.2, 0.05, 0.7}; + static quat_t red = {0.5, 0.05, 0.05, 0.7}; + static quat_t blue = {0.05, 0.05, 0.5, 0.7}; + static quat_t purple = {0.5, 0.05, 0.5, 0.7}; if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT))) return; @@ -425,16 +425,16 @@ CL_NewDlight (int key, vec3_t org, int effects) switch (effects & (EF_BLUE | EF_RED)) { case EF_RED | EF_BLUE: - VectorCopy (purple, dl->color); + QuatCopy (purple, dl->color); break; case EF_RED: - VectorCopy (red, dl->color); + QuatCopy (red, dl->color); break; case EF_BLUE: - VectorCopy (blue, dl->color); + QuatCopy (blue, dl->color); break; default: - VectorCopy (normal, dl->color); + QuatCopy (normal, dl->color); break; } } @@ -598,6 +598,7 @@ CL_RelinkEntities (void) dl->color[0] = 0.2; dl->color[1] = 0.1; dl->color[2] = 0.05; + dl->color[3] = 0.7; } } CL_NewDlight (i, ent->origin, state->effects); @@ -611,6 +612,7 @@ CL_RelinkEntities (void) dl->radius = 200; dl->die = cl.time + 0.1; VectorCopy (r_firecolor->vec, dl->color); + dl->color[3] = 0.7; } R_RocketTrail (ent); } else if (ent->model->flags & EF_GRENADE) diff --git a/nq/source/cl_tent.c b/nq/source/cl_tent.c index 791250693..998d3b1a4 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -339,6 +339,7 @@ CL_ParseTEnt (void) dl->color[0] = 1.0; dl->color[1] = 0.5; dl->color[2] = 0.25; + dl->color[3] = 0.7; } // sound @@ -409,6 +410,7 @@ CL_ParseTEnt (void) dl->color[0] = vid.palette[colorStart] * (1.0 / 255.0); dl->color[1] = vid.palette[colorStart + 1] * (1.0 / 255.0); dl->color[2] = vid.palette[colorStart + 2] * (1.0 / 255.0); + dl->color[3] = 0.7; break; case TE_EXPLOSION3: // Nehahra colored light explosion @@ -423,6 +425,7 @@ CL_ParseTEnt (void) dl->die = cl.time + 0.5; dl->decay = 300; VectorCopy (col, dl->color); + dl->color[3] = 0.7; } break; diff --git a/qw/include/cl_parse.h b/qw/include/cl_parse.h index 5ab36598d..7c3cc0f3b 100644 --- a/qw/include/cl_parse.h +++ b/qw/include/cl_parse.h @@ -38,6 +38,7 @@ struct skin_s; extern int packet_latency[NET_TIMINGS]; extern int parsecountmod; +extern int player_parsecountmod; extern double parsecounttime; extern int cl_playerindex; extern int cl_flagindex; diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index fc15dba6b..04e238c5e 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -97,10 +97,10 @@ CL_NewDlight (int key, vec3_t org, int effects, byte glow_size, { float radius; dlight_t *dl; - static vec3_t normal = {0.4, 0.2, 0.05}; - static vec3_t red = {0.5, 0.05, 0.05}; - static vec3_t blue = {0.05, 0.05, 0.5}; - static vec3_t purple = {0.5, 0.05, 0.5}; + static quat_t normal = {0.4, 0.2, 0.05, 0.7}; + static quat_t red = {0.5, 0.05, 0.05, 0.7}; + static quat_t blue = {0.05, 0.05, 0.5, 0.7}; + static quat_t purple = {0.5, 0.05, 0.5, 0.7}; effects &= EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT; if (!effects) { @@ -126,16 +126,16 @@ CL_NewDlight (int key, vec3_t org, int effects, byte glow_size, dl->die = cl.time + 0.1; switch (effects & (EF_RED | EF_BLUE)) { case EF_RED | EF_BLUE: - VectorCopy (purple, dl->color); + QuatCopy (purple, dl->color); break; case EF_RED: - VectorCopy (red, dl->color); + QuatCopy (red, dl->color); break; case EF_BLUE: - VectorCopy (blue, dl->color); + QuatCopy (blue, dl->color); break; default: - VectorCopy (normal, dl->color); + QuatCopy (normal, dl->color); break; } } @@ -537,6 +537,7 @@ CL_LinkPacketEntities (void) dl->radius = 200.0; dl->die = cl.time + 0.1; VectorCopy (r_firecolor->vec, dl->color); + dl->color[3] = 0.7; } R_RocketTrail (*ent); } else if (model->flags & EF_GRENADE) @@ -663,6 +664,7 @@ CL_ParsePlayerinfo (void) Host_Error ("CL_ParsePlayerinfo: bad num"); info = &cl.players[num]; + player_parsecountmod = parsecountmod; state = &cl.frames[parsecountmod].playerstate[num]; state->number = num; @@ -1160,6 +1162,7 @@ CL_EmitEntities (void) dl->color[0] = 0; dl->color[1] = 1; dl->color[2] = 0; + dl->color[3] = 0.7; } VectorCopy (nearloc->loc, trueloc); R_WizSpikeEffect (trueloc); diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index f2e0c0f29..51f26b7d4 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -159,6 +159,7 @@ const char *svc_strings[] = { int oldparsecountmod; int parsecountmod; +int player_parsecountmod; double parsecounttime; int viewentity; @@ -1156,7 +1157,7 @@ CL_MuzzleFlash (void) if ((unsigned int) (i - 1) >= MAX_CLIENTS) return; - pl = &cl.frames[parsecountmod].playerstate[i - 1]; + pl = &cl.frames[player_parsecountmod].playerstate[i - 1]; dl = R_AllocDlight (i); if (!dl) @@ -1174,6 +1175,7 @@ CL_MuzzleFlash (void) dl->color[0] = 0.2; dl->color[1] = 0.1; dl->color[2] = 0.05; + dl->color[3] = 0.7; } #define SHOWNET(x) \ diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index e18e31911..4dd2193b4 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -350,6 +350,7 @@ CL_ParseTEnt (void) dl->color[0] = 0.86; dl->color[1] = 0.31; dl->color[2] = 0.24; + dl->color[3] = 0.7; } // sound @@ -419,6 +420,7 @@ CL_ParseTEnt (void) dl->color[0] = vid.palette[colorStart] * (1.0 / 255.0); dl->color[1] = vid.palette[colorStart + 1] * (1.0 / 255.0); dl->color[2] = vid.palette[colorStart + 2] * (1.0 / 255.0); + dl->color[3] = 0.7; break; case TE_GUNSHOT: // bullet hitting wall @@ -446,6 +448,7 @@ CL_ParseTEnt (void) dl->color[0] = 0.25; dl->color[1] = 0.40; dl->color[2] = 0.65; + dl->color[3] = 1; } R_LightningBloodEffect (pos);