From b66c22d0e5d137d32683353c1eab32c454fd1fbc Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 8 Jan 2001 07:07:48 +0000 Subject: [PATCH] flickering rocket/lava lights are dead and cvars now support vectors (archiving broken atm). --- include/cl_ents.h | 1 + include/cvar.h | 1 + source/cl_ents.c | 10 ++++++++++ source/cl_main.c | 1 + source/cvar.c | 4 ++++ source/gl_dyn_fires.c | 33 ++------------------------------- source/gl_rmisc.c | 3 --- 7 files changed, 19 insertions(+), 34 deletions(-) diff --git a/include/cl_ents.h b/include/cl_ents.h index 5f19fbb..25e3bce 100644 --- a/include/cl_ents.h +++ b/include/cl_ents.h @@ -39,6 +39,7 @@ void CL_ParseProjectiles (void); void CL_ParsePacketEntities (qboolean delta); void CL_SetSolidEntities (void); void CL_ParsePlayerinfo (void); +void CL_Ents_Init (void); extern struct cvar_s *cl_deadbodyfilter; extern struct cvar_s *cl_gibfilter; diff --git a/include/cvar.h b/include/cvar.h index 08b8fed..ceac5b4 100644 --- a/include/cvar.h +++ b/include/cvar.h @@ -40,6 +40,7 @@ typedef struct cvar_s char *description; // for "help" command float value; int int_val; + vec3_t vec; struct cvar_s *next; } cvar_t; diff --git a/source/cl_ents.c b/source/cl_ents.c index 7e076e4..0259b74 100644 --- a/source/cl_ents.c +++ b/source/cl_ents.c @@ -49,6 +49,8 @@ extern cvar_t *cl_solid_players; extern cvar_t *gl_flashblend; +cvar_t *r_firecolor; + static struct predicted_player { int flags; qboolean active; @@ -611,6 +613,7 @@ CL_LinkPacketEntities (void) dl = CL_AllocDlight (-s1->number); VectorCopy ((*ent)->origin, dl->origin); dl->radius = 200; + VectorCopy (r_firecolor->vec, dl->color); dl->die = cl.time + 0.1; R_RocketTrail (0, (*ent)); } else if (model->flags & EF_GRENADE) @@ -1192,3 +1195,10 @@ CL_EmitEntities (void) CL_LinkProjectiles (); CL_UpdateTEnts (); } + +void +CL_Ents_Init (void) +{ + r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, + "color of rocket and lava ball fires"); +} diff --git a/source/cl_main.c b/source/cl_main.c index 2f43547..aa133f5 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -441,6 +441,7 @@ CL_ClearState (void) if (host_hunklevel) // FIXME: check this... Hunk_FreeToLowMark (host_hunklevel); + CL_Ents_Init (); CL_ClearEnts (); CL_ClearTEnts (); diff --git a/source/cvar.c b/source/cvar.c index 9e0f84f..dbaf858 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -207,6 +207,7 @@ Cvar_Set (cvar_t *var, char *value) var->string = strdup (value); var->value = atof (var->string); var->int_val = atoi (var->string); + sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]); Cvar_Info (var); } @@ -228,6 +229,7 @@ Cvar_SetROM (cvar_t *var, char *value) var->string = strdup (value); var->value = atof (var->string); var->int_val = atoi (var->string); + sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]); Cvar_Info (var); } @@ -525,6 +527,8 @@ Cvar_Get (char *name, char *string, int cvarflags, char *description) v->description = description; v->value = atof (v->string); v->int_val = atoi (v->string); + sscanf (v->string, "%f %f %f", + &v->vec[0], &v->vec[1], &v->vec[2]); Hash_Add (cvar_hash, v); } else { // Cvar does exist, so we update the flags and return. diff --git a/source/gl_dyn_fires.c b/source/gl_dyn_fires.c index 4b513f4..e1efc5b 100644 --- a/source/gl_dyn_fires.c +++ b/source/gl_dyn_fires.c @@ -47,6 +47,7 @@ static fire_t r_fires[MAX_FIRES]; extern cvar_t *gl_fires; +extern cvar_t *r_firecolor; /* R_AddFire @@ -54,14 +55,12 @@ extern cvar_t *gl_fires; Nifty ball of fire GL effect. Kinda a meshing of the dlight and particle engine code. */ -float r_firecolor[3] = { 0.9, 0.4, 0 }; void R_AddFire (vec3_t start, vec3_t end, entity_t *ent) { float len; fire_t *f; - dlight_t *dl; vec3_t vec; int key; @@ -79,13 +78,7 @@ R_AddFire (vec3_t start, vec3_t end, entity_t *ent) f->size = 20; f->die = cl.time + 0.5; f->decay = -1; - f->color = r_firecolor; - - dl = CL_AllocDlight (-key); - VectorCopy (end, dl->origin); - dl->radius = 200; - dl->die = cl.time + 0.5; - dl->color = r_firecolor; + f->color = r_firecolor->vec; } } @@ -213,25 +206,3 @@ R_UpdateFires (void) glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glDepthMask (GL_TRUE); } - -void -R_FireColor_f (void) -{ - int i; - - if (Cmd_Argc () == 1) { - Con_Printf ("r_firecolor %g %g %g\n", - r_firecolor[0], r_firecolor[1], r_firecolor[2]); - return; - } - if (Cmd_Argc () == 5 || Cmd_Argc () == 6) { - Con_Printf - ("Warning: obsolete 4th and 5th parameters to r_firecolor ignored\n"); - } else if (Cmd_Argc () != 4) { - Con_Printf ("Usage r_firecolor R G B\n"); - return; - } - for (i = 0; i < 4; i++) { - r_firecolor[i] = atof (Cmd_Argv (i + 1)); - } -} diff --git a/source/gl_rmisc.c b/source/gl_rmisc.c index b8b8b16..ceadd02 100644 --- a/source/gl_rmisc.c +++ b/source/gl_rmisc.c @@ -49,7 +49,6 @@ qboolean VID_Is8bit (void); void R_InitBubble (void); -void R_FireColor_f (void); cvar_t *gl_fires; cvar_t *r_netgraph_alpha; @@ -194,8 +193,6 @@ R_Init (void) Cmd_AddCommand ("pointfile", R_ReadPointFile_f); Cmd_AddCommand ("loadsky", R_LoadSky_f); - Cmd_AddCommand ("r_firecolor", R_FireColor_f); - R_InitBubble (); R_InitParticles ();