mirror of
https://git.code.sf.net/p/quake/newtree
synced 2025-05-30 16:50:48 +00:00
Cvar audit; These files set cvars improperly, by changing their values
without using Cvar_SetValue ().
This commit is contained in:
parent
bf2ec8da6d
commit
71b841adeb
14 changed files with 56 additions and 82 deletions
|
@ -346,17 +346,13 @@ void CDAudio_Update(void)
|
|||
if (!enabled)
|
||||
return;
|
||||
|
||||
if (bgmvolume->value != cdvolume)
|
||||
{
|
||||
if (cdvolume)
|
||||
{
|
||||
if (bgmvolume->value != cdvolume) {
|
||||
if (cdvolume) {
|
||||
Cvar_SetValue (bgmvolume, 0.0);
|
||||
cdvolume = bgmvolume->value;
|
||||
CDAudio_Pause ();
|
||||
}
|
||||
else
|
||||
{
|
||||
bgmvolume->value = 1.0;
|
||||
} else {
|
||||
Cvar_SetValue (bgmvolume, 1.0);
|
||||
cdvolume = bgmvolume->value;
|
||||
CDAudio_Resume ();
|
||||
}
|
||||
|
|
|
@ -130,16 +130,12 @@ void CDAudio_Resume()
|
|||
void CDAudio_Update()
|
||||
{
|
||||
if(!cd_id || !enabled) return;
|
||||
if(bgmvolume->value != cdvolume)
|
||||
{
|
||||
if(cdvolume)
|
||||
{
|
||||
bgmvolume->value = 0.0;
|
||||
if(bgmvolume->value != cdvolume) {
|
||||
if(cdvolume) {
|
||||
Cvar_SetValue (bgmvolume, 0.0);
|
||||
CDAudio_Pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
bgmvolume->value = 1.0;
|
||||
} else {
|
||||
Cvar_SetValue (bgmvolume, 1.0);
|
||||
CDAudio_Resume();
|
||||
}
|
||||
cdvolume = bgmvolume->value;
|
||||
|
|
|
@ -834,8 +834,8 @@ R_SetupFrame
|
|||
static void R_SetupFrame (void)
|
||||
{
|
||||
// don't allow cheats in multiplayer
|
||||
r_fullbright->value = 0;
|
||||
r_lightmap->value = 0;
|
||||
Cvar_SetValue (r_fullbright, 0);
|
||||
Cvar_SetValue (r_lightmap, 0);
|
||||
if (!atoi(Info_ValueForKey(cl.serverinfo, "watervis")))
|
||||
Cvar_SetValue(r_wateralpha, 1);
|
||||
|
||||
|
|
|
@ -812,7 +812,7 @@ void R_DrawBrushModel (entity_t *e)
|
|||
|
||||
// LordHavoc: anyone without multitexture won't want texsort 0 anyway...
|
||||
if (!gl_mtexable)
|
||||
gl_texsort->value = 1;
|
||||
Cvar_SetValue (gl_texsort, 1);
|
||||
|
||||
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...
|
||||
if (!gl_mtexable)
|
||||
gl_texsort->value = 1;
|
||||
Cvar_SetValue (gl_texsort, 1);
|
||||
|
||||
glColor3f (1.0, 1.0, 1.0);
|
||||
memset (lightmap_polys, 0, sizeof(lightmap_polys));
|
||||
|
|
|
@ -310,16 +310,10 @@ static void SCR_CalcRefdef (void)
|
|||
//========================================
|
||||
|
||||
// bound viewsize
|
||||
if (scr_viewsize->value < 30)
|
||||
Cvar_Set (scr_viewsize,"30");
|
||||
if (scr_viewsize->value > 120)
|
||||
Cvar_Set (scr_viewsize,"120");
|
||||
Cvar_SetValue (scr_viewsize, bound (30, scr_viewsize->value, 120);
|
||||
|
||||
// bound field of view
|
||||
if (scr_fov->value < 10)
|
||||
Cvar_Set (scr_fov,"10");
|
||||
if (scr_fov->value > 170)
|
||||
Cvar_Set (scr_fov,"170");
|
||||
Cvar_Set (scr_fov, bound (10, scr_fov->value, 170);
|
||||
|
||||
// intermission is always full screen
|
||||
if (cl.intermission)
|
||||
|
@ -1240,7 +1234,7 @@ void SCR_UpdateScreen (void)
|
|||
// also makes polyblend apply to whole screen
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
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
|
||||
f = brightness->value * 2;
|
||||
else
|
||||
|
@ -1264,7 +1258,7 @@ void SCR_UpdateScreen (void)
|
|||
glEnd ();
|
||||
}
|
||||
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)
|
||||
{
|
||||
glBegin (GL_QUADS);
|
||||
|
|
|
@ -376,7 +376,7 @@ static void IN_ExtraOptionCmd(int option_cursor)
|
|||
{
|
||||
switch (option_cursor) {
|
||||
case 1: // _windowed_mouse
|
||||
_windowed_mouse->value = !_windowed_mouse->value;
|
||||
Cvar_SetValue (_windowed_mouse, !_windowed_mouse->value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ void Netchan_Init (void)
|
|||
showpackets = Cvar_Get("showpackets", "0", CVAR_NONE, "None");
|
||||
showdrop = Cvar_Get("showdrop", "0", CVAR_NONE, "None");
|
||||
qport = Cvar_Get("qport", "0", CVAR_NONE, "None");
|
||||
qport->value = port;
|
||||
Cvar_SetValue (qport, port);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -244,8 +244,8 @@ void R_Init (void)
|
|||
r_aliastransadj = Cvar_Get("r_aliastransadj", "100", CVAR_NONE, "None");
|
||||
gl_flashblend = Cvar_Get("gl_flashblend", "0", CVAR_NONE, "None"); // FIXME: remove this! --KB
|
||||
|
||||
r_maxedges->value = (float)NUMSTACKEDGES;
|
||||
r_maxsurfs->value = (float)NUMSTACKSURFACES;
|
||||
Cvar_SetValue (r_maxedges, (float)NUMSTACKEDGES);
|
||||
Cvar_SetValue (r_maxsurfs, (float)NUMSTACKSURFACES);
|
||||
|
||||
view_clipplanes[0].leftedge = true;
|
||||
view_clipplanes[1].rightedge = true;
|
||||
|
|
|
@ -480,13 +480,12 @@ void R_SetupFrame (void)
|
|||
float w, h;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
r_draworder->value = 0;
|
||||
r_fullbright->value = 0;
|
||||
r_ambient->value = 0;
|
||||
r_drawflat->value = 0;
|
||||
Cvar_SetValue(r_draworder, 0);
|
||||
Cvar_SetValue(r_fullbright, 0);
|
||||
Cvar_SetValue(r_ambient, 0);
|
||||
Cvar_SetValue(r_drawflat, 0);
|
||||
|
||||
if (r_numsurfs->value)
|
||||
{
|
||||
if (r_numsurfs->value) {
|
||||
if ((surface_p - surfaces) > r_maxsurfsseen)
|
||||
r_maxsurfsseen = surface_p - surfaces;
|
||||
|
||||
|
@ -494,8 +493,7 @@ r_drawflat->value = 0;
|
|||
surf_max - surfaces, r_maxsurfsseen);
|
||||
}
|
||||
|
||||
if (r_numedges->value)
|
||||
{
|
||||
if (r_numedges->value) {
|
||||
edgecount = edge_p - r_edges;
|
||||
|
||||
if (edgecount > r_maxedgesseen)
|
||||
|
@ -505,13 +503,9 @@ r_drawflat->value = 0;
|
|||
r_numallocatededges, r_maxedgesseen);
|
||||
}
|
||||
|
||||
r_refdef.ambientlight = r_ambient->value;
|
||||
r_refdef.ambientlight = max(r_ambient->value, 0);
|
||||
|
||||
if (r_refdef.ambientlight < 0)
|
||||
r_refdef.ambientlight = 0;
|
||||
|
||||
// if (!sv.active)
|
||||
r_draworder->value = 0; // don't let cheaters look behind walls
|
||||
Cvar_SetValue(r_draworder, 0);
|
||||
|
||||
R_CheckVariables ();
|
||||
|
||||
|
|
|
@ -594,6 +594,7 @@ void SV_Serverinfo_f (void)
|
|||
}
|
||||
Info_SetValueForKey (svs.info, Cmd_Argv(1), Cmd_Argv(2), MAX_SERVERINFO_STRING);
|
||||
|
||||
// FIXME This sucks.
|
||||
// if this is a cvar, change it too
|
||||
var = Cvar_FindVar (Cmd_Argv(1));
|
||||
if (var)
|
||||
|
|
|
@ -1096,16 +1096,12 @@ void VID_CheckModedescFixup (int mode)
|
|||
{
|
||||
int x, y, stretch;
|
||||
|
||||
if (mode == MODE_SETTABLE_WINDOW)
|
||||
{
|
||||
if (mode == MODE_SETTABLE_WINDOW) {
|
||||
modelist[mode].stretched = (int) vid_stretch_by_2->value;
|
||||
stretch = modelist[mode].stretched;
|
||||
|
||||
if (vid_config_x->value < (320 << stretch))
|
||||
vid_config_x->value = 320 << stretch;
|
||||
|
||||
if (vid_config_y->value < (200 << stretch))
|
||||
vid_config_y->value = 200 << stretch;
|
||||
Cvar_SetValue (vid_config_x, max (vid_config_x, 320 << stretch));
|
||||
Cvar_SetValue (vid_config_y, max (vid_config_y, 200 << stretch));
|
||||
|
||||
x = (int) vid_config_x->value;
|
||||
y = (int) vid_config_y->value;
|
||||
|
@ -1134,12 +1130,9 @@ char *VID_GetModeDescriptionMemCheck (int mode)
|
|||
pv = VID_GetModePtr (mode);
|
||||
pinfo = pv->modedesc;
|
||||
|
||||
if (VID_CheckAdequateMem (pv->width, pv->height))
|
||||
{
|
||||
if (VID_CheckAdequateMem (pv->width, pv->height)) {
|
||||
return pinfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,14 +411,14 @@ VID_SetMode(int modenum, unsigned char *palette)
|
|||
int err;
|
||||
|
||||
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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
vid_mode->value = (float)modenum;
|
||||
Cvar_SetValue (vid_mode, modenum);
|
||||
|
||||
current_mode = modenum;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue