CL_ClientMovement_Physics_Walk(s);
}
-extern cvar_t host_timescale;
+extern cvar_t slowmo;
void CL_UpdateMoveVars(void)
{
if (cls.protocol == PROTOCOL_QUAKEWORLD)
else
{
cl.moveflags = 0;
- cl.movevars_ticrate = (cls.demoplayback ? 1.0f : host_timescale.value) / bound(1.0f, cl_netfps.value, 1000.0f);
- cl.movevars_timescale = (cls.demoplayback ? 1.0f : host_timescale.value);
+ cl.movevars_ticrate = (cls.demoplayback ? 1.0f : slowmo.value) / bound(1.0f, cl_netfps.value, 1000.0f);
+ cl.movevars_timescale = (cls.demoplayback ? 1.0f : slowmo.value);
cl.movevars_gravity = sv_gravity.value;
cl.movevars_stopspeed = cl_movement_stopspeed.value;
cl.movevars_maxspeed = cl_movement_maxspeed.value;
return true;
}
-extern cvar_t host_timescale;
+extern cvar_t slowmo;
extern cvar_t cl_lerpexcess;
static void CL_NetworkTimeReceived(double newtime)
{
char overridename[MAX_QPATH];
cvar_t *langcvar;
- langcvar = Cvar_FindVar(&cvars_all, "language", CVAR_CLIENT | CVAR_SERVER, false);
+ langcvar = Cvar_FindVar(&cvars_all, "language", CVAR_CLIENT | CVAR_SERVER);
subtitle_text = NULL;
if (langcvar)
{
else
{ // Correct Arguments Specified
// Acquire Potential CVar
- cvar_t* cvCVar = Cvar_FindVar(cmd->cvars, Cmd_Argv(cmd, 1), cmd->cvars_flagsmask, false);
+ cvar_t* cvCVar = Cvar_FindVar(cmd->cvars, Cmd_Argv(cmd, 1), cmd->cvars_flagsmask);
if(cvCVar != NULL)
{ // Valid CVar
}
}
- if((cvar = Cvar_FindVar(cmd->cvars, varname, cmd->cvars_flagsmask, false)) && !(cvar->flags & CVAR_PRIVATE))
+ if((cvar = Cvar_FindVar(cmd->cvars, varname, cmd->cvars_flagsmask)) && !(cvar->flags & CVAR_PRIVATE))
return cvar->string;
return NULL;
for (cvar = cmd->cvars->vars; cvar; cvar = cvar->next)
{
if (!matchpattern_with_separator(cvar->name, partial, true, "", false))
+ if (!matchpattern_with_separator(cvar->description, partial, true, "", false))
continue;
- if (!(cvar->flags & CVAR_ALIAS))
- if (!matchpattern_with_separator(cvar->description, partial, true, "", false))
- continue;
Con_Printf ("cvar ");
Cvar_PrintHelp(cvar, true);
count++;
cmd_function_t *prev, *current;
// fail if the command is a variable name
- if (Cvar_FindVar(cmd->cvars, cmd_name, ~0, true))
+ if (Cvar_FindVar(cmd->cvars, cmd_name, ~0))
{
Con_Printf("Cmd_AddCommand: %s already defined as a var\n", cmd_name);
return;
Con_Printf("\n%i possible command%s\n", c, (c > 1) ? "s: " : ":");
Cmd_CompleteCommandPrint(cmd, s);
}
- v = Cvar_CompleteCountPossible(cmd->cvars, s, CVAR_CLIENT | CVAR_SERVER | CVAR_ALIAS);
+ v = Cvar_CompleteCountPossible(cmd->cvars, s, CVAR_CLIENT | CVAR_SERVER);
if (v)
{
Con_Printf("\n%i possible variable%s\n", v, (v > 1) ? "s: " : ":");
- Cvar_CompleteCvarPrint(cmd->cvars, s, CVAR_CLIENT | CVAR_SERVER | CVAR_ALIAS);
+ Cvar_CompleteCvarPrint(cmd->cvars, s, CVAR_CLIENT | CVAR_SERVER);
}
a = Cmd_CompleteAliasCountPossible(cmd, s);
if (a)
if (c)
text = *(list[0] = Cmd_CompleteBuildList(cmd, s));
if (v)
- text = *(list[1] = Cvar_CompleteBuildList(cmd->cvars, s, (cmd->cvars_flagsmask |= CVAR_ALIAS)));
+ text = *(list[1] = Cvar_CompleteBuildList(cmd->cvars, s, cmd->cvars_flagsmask));
if (a)
text = *(list[2] = Cmd_CompleteAliasBuildList(cmd, s));
if (n)
Cvar_FindVar
============
*/
-cvar_t *Cvar_FindVar(cvar_state_t *cvars, const char *var_name, int neededflags, qboolean alias)
+cvar_t *Cvar_FindVar(cvar_state_t *cvars, const char *var_name, int neededflags)
{
int hashindex;
cvar_t *var;
// use hash lookup to minimize search time
hashindex = CRC_Block((const unsigned char *)var_name, strlen(var_name)) % CVAR_HASHSIZE;
for (var = cvars->hashtable[hashindex];var;var = var->nextonhashchain)
- if (!strcmp (var_name, var->name))
- {
- if(!alias && var->alias)
- return var->alias;
+ if (!strcmp (var_name, var->name) && (var->flags & neededflags))
return var;
- }
+
return NULL;
}
if (*prev_var_name)
{
- var = Cvar_FindVar(cvars, prev_var_name, neededflags, false);
+ var = Cvar_FindVar(cvars, prev_var_name, neededflags);
if (!var)
return NULL;
var = var->next;
{
cvar_t *var;
- var = Cvar_FindVar(cvars, var_name, neededflags, false);
+ var = Cvar_FindVar(cvars, var_name, neededflags);
if (!var)
return def;
return atof (var->string);
{
cvar_t *var;
- var = Cvar_FindVar(cvars, var_name, neededflags, false);
+ var = Cvar_FindVar(cvars, var_name, neededflags);
if (!var)
return def;
return var->string;
{
cvar_t *var;
- var = Cvar_FindVar(cvars, var_name, neededflags, false);
+ var = Cvar_FindVar(cvars, var_name, neededflags);
if (!var)
return cvar_null_string;
return var->defstring;
{
cvar_t *var;
- var = Cvar_FindVar(cvars, var_name, neededflags, false);
+ var = Cvar_FindVar(cvars, var_name, neededflags);
if (!var)
return cvar_null_string;
return var->description;
void Cvar_PrintHelp(cvar_t *cvar, qboolean full)
{
- cvar_t *cvar_actual;
-
- Con_Printf("^3%s^7", cvar->name);
- if(cvar->alias) {
- cvar_actual = cvar->alias;
- Con_Printf(" (now ^3%s^7)", cvar_actual->name);
- } else {
- cvar_actual = cvar;
- }
-
- Con_Printf(" is \"%s\" [\"%s\"] ", ((cvar_actual->flags & CVAR_PRIVATE) ? "********"/*hunter2*/ : cvar_actual->string), cvar_actual->defstring);
-
+ Con_Printf("^3%s^7 is \"%s\" [\"%s\"] ", cvar->name, ((cvar->flags & CVAR_PRIVATE) ? "********"/*hunter2*/ : cvar->string), cvar->defstring);
if (full)
- Con_Printf("%s", cvar_actual->description);
+ Con_Printf("%s", cvar->description);
Con_Printf("\n");
}
char vabuf[1024];
char new_value[MAX_INPUTLINE];
- if(var->alias)
- var = var->alias;
-
changed = strcmp(var->string, value) != 0;
// LadyHavoc: don't reallocate when there is no change
if (!changed)
void Cvar_Set(cvar_state_t *cvars, const char *var_name, const char *value)
{
cvar_t *var;
- var = Cvar_FindVar(cvars, var_name, ~0, false);
+ var = Cvar_FindVar(cvars, var_name, ~0);
if (var == NULL)
{
Con_Printf("Cvar_Set: variable %s not found\n", var_name);
Cvar_Set(cvars, var_name, val);
}
-void Cvar_RegisterCallback(cvar_t *var, void (*callback)(char *))
+void Cvar_RegisterCallback(cvar_t *variable, void (*callback)(char *))
{
- var->callback = callback;
-}
-
-void Cvar_RegisterAlias(cvar_t *alias, cvar_t *target)
-{
- if(!(alias->flags & CVAR_ALIAS)) {
- Con_Warnf("Cvar_RegisterAlias: \"%s\" is not declared as an alias\n", alias->name);
- return;
- }
- // We'll want to register it first
- Cvar_RegisterVariable(alias);
-
- alias->alias = target;
+ variable->callback = callback;
}
/*
size_t alloclen;
int i;
- if(!(variable->flags & CVAR_ALIAS))
- {
- switch (variable->flags & (CVAR_CLIENT | CVAR_SERVER))
- {
- case CVAR_CLIENT:
- case CVAR_SERVER:
- case CVAR_CLIENT | CVAR_SERVER:
- cvars = &cvars_all;
- break;
- case 0:
- Sys_Error("Cvar_RegisterVariable({\"%s\", \"%s\", %i}) with no CVAR_CLIENT | CVAR_SERVER flags\n", variable->name, variable->string, variable->flags);
- break;
- default:
- Sys_Error("Cvar_RegisterVariable({\"%s\", \"%s\", %i}) with weird CVAR_CLIENT | CVAR_SERVER flags\n", variable->name, variable->string, variable->flags);
- break;
- }
- }
- else
+ switch (variable->flags & (CVAR_CLIENT | CVAR_SERVER))
{
+ case CVAR_CLIENT:
+ case CVAR_SERVER:
+ case CVAR_CLIENT | CVAR_SERVER:
cvars = &cvars_all;
+ break;
+ case 0:
+ Sys_Error("Cvar_RegisterVariable({\"%s\", \"%s\", %i}) with no CVAR_CLIENT | CVAR_SERVER flags\n", variable->name, variable->string, variable->flags);
+ break;
+ default:
+ Sys_Error("Cvar_RegisterVariable({\"%s\", \"%s\", %i}) with weird CVAR_CLIENT | CVAR_SERVER flags\n", variable->name, variable->string, variable->flags);
+ break;
}
-
+
if (developer_extra.integer)
Con_DPrintf("Cvar_RegisterVariable({\"%s\", \"%s\", %i});\n", variable->name, variable->string, variable->flags);
// first check to see if it has already been defined
- cvar = Cvar_FindVar(cvars, variable->name, ~0, true);
+ cvar = Cvar_FindVar(cvars, variable->name, ~0);
if (cvar)
{
if (cvar->flags & CVAR_ALLOCATED)
Con_Printf("Cvar_RegisterVariable: %s is a command\n", variable->name);
return;
}
- if(!(variable->flags & CVAR_ALIAS))
- {
- // copy the value off, because future sets will Z_Free it
- oldstr = (char *)variable->string;
- alloclen = strlen(variable->string) + 1;
- variable->string = (char *)Z_Malloc (alloclen);
- memcpy ((char *)variable->string, oldstr, alloclen);
- variable->defstring = (char *)Z_Malloc (alloclen);
- memcpy ((char *)variable->defstring, oldstr, alloclen);
- variable->value = atof (variable->string);
- variable->integer = (int) variable->value;
- }
+
+// copy the value off, because future sets will Z_Free it
+ oldstr = (char *)variable->string;
+ alloclen = strlen(variable->string) + 1;
+ variable->string = (char *)Z_Malloc (alloclen);
+ memcpy ((char *)variable->string, oldstr, alloclen);
+ variable->defstring = (char *)Z_Malloc (alloclen);
+ memcpy ((char *)variable->defstring, oldstr, alloclen);
+ variable->value = atof (variable->string);
+ variable->integer = (int) variable->value;
// Mark it as not an autocvar.
for (i = 0;i < PRVM_PROG_MAX;i++)
Con_DPrintf("Cvar_Get(\"%s\", \"%s\", %i);\n", name, value, flags);
// first check to see if it has already been defined
- cvar = Cvar_FindVar(cvars, name, ~0, true);
+ cvar = Cvar_FindVar(cvars, name, ~0);
if (cvar)
{
cvar->flags |= flags;
return cvar;
}
-qboolean Cvar_Readonly (cvar_t *var, const char *cmd_name)
-{
- if (var->flags & CVAR_READONLY || (var->alias && (var->alias->flags & CVAR_READONLY)))
- {
- if(cmd_name)
- Con_Printf("%s: ",cmd_name);
- Con_Printf("%s", var->name);
- if (var->alias && var->alias->name)
- Con_Printf(" (from %s)",var->alias->name);
- Con_Printf(" is read-only\n");
- return true;
- }
- return false;
-}
/*
============
cvar_t *v;
// check variables
- v = Cvar_FindVar(cvars, Cmd_Argv(cmd, 0), (cmd->cvars_flagsmask), true);
+ v = Cvar_FindVar(cvars, Cmd_Argv(cmd, 0), cmd->cvars_flagsmask);
if (!v)
return false;
if (developer_extra.integer)
Con_DPrint("Cvar_Command: ");
-
- if(Cvar_Readonly(v, NULL))
+
+ if (v->flags & CVAR_READONLY)
+ {
+ Con_Printf("%s is read-only\n", v->name);
return true;
-
+ }
Cvar_SetQuick(v, Cmd_Argv(cmd, 1));
if (developer_extra.integer)
Con_DPrint("\n");
cvar_t *var;
// unlock the default values of all cvars
for (var = cvars->vars ; var ; var = var->next)
- {
- if(var->flags & CVAR_ALIAS)
- continue;
var->flags &= ~CVAR_DEFAULTSET;
- }
}
// lock in the default values of all cvars
for (var = cvars->vars ; var ; var = var->next)
{
- if(var->flags & CVAR_ALIAS)
- continue;
if (!(var->flags & CVAR_DEFAULTSET))
{
size_t alloclen;
cvar_t *c;
for (c = cvars->vars;c;c = c->next)
{
- if(c->flags & CVAR_ALIAS)
- continue;
c->initstate = true;
c->initflags = c->flags;
c->initdefstring = Mem_strdup(zonemempool, c->defstring);
cvar_t *c2, **cp2;
for (cp = &cvars->vars;(c = *cp);)
{
- if(c->flags & CVAR_ALIAS)
- continue;
if (c->initstate)
{
// restore this cvar, it existed at init
cvar_t *var;
// restore the default values of all cvars
for (var = cvars->vars ; var ; var = var->next)
- {
- if(var->flags & CVAR_ALIAS)
- continue;
if((var->flags & CVAR_NORESETTODEFAULTS) == 0)
Cvar_SetQuick(var, var->defstring);
- }
}
cvar_t *var;
// restore the default values of all cvars
for (var = cvars->vars ; var ; var = var->next)
- {
- if(var->flags & CVAR_ALIAS)
- continue;
if ((var->flags & (CVAR_NORESETTODEFAULTS | CVAR_SAVE)) == 0)
Cvar_SetQuick(var, var->defstring);
- }
}
cvar_t *var;
// restore the default values of all cvars
for (var = cvars->vars ; var ; var = var->next)
- {
- if(var->flags & CVAR_ALIAS)
- continue;
if ((var->flags & (CVAR_NORESETTODEFAULTS | CVAR_SAVE)) == CVAR_SAVE)
Cvar_SetQuick(var, var->defstring);
- }
}
char buf1[MAX_INPUTLINE], buf2[MAX_INPUTLINE];
// don't save cvars that match their default value
- for (var = cvars->vars ; var ; var = var->next) {
- if(var->flags & CVAR_ALIAS)
- continue;
+ for (var = cvars->vars ; var ; var = var->next)
if ((var->flags & CVAR_SAVE) && (strcmp(var->string, var->defstring) || ((var->flags & CVAR_ALLOCATED) && !(var->flags & CVAR_DEFAULTSET))))
{
Cmd_QuoteString(buf1, sizeof(buf1), var->name, "\"\\$", false);
Cmd_QuoteString(buf2, sizeof(buf2), var->string, "\"\\$", false);
FS_Printf(f, "%s\"%s\" \"%s\"\n", var->flags & CVAR_ALLOCATED ? "seta " : "", buf1, buf2);
}
- }
}
}
// check if it's read-only
- cvar = Cvar_FindVar(cvars, Cmd_Argv(cmd, 1), ~0, true);
- if (cvar)
- if(Cvar_Readonly(cvar,"Set"))
- return;
+ cvar = Cvar_FindVar(cvars, Cmd_Argv(cmd, 1), ~0);
+ if (cvar && cvar->flags & CVAR_READONLY)
+ {
+ Con_Printf("Set: %s is read-only\n", cvar->name);
+ return;
+ }
if (developer_extra.integer)
Con_DPrint("Set: ");
}
// check if it's read-only
- cvar = Cvar_FindVar(cvars, Cmd_Argv(cmd, 1), ~0, true);
- if (cvar)
- if(Cvar_Readonly(cvar,"SetA"))
- return;
+ cvar = Cvar_FindVar(cvars, Cmd_Argv(cmd, 1), ~0);
+ if (cvar && cvar->flags & CVAR_READONLY)
+ {
+ Con_Printf("SetA: %s is read-only\n", cvar->name);
+ return;
+ }
if (developer_extra.integer)
Con_DPrint("SetA: ");
Con_Printf("%s: %s is not defined\n", Cmd_Argv(cmd, 0), Cmd_Argv(cmd, i));
continue;
}
- if(Cvar_Readonly(cvar, Cmd_Argv(cmd, 0)))
+ if(cvar->flags & CVAR_READONLY)
+ {
+ Con_Printf("%s: %s is read-only\n", Cmd_Argv(cmd, 0), cvar->name);
continue;
+ }
if(!(cvar->flags & CVAR_ALLOCATED))
{
Con_Printf("%s: %s is static and cannot be deleted\n", Cmd_Argv(cmd, 0), cvar->name);
parent->nextonhashchain = cvar->nextonhashchain;
else if(link)
*link = cvar->nextonhashchain;
- if(!(cvar->flags & CVAR_ALIAS))
- {
- if(cvar->description != cvar_dummy_description)
- Z_Free((char *)cvar->description);
- Z_Free((char *)cvar->name);
- Z_Free((char *)cvar->string);
- Z_Free((char *)cvar->defstring);
- }
+ if(cvar->description != cvar_dummy_description)
+ Z_Free((char *)cvar->description);
+
+ Z_Free((char *)cvar->name);
+ Z_Free((char *)cvar->string);
+ Z_Free((char *)cvar->defstring);
Z_Free(cvar);
}
}
buf[n] = 0;
for(var = cvars->vars; var; var = var->next)
{
- if(var->flags & CVAR_ALIAS)
- continue;
for(i = 0, p = buf, q = var->name; i < n; ++i)
{
*p++ = *q++;
#define CVAR_CLIENT 256
// cvar is accessible in dedicated server
#define CVAR_SERVER 512
-// cvar is an alias of another cvar
-#define CVAR_ALIAS 1024
// used to determine if flags is valid
-#define CVAR_MAXFLAGSVAL 2047
+#define CVAR_MAXFLAGSVAL 1023
// for internal use only!
#define CVAR_DEFAULTSET (1<<30)
#define CVAR_ALLOCATED (1<<31)
//menucvar_t menuinfo;
struct cvar_s *next;
struct cvar_s *nextonhashchain;
- struct cvar_s *alias;
} cvar_t;
typedef struct cvar_state_s
/// registers a cvar that already has the name, string, and optionally the
/// archive elements set.
-void Cvar_RegisterAlias(cvar_t *source, cvar_t *target);
-
void Cvar_RegisterCallback(cvar_t *variable, void (*callback)(char *));
void Cvar_RegisterVariable(cvar_t *variable);
-qboolean Cvar_Readonly (cvar_t *var, const char *cmd_name);
-
/// equivelant to "<name> <variable>" typed at the console
void Cvar_Set (cvar_state_t *cvars, const char *var_name, const char *value);
// Writes lines containing "set variable value" for all variables
// with the archive flag set to true.
-cvar_t *Cvar_FindVar(cvar_state_t *cvars, const char *var_name, int neededflags, qboolean alias);
+cvar_t *Cvar_FindVar(cvar_state_t *cvars, const char *var_name, int neededflags);
cvar_t *Cvar_FindVarAfter(cvar_state_t *cvars, const char *prev_var_name, int neededflags);
int Cvar_CompleteCountPossible(cvar_state_t *cvars, const char *partial, int neededflags);
framelimit = cl_maxphysicsframesperserverframe.integer;
aborttime = Sys_DirtyTime() + 0.1;
}
- if(host_timescale.value > 0 && host_timescale.value < 1)
- advancetime = min(advancetime, 0.1 / host_timescale.value);
+ if(slowmo.value > 0 && slowmo.value < 1)
+ advancetime = min(advancetime, 0.1 / slowmo.value);
else
advancetime = min(advancetime, 0.1);
// only advance time if not paused
// the game also pauses in singleplayer when menu or console is used
- sv.frametime = advancetime * host_timescale.value;
+ sv.frametime = advancetime * slowmo.value;
if (host_framerate.value)
sv.frametime = host_framerate.value;
if (sv.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
// scale playback speed of demos by slowmo cvar
if (cls.demoplayback)
{
- clframetime *= host_timescale.value;
+ clframetime *= slowmo.value;
// if demo playback is paused, don't advance time at all
if (cls.demopaused)
clframetime = 0;
cvarname = Cmd_Argv(cmd, 1);
if (cls.state == ca_connected)
{
- c = Cvar_FindVar(&cvars_all, cvarname, CVAR_CLIENT | CVAR_SERVER, false);
+ c = Cvar_FindVar(&cvars_all, cvarname, CVAR_CLIENT | CVAR_SERVER);
// LadyHavoc: if there is no such cvar or if it is private, send a
// reply indicating that it has no value
if(!c || (c->flags & CVAR_PRIVATE))
Cmd_ForwardStringToServer(va(vabuf, sizeof(vabuf), "sentcvar %s", cvarname));
else
- Cmd_ForwardStringToServer(va(vabuf, sizeof(vabuf), "sentcvar %s \"%s\"", cvarname, c->string));
+ Cmd_ForwardStringToServer(va(vabuf, sizeof(vabuf), "sentcvar %s \"%s\"", c->name, c->string));
return;
}
if(!sv.active)// || !PRVM_serverfunction(SV_ParseClientCommand))
continue;
}
#ifndef STANDALONETEST
- if (net_fakelag.value && (realtime - net_fakelag.value * (1.0 / 2000.0)) < p->sentdoubletime)
+ if (cl_netlocalping.value && (realtime - cl_netlocalping.value * (1.0 / 2000.0)) < p->sentdoubletime)
continue;
#endif
if (value == 0 && p->destinationport == lhnetsocket->address.port)
m_entersound = true;
}
-extern cvar_t host_timescale;
+extern cvar_t slowmo;
extern dllhandle_t jpeg_dll;
extern cvar_t gl_texture_anisotropy;
extern cvar_t r_textshadow;
Cvar_SetValueQuick (&cl_backspeed, 400);
}
}
- else if (options_cursor == optnum++) Cvar_SetValueQuick(&cl_showfps, !cl_showfps.integer);
- else if (options_cursor == optnum++) {f = !(cl_showdate.integer && cl_showtime.integer);Cvar_SetValueQuick(&cl_showdate, f);Cvar_SetValueQuick(&cl_showtime, f);}
+ else if (options_cursor == optnum++) Cvar_SetValueQuick(&showfps, !showfps.integer);
+ else if (options_cursor == optnum++) {f = !(showdate.integer && showtime.integer);Cvar_SetValueQuick(&showdate, f);Cvar_SetValueQuick(&showtime, f);}
else if (options_cursor == optnum++) ;
else if (options_cursor == optnum++) Cvar_SetValueQuick(&r_hdr_scenebrightness, bound(1, r_hdr_scenebrightness.value + dir * 0.0625, 4));
else if (options_cursor == optnum++) Cvar_SetValueQuick(&v_contrast, bound(1, v_contrast.value + dir * 0.0625, 4));
M_Options_PrintCheckbox(" Invert Mouse", true, m_pitch.value < 0);
M_Options_PrintSlider( " Field of View", true, scr_fov.integer, 1, 170);
M_Options_PrintCheckbox(" Always Run", true, cl_forwardspeed.value > 200);
- M_Options_PrintCheckbox(" Show Framerate", true, cl_showfps.integer);
- M_Options_PrintCheckbox(" Show Date and Time", true, cl_showdate.integer && cl_showtime.integer);
+ M_Options_PrintCheckbox(" Show Framerate", true, showfps.integer);
+ M_Options_PrintCheckbox(" Show Date and Time", true, showdate.integer && showtime.integer);
M_Options_PrintCommand( " Custom Brightness", true);
M_Options_PrintSlider( " Game Brightness", true, r_hdr_scenebrightness.value, 1, 4);
M_Options_PrintSlider( " Brightness", true, v_contrast.value, 1, 2);
cvar_t hostname = {CVAR_SERVER | CVAR_SAVE, "hostname", "UNNAMED", "server message to show in server browser"};
cvar_t developer_networking = {CVAR_CLIENT | CVAR_SERVER, "developer_networking", "0", "prints all received and sent packets (recommended only for debugging)"};
-cvar_t net_fakelag = {CVAR_CLIENT, "net_fakelag","0", "lags local loopback connection by this much ping time (useful to play more fairly on your own server with people with higher pings)"};
-cvar_t cl_netlocalping = {CVAR_ALIAS, "cl_netlocalping"};
-static cvar_t net_fakeloss_send = {CVAR_CLIENT, "cl_netpacketloss_send","0", "drops this percentage of outgoing packets, useful for testing network protocol robustness (jerky movement, prediction errors, etc)"};
-static cvar_t net_fakeloss_receive = {CVAR_CLIENT, "cl_netpacketloss_receive","0", "drops this percentage of incoming packets, useful for testing network protocol robustness (jerky movement, effects failing to start, sounds failing to play, etc)"};
-static cvar_t cl_netpacketloss_send = {CVAR_ALIAS, "cl_netpacketloss_send"};
-static cvar_t cl_netpacketloss_receive = {CVAR_ALIAS, "cl_netpacketloss_receive"};
-
+cvar_t cl_netlocalping = {CVAR_CLIENT, "cl_netlocalping","0", "lags local loopback connection by this much ping time (useful to play more fairly on your own server with people with higher pings)"};
+static cvar_t cl_netpacketloss_send = {CVAR_CLIENT, "cl_netpacketloss_send","0", "drops this percentage of outgoing packets, useful for testing network protocol robustness (jerky movement, prediction errors, etc)"};
+static cvar_t cl_netpacketloss_receive = {CVAR_CLIENT, "cl_netpacketloss_receive","0", "drops this percentage of incoming packets, useful for testing network protocol robustness (jerky movement, effects failing to start, sounds failing to play, etc)"};
static cvar_t net_slist_queriespersecond = {CVAR_CLIENT, "net_slist_queriespersecond", "20", "how many server information requests to send per second"};
static cvar_t net_slist_queriesperframe = {CVAR_CLIENT, "net_slist_queriesperframe", "4", "maximum number of server information requests to send each rendered frame (guards against low framerates causing problems)"};
static cvar_t net_slist_timeout = {CVAR_CLIENT, "net_slist_timeout", "4", "how long to listen for a server information response before giving up"};
Thread_UnlockMutex(netconn_mutex);
if (length == 0)
return 0;
- if (net_fakeloss_receive.integer)
+ if (cl_netpacketloss_receive.integer)
for (i = 0;i < cl_numsockets;i++)
- if (cl_sockets[i] == mysocket && (rand() % 100) < net_fakeloss_receive.integer)
+ if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_receive.integer)
return 0;
if (developer_networking.integer)
{
{
int ret;
int i;
- if (net_fakeloss_send.integer)
+ if (cl_netpacketloss_send.integer)
for (i = 0;i < cl_numsockets;i++)
- if (cl_sockets[i] == mysocket && (rand() % 100) < net_fakeloss_send.integer)
+ if (cl_sockets[i] == mysocket && (rand() % 100) < cl_netpacketloss_send.integer)
return length;
if (mysocket->address.addresstype == LHNETADDRESSTYPE_LOOP && netconn_mutex)
Thread_LockMutex(netconn_mutex);
Cvar_RegisterVariable(&net_challengefloodblockingtimeout);
Cvar_RegisterVariable(&net_getstatusfloodblockingtimeout);
Cvar_RegisterVariable(&net_sourceaddresscheck);
- Cvar_RegisterVariable(&net_fakelag);
- Cvar_RegisterVariable(&net_fakeloss_send);
- Cvar_RegisterVariable(&net_fakeloss_receive);
- Cvar_RegisterAlias(&cl_netlocalping, &net_fakelag);
- Cvar_RegisterAlias(&cl_netpacketloss_send, &net_fakeloss_send);
- Cvar_RegisterAlias(&cl_netpacketloss_receive, &net_fakeloss_receive);
+ Cvar_RegisterVariable(&cl_netlocalping);
+ Cvar_RegisterVariable(&cl_netpacketloss_send);
+ Cvar_RegisterVariable(&cl_netpacketloss_receive);
Cvar_RegisterVariable(&hostname);
Cvar_RegisterVariable(&developer_networking);
Cvar_RegisterVariable(&cl_netport);
extern cvar_t sv_public;
-extern cvar_t net_fakelag;
+extern cvar_t cl_netlocalping;
extern cvar_t cl_netport;
extern cvar_t sv_netport;
static qboolean PRVM_Cvar_ReadOk(prvm_prog_t *prog, const char *string)
{
cvar_t *cvar;
- cvar = Cvar_FindVar(prog->console_cmd->cvars, string, prog->console_cmd->cvars_flagsmask, false);
+ cvar = Cvar_FindVar(prog->console_cmd->cvars, string, prog->console_cmd->cvars_flagsmask);
return ((cvar) && ((cvar->flags & CVAR_PRIVATE) == 0));
}
VM_SAFEPARMCOUNTRANGE(1,8,VM_cvar);
VM_VarString(prog, 0, string, sizeof(string));
VM_CheckEmptyString(prog, string);
- cvar = Cvar_FindVar(prog->console_cmd->cvars, string, prog->console_cmd->cvars_flagsmask, true);
+ cvar = Cvar_FindVar(prog->console_cmd->cvars, string, prog->console_cmd->cvars_flagsmask);
if(!cvar)
return;
// first check to see if it has already been defined
- if (Cvar_FindVar (prog->console_cmd->cvars, name, prog->console_cmd->cvars_flagsmask, true))
+ if (Cvar_FindVar (prog->console_cmd->cvars, name, prog->console_cmd->cvars_flagsmask))
return;
// check for overlap with a command
s = PRVM_UglyValueString(prog, (etype_t)key->type, v, valuebuf, sizeof(valuebuf));
if(Cmd_Argc(cmd) == 5)
{
- cvar_t *cvar = Cvar_FindVar(cmd->cvars, Cmd_Argv(cmd, 4), cmd->cvars_flagsmask, true);
- if (cvar)
- if(Cvar_Readonly(cvar, "prvm_edictget"))
- goto fail;
-
+ cvar_t *cvar = Cvar_FindVar(cmd->cvars, Cmd_Argv(cmd, 4), cmd->cvars_flagsmask);
+ if (cvar && cvar->flags & CVAR_READONLY)
+ {
+ Con_Printf("prvm_edictget: %s is read-only\n", cvar->name);
+ goto fail;
+ }
Cvar_Get(cmd->cvars, Cmd_Argv(cmd, 4), s, cmd->cvars_flagsmask, NULL);
}
else
s = PRVM_UglyValueString(prog, (etype_t)key->type, v, valuebuf, sizeof(valuebuf));
if(Cmd_Argc(cmd) == 4)
{
- cvar_t *cvar = Cvar_FindVar(cmd->cvars, Cmd_Argv(cmd, 3), cmd->cvars_flagsmask, true);
- if (cvar)
- if(Cvar_Readonly(cvar, "prvm_globalget"))
- goto fail;
+ cvar_t *cvar = Cvar_FindVar(cmd->cvars, Cmd_Argv(cmd, 3), cmd->cvars_flagsmask);
+ if (cvar && cvar->flags & CVAR_READONLY)
+ {
+ Con_Printf("prvm_globalget: %s is read-only\n", cvar->name);
+ goto fail;
+ }
Cvar_Get(cmd->cvars, Cmd_Argv(cmd, 3), s, cmd->cvars_flagsmask, NULL);
}
else
)
{
prvm_eval_t *val = PRVM_GLOBALFIELDVALUE(prog->globaldefs[i].ofs);
- cvar = Cvar_FindVar(prog->console_cmd->cvars, name + 9, prog->console_cmd->cvars_flagsmask, false);
+ cvar = Cvar_FindVar(prog->console_cmd->cvars, name + 9, prog->console_cmd->cvars_flagsmask);
//Con_Printf("PRVM_LoadProgs: autocvar global %s in %s, processing...\n", name, prog->name);
if(!cvar)
{
cachepic_t *sb_inter;
cachepic_t *sb_finale;
-cvar_t cl_showfps = {CVAR_CLIENT | CVAR_SAVE, "cl_showfps", "0", "shows your rendered fps (frames per second)"};
-cvar_t cl_showsound = {CVAR_CLIENT | CVAR_SAVE, "cl_showsound", "0", "shows number of active sound sources, sound latency, and other statistics"};
-cvar_t cl_showblur = {CVAR_CLIENT | CVAR_SAVE, "cl_showblur", "0", "shows the current alpha level of motionblur"};
-cvar_t cl_showspeed = {CVAR_CLIENT | CVAR_SAVE, "cl_showspeed", "0", "shows your current speed (qu per second); number selects unit: 1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots"};
-cvar_t cl_showtopspeed = {CVAR_CLIENT | CVAR_SAVE, "cl_showtopspeed", "0", "shows your top speed (kept on screen for max 3 seconds); value -1 takes over the unit from cl_showspeed, otherwise it's an unit number just like in cl_showspeed"};
-cvar_t cl_showtime = {CVAR_CLIENT | CVAR_SAVE, "cl_showtime", "0", "shows current time of day (useful on screenshots)"};
-cvar_t cl_showtime_format = {CVAR_CLIENT | CVAR_SAVE, "cl_showtime_format", "%H:%M:%S", "format string for time of day"};
-cvar_t cl_showdate = {CVAR_CLIENT | CVAR_SAVE, "cl_showdate", "0", "shows current date (useful on screenshots)"};
-cvar_t cl_showdate_format = {CVAR_CLIENT | CVAR_SAVE, "cl_showdate_format", "%Y-%m-%d", "format string for date"};
-cvar_t cl_showtex = {CVAR_CLIENT, "cl_showtex", "0", "shows the name of the texture on the crosshair (for map debugging)"};
-
-cvar_t showfps = {CVAR_ALIAS, "showfps"};
-cvar_t showsound = {CVAR_ALIAS, "showsound"};
-cvar_t showblur = {CVAR_ALIAS, "showblur"};
-cvar_t showspeed = {CVAR_ALIAS, "showspeed"};
-cvar_t showtopspeed = {CVAR_ALIAS, "showtopspeed"};
-cvar_t showtime = {CVAR_ALIAS, "showtime"};
-cvar_t showtime_format = {CVAR_ALIAS, "showtime_format"};
-cvar_t showdate = {CVAR_ALIAS, "showdate"};
-cvar_t showdate_format = {CVAR_ALIAS, "showdate_format"};
-cvar_t showtex = {CVAR_ALIAS, "showtex"};
-
+cvar_t showfps = {CVAR_CLIENT | CVAR_SAVE, "showfps", "0", "shows your rendered fps (frames per second)"};
+cvar_t showsound = {CVAR_CLIENT | CVAR_SAVE, "showsound", "0", "shows number of active sound sources, sound latency, and other statistics"};
+cvar_t showblur = {CVAR_CLIENT | CVAR_SAVE, "showblur", "0", "shows the current alpha level of motionblur"};
+cvar_t showspeed = {CVAR_CLIENT | CVAR_SAVE, "showspeed", "0", "shows your current speed (qu per second); number selects unit: 1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots"};
+cvar_t showtopspeed = {CVAR_CLIENT | CVAR_SAVE, "showtopspeed", "0", "shows your top speed (kept on screen for max 3 seconds); value -1 takes over the unit from showspeed, otherwise it's an unit number just like in showspeed"};
+cvar_t showtime = {CVAR_CLIENT | CVAR_SAVE, "showtime", "0", "shows current time of day (useful on screenshots)"};
+cvar_t showtime_format = {CVAR_CLIENT | CVAR_SAVE, "showtime_format", "%H:%M:%S", "format string for time of day"};
+cvar_t showdate = {CVAR_CLIENT | CVAR_SAVE, "showdate", "0", "shows current date (useful on screenshots)"};
+cvar_t showdate_format = {CVAR_CLIENT | CVAR_SAVE, "showdate_format", "%Y-%m-%d", "format string for date"};
+cvar_t showtex = {CVAR_CLIENT, "showtex", "0", "shows the name of the texture on the crosshair (for map debugging)"};
cvar_t sbar_alpha_bg = {CVAR_CLIENT | CVAR_SAVE, "sbar_alpha_bg", "0.4", "opacity value of the statusbar background image"};
cvar_t sbar_alpha_fg = {CVAR_CLIENT | CVAR_SAVE, "sbar_alpha_fg", "1", "opacity value of the statusbar weapon/item icons and numbers"};
cvar_t sbar_hudselector = {CVAR_CLIENT | CVAR_SAVE, "sbar_hudselector", "0", "selects which of the builtin hud layouts to use (meaning is somewhat dependent on gamemode, so nexuiz has a very different set of hud layouts than quake for example)"};
Cmd_AddCommand(&cmd_client, "+showscores", Sbar_ShowScores_f, "show scoreboard");
Cmd_AddCommand(&cmd_client, "-showscores", Sbar_DontShowScores_f, "hide scoreboard");
}
- Cvar_RegisterVariable(&cl_showfps);
- Cvar_RegisterVariable(&cl_showsound);
- Cvar_RegisterVariable(&cl_showblur);
- Cvar_RegisterVariable(&cl_showspeed);
- Cvar_RegisterVariable(&cl_showtopspeed);
- Cvar_RegisterVariable(&cl_showtime);
- Cvar_RegisterVariable(&cl_showtime_format);
- Cvar_RegisterVariable(&cl_showdate);
- Cvar_RegisterVariable(&cl_showdate_format);
- Cvar_RegisterVariable(&cl_showtex);
-
- Cvar_RegisterAlias(&showfps, &cl_showfps);
- Cvar_RegisterAlias(&showsound, &cl_showsound);
- Cvar_RegisterAlias(&showblur, &cl_showblur);
- Cvar_RegisterAlias(&showspeed, &cl_showspeed);
- Cvar_RegisterAlias(&showtopspeed, &cl_showtopspeed);
- Cvar_RegisterAlias(&showtime, &cl_showtime);
- Cvar_RegisterAlias(&showtime_format, &cl_showtime_format);
- Cvar_RegisterAlias(&showdate, &cl_showdate);
- Cvar_RegisterAlias(&showdate_format, &cl_showdate_format);
- Cvar_RegisterAlias(&showtex, &cl_showtex);
-
+ Cvar_RegisterVariable(&showfps);
+ Cvar_RegisterVariable(&showsound);
+ Cvar_RegisterVariable(&showblur);
+ Cvar_RegisterVariable(&showspeed);
+ Cvar_RegisterVariable(&showtopspeed);
+ Cvar_RegisterVariable(&showtime);
+ Cvar_RegisterVariable(&showtime_format);
+ Cvar_RegisterVariable(&showdate);
+ Cvar_RegisterVariable(&showdate_format);
+ Cvar_RegisterVariable(&showtex);
Cvar_RegisterVariable(&sbar_alpha_bg);
Cvar_RegisterVariable(&sbar_alpha_fg);
Cvar_RegisterVariable(&sbar_hudselector);
static void get_showspeed_unit(int unitnumber, double *conversion_factor, const char **unit)
{
if(unitnumber < 0)
- unitnumber = cl_showspeed.integer;
+ unitnumber = showspeed.integer;
switch(unitnumber)
{
default:
topspeedstring[0] = 0;
texstring[0] = 0;
entstring[0] = 0;
- if (cl_showfps.integer)
+ if (showfps.integer)
{
red = (showfps_framerate < 1.0f);
- if(cl_showfps.integer == 2)
+ if(showfps.integer == 2)
dpsnprintf(fpsstring, sizeof(fpsstring), "%7.3f mspf", (1000.0 / showfps_framerate));
else if (red)
dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / showfps_framerate + 0.5));
fps_strings++;
}
}
- if (cl_showtime.integer)
+ if (showtime.integer)
{
- strlcpy(timestring, Sys_TimeString(cl_showtime_format.string), sizeof(timestring));
+ strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
fps_strings++;
}
- if (cl_showdate.integer)
+ if (showdate.integer)
{
- strlcpy(datestring, Sys_TimeString(cl_showdate_format.string), sizeof(datestring));
+ strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
fps_strings++;
}
- if (cl_showblur.integer)
+ if (showblur.integer)
{
dpsnprintf(blurstring, sizeof(blurstring), "%3i%% blur", (int)(cl.motionbluralpha * 100));
fps_strings++;
}
- if (cl_showsound.integer)
+ if (showsound.integer)
{
dpsnprintf(soundstring, sizeof(soundstring), "%4i/4%i at %3ims", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
fps_strings++;
}
- if (cl_showspeed.integer || cl_showtopspeed.integer)
+ if (showspeed.integer || showtopspeed.integer)
{
double speed, speedxy, f;
const char *unit;
speed = VectorLength(cl.movement_velocity);
speedxy = sqrt(cl.movement_velocity[0] * cl.movement_velocity[0] + cl.movement_velocity[1] * cl.movement_velocity[1]);
- if (cl_showspeed.integer)
+ if (showspeed.integer)
{
- get_showspeed_unit(cl_showspeed.integer, &f, &unit);
+ get_showspeed_unit(showspeed.integer, &f, &unit);
dpsnprintf(speedstring, sizeof(speedstring), "%.0f (%.0f) %s", f*speed, f*speedxy, unit);
fps_strings++;
}
- if (cl_showtopspeed.integer)
+ if (showtopspeed.integer)
{
qboolean topspeed_latched = false, topspeedxy_latched = false;
- get_showspeed_unit(cl_showtopspeed.integer, &f, &unit);
+ get_showspeed_unit(showtopspeed.integer, &f, &unit);
if (speed >= topspeed || current_time - top_time > 3)
{
topspeed = speed;
fps_strings++;
}
}
- if (cl_showtex.integer)
+ if (showtex.integer)
{
vec3_t org;
vec3_t dest;
extern cvar_t scr_viewsize;
extern cvar_t scr_fov;
-extern cvar_t cl_showfps;
-extern cvar_t cl_showtime;
-extern cvar_t cl_showdate;
+extern cvar_t showfps;
+extern cvar_t showtime;
+extern cvar_t showdate;
extern cvar_t crosshair;
extern cvar_t crosshair_size;
extern cvar_t scratch3;
extern cvar_t scratch4;
extern cvar_t skill;
-extern cvar_t host_timescale;
+extern cvar_t slowmo;
extern cvar_t sv_accelerate;
extern cvar_t sv_aim;
extern cvar_t sv_airaccel_qw;
cvar_t pr_checkextension = {CVAR_SERVER | CVAR_READONLY, "pr_checkextension", "1", "indicates to QuakeC that the standard quakec extensions system is available (if 0, quakec should not attempt to use extensions)"};
cvar_t samelevel = {CVAR_SERVER | CVAR_NOTIFY, "samelevel","0", "repeats same level if level ends (due to timelimit or someone hitting an exit)"};
cvar_t skill = {CVAR_SERVER, "skill","1", "difficulty level of game, affects monster layouts in levels, 0 = easy, 1 = normal, 2 = hard, 3 = nightmare (same layout as hard but monsters fire twice)"};
-cvar_t host_timescale = {CVAR_CLIENT | CVAR_SERVER, "host_timescale", "1.0", "controls game speed, 0.5 is half speed, 2 is double speed"};
-cvar_t slowmo = {CVAR_ALIAS, "slowmo"};
+cvar_t slowmo = {CVAR_CLIENT | CVAR_SERVER, "slowmo", "1.0", "controls game speed, 0.5 is half speed, 2 is double speed"};
cvar_t sv_accelerate = {CVAR_SERVER, "sv_accelerate", "10", "rate at which a player accelerates to sv_maxspeed"};
cvar_t sv_aim = {CVAR_SERVER | CVAR_SAVE, "sv_aim", "2", "maximum cosine angle for quake's vertical autoaim, a value above 1 completely disables the autoaim, quake used 0.93"};
mempool_t *sv_mempool = NULL;
-extern cvar_t host_timescale;
+extern cvar_t slowmo;
extern float scr_centertime_off;
// MUST match effectnameindex_t in client.h
#undef PRVM_DECLARE_function
};
-static void Host_Timescale_c(char *string)
+static void SV_Slowmo_c(char *string)
{
double value;
value = atof(string);
Cvar_RegisterVariable (&pr_checkextension);
Cvar_RegisterVariable (&samelevel);
Cvar_RegisterVariable (&skill);
- Cvar_RegisterVariable (&host_timescale);
- Cvar_RegisterCallback (&host_timescale, Host_Timescale_c);
- Cvar_RegisterAlias (&slowmo, &host_timescale);
+ Cvar_RegisterVariable (&slowmo);
+ Cvar_RegisterCallback (&slowmo, SV_Slowmo_c);
Cvar_RegisterVariable (&sv_accelerate);
Cvar_RegisterVariable (&sv_aim);
Cvar_RegisterVariable (&sv_airaccel_qw);
| (sv_gameplayfix_gravityunaffectedbyticrate.integer ? MOVEFLAG_GRAVITYUNAFFECTEDBYTICRATE : 0)
;
statsf[STAT_MOVEVARS_TICRATE] = sys_ticrate.value;
- statsf[STAT_MOVEVARS_TIMESCALE] = host_timescale.value;
+ statsf[STAT_MOVEVARS_TIMESCALE] = slowmo.value;
statsf[STAT_MOVEVARS_GRAVITY] = sv_gravity.value;
statsf[STAT_MOVEVARS_STOPSPEED] = sv_stopspeed.value;
statsf[STAT_MOVEVARS_MAXSPEED] = sv_maxspeed.value;
// only advance time if not paused
// the game also pauses in singleplayer when menu or console is used
- sv.frametime = advancetime * host_timescale.value;
+ sv.frametime = advancetime * slowmo.value;
if (host_framerate.value)
sv.frametime = host_framerate.value;
if (sv.paused || (cl.islocalgame && (key_dest != key_game || key_consoleactive || cl.csqc_paused)))
qboolean VID_InitMode(viddef_mode_t *mode)
{
// GAME_STEELSTORM specific
- steelstorm_showing_map = Cvar_FindVar(&cvars_all, "steelstorm_showing_map", ~0, false);
- steelstorm_showing_mousecursor = Cvar_FindVar(&cvars_all, "steelstorm_showing_mousecursor", ~0, false);
+ steelstorm_showing_map = Cvar_FindVar(&cvars_all, "steelstorm_showing_map", ~0);
+ steelstorm_showing_mousecursor = Cvar_FindVar(&cvars_all, "steelstorm_showing_mousecursor", ~0);
if (!SDL_WasInit(SDL_INIT_VIDEO) && SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
Sys_Error ("Failed to init SDL video subsystem: %s", SDL_GetError());