From 90f4bf5fa76b7bbf60feebad54eb9e4165b94eae Mon Sep 17 00:00:00 2001 From: Ragnvald Maartmann-Moe IV Date: Fri, 7 Jun 2002 05:21:53 +0000 Subject: [PATCH] Improve dlight flag combination behaviors, plus some more dlight initialization cleanups. --- nq/source/cl_main.c | 45 ++++++++++++++++++++++---------------------- nq/source/cl_tent.c | 8 ++++---- qw/source/cl_ents.c | 38 ++++++++++++++++++------------------- qw/source/cl_parse.c | 5 ++--- qw/source/cl_tent.c | 9 +++++---- 5 files changed, 52 insertions(+), 53 deletions(-) diff --git a/nq/source/cl_main.c b/nq/source/cl_main.c index 1686e9130..316c1ff1c 100644 --- a/nq/source/cl_main.c +++ b/nq/source/cl_main.c @@ -437,31 +437,31 @@ CL_NewDlight (int key, vec3_t org, int effects) if (!dl) return; VectorCopy (org, dl->origin); - - switch (effects & (EF_BLUE | EF_RED)) { - case EF_BLUE | EF_RED: - VectorCopy (purple, dl->color); - break; - case EF_BLUE: - VectorCopy (blue, dl->color); - break; - case EF_RED: - VectorCopy (red, dl->color); - break; - default: - VectorCopy (normal, dl->color); - break; - } - if (effects & EF_DIMLIGHT) { - VectorScale (dl->color, 0.5, dl->color); - } radius = 200 + (rand () & 31); if (effects & EF_BRIGHTLIGHT) { radius += 200; dl->origin[2] += 16; } + if (effects & EF_DIMLIGHT) + if (effects & ~EF_DIMLIGHT) + radius -= 100; dl->radius = radius; dl->die = cl.time + time; + + switch (effects & (EF_BLUE | EF_RED)) { + case EF_RED | EF_BLUE: + VectorCopy (purple, dl->color); + break; + case EF_RED: + VectorCopy (red, dl->color); + break; + case EF_BLUE: + VectorCopy (blue, dl->color); + break; + default: + VectorCopy (normal, dl->color); + break; + } } /* @@ -598,14 +598,13 @@ CL_RelinkEntities (void) dl = R_AllocDlight (i); if (dl) { - VectorCopy (ent->origin, dl->origin); - dl->origin[2] += 16; AngleVectors (ent->angles, fv, rv, uv); - VectorMA (dl->origin, 18, fv, dl->origin); + VectorMA (ent->origin, 18, fv, dl->origin); + dl->origin[2] += 16; dl->radius = 200 + (rand () & 31); - dl->minlight = 32; dl->die = cl.time + 0.1; + dl->minlight = 32; dl->color[0] = 0.2; dl->color[1] = 0.1; dl->color[2] = 0.05; @@ -618,9 +617,9 @@ CL_RelinkEntities (void) dl = R_AllocDlight (i); if (dl) { VectorCopy (ent->origin, dl->origin); - VectorCopy (r_firecolor->vec, dl->color); dl->radius = 200; dl->die = cl.time + 0.1; + VectorCopy (r_firecolor->vec, dl->color); } 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 e9ba7af8f..3c86ff577 100644 --- a/nq/source/cl_tent.c +++ b/nq/source/cl_tent.c @@ -130,11 +130,11 @@ CL_Init_Entity (entity_t *ent) memset (ent, 0, sizeof (*ent)); ent->colormap = vid.colormap8; - ent->glow_size = 0; + ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0; + ent->alpha = 1.0; + ent->scale = 1.0; + ent->glow_size = 0.0; ent->glow_color = 254; - ent->alpha = 1; - ent->scale = 1; - ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1; ent->pose1 = ent->pose2 = -1; } diff --git a/qw/source/cl_ents.c b/qw/source/cl_ents.c index a0ae9d49d..5d8d4644c 100644 --- a/qw/source/cl_ents.c +++ b/qw/source/cl_ents.c @@ -104,30 +104,30 @@ CL_NewDlight (int key, vec3_t org, int effects) if (!dl) return; VectorCopy (org, dl->origin); - dl->die = cl.time + 0.1; - switch (effects & (EF_BLUE | EF_RED)) { - case EF_BLUE | EF_RED: - VectorCopy (purple, dl->color); - break; - case EF_BLUE: - VectorCopy (blue, dl->color); - break; - case EF_RED: - VectorCopy (red, dl->color); - break; - default: - VectorCopy (normal, dl->color); - break; - } - if (effects & EF_DIMLIGHT) { - VectorScale (dl->color, 0.5, dl->color); - } radius = 200 + (rand () & 31); if (effects & EF_BRIGHTLIGHT) { radius += 200; dl->origin[2] += 16; } + if (effects & EF_DIMLIGHT) + if (effects & ~EF_DIMLIGHT) + radius -= 100; dl->radius = radius; + dl->die = cl.time + 0.1; + switch (effects & (EF_RED | EF_BLUE)) { + case EF_RED | EF_BLUE: + VectorCopy (purple, dl->color); + break; + case EF_RED: + VectorCopy (red, dl->color); + break; + case EF_BLUE: + VectorCopy (blue, dl->color); + break; + default: + VectorCopy (normal, dl->color); + break; + } } /* PACKET ENTITY PARSING / LINKING */ @@ -517,9 +517,9 @@ CL_LinkPacketEntities (void) dl = R_AllocDlight (-s1->number); if (dl) { VectorCopy ((*ent)->origin, dl->origin); - VectorCopy (r_firecolor->vec, dl->color); dl->radius = 200; dl->die = cl.time + 0.1; + VectorCopy (r_firecolor->vec, dl->color); } } diff --git a/qw/source/cl_parse.c b/qw/source/cl_parse.c index ffa5a96f6..6fc1db313 100644 --- a/qw/source/cl_parse.c +++ b/qw/source/cl_parse.c @@ -1106,16 +1106,15 @@ CL_MuzzleFlash (void) if (!dl) return; - VectorCopy (pl->origin, dl->origin); if (i - 1 == cl.playernum) AngleVectors (cl.viewangles, fv, rv, uv); else AngleVectors (pl->viewangles, fv, rv, uv); - VectorMA (dl->origin, 18, fv, dl->origin); + VectorMA (pl->origin, 18, fv, dl->origin); dl->radius = 200 + (rand () & 31); - dl->minlight = 32; dl->die = cl.time + 0.1; + dl->minlight = 32; dl->color[0] = 0.2; dl->color[1] = 0.1; dl->color[2] = 0.05; diff --git a/qw/source/cl_tent.c b/qw/source/cl_tent.c index dac227228..c5eca5a95 100644 --- a/qw/source/cl_tent.c +++ b/qw/source/cl_tent.c @@ -135,11 +135,11 @@ CL_Init_Entity (entity_t *ent) memset (ent, 0, sizeof (*ent)); ent->colormap = vid.colormap8; - ent->glow_size = 0; + ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1.0; + ent->alpha = 1.0; + ent->scale = 1.0; + ent->glow_size = 0.0; ent->glow_color = 254; - ent->alpha = 1; - ent->scale = 1; - ent->colormod[0] = ent->colormod[1] = ent->colormod[2] = 1; ent->pose1 = ent->pose2 = -1; } @@ -152,6 +152,7 @@ CL_ClearTEnts (void) memset (&cl_explosions, 0, sizeof (cl_explosions)); for (i = 0; i < MAX_BEAMS; i++) { int j; + for (j = 0; j < MAX_BEAM_ENTS; j++) { CL_Init_Entity(&cl_beams[i].ent_list[j]); }