Cvar audit; These files set cvars improperly, by changing their values

without using Cvar_SetValue ().
This commit is contained in:
Jeff Teunissen 2000-09-25 06:36:50 +00:00
parent bf2ec8da6d
commit 71b841adeb
14 changed files with 56 additions and 82 deletions

View File

@ -346,17 +346,13 @@ void CDAudio_Update(void)
if (!enabled) if (!enabled)
return; return;
if (bgmvolume->value != cdvolume) if (bgmvolume->value != cdvolume) {
{ if (cdvolume) {
if (cdvolume)
{
Cvar_SetValue (bgmvolume, 0.0); Cvar_SetValue (bgmvolume, 0.0);
cdvolume = bgmvolume->value; cdvolume = bgmvolume->value;
CDAudio_Pause (); CDAudio_Pause ();
} } else {
else Cvar_SetValue (bgmvolume, 1.0);
{
bgmvolume->value = 1.0;
cdvolume = bgmvolume->value; cdvolume = bgmvolume->value;
CDAudio_Resume (); CDAudio_Resume ();
} }

View File

@ -130,16 +130,12 @@ void CDAudio_Resume()
void CDAudio_Update() void CDAudio_Update()
{ {
if(!cd_id || !enabled) return; if(!cd_id || !enabled) return;
if(bgmvolume->value != cdvolume) if(bgmvolume->value != cdvolume) {
{ if(cdvolume) {
if(cdvolume) Cvar_SetValue (bgmvolume, 0.0);
{
bgmvolume->value = 0.0;
CDAudio_Pause(); CDAudio_Pause();
} } else {
else Cvar_SetValue (bgmvolume, 1.0);
{
bgmvolume->value = 1.0;
CDAudio_Resume(); CDAudio_Resume();
} }
cdvolume = bgmvolume->value; cdvolume = bgmvolume->value;

View File

@ -1105,7 +1105,7 @@ void CL_MuzzleFlash (void)
} }
#define SHOWNET(x) if(cl_shownet->value==2)Con_Printf ("%3i:%s\n", msg_readcount-1, x); #define SHOWNET(x) if (cl_shownet->value == 2) Con_Printf ("%3i:%s\n", msg_readcount-1, x);
/* /*
===================== =====================
CL_ParseServerMessage CL_ParseServerMessage

View File

@ -834,8 +834,8 @@ R_SetupFrame
static void R_SetupFrame (void) static void R_SetupFrame (void)
{ {
// don't allow cheats in multiplayer // don't allow cheats in multiplayer
r_fullbright->value = 0; Cvar_SetValue (r_fullbright, 0);
r_lightmap->value = 0; Cvar_SetValue (r_lightmap, 0);
if (!atoi(Info_ValueForKey(cl.serverinfo, "watervis"))) if (!atoi(Info_ValueForKey(cl.serverinfo, "watervis")))
Cvar_SetValue(r_wateralpha, 1); Cvar_SetValue(r_wateralpha, 1);

View File

@ -812,7 +812,7 @@ void R_DrawBrushModel (entity_t *e)
// LordHavoc: anyone without multitexture won't want texsort 0 anyway... // LordHavoc: anyone without multitexture won't want texsort 0 anyway...
if (!gl_mtexable) if (!gl_mtexable)
gl_texsort->value = 1; Cvar_SetValue (gl_texsort, 1);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
@ -997,7 +997,7 @@ void R_DrawWorld (void)
// LordHavoc: anyone without multitexture won't want texsort 0 anyway... // LordHavoc: anyone without multitexture won't want texsort 0 anyway...
if (!gl_mtexable) if (!gl_mtexable)
gl_texsort->value = 1; Cvar_SetValue (gl_texsort, 1);
glColor3f (1.0, 1.0, 1.0); glColor3f (1.0, 1.0, 1.0);
memset (lightmap_polys, 0, sizeof(lightmap_polys)); memset (lightmap_polys, 0, sizeof(lightmap_polys));

View File

@ -310,16 +310,10 @@ static void SCR_CalcRefdef (void)
//======================================== //========================================
// bound viewsize // bound viewsize
if (scr_viewsize->value < 30) Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->value, 120);
Cvar_Set (scr_viewsize,"30");
if (scr_viewsize->value > 120)
Cvar_Set (scr_viewsize,"120");
// bound field of view // bound field of view
if (scr_fov->value < 10) Cvar_Set (scr_fov, bound (10, scr_fov->value, 170);
Cvar_Set (scr_fov,"10");
if (scr_fov->value > 170)
Cvar_Set (scr_fov,"170");
// intermission is always full screen // intermission is always full screen
if (cl.intermission) if (cl.intermission)
@ -1240,7 +1234,7 @@ void SCR_UpdateScreen (void)
// also makes polyblend apply to whole screen // also makes polyblend apply to whole screen
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); glEnable(GL_BLEND);
brightness->value = bound(1, brightness->value, 5); Cvar_SetValue (brightness, bound (1, brightness->value, 5));
if (lighthalf) // LordHavoc: render was done at half brightness if (lighthalf) // LordHavoc: render was done at half brightness
f = brightness->value * 2; f = brightness->value * 2;
else else
@ -1264,7 +1258,7 @@ void SCR_UpdateScreen (void)
glEnd (); glEnd ();
} }
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
contrast->value = bound(0.1, contrast->value, 1.0); Cvar_SetValue (contrast, bound (0.1, contrast->value, 1));
if ((gl_polyblend->value && v_blend[3]) || contrast->value < 1) if ((gl_polyblend->value && v_blend[3]) || contrast->value < 1)
{ {
glBegin (GL_QUADS); glBegin (GL_QUADS);

View File

@ -376,7 +376,7 @@ static void IN_ExtraOptionCmd(int option_cursor)
{ {
switch (option_cursor) { switch (option_cursor) {
case 1: // _windowed_mouse case 1: // _windowed_mouse
_windowed_mouse->value = !_windowed_mouse->value; Cvar_SetValue (_windowed_mouse, !_windowed_mouse->value);
break; break;
} }
} }

View File

@ -127,7 +127,7 @@ void Netchan_Init (void)
showpackets = Cvar_Get("showpackets", "0", CVAR_NONE, "None"); showpackets = Cvar_Get("showpackets", "0", CVAR_NONE, "None");
showdrop = Cvar_Get("showdrop", "0", CVAR_NONE, "None"); showdrop = Cvar_Get("showdrop", "0", CVAR_NONE, "None");
qport = Cvar_Get("qport", "0", CVAR_NONE, "None"); qport = Cvar_Get("qport", "0", CVAR_NONE, "None");
qport->value = port; Cvar_SetValue (qport, port);
} }
/* /*

View File

@ -244,8 +244,8 @@ void R_Init (void)
r_aliastransadj = Cvar_Get("r_aliastransadj", "100", CVAR_NONE, "None"); r_aliastransadj = Cvar_Get("r_aliastransadj", "100", CVAR_NONE, "None");
gl_flashblend = Cvar_Get("gl_flashblend", "0", CVAR_NONE, "None"); // FIXME: remove this! --KB gl_flashblend = Cvar_Get("gl_flashblend", "0", CVAR_NONE, "None"); // FIXME: remove this! --KB
r_maxedges->value = (float)NUMSTACKEDGES; Cvar_SetValue (r_maxedges, (float)NUMSTACKEDGES);
r_maxsurfs->value = (float)NUMSTACKSURFACES; Cvar_SetValue (r_maxsurfs, (float)NUMSTACKSURFACES);
view_clipplanes[0].leftedge = true; view_clipplanes[0].leftedge = true;
view_clipplanes[1].rightedge = true; view_clipplanes[1].rightedge = true;

View File

@ -479,14 +479,13 @@ void R_SetupFrame (void)
vrect_t vrect; vrect_t vrect;
float w, h; float w, h;
// don't allow cheats in multiplayer // don't allow cheats in multiplayer
r_draworder->value = 0; Cvar_SetValue(r_draworder, 0);
r_fullbright->value = 0; Cvar_SetValue(r_fullbright, 0);
r_ambient->value = 0; Cvar_SetValue(r_ambient, 0);
r_drawflat->value = 0; Cvar_SetValue(r_drawflat, 0);
if (r_numsurfs->value) if (r_numsurfs->value) {
{
if ((surface_p - surfaces) > r_maxsurfsseen) if ((surface_p - surfaces) > r_maxsurfsseen)
r_maxsurfsseen = surface_p - surfaces; r_maxsurfsseen = surface_p - surfaces;
@ -494,8 +493,7 @@ r_drawflat->value = 0;
surf_max - surfaces, r_maxsurfsseen); surf_max - surfaces, r_maxsurfsseen);
} }
if (r_numedges->value) if (r_numedges->value) {
{
edgecount = edge_p - r_edges; edgecount = edge_p - r_edges;
if (edgecount > r_maxedgesseen) if (edgecount > r_maxedgesseen)
@ -505,13 +503,9 @@ r_drawflat->value = 0;
r_numallocatededges, r_maxedgesseen); r_numallocatededges, r_maxedgesseen);
} }
r_refdef.ambientlight = r_ambient->value; r_refdef.ambientlight = max(r_ambient->value, 0);
if (r_refdef.ambientlight < 0) Cvar_SetValue(r_draworder, 0);
r_refdef.ambientlight = 0;
// if (!sv.active)
r_draworder->value = 0; // don't let cheaters look behind walls
R_CheckVariables (); R_CheckVariables ();
@ -521,23 +515,23 @@ r_drawflat->value = 0;
numbtofpolys = 0; numbtofpolys = 0;
// debugging // debugging
#if 0 #if 0
r_refdef.vieworg[0]= 80; r_refdef.vieworg[0] = 80;
r_refdef.vieworg[1]= 64; r_refdef.vieworg[1] = 64;
r_refdef.vieworg[2]= 40; r_refdef.vieworg[2] = 40;
r_refdef.viewangles[0]= 0; r_refdef.viewangles[0] = 0;
r_refdef.viewangles[1]= 46.763641357; r_refdef.viewangles[1] = 46.763641357;
r_refdef.viewangles[2]= 0; r_refdef.viewangles[2] = 0;
#endif #endif
// build the transformation matrix for the given view angles // build the transformation matrix for the given view angles
VectorCopy (r_refdef.vieworg, modelorg); VectorCopy (r_refdef.vieworg, modelorg);
VectorCopy (r_refdef.vieworg, r_origin); VectorCopy (r_refdef.vieworg, r_origin);
AngleVectors (r_refdef.viewangles, vpn, vright, vup); AngleVectors (r_refdef.viewangles, vpn, vright, vup);
// current viewleaf // current viewleaf
r_oldviewleaf = r_viewleaf; r_oldviewleaf = r_viewleaf;
r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel); r_viewleaf = Mod_PointInLeaf (r_origin, cl.worldmodel);

View File

@ -122,7 +122,7 @@ byte *Skin_Cache (skin_t *skin)
if (cls.downloadtype == dl_skin) if (cls.downloadtype == dl_skin)
return NULL; // use base until downloaded return NULL; // use base until downloaded
if (noskins->value==1) // JACK: So NOSKINS > 1 will show skins, but if (noskins->value == 1) // JACK: So NOSKINS > 1 will show skins, but
return NULL; // not download new ones. return NULL; // not download new ones.
if (skin->failedload) if (skin->failedload)

View File

@ -594,6 +594,7 @@ void SV_Serverinfo_f (void)
} }
Info_SetValueForKey (svs.info, Cmd_Argv(1), Cmd_Argv(2), MAX_SERVERINFO_STRING); Info_SetValueForKey (svs.info, Cmd_Argv(1), Cmd_Argv(2), MAX_SERVERINFO_STRING);
// FIXME This sucks.
// if this is a cvar, change it too // if this is a cvar, change it too
var = Cvar_FindVar (Cmd_Argv(1)); var = Cvar_FindVar (Cmd_Argv(1));
if (var) if (var)

View File

@ -1096,20 +1096,16 @@ void VID_CheckModedescFixup (int mode)
{ {
int x, y, stretch; int x, y, stretch;
if (mode == MODE_SETTABLE_WINDOW) if (mode == MODE_SETTABLE_WINDOW) {
{ modelist[mode].stretched = (int) vid_stretch_by_2->value;
modelist[mode].stretched = (int)vid_stretch_by_2->value;
stretch = modelist[mode].stretched; stretch = modelist[mode].stretched;
if (vid_config_x->value < (320 << stretch)) Cvar_SetValue (vid_config_x, max (vid_config_x, 320 << stretch));
vid_config_x->value = 320 << stretch; Cvar_SetValue (vid_config_y, max (vid_config_y, 200 << stretch));
if (vid_config_y->value < (200 << stretch)) x = (int) vid_config_x->value;
vid_config_y->value = 200 << stretch; y = (int) vid_config_y->value;
snprintf (modelist[mode].modedesc, sizeof(modelist[mode].modedesc), "%dx%d", x, y);
x = (int)vid_config_x->value;
y = (int)vid_config_y->value;
snprintf (modelist[mode].modedesc, sizeof(modelist[mode].modedesc), "%dx%d", x, y);
modelist[mode].width = x; modelist[mode].width = x;
modelist[mode].height = y; modelist[mode].height = y;
} }
@ -1134,12 +1130,9 @@ char *VID_GetModeDescriptionMemCheck (int mode)
pv = VID_GetModePtr (mode); pv = VID_GetModePtr (mode);
pinfo = pv->modedesc; pinfo = pv->modedesc;
if (VID_CheckAdequateMem (pv->width, pv->height)) if (VID_CheckAdequateMem (pv->width, pv->height)) {
{
return pinfo; return pinfo;
} } else {
else
{
return NULL; return NULL;
} }
} }

View File

@ -405,22 +405,22 @@ VID_SetPalette(byte *palette)
int int
VID_SetMode(int modenum, unsigned char *palette) VID_SetMode (int modenum, unsigned char *palette)
{ {
int bsize, zsize, tsize; int bsize, zsize, tsize;
int err; int err;
if ((modenum >= num_modes) || (modenum < 0) || !modes[modenum].width){ if ((modenum >= num_modes) || (modenum < 0) || !modes[modenum].width) {
vid_mode->value = (float)current_mode; Cvar_SetValue(vid_mode, current_mode);
Con_Printf("No such video mode: %d\n",modenum); Con_Printf("No such video mode: %d\n",modenum);
return 0; return 0;
} }
vid_mode->value = (float)modenum; Cvar_SetValue (vid_mode, modenum);
current_mode=modenum; current_mode = modenum;
vid.width = modes[current_mode].width; vid.width = modes[current_mode].width;
vid.height = modes[current_mode].height; vid.height = modes[current_mode].height;