probably overdoing the callback thing now but oh well! (changed r_explosionlight, r_stains, r_rocketlight, scr_conalpha)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2227 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-04-21 05:23:51 +00:00
parent fbe51078b2
commit bd3cab06a3
11 changed files with 48 additions and 31 deletions

View File

@ -1801,7 +1801,6 @@ void CL_LinkPacketEntities (void)
}
}
//dlights are not so customisable.
if (r_rocketlight.value)
{
@ -1844,7 +1843,7 @@ void CL_LinkPacketEntities (void)
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);
dl->radius = rad * r_rocketlight.value;
VectorCopy(dclr, dl->color);
}
@ -2150,7 +2149,7 @@ void CL_LinkPacketEntities (void)
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);
dl->radius = rad * r_rocketlight.value;
VectorCopy(dclr, dl->color);
}

View File

@ -109,7 +109,7 @@ cvar_t cl_chatsound = SCVAR("cl_chatsound","1");
cvar_t cl_enemychatsound = SCVAR("cl_enemychatsound", "misc/talk.wav");
cvar_t cl_teamchatsound = SCVAR("cl_teamchatsound", "misc/talk.wav");
cvar_t r_rocketlight = SCVAR("r_rocketlight", "1");
cvar_t r_rocketlight = SCVARC("r_rocketlight", "1", Cvar_Limiter_ZeroToOne_Callback);
cvar_t r_lightflicker = SCVAR("r_lightflicker", "1");
cvar_t cl_r2g = SCVAR("cl_r2g", "0");
cvar_t r_powerupglow = SCVAR("r_powerupglow", "1");

View File

@ -174,7 +174,7 @@ sfx_t *cl_sfx_ric3;
sfx_t *cl_sfx_r_exp3;
cvar_t cl_expsprite = SCVAR("cl_expsprite", "0");
cvar_t r_explosionlight = SCVAR("r_explosionlight", "1");
cvar_t r_explosionlight = SCVARC("r_explosionlight", "1", Cvar_Limiter_ZeroToOne_Callback);
cvar_t cl_truelightning = SCVARF("cl_truelightning", "0", CVAR_SEMICHEAT);
cvar_t cl_beam_trace = SCVAR("cl_beam_trace", "0");
@ -762,7 +762,7 @@ void CL_ParseTEnt (void)
{
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 1;
dl->decay = 300;
@ -802,7 +802,7 @@ void CL_ParseTEnt (void)
{
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 1;
dl->decay = 300;
@ -843,7 +843,7 @@ void CL_ParseTEnt (void)
{
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 0.5;
dl->decay = 300;
@ -874,7 +874,7 @@ void CL_ParseTEnt (void)
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
// no point in doing this the fuh/ez way
dl->radius = 500*bound(0, r_explosionlight.value, 1);
dl->radius = 500*r_explosionlight.value;
dl->die = cl.time + 1;
dl->decay = 500;
@ -1727,7 +1727,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 * bound(0, r_explosionlight.value, 1);
dl->radius = 150 * r_explosionlight.value;
dl->die = cl.time + 0.4;
dl->decay = 400;
dl->color[0] = 0.2;
@ -1764,7 +1764,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 0.5;
dl->decay = 300;
dl->color[0] = 0.2;
@ -1859,7 +1859,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 0.5;
dl->decay = 300;
dl->color[0] = 0.2;
@ -2054,7 +2054,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 * bound(0, r_explosionlight.value, 1);
dl->radius = 150 * r_explosionlight.value;
dl->die = cl.time + 0.4;
dl->decay = 400;
dl->color[0] = 0.01;
@ -2104,7 +2104,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 * bound(0, r_explosionlight.value, 1);
dl->radius = 150 * r_explosionlight.value;
dl->die = cl.time + 0.4;
dl->decay = 400;
dl->color[0] = 0.038;
@ -2149,7 +2149,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 0.5;
dl->decay = 300;
dl->color[0] = 0.2;
@ -2264,7 +2264,7 @@ void CLQ2_ParseTEnt (void)
dlight_t *dl;
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 * bound(0, r_explosionlight.value, 1);
dl->radius = 150 * r_explosionlight.value;
dl->die = cl.time + 0.1;
dl->minlight = 250;
dl->color[0] = -0.2;

View File

@ -2225,7 +2225,7 @@ static void PF_cl_te_explosion (progfuncs_t *prinst, struct globalvars_s *pr_glo
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 1;
dl->decay = 300;
@ -2316,7 +2316,7 @@ static void PF_cl_te_explosionquad (progfuncs_t *prinst, struct globalvars_s *pr
dl = CL_AllocDlight (0);
VectorCopy (pos, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 1;
dl->decay = 300;
@ -2427,7 +2427,7 @@ static void PF_cl_te_explosionrgb (progfuncs_t *prinst, struct globalvars_s *pr_
{
dl = CL_AllocDlight (0);
VectorCopy (org, dl->origin);
dl->radius = 150 + bound(0, r_explosionlight.value, 1)*200;
dl->radius = 150 + r_explosionlight.value*200;
dl->die = cl.time + 0.5;
dl->decay = 300;

View File

@ -81,7 +81,7 @@ cvar_t r_sirds = SCVARF("r_sirds", "0", CVAR_SEMICHEAT);//whack in a value of 2
cvar_t r_loadlits = SCVAR("r_loadlit", "1");
cvar_t r_stains = SCVARF("r_stains", "0.75", CVAR_ARCHIVE);
cvar_t r_stains = SCVARFC("r_stains", "0.75", CVAR_ARCHIVE, Cvar_Limiter_ZeroToOne_Callback);
cvar_t r_stainfadetime = SCVAR("r_stainfadetime", "1");
cvar_t r_stainfadeammount = SCVAR("r_stainfadeammount", "1");
@ -175,7 +175,7 @@ cvar_t scr_sshot_type = SCVAR("scr_sshot_type", "jpg");
cvar_t scr_centersbar = SCVAR("scr_centersbar", "0");
cvar_t scr_consize = SCVAR("scr_consize", "0.5");
cvar_t scr_conalpha = SCVAR("scr_conalpha", "0.7");
cvar_t scr_conalpha = SCVARC("scr_conalpha", "0.7", Cvar_Limiter_ZeroToOne_Callback);
cvar_t scr_viewsize = SCVARFC("viewsize","100", CVAR_ARCHIVE, SCR_Viewsize_Callback);
cvar_t scr_fov = SCVARFC("fov","90", CVAR_ARCHIVE, SCR_Fov_Callback); // 10 - 170

View File

@ -1143,6 +1143,21 @@ void Cvar_ApplyCallbacks(int callbackflag)
}
}
// standard callbacks
void Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue)
{
if (var->value > 1)
{
Cvar_ForceSet(var, "1");
return;
}
else if (var->value < 0)
{
Cvar_ForceSet(var, "0");
return;
}
}
void Cvar_Shutdown(void)
{
cvar_t *var;

View File

@ -143,6 +143,9 @@ void Cvar_ForceCallback(cvar_t *cvar);
void Cvar_ApplyCallbacks(int callbackflag);
//forces callbacks to be ran for given flags
void Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue);
//cvar callback to limit cvar value to 0 or 1
float Cvar_VariableValue (const char *var_name);
// returns 0 if not defined or non numeric

View File

@ -1864,7 +1864,7 @@ void GLDraw_ConsoleBackground (int lines)
}
else
{
if (scr_conalpha.value <= 0)
if (!scr_conalpha.value)
return;
a = scr_conalpha.value;

View File

@ -92,7 +92,7 @@ void GLR_StainSurf (msurface_t *surf, float *parms)
mtexinfo_t *tex;
stmap *stainbase;
lim = 255 - (bound(0, r_stains.value, 1)*255);
lim = 255 - (r_stains.value*255);
#define stain(x) \
change = stainbase[(s)*3+x] + amm*parms[4+x]; \
@ -309,7 +309,7 @@ void GLR_LessenStains(void)
static float time;
if (r_stains.value <= 0)
if (!r_stains.value)
return;
time += host_frametime;
@ -970,7 +970,7 @@ store:
blg = greenblklights;
blb = blueblklights;
if (r_stains.value <= 0)
if (!r_stains.value)
isstained = false;
else
isstained = surf->stained;
@ -1128,7 +1128,7 @@ store:
blg = greenblklights;
blb = blueblklights;
if (r_stains.value <= 0)
if (!r_stains.value)
isstained = false;
else
isstained = surf->stained;
@ -1321,7 +1321,7 @@ store:
blg = greenblklights;
blb = blueblklights;
if (r_stains.value <= 0)
if (!r_stains.value)
isstained = false;
else
isstained = surf->stained;
@ -1479,7 +1479,7 @@ store:
blg = greenblklights;
blb = blueblklights;
if (r_stains.value <= 0)
if (!r_stains.value)
isstained = false;
else
isstained = surf->stained;

View File

@ -106,7 +106,7 @@ void SWR_StainSurf (msurface_t *surf, float *parms)
stmap *stainbase;
lim = 255 - (bound(0, r_stains.value, 1)*255);
lim = 255 - (r_stains.value*255);
smax = (surf->extents[0]>>4)+1;
tmax = (surf->extents[1]>>4)+1;

View File

@ -2023,7 +2023,7 @@ void SWDraw_ConsoleBackground (int lines)
char ver[100];
static char saveback[320*8];
if (!scr_con_forcedraw && scr_conalpha.value <= 0)
if (!scr_con_forcedraw && !scr_conalpha.value)
return;
conback = (mpic_t *)SWDraw_SafeCachePic ("gfx/conback.lmp");
@ -2154,7 +2154,7 @@ void SWDraw_ConsoleBackground (int lines)
if (scr_con_forcedraw)
alpha = 255;
else
alpha = bound(0, scr_conalpha.value*255, 255);
alpha = scr_conalpha.value*255;
p24dest = (unsigned int *)vid.conbuffer;
dest = (unsigned char *)vid.conbuffer;