Improve dlight flag combination behaviors, plus some more dlight initialization cleanups.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-06-07 05:21:53 +00:00
parent b552aceced
commit 90f4bf5fa7
5 changed files with 52 additions and 53 deletions

View file

@ -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)

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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]);
}