r_rocketlight should be variable

maybe some fixes to dlights?


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1261 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-08-28 05:21:25 +00:00
parent 9b2c9c63c8
commit 398e6b23cf
2 changed files with 32 additions and 22 deletions

View file

@ -1713,41 +1713,47 @@ void CL_LinkPacketEntities (void)
//dlights are not so customisable. //dlights are not so customisable.
if (r_rocketlight.value) if (r_rocketlight.value)
{ {
float rad = 0;
vec3_t dclr;
dclr[0] = 0.20;
dclr[1] = 0.10;
dclr[2] = 0;
if (model->flags & EF_ROCKET) if (model->flags & EF_ROCKET)
{ {
if (strncmp(model->name, "models/sflesh", 13)) if (strncmp(model->name, "models/sflesh", 13))
{ //hmm. hexen spider gibs... { //hmm. hexen spider gibs...
dl = CL_AllocDlight (s1->number); rad = 200;
VectorCopy (ent->origin, dl->origin); dclr[2] = 0.05;
dl->origin[2] += 1;
dl->radius = 200;
dl->die = (float)cl.time;
dl->color[0] = 0.20;
dl->color[1] = 0.1;
dl->color[2] = 0.05;
} }
} }
else if (model->flags & EF_FIREBALL) else if (model->flags & EF_FIREBALL)
{ {
dl = CL_AllocDlight (i); rad = 120 - (rand() % 20);
VectorCopy (ent->origin, dl->origin);
dl->radius = 120 - (rand() % 20);
dl->die = (float)cl.time;
} }
else if (model->flags & EF_ACIDBALL) else if (model->flags & EF_ACIDBALL)
{ {
dl = CL_AllocDlight (i); rad = 120 - (rand() % 20);
VectorCopy (ent->origin, dl->origin);
dl->radius = 120 - (rand() % 20);
dl->die = (float)cl.time;
} }
else if (model->flags & EF_SPIT) else if (model->flags & EF_SPIT)
{ {
dl = CL_AllocDlight (i); // how the hell does this even work?
VectorCopy (ent->origin, dl->origin); rad = -120 - (rand() % 20);
dl->radius = -120 - (rand() % 20);
dl->die = (float)cl.time;
} }
if (rad)
{
dl = CL_AllocDlight (s1->number);
VectorCopy (ent->origin, dl->origin);
dl->die = (float)cl.time;
if (model->flags & EF_ROCKET)
dl->origin[2] += 1; // is this even necessary
dl->radius = rad * bound(0, r_rocketlight.value, 1);
VectorCopy(dclr, dl->color);
}
} }
} }
} }

View file

@ -79,11 +79,15 @@ void AddLightBlend (float r, float g, float b, float a2)
{ {
float a; float a;
r = bound(0, r, 1);
g = bound(0, g, 1);
b = bound(0, b, 1);
v_blend[3] = a = v_blend[3] + a2*(1-v_blend[3]); v_blend[3] = a = v_blend[3] + a2*(1-v_blend[3]);
a2 = a2/a; a2 = a2/a;
v_blend[0] = v_blend[1]*(1-a2) + r*a2; v_blend[0] = v_blend[0]*(1-a2) + r*a2;
v_blend[1] = v_blend[1]*(1-a2) + g*a2; v_blend[1] = v_blend[1]*(1-a2) + g*a2;
v_blend[2] = v_blend[2]*(1-a2) + b*a2; v_blend[2] = v_blend[2]*(1-a2) + b*a2;
//Con_Printf("AddLightBlend(): %4.2f %4.2f %4.2f %4.6f\n", v_blend[0], v_blend[1], v_blend[2], v_blend[3]); //Con_Printf("AddLightBlend(): %4.2f %4.2f %4.2f %4.6f\n", v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
@ -122,7 +126,7 @@ void R_RenderDlight (dlight_t *light)
VectorSubtract (light->origin, r_origin, v); VectorSubtract (light->origin, r_origin, v);
if (Length (v) < rad) if (Length (v) < rad)
{ // view is inside the dlight { // view is inside the dlight
AddLightBlend (1, 0.5, 0, light->radius * 0.0003); AddLightBlend (light->color[0]*5, light->color[1]*5, light->color[2]*5, light->radius * 0.0003);
return; return;
} }