2004-08-21 01:25:48 +00:00
|
|
|
/*
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2005-07-03 15:16:20 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
// cvar.c -- dynamic variable tracking
|
|
|
|
|
|
|
|
#include "quakedef.h"
|
2009-11-04 21:16:50 +00:00
|
|
|
#include "shader.h"
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
cvar_group_t *cvar_groups;
|
|
|
|
|
2010-07-11 02:22:39 +00:00
|
|
|
hashtable_t cvar_hash;
|
|
|
|
bucket_t *cvar_buckets[1024];
|
2016-08-25 00:12:14 +00:00
|
|
|
int cvar_watched;
|
2010-07-11 02:22:39 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
//cvar_t *cvar_vars;
|
2009-01-29 02:55:08 +00:00
|
|
|
static char *cvar_null_string = "";
|
|
|
|
static char *cvar_zero_string = "0";
|
2009-04-01 22:03:56 +00:00
|
|
|
static char *cvar_one_string = "1";
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2018-10-11 10:31:23 +00:00
|
|
|
static char *Cvar_DefaultAlloc(char *str)
|
2005-09-21 01:14:04 +00:00
|
|
|
{
|
2009-01-29 02:55:08 +00:00
|
|
|
char *c;
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2009-01-29 02:55:08 +00:00
|
|
|
if (str[0] == '\0')
|
|
|
|
return cvar_null_string;
|
|
|
|
if (str[0] == '0' && str[1] == '\0')
|
|
|
|
return cvar_zero_string;
|
2009-04-01 22:03:56 +00:00
|
|
|
if (str[0] == '1' && str[1] == '\0')
|
|
|
|
return cvar_one_string;
|
2005-09-21 01:14:04 +00:00
|
|
|
|
2009-01-29 02:55:08 +00:00
|
|
|
c = (char *)Z_Malloc(strlen(str)+1);
|
|
|
|
Q_strcpy(c, str);
|
2005-09-21 01:14:04 +00:00
|
|
|
|
2009-01-29 02:55:08 +00:00
|
|
|
return c;
|
2005-09-21 01:14:04 +00:00
|
|
|
}
|
|
|
|
|
2009-01-29 02:55:08 +00:00
|
|
|
void Cvar_DefaultFree(char *str)
|
2005-09-21 01:14:04 +00:00
|
|
|
{
|
2009-01-29 02:55:08 +00:00
|
|
|
if (str == cvar_null_string)
|
|
|
|
return;
|
|
|
|
else if (str == cvar_zero_string)
|
|
|
|
return;
|
2009-04-01 22:03:56 +00:00
|
|
|
else if (str == cvar_one_string)
|
|
|
|
return;
|
2009-01-29 02:55:08 +00:00
|
|
|
else
|
|
|
|
Z_Free(str);
|
2005-09-21 01:14:04 +00:00
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_FindVar
|
|
|
|
============
|
|
|
|
*/
|
2005-03-28 00:11:59 +00:00
|
|
|
cvar_t *Cvar_FindVar (const char *var_name)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
2014-03-30 08:55:06 +00:00
|
|
|
return Hash_GetInsensitive(&cvar_hash, var_name);
|
2010-07-11 02:22:39 +00:00
|
|
|
/*
|
2004-08-21 01:25:48 +00:00
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *var;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
for (var=grp->cvars ; var ; var=var->next)
|
2006-04-21 06:02:06 +00:00
|
|
|
{
|
2004-08-21 01:25:48 +00:00
|
|
|
if (!Q_strcasecmp (var_name, var->name))
|
|
|
|
return var;
|
|
|
|
if (var->name2 && !Q_strcasecmp (var_name, var->name2))
|
|
|
|
return var;
|
2006-04-21 06:02:06 +00:00
|
|
|
}
|
2010-07-11 02:22:39 +00:00
|
|
|
*/
|
2004-08-21 01:25:48 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-10-11 10:31:23 +00:00
|
|
|
static cvar_group_t *Cvar_FindGroup (const char *group_name)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
if (!Q_strcasecmp (group_name, grp->name))
|
|
|
|
return grp;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2018-10-11 10:31:23 +00:00
|
|
|
static cvar_group_t *Cvar_GetGroup(const char *gname)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
cvar_group_t *g;
|
|
|
|
if (!gname)
|
|
|
|
gname = "Miscilaneous vars";
|
|
|
|
g = Cvar_FindGroup(gname);
|
|
|
|
if (g)
|
|
|
|
return g;
|
|
|
|
|
2006-01-13 20:28:46 +00:00
|
|
|
g = (cvar_group_t*)Z_Malloc(sizeof(cvar_group_t) + strlen(gname)+1);
|
|
|
|
g->name = (char*)(g+1);
|
2006-01-21 00:06:49 +00:00
|
|
|
strcpy((char*)g->name, gname);
|
2004-08-21 01:25:48 +00:00
|
|
|
g->next = NULL;
|
|
|
|
g->next = cvar_groups;
|
|
|
|
cvar_groups = g;
|
|
|
|
return g;
|
|
|
|
}
|
|
|
|
|
2005-08-22 22:21:59 +00:00
|
|
|
// converts a given single cvar flag into a human readable string
|
2018-10-11 10:31:23 +00:00
|
|
|
static char *Cvar_FlagToName(int flag)
|
2005-08-22 22:21:59 +00:00
|
|
|
{
|
|
|
|
switch (flag)
|
|
|
|
{
|
|
|
|
case CVAR_ARCHIVE:
|
|
|
|
return "archive";
|
|
|
|
case CVAR_USERINFO:
|
|
|
|
return "userinfo";
|
2005-10-30 01:21:42 +00:00
|
|
|
case CVAR_SERVERINFO:
|
|
|
|
return "serverinfo";
|
2005-08-22 22:21:59 +00:00
|
|
|
case CVAR_NOSET:
|
|
|
|
return "noset";
|
|
|
|
case CVAR_LATCH:
|
|
|
|
return "latch";
|
|
|
|
case CVAR_POINTER:
|
|
|
|
return "pointer";
|
|
|
|
case CVAR_NOTFROMSERVER:
|
|
|
|
return "noserver";
|
|
|
|
case CVAR_USERCREATED:
|
|
|
|
return "userset";
|
|
|
|
case CVAR_CHEAT:
|
|
|
|
return "cheat";
|
|
|
|
case CVAR_SEMICHEAT:
|
|
|
|
return "semicheat";
|
|
|
|
case CVAR_RENDERERLATCH:
|
|
|
|
return "renderlatch";
|
2018-01-22 19:18:04 +00:00
|
|
|
case CVAR_VIDEOLATCH:
|
|
|
|
return "videolatch";
|
2005-08-22 22:21:59 +00:00
|
|
|
case CVAR_SERVEROVERRIDE:
|
|
|
|
return "serverlatch";
|
2006-04-12 00:17:02 +00:00
|
|
|
case CVAR_RENDERERCALLBACK:
|
|
|
|
return "rendercallback";
|
2006-06-12 22:05:41 +00:00
|
|
|
case CVAR_NOUNSAFEEXPAND:
|
|
|
|
return "nounsafeexpand";
|
2007-09-17 20:35:39 +00:00
|
|
|
case CVAR_RULESETLATCH:
|
|
|
|
return "rulesetlatch";
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
case CVAR_SHADERSYSTEM:
|
|
|
|
return "shadersystem";
|
2014-02-11 17:51:29 +00:00
|
|
|
case CVAR_NOSAVE:
|
|
|
|
return "nosave";
|
2015-07-08 19:32:16 +00:00
|
|
|
case CVAR_TELLGAMECODE:
|
|
|
|
return "autocvar";
|
|
|
|
case CVAR_CONFIGDEFAULT:
|
|
|
|
return "";
|
|
|
|
case CVAR_NORESET:
|
|
|
|
return "noreset";
|
2005-08-22 22:21:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
//lists commands, also prints restriction level
|
2005-08-22 22:21:59 +00:00
|
|
|
#define CLF_RAW 0x1
|
|
|
|
#define CLF_LEVEL 0x2
|
2005-08-23 03:25:22 +00:00
|
|
|
#define CLF_ALTNAME 0x4
|
2005-08-22 22:21:59 +00:00
|
|
|
#define CLF_VALUES 0x8
|
|
|
|
#define CLF_DEFAULT 0x10
|
|
|
|
#define CLF_LATCHES 0x20
|
|
|
|
#define CLF_FLAGS 0x40
|
|
|
|
#define CLF_FLAGMASK 0x80
|
2018-07-22 11:49:37 +00:00
|
|
|
#define CLF_CHANGEDONLY 0x100
|
2004-08-21 01:25:48 +00:00
|
|
|
void Cvar_List_f (void)
|
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *cmd;
|
2005-08-22 22:21:59 +00:00
|
|
|
char *var, *search, *gsearch;
|
|
|
|
int gnum, i, num = 0;
|
2005-08-23 03:25:22 +00:00
|
|
|
int listflags = 0, cvarflags = 0;
|
|
|
|
char strtmp[512];
|
2011-05-15 13:23:13 +00:00
|
|
|
static char *cvarlist_help =
|
|
|
|
"cvarlist list all cvars matching given parameters\n"
|
|
|
|
"Syntax: cvarlist [-FLdhlrv] [-f flag] [-g group] [cvar]\n"
|
2018-07-22 11:49:37 +00:00
|
|
|
" -c includes only the cvars that have been changed from their defaults\n"
|
2011-05-15 13:23:13 +00:00
|
|
|
" -F shows cvar flags\n"
|
|
|
|
" -L shows latched values\n"
|
|
|
|
" -a shows cvar alternate names\n"
|
|
|
|
" -d shows default cvar values\n"
|
|
|
|
" -f shows only cvars with a matching flag, more than one -f can be used\n"
|
|
|
|
" -g shows only cvar groups using wildcards in group\n"
|
|
|
|
" -h shows this help message\n"
|
|
|
|
" -l shows cvar restriction levels\n"
|
|
|
|
" -r removes group and list headers\n"
|
|
|
|
" -v shows current values\n"
|
|
|
|
" cvar indicates the cvar to show, wildcards (*,?) accepted\n"
|
|
|
|
"Cvar flags are:"
|
|
|
|
;
|
|
|
|
|
2015-07-08 19:32:16 +00:00
|
|
|
if (Cmd_Argc() == 1)
|
|
|
|
goto showhelp;
|
|
|
|
|
2005-08-22 22:21:59 +00:00
|
|
|
gsearch = search = NULL;
|
|
|
|
for (i = 1; i < Cmd_Argc(); i++)
|
|
|
|
{
|
|
|
|
var = Cmd_Argv(i);
|
|
|
|
if (*var == '-')
|
|
|
|
{
|
|
|
|
// short options
|
|
|
|
for (var++; *var; var++)
|
|
|
|
{
|
2005-08-23 03:25:22 +00:00
|
|
|
switch (*var)
|
2005-08-22 22:21:59 +00:00
|
|
|
{
|
2005-08-23 03:25:22 +00:00
|
|
|
case 'g':
|
2005-08-22 22:21:59 +00:00
|
|
|
// fix this so we can search for multiple groups
|
|
|
|
i++;
|
|
|
|
if (i >= Cmd_Argc())
|
|
|
|
{
|
|
|
|
Con_Printf("Missing parameter for -g\nUse cvarlist -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gsearch = Cmd_Argv(i);
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
2018-07-22 11:49:37 +00:00
|
|
|
case 'c':
|
|
|
|
listflags |= CLF_CHANGEDONLY;
|
|
|
|
break;
|
2005-08-23 03:25:22 +00:00
|
|
|
case 'a':
|
|
|
|
listflags |= CLF_ALTNAME;
|
|
|
|
break;
|
|
|
|
case 'l':
|
2005-08-22 22:21:59 +00:00
|
|
|
listflags |= CLF_LEVEL;
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'r':
|
2005-08-22 22:21:59 +00:00
|
|
|
listflags |= CLF_RAW;
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'v':
|
2005-08-22 22:21:59 +00:00
|
|
|
listflags |= CLF_VALUES;
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'd':
|
2005-08-22 22:21:59 +00:00
|
|
|
listflags |= CLF_DEFAULT;
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'L':
|
2005-08-22 22:21:59 +00:00
|
|
|
listflags |= CLF_LATCHES;
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'f':
|
2005-08-22 22:21:59 +00:00
|
|
|
{
|
|
|
|
char *tmpv;
|
|
|
|
|
2005-08-23 03:25:22 +00:00
|
|
|
listflags |= CLF_FLAGMASK;
|
2005-08-22 22:21:59 +00:00
|
|
|
|
|
|
|
i++;
|
|
|
|
if (i >= Cmd_Argc())
|
|
|
|
{
|
|
|
|
Con_Printf("Missing parameter for -f\nUse cvarlist -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
tmpv = Cmd_Argv(i);
|
|
|
|
|
|
|
|
for (num = 1; num <= CVAR_LASTFLAG; num <<= 1)
|
|
|
|
{
|
|
|
|
char *tmp;
|
|
|
|
|
|
|
|
tmp = Cvar_FlagToName(num);
|
|
|
|
|
|
|
|
if (tmp && !stricmp(tmp, tmpv))
|
|
|
|
{
|
|
|
|
cvarflags |= num;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (num > CVAR_LASTFLAG)
|
|
|
|
{
|
|
|
|
Con_Printf("Invalid cvar flag name\nUse cvarlist -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'F':
|
2005-08-22 22:21:59 +00:00
|
|
|
listflags |= CLF_FLAGS;
|
2005-08-23 03:25:22 +00:00
|
|
|
break;
|
|
|
|
case 'h':
|
2015-07-08 19:32:16 +00:00
|
|
|
showhelp:
|
2005-08-22 22:21:59 +00:00
|
|
|
// list options
|
2011-05-15 13:23:13 +00:00
|
|
|
Con_Printf("%s", cvarlist_help);
|
2005-08-22 22:21:59 +00:00
|
|
|
|
|
|
|
for (num = 1; num <= CVAR_LASTFLAG; num <<= 1)
|
|
|
|
{
|
|
|
|
// no point caring about the content of var at this point
|
|
|
|
var = Cvar_FlagToName(num);
|
|
|
|
|
|
|
|
if (var)
|
|
|
|
Con_Printf(" %s", var);
|
|
|
|
}
|
|
|
|
|
|
|
|
Con_Printf("\n\n");
|
|
|
|
return;
|
2005-08-23 03:25:22 +00:00
|
|
|
case '-':
|
|
|
|
break;
|
|
|
|
default:
|
2005-08-22 22:21:59 +00:00
|
|
|
Con_Printf("Invalid option for cvarlist\nUse cvarlist -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
search = var;
|
|
|
|
}
|
|
|
|
|
2005-08-23 03:25:22 +00:00
|
|
|
// this is sane.. hopefully
|
|
|
|
if (gsearch)
|
|
|
|
Q_strlwr(gsearch);
|
|
|
|
|
|
|
|
if (search)
|
|
|
|
Q_strlwr(search);
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
{
|
2005-08-22 22:21:59 +00:00
|
|
|
// list only cvars with group search substring
|
2005-08-23 03:25:22 +00:00
|
|
|
if (gsearch)
|
|
|
|
{
|
|
|
|
Q_strncpyz(strtmp, grp->name, 512);
|
|
|
|
Q_strlwr(strtmp);
|
|
|
|
if (!wildcmp(gsearch, strtmp))
|
|
|
|
continue;
|
|
|
|
}
|
2005-08-22 22:21:59 +00:00
|
|
|
|
|
|
|
gnum = 0;
|
|
|
|
for (cmd=grp->cvars ; cmd ; cmd=cmd->next)
|
|
|
|
{
|
|
|
|
// list only non-restricted cvars
|
2009-11-04 21:16:50 +00:00
|
|
|
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
|
2005-08-22 22:21:59 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
// list only cvars with search substring
|
2005-08-23 03:25:22 +00:00
|
|
|
if (search)
|
|
|
|
{
|
|
|
|
Q_strncpyz(strtmp, cmd->name, 512);
|
|
|
|
Q_strlwr(strtmp);
|
|
|
|
|
|
|
|
if (!wildcmp(search, strtmp))
|
|
|
|
{
|
|
|
|
if (cmd->name2)
|
|
|
|
{
|
|
|
|
Q_strncpyz(strtmp, cmd->name2, 512);
|
|
|
|
Q_strlwr(strtmp);
|
|
|
|
if (!wildcmp(search, strtmp))
|
2011-05-15 13:23:13 +00:00
|
|
|
continue;
|
2005-08-23 03:25:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
2005-08-22 22:21:59 +00:00
|
|
|
|
|
|
|
// list only cvars with matching flags
|
2005-08-23 03:25:22 +00:00
|
|
|
if ((listflags & CLF_FLAGMASK) && !(cmd->flags & cvarflags))
|
2005-08-22 22:21:59 +00:00
|
|
|
continue;
|
|
|
|
|
2018-07-22 11:49:37 +00:00
|
|
|
if ((listflags & CLF_CHANGEDONLY) && cmd->defaultstr && !strcmp(cmd->string, cmd->defaultstr))
|
|
|
|
continue;
|
|
|
|
|
2005-08-22 22:21:59 +00:00
|
|
|
// print cvar list header
|
|
|
|
if (!(listflags & CLF_RAW) && !num)
|
2013-11-29 14:36:47 +00:00
|
|
|
Con_TPrintf("CVar list:\n");
|
2005-08-22 22:21:59 +00:00
|
|
|
|
|
|
|
// print group header
|
|
|
|
if (!(listflags & CLF_RAW) && !gnum)
|
|
|
|
Con_Printf("%s --\n", grp->name);
|
|
|
|
|
|
|
|
// print restriction level
|
|
|
|
if (listflags & CLF_LEVEL)
|
|
|
|
Con_Printf("(%i) ", cmd->restriction);
|
|
|
|
|
|
|
|
// print cvar name
|
2011-05-15 13:23:13 +00:00
|
|
|
Con_Printf("%s", cmd->name);
|
|
|
|
|
2005-08-22 22:21:59 +00:00
|
|
|
// print current value
|
|
|
|
if (listflags & CLF_VALUES)
|
|
|
|
{
|
|
|
|
if (*cmd->string)
|
|
|
|
Con_Printf(" %s", cmd->string);
|
|
|
|
}
|
|
|
|
|
|
|
|
// print default value
|
2013-10-29 17:38:22 +00:00
|
|
|
if (cmd->defaultstr && (listflags & CLF_DEFAULT))
|
2005-08-22 22:21:59 +00:00
|
|
|
Con_Printf(", default \"%s\"", cmd->defaultstr);
|
|
|
|
|
2005-08-23 03:25:22 +00:00
|
|
|
// print alternate name
|
|
|
|
if ((listflags & CLF_ALTNAME) && cmd->name2)
|
|
|
|
Con_Printf(", alternate %s", cmd->name2);
|
|
|
|
|
2005-08-22 22:21:59 +00:00
|
|
|
// print cvar flags
|
|
|
|
if (listflags & CLF_FLAGS)
|
|
|
|
{
|
2011-05-15 13:23:13 +00:00
|
|
|
for (i = 1; i <= CVAR_LASTFLAG; i <<= 1)
|
2005-08-22 22:21:59 +00:00
|
|
|
{
|
2011-05-15 13:23:13 +00:00
|
|
|
if (i & cmd->flags)
|
2005-08-22 22:21:59 +00:00
|
|
|
{
|
|
|
|
var = Cvar_FlagToName(i);
|
|
|
|
if (var)
|
|
|
|
Con_Printf(" %s", var);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// print latched value
|
|
|
|
if (listflags & CLF_LATCHES)
|
|
|
|
{
|
|
|
|
if (cmd->latched_string)
|
|
|
|
Con_Printf(", latched as \"%s\"", cmd->latched_string);
|
|
|
|
}
|
|
|
|
|
|
|
|
// print new line to finish individual cvar
|
|
|
|
Con_Printf("\n");
|
|
|
|
|
|
|
|
num++;
|
|
|
|
gnum++;
|
|
|
|
}
|
|
|
|
|
|
|
|
// print new line to seperate groups
|
|
|
|
if (!(listflags & CLF_RAW) && gnum)
|
|
|
|
Con_Printf("\n");
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-29 02:35:10 +00:00
|
|
|
//default values are meant to be constants.
|
|
|
|
//sometimes that just doesn't make sense.
|
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
|
|
|
//so provide a safe way to change it (MUST be initialised to NULL so that it doesn't get freed)
|
2014-12-29 02:35:10 +00:00
|
|
|
void Cvar_SetEngineDefault(cvar_t *var, char *val)
|
|
|
|
{
|
|
|
|
qboolean wasdefault = (var->defaultstr == var->enginevalue);
|
|
|
|
Z_Free(var->enginevalue);
|
|
|
|
if (val)
|
|
|
|
var->enginevalue = Z_StrDup(val);
|
|
|
|
else
|
|
|
|
var->enginevalue = NULL;
|
|
|
|
|
|
|
|
if (wasdefault)
|
|
|
|
var->defaultstr = var->enginevalue;
|
|
|
|
}
|
2013-10-29 17:38:22 +00:00
|
|
|
void Cvar_LockDefaults_f(void)
|
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *cmd;
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
{
|
|
|
|
for (cmd=grp->cvars ; cmd ; cmd=cmd->next)
|
|
|
|
{
|
|
|
|
if (cmd->flags & (CVAR_NOSET | CVAR_CHEAT))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (strcmp(cmd->string, cmd->defaultstr))
|
|
|
|
{
|
|
|
|
if (cmd->defaultstr != cmd->enginevalue)
|
|
|
|
Cvar_DefaultFree(cmd->defaultstr);
|
|
|
|
cmd->defaultstr = Cvar_DefaultAlloc(cmd->string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Cvar_PurgeDefaults_f(void)
|
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *cmd;
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
{
|
|
|
|
for (cmd=grp->cvars ; cmd ; cmd=cmd->next)
|
|
|
|
{
|
|
|
|
if (!cmd->enginevalue)
|
|
|
|
continue; //can't reset the cvar's default if its an engine cvar.
|
|
|
|
if (cmd->flags & CVAR_NOSET)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (cmd->defaultstr != cmd->enginevalue)
|
|
|
|
{
|
|
|
|
Cvar_DefaultFree(cmd->defaultstr);
|
|
|
|
cmd->defaultstr = cmd->enginevalue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-23 03:25:22 +00:00
|
|
|
#define CRF_ALTNAME 0x1
|
|
|
|
void Cvar_Reset_f (void)
|
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *cmd;
|
2005-09-14 04:18:05 +00:00
|
|
|
int i, listflags=0, exclflags;
|
2005-08-23 03:25:22 +00:00
|
|
|
char *var;
|
|
|
|
char *search, *gsearch;
|
|
|
|
char strtmp[512];
|
2013-10-29 17:38:22 +00:00
|
|
|
char *resetval;
|
|
|
|
char *pendingval;
|
2005-08-23 03:25:22 +00:00
|
|
|
|
|
|
|
search = gsearch = NULL;
|
2005-08-27 04:24:38 +00:00
|
|
|
exclflags = 0;
|
2005-08-23 03:25:22 +00:00
|
|
|
|
|
|
|
// parse command line options
|
|
|
|
for (i = 1; i < Cmd_Argc(); i++)
|
|
|
|
{
|
|
|
|
var = Cmd_Argv(i);
|
|
|
|
if (*var == '-')
|
|
|
|
{
|
|
|
|
// short options
|
|
|
|
for (var++; *var; var++)
|
|
|
|
{
|
|
|
|
switch (*var)
|
|
|
|
{
|
|
|
|
case 'a':
|
|
|
|
listflags |= CRF_ALTNAME;
|
|
|
|
break;
|
|
|
|
case 'g':
|
|
|
|
// fix this so we can search for multiple groups
|
|
|
|
i++;
|
|
|
|
if (i >= Cmd_Argc())
|
|
|
|
{
|
|
|
|
Con_Printf("Missing parameter for -g\nUse cvarlist -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gsearch = Cmd_Argv(i);
|
|
|
|
break;
|
2005-08-27 04:24:38 +00:00
|
|
|
case 'u':
|
|
|
|
exclflags |= CVAR_USERCREATED;
|
2005-08-23 03:25:22 +00:00
|
|
|
case 'h':
|
|
|
|
Con_Printf("cvarreset resets all cvars to default values matching given parameters\n"
|
2005-08-27 04:24:38 +00:00
|
|
|
"Syntax: cvarreset [-ahu] (-g group)/cvar\n"
|
2005-08-23 03:25:22 +00:00
|
|
|
" -a matches cvar against alternate cvar names\n"
|
|
|
|
" -g matches using wildcards in group\n"
|
|
|
|
" -h shows this help message\n"
|
2005-08-27 04:24:38 +00:00
|
|
|
" -u excludes user cvars\n"
|
2005-08-23 03:25:22 +00:00
|
|
|
" cvar indicates the cvars to reset, wildcards (*, ?) accepted\n"
|
|
|
|
"A -g or cvar is required\n");
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
Con_Printf("Invalid option for cvarreset\nUse cvarreset -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
2011-05-15 13:23:13 +00:00
|
|
|
}
|
2005-08-23 03:25:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
search = var;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!search && !gsearch)
|
|
|
|
{
|
|
|
|
Con_Printf("No group or cvars given\nUse cvarreset -h for help\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// this should be sane.. hopefully
|
|
|
|
if (search)
|
|
|
|
Q_strlwr(search);
|
|
|
|
if (gsearch)
|
|
|
|
Q_strlwr(gsearch);
|
|
|
|
|
2013-10-29 17:38:22 +00:00
|
|
|
if (search && !strcmp(search, "*"))
|
2013-08-07 14:20:24 +00:00
|
|
|
search = NULL;
|
2013-10-29 17:38:22 +00:00
|
|
|
if (gsearch && !strcmp(gsearch, "*"))
|
2013-08-07 14:20:24 +00:00
|
|
|
gsearch = NULL;
|
|
|
|
|
2005-08-23 03:25:22 +00:00
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
{
|
|
|
|
if (gsearch)
|
|
|
|
{
|
|
|
|
Q_strncpyz(strtmp, grp->name, 512);
|
|
|
|
Q_strlwr(strtmp);
|
|
|
|
if (!wildcmp(gsearch, strtmp))
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (cmd=grp->cvars ; cmd ; cmd=cmd->next)
|
|
|
|
{
|
|
|
|
// reset only non-restricted cvars
|
2009-11-04 21:16:50 +00:00
|
|
|
if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
|
2005-08-23 03:25:22 +00:00
|
|
|
continue;
|
|
|
|
|
2005-08-27 04:24:38 +00:00
|
|
|
// don't reset cvars with matched flags
|
|
|
|
if (exclflags & cmd->flags)
|
|
|
|
continue;
|
|
|
|
|
2005-08-23 03:25:22 +00:00
|
|
|
// reset only cvars with search substring
|
|
|
|
if (search)
|
|
|
|
{
|
|
|
|
Q_strncpyz(strtmp, cmd->name, 512);
|
|
|
|
Q_strlwr(strtmp);
|
|
|
|
|
|
|
|
if (!wildcmp(search, strtmp))
|
|
|
|
{
|
|
|
|
if ((listflags & CRF_ALTNAME) && cmd->name2)
|
|
|
|
{
|
|
|
|
Q_strncpyz(strtmp, cmd->name2, 512);
|
|
|
|
Q_strlwr(strtmp);
|
|
|
|
if (!wildcmp(search, strtmp))
|
2011-05-15 13:23:13 +00:00
|
|
|
continue;
|
2005-08-23 03:25:22 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-07 14:20:24 +00:00
|
|
|
if ((cmd->flags & CVAR_NOSET) && !search)
|
2013-05-14 12:59:37 +00:00
|
|
|
continue;
|
2014-02-11 17:51:29 +00:00
|
|
|
if (cmd->flags & CVAR_NORESET)
|
|
|
|
continue;
|
2013-10-29 17:38:22 +00:00
|
|
|
|
|
|
|
// reset cvar to default only if its okay to do so
|
|
|
|
if (cmd->defaultstr)
|
|
|
|
resetval = cmd->defaultstr;
|
|
|
|
else if (cmd->enginevalue)
|
|
|
|
resetval = cmd->enginevalue;
|
|
|
|
else
|
|
|
|
continue; //no idea what to reset it to.
|
|
|
|
pendingval = cmd->string;
|
|
|
|
if (cmd->latched_string)
|
|
|
|
pendingval = cmd->latched_string;
|
|
|
|
if (strcmp(resetval, pendingval))
|
|
|
|
Cvar_Set(cmd, resetval);
|
2005-08-23 03:25:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_VariableValue
|
|
|
|
============
|
|
|
|
*/
|
2005-03-28 00:11:59 +00:00
|
|
|
float Cvar_VariableValue (const char *var_name)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
cvar_t *var;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
var = Cvar_FindVar (var_name);
|
|
|
|
if (!var)
|
|
|
|
return 0;
|
|
|
|
return Q_atof (var->string);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_VariableString
|
|
|
|
============
|
|
|
|
*/
|
2005-03-28 00:11:59 +00:00
|
|
|
char *Cvar_VariableString (const char *var_name)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
cvar_t *var;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
var = Cvar_FindVar (var_name);
|
|
|
|
if (!var)
|
|
|
|
return cvar_null_string;
|
|
|
|
return var->string;
|
|
|
|
}
|
|
|
|
|
2018-05-21 13:47:53 +00:00
|
|
|
void Cvar_SetNamed (const char *var_name, const char *newvalue)
|
|
|
|
{
|
|
|
|
cvar_t *var;
|
|
|
|
|
|
|
|
var = Cvar_FindVar (var_name);
|
|
|
|
if (!var)
|
|
|
|
return;
|
|
|
|
Cvar_Set(var, newvalue);
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_CompleteVariable
|
|
|
|
============
|
|
|
|
*/
|
|
|
|
/* moved to cmd_compleatevariable
|
|
|
|
char *Cvar_CompleteVariable (char *partial)
|
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *cvar;
|
|
|
|
int len;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
len = Q_strlen(partial);
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
if (!len)
|
|
|
|
return NULL;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
// check exact match
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
for (cvar=grp->cvars ; cvar ; cvar=cvar->next)
|
|
|
|
if (!strcmp (partial,cvar->name))
|
|
|
|
return cvar->name;
|
|
|
|
|
|
|
|
// check partial match
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
for (cvar=grp->cvars ; cvar ; cvar=cvar->next)
|
|
|
|
if (!Q_strncmp (partial,cvar->name, len))
|
|
|
|
return cvar->name;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2012-04-24 07:59:11 +00:00
|
|
|
static qboolean cvar_archivedvaluechanged;
|
|
|
|
qboolean Cvar_UnsavedArchive(void)
|
|
|
|
{
|
|
|
|
return cvar_archivedvaluechanged;
|
|
|
|
}
|
2013-03-12 22:40:16 +00:00
|
|
|
void Cvar_ConfigChanged(void)
|
|
|
|
{
|
|
|
|
cvar_archivedvaluechanged = true;
|
|
|
|
}
|
2012-04-24 07:59:11 +00:00
|
|
|
void Cvar_Saved(void)
|
|
|
|
{
|
|
|
|
cvar_archivedvaluechanged = false;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_Set
|
|
|
|
============
|
|
|
|
*/
|
2018-10-11 10:31:23 +00:00
|
|
|
static cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
|
2007-09-17 20:35:39 +00:00
|
|
|
{ //fixme: force should probably be a latch bitmask
|
2004-08-21 01:25:48 +00:00
|
|
|
char *latch=NULL;
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2014-10-11 19:39:45 +00:00
|
|
|
COM_AssertMainThread("Cvar_SetCore");
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
if (!var)
|
|
|
|
return NULL;
|
|
|
|
|
2016-08-25 00:12:14 +00:00
|
|
|
if ((var->flags & CVAR_WATCHED) || cvar_watched == 2)
|
|
|
|
Con_Printf("Cvar Set: %s to %s\n", var->name, value);
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
if ((var->flags & CVAR_NOSET) && !force)
|
|
|
|
{
|
|
|
|
Con_Printf ("variable %s is readonly\n", var->name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2018-10-11 10:31:23 +00:00
|
|
|
if (force)
|
|
|
|
;
|
|
|
|
else if (0)//var->flags & CVAR_SERVEROVERRIDE && !force)
|
2004-08-21 01:25:48 +00:00
|
|
|
latch = "variable %s is under server control - latched\n";
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
else if (var->flags & CVAR_LATCH && (sv_state || cls_state))
|
2006-02-11 02:09:43 +00:00
|
|
|
latch = "variable %s is latched and will be applied for the start of the next map\n";
|
|
|
|
// else if (var->flags & CVAR_LATCHFLUSH)
|
|
|
|
// latch = "variable %s is latched (type flush)\n";
|
2018-01-22 19:18:04 +00:00
|
|
|
else if (var->flags & CVAR_VIDEOLATCH && qrenderer != QR_NONE)
|
2006-02-11 02:09:43 +00:00
|
|
|
latch = "variable %s will be changed after a vid_restart\n";
|
2018-01-22 19:18:04 +00:00
|
|
|
else if (var->flags & CVAR_RENDERERLATCH && qrenderer != QR_NONE)
|
|
|
|
latch = "variable %s will be changed after a vid_reload\n";
|
2007-08-23 21:25:18 +00:00
|
|
|
else if (var->flags & CVAR_RULESETLATCH)
|
|
|
|
latch = "variable %s is latched due to current ruleset\n";
|
2004-08-21 01:25:48 +00:00
|
|
|
#ifndef SERVERONLY
|
2004-12-21 04:37:14 +00:00
|
|
|
else if (var->flags & CVAR_CHEAT && !cls.allow_cheats && cls.state)
|
2004-08-21 01:25:48 +00:00
|
|
|
latch = "variable %s is a cheat variable - latched\n";
|
2004-12-21 04:37:14 +00:00
|
|
|
else if (var->flags & CVAR_SEMICHEAT && !cls.allow_semicheats && cls.state)
|
2004-08-21 01:25:48 +00:00
|
|
|
latch = "variable %s is a cheat variable - latched\n";
|
|
|
|
#endif
|
|
|
|
|
2018-10-11 10:31:23 +00:00
|
|
|
if (latch)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
if (cl_warncmd.value)
|
2018-01-22 19:18:04 +00:00
|
|
|
{ //FIXME: flag that there's a latched cvar instead of spamming prints.
|
|
|
|
//FIXME: apply pending rendererlatches vith a vid_reload when leaving the console/menu.
|
2004-12-24 08:45:56 +00:00
|
|
|
if (var->latched_string)
|
|
|
|
{ //already latched
|
|
|
|
if (strcmp(var->latched_string, value))
|
|
|
|
Con_Printf (latch, var->name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{ //new latch
|
|
|
|
if (strcmp(var->string, value))
|
|
|
|
Con_Printf (latch, var->name);
|
|
|
|
}
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
if (var->latched_string && !strcmp(var->latched_string, value)) //no point, this would force the same
|
|
|
|
return NULL;
|
2015-06-04 06:15:14 +00:00
|
|
|
Cvar_ConfigChanged();
|
2004-08-21 01:25:48 +00:00
|
|
|
if (var->latched_string)
|
|
|
|
Z_Free(var->latched_string);
|
2005-07-28 15:52:31 +00:00
|
|
|
if (!strcmp(var->string, value)) //latch to the original value? remove the latch.
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
var->latched_string = NULL;
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-03-28 00:11:59 +00:00
|
|
|
var->latched_string = (char*)Z_Malloc(strlen(value)+1);
|
2004-08-21 01:25:48 +00:00
|
|
|
strcpy(var->latched_string, value);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef CLIENTONLY
|
|
|
|
if (var->flags & CVAR_SERVERINFO)
|
|
|
|
{
|
2018-07-05 16:21:44 +00:00
|
|
|
InfoBuf_SetKey (&svs.info, var->name, value);
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#ifndef SERVERONLY
|
2009-11-04 21:16:50 +00:00
|
|
|
if (var->flags & CVAR_SHADERSYSTEM)
|
|
|
|
{
|
|
|
|
if (var->string && value)
|
|
|
|
if (strcmp(var->string, value))
|
2011-12-05 15:23:40 +00:00
|
|
|
Shader_NeedReload(false);
|
2009-11-04 21:16:50 +00:00
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
if (var->flags & CVAR_USERINFO)
|
|
|
|
{
|
2018-07-05 16:21:44 +00:00
|
|
|
char *old = InfoBuf_ValueForKey(&cls.userinfo[0], var->name);
|
2007-09-10 22:12:13 +00:00
|
|
|
if (strcmp(old, value)) //only spam the server if it actually changed
|
|
|
|
{ //this helps with config execs
|
2018-07-05 16:21:44 +00:00
|
|
|
InfoBuf_SetKey (&cls.userinfo[0], var->name, value);
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-03-23 19:22:12 +00:00
|
|
|
latch = var->string;//save off the old value (so cvar_set(var, var->string) works)
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2005-03-28 00:11:59 +00:00
|
|
|
var->string = (char*)Z_Malloc (Q_strlen(value)+1);
|
2004-08-21 01:25:48 +00:00
|
|
|
Q_strcpy (var->string, value);
|
|
|
|
var->value = Q_atof (var->string);
|
2016-07-12 00:40:13 +00:00
|
|
|
var->ival = Q_atoi (var->string);
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2015-09-18 20:30:10 +00:00
|
|
|
var->flags &= ~CVAR_TEAMPLAYTAINT;
|
|
|
|
|
2015-04-21 04:12:00 +00:00
|
|
|
{
|
|
|
|
char *str = COM_Parse(var->string);
|
|
|
|
var->vec4[0] = atof(com_token);
|
|
|
|
str = COM_Parse(str);
|
|
|
|
var->vec4[1] = atof(com_token);
|
|
|
|
str = COM_Parse(str);
|
|
|
|
var->vec4[2] = atof(com_token);
|
|
|
|
if (!str || !*str)
|
|
|
|
var->vec4[3] = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str = COM_Parse(str);
|
|
|
|
var->vec4[3] = atof(com_token);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
if (latch)
|
|
|
|
{
|
|
|
|
if (strcmp(latch, value))
|
2006-04-11 20:42:05 +00:00
|
|
|
{
|
2005-04-16 16:21:27 +00:00
|
|
|
var->modified++; //only modified if it changed.
|
2006-04-11 20:42:05 +00:00
|
|
|
if (var->callback)
|
|
|
|
var->callback(var, latch);
|
2016-07-12 00:40:13 +00:00
|
|
|
|
|
|
|
if (var->flags & CVAR_TELLGAMECODE)
|
|
|
|
{
|
|
|
|
#ifndef CLIENTONLY
|
|
|
|
SVQ1_CvarChanged(var);
|
|
|
|
#endif
|
|
|
|
#ifndef SERVERONLY
|
|
|
|
#ifdef MENU_DAT
|
|
|
|
MP_CvarChanged(var);
|
|
|
|
#endif
|
|
|
|
#ifdef CSQC_DAT
|
|
|
|
CSQC_CvarChanged(var);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}
|
2006-04-11 20:42:05 +00:00
|
|
|
}
|
2014-03-30 08:55:06 +00:00
|
|
|
if ((var->flags & CVAR_ARCHIVE) && !(var->flags & CVAR_SERVEROVERRIDE) && cl_warncmd.ival)
|
|
|
|
{
|
|
|
|
if (var->latched_string)
|
|
|
|
{
|
|
|
|
if (strcmp(var->latched_string, value))
|
|
|
|
Cvar_ConfigChanged();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (strcmp(latch, value))
|
|
|
|
Cvar_ConfigChanged();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-16 16:21:27 +00:00
|
|
|
|
|
|
|
Z_Free (latch); // free the old value string
|
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
if (var->latched_string) //we may as well have this here.
|
|
|
|
{
|
|
|
|
Z_Free(var->latched_string);
|
|
|
|
var->latched_string = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
|
2007-09-17 20:35:39 +00:00
|
|
|
qboolean Cvar_ApplyLatchFlag(cvar_t *var, char *value, int flag)
|
|
|
|
{
|
|
|
|
qboolean result = true;
|
|
|
|
|
|
|
|
char *latch;
|
|
|
|
var->flags &= ~flag;
|
|
|
|
latch = var->latched_string;
|
|
|
|
var->latched_string = NULL;
|
|
|
|
if (!latch)
|
|
|
|
{
|
2011-10-27 16:16:29 +00:00
|
|
|
#ifdef warningmsg
|
|
|
|
#pragma warningmsg("this means the callback will never be called")
|
2007-09-17 20:35:39 +00:00
|
|
|
#endif
|
2015-06-26 13:21:04 +00:00
|
|
|
latch = Z_StrDup(var->string);
|
|
|
|
// var->string = NULL;
|
2007-09-17 20:35:39 +00:00
|
|
|
}
|
2011-10-27 16:16:29 +00:00
|
|
|
#ifdef warningmsg
|
|
|
|
#pragma warningmsg("set or forceset?")
|
2007-09-17 20:35:39 +00:00
|
|
|
#endif
|
2007-09-21 09:58:17 +00:00
|
|
|
Cvar_ForceSet(var, value);
|
2007-09-17 20:35:39 +00:00
|
|
|
|
|
|
|
if (var->latched_string)
|
|
|
|
{ //something else latched it
|
|
|
|
Z_Free(var->latched_string);
|
|
|
|
var->latched_string = NULL;
|
|
|
|
result = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
var->flags |= flag;
|
|
|
|
|
|
|
|
if (latch)
|
|
|
|
{
|
|
|
|
if (!strcmp(var->string, latch))
|
|
|
|
Z_Free(latch); //don't allow a latch to be the same as the current value
|
|
|
|
else
|
|
|
|
var->latched_string = latch;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats)
|
|
|
|
{ //this either unlatches if the cheat type is allowed, or enforces a default for full cheats and blank for semicheats.
|
|
|
|
//this is clientside only.
|
|
|
|
//if a value is enforced, it is latched to the old value.
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *var;
|
|
|
|
|
|
|
|
char *latch;
|
|
|
|
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
for (var=grp->cvars ; var ; var=var->next)
|
|
|
|
{
|
|
|
|
if (!(var->flags & (CVAR_CHEAT|CVAR_SEMICHEAT)))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
latch = var->latched_string;
|
|
|
|
var->latched_string = NULL;
|
|
|
|
if (!latch)
|
2015-06-26 13:21:04 +00:00
|
|
|
latch = Z_StrDup(var->string);
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
if (var->flags & CVAR_CHEAT)
|
|
|
|
{
|
|
|
|
if (!absolutecheats)
|
|
|
|
Cvar_ForceSet(var, var->defaultstr);
|
|
|
|
else
|
|
|
|
Cvar_ForceSet(var, latch);
|
|
|
|
}
|
|
|
|
if (var->flags & CVAR_SEMICHEAT)
|
|
|
|
{
|
2015-06-26 13:21:04 +00:00
|
|
|
if (var->flags & CVAR_RULESETLATCH)
|
|
|
|
; //this is too problematic. the ruleset should cover it.
|
|
|
|
else if (!semicheats)
|
2004-08-21 01:25:48 +00:00
|
|
|
Cvar_ForceSet(var, "");
|
|
|
|
else
|
|
|
|
Cvar_ForceSet(var, latch);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (latch)
|
|
|
|
{
|
|
|
|
if (!strcmp(var->string, latch))
|
|
|
|
Z_Free(latch);
|
|
|
|
else
|
|
|
|
var->latched_string = latch;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-12-05 15:23:40 +00:00
|
|
|
int Cvar_ApplyLatches(int latchflag)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
2011-12-05 15:23:40 +00:00
|
|
|
int result = 0;
|
2004-08-21 01:25:48 +00:00
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *var;
|
2004-09-04 17:39:47 +00:00
|
|
|
int mask = ~0;
|
2007-08-23 21:25:18 +00:00
|
|
|
int of;
|
2004-09-04 17:39:47 +00:00
|
|
|
|
2007-09-17 20:35:39 +00:00
|
|
|
if (latchflag == CVAR_SERVEROVERRIDE || latchflag == CVAR_RULESETLATCH) //these ones are cleared
|
|
|
|
mask = ~latchflag;
|
2004-09-04 17:39:47 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
for (var=grp->cvars ; var ; var=var->next)
|
|
|
|
{
|
|
|
|
if (var->flags & latchflag)
|
|
|
|
{
|
|
|
|
if (var->latched_string)
|
|
|
|
{
|
2007-08-23 21:25:18 +00:00
|
|
|
of = var->flags;
|
|
|
|
var->flags &= ~latchflag;
|
|
|
|
Cvar_Set(var, var->latched_string);
|
|
|
|
var->flags = of;
|
2011-12-05 15:23:40 +00:00
|
|
|
|
|
|
|
result++;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
2004-09-04 17:39:47 +00:00
|
|
|
var->flags &= mask;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
2011-12-05 15:23:40 +00:00
|
|
|
|
|
|
|
return result;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
|
2005-03-28 00:11:59 +00:00
|
|
|
cvar_t *Cvar_Set (cvar_t *var, const char *value)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
return Cvar_SetCore(var, value, false);
|
|
|
|
}
|
2005-03-28 00:11:59 +00:00
|
|
|
cvar_t *Cvar_ForceSet (cvar_t *var, const char *value)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
return Cvar_SetCore(var, value, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_SetValue
|
|
|
|
============
|
|
|
|
*/
|
|
|
|
void Cvar_SetValue (cvar_t *var, float value)
|
|
|
|
{
|
|
|
|
char val[32];
|
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
|
|
|
char *e, *p;
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2015-09-18 20:30:10 +00:00
|
|
|
// if (value == (int)value)
|
|
|
|
// sprintf (val, "%i",(int)value); //make it look nicer.
|
|
|
|
// else
|
playdemo accepts https urls now. will start playing before the file has finished downloading, to avoid unnecessary delays.
reworked network addresses to separate address family and connection type. this should make banning people more reliable, as well as simplifying a whole load of logic (no need to check for ipv4 AND ipv6).
tcpconnect will keep trying to connect even if the connection wasn't instant, instead of giving up instantly.
rewrote tcp connections quite a bit. sv_port_tcp now handles qtv+qizmo+http+ws+rtcbroker+tls equivalents.
qtv_streamport is now a legacy cvar and now acts equivalently to sv_port_tcp (but still separate).
rewrote screenshot and video capture code to use strides. this solves image-is-upside down issues with vulkan.
ignore alt key in browser port. oh no! no more red text! oh no! no more alt-being-wrongly-down-and-being-unable-to-type-anything-without-forcing-alt-released!
reworked audio decoder interface. now has clearly defined success/unavailable/end-of-file results. this should solve a whole load of issues with audio streaming.
fixed various openal audio streaming issues too. openal also got some workarounds for emscripten's poor emulation.
fixed ogg decoder to retain sync properly if seeked.
updated menu_media a bit. now reads vorbis comments/id3v1 tags to get proper track names. also saves the playlist so you don't have to manually repopulate the list so it might actually be usable now (after how many years?)
r_stains now defaults to 0, and is no longer enabled by presets. use decals if you want that sort of thing.
added fs_noreexec cvar, so configs will not be reexeced on gamedir change. this also means defaults won't be reapplied, etc.
added 'nvvk' renderer on windows, using nvidia's vulkan-inside-opengl gl extension. mostly just to see how much slower it is.
fixed up the ftp server quite a lot. more complete, more compliant, and should do ipv6 properly to-boot. file transfers also threaded.
fixed potential crash inside runclientphys.
experimental sv_antilag=3 setting. totally untested. the aim is to avoid missing due to lagged knockbacks. may be expensive for the server.
browser port's websockets support fixed. experimental support for webrtc ('works for me', requires a broker server).
updated avplug(renamed to ffmpeg so people know what it is) to use ffmpeg 3.2.4 properly, with its new encoder api. should be much more robust... also added experimental audio decoder for game music etc (currently doesn't resample, so playback rates are screwed, disabled by cvar).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5097 fc73d0e0-1445-4013-8a0c-d673dee63da5
2017-05-10 02:08:58 +00:00
|
|
|
sprintf (val, "%f",value);
|
|
|
|
p = strchr(val, '.');
|
|
|
|
if (p)
|
|
|
|
{
|
|
|
|
e = p + strlen(p);
|
|
|
|
while (e > p && e[-1] == '0')
|
|
|
|
e--;
|
|
|
|
if (e[-1] == '.')
|
|
|
|
e--;
|
|
|
|
*e = 0;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
Cvar_Set (var, val);
|
|
|
|
}
|
2016-02-10 23:23:43 +00:00
|
|
|
void Cvar_ForceSetValue (cvar_t *var, float value)
|
|
|
|
{
|
|
|
|
char val[32];
|
|
|
|
|
|
|
|
// if (value == (int)value)
|
|
|
|
// sprintf (val, "%i",(int)value); //make it look nicer.
|
|
|
|
// else
|
|
|
|
sprintf (val, "%g",value);
|
|
|
|
Cvar_ForceSet (var, val);
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2018-10-11 10:31:23 +00:00
|
|
|
static void Cvar_Free(cvar_t *tbf)
|
2005-01-07 02:46:54 +00:00
|
|
|
{
|
|
|
|
cvar_t *var;
|
|
|
|
cvar_group_t *grp;
|
|
|
|
if (!(tbf->flags & CVAR_POINTER))
|
|
|
|
return; //only freeable if it was a pointer to begin with.
|
|
|
|
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
{
|
|
|
|
if (grp->cvars == tbf)
|
|
|
|
{
|
|
|
|
grp->cvars = tbf->next;
|
|
|
|
goto unlinked;
|
|
|
|
}
|
|
|
|
for (var=grp->cvars ; var->next ; var=var->next)
|
|
|
|
{
|
|
|
|
if (var->next == tbf)
|
|
|
|
{
|
|
|
|
var->next = tbf->next;
|
|
|
|
goto unlinked;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
unlinked:
|
|
|
|
Z_Free(tbf->string);
|
2013-10-29 17:38:22 +00:00
|
|
|
if (tbf->defaultstr != tbf->enginevalue)
|
2009-04-01 22:03:56 +00:00
|
|
|
Cvar_DefaultFree(tbf->defaultstr);
|
2005-01-07 02:46:54 +00:00
|
|
|
if (tbf->latched_string)
|
|
|
|
Z_Free(tbf->latched_string);
|
2010-07-11 02:22:39 +00:00
|
|
|
Hash_RemoveData(&cvar_hash, tbf->name, tbf);
|
|
|
|
if (tbf->name2)
|
|
|
|
Hash_RemoveData(&cvar_hash, tbf->name2, tbf);
|
2005-01-07 02:46:54 +00:00
|
|
|
Z_Free(tbf);
|
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_RegisterVariable
|
|
|
|
|
|
|
|
Adds a freestanding variable to the variable list.
|
|
|
|
============
|
|
|
|
*/
|
2009-01-29 02:55:08 +00:00
|
|
|
|
2005-12-21 03:07:33 +00:00
|
|
|
qboolean Cvar_Register (cvar_t *variable, const char *groupname)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
cvar_t *old;
|
|
|
|
cvar_group_t *group;
|
2009-04-01 22:03:56 +00:00
|
|
|
char *initial;
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
if (variable->defaultstr)
|
|
|
|
initial = variable->defaultstr;
|
2013-10-29 17:38:22 +00:00
|
|
|
else if (variable->enginevalue)
|
|
|
|
initial = variable->enginevalue;
|
|
|
|
else if (variable->string)
|
2009-04-01 22:03:56 +00:00
|
|
|
initial = variable->string;
|
2013-10-29 17:38:22 +00:00
|
|
|
else
|
|
|
|
initial = "";
|
2005-01-07 02:46:54 +00:00
|
|
|
|
2005-07-28 15:22:15 +00:00
|
|
|
// check to see if it has already been defined
|
2004-08-21 01:25:48 +00:00
|
|
|
old = Cvar_FindVar (variable->name);
|
|
|
|
if (old)
|
|
|
|
{
|
2016-07-12 00:40:13 +00:00
|
|
|
if ((old->flags & CVAR_POINTER) && !(variable->flags & CVAR_POINTER))
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
group = Cvar_GetGroup(groupname);
|
|
|
|
|
|
|
|
variable->modified = old->modified;
|
2009-04-01 22:03:56 +00:00
|
|
|
variable->flags |= (old->flags & CVAR_ARCHIVE);
|
2005-01-07 02:46:54 +00:00
|
|
|
|
|
|
|
// link the variable in
|
|
|
|
variable->next = group->cvars;
|
|
|
|
variable->restriction = old->restriction; //exe registered vars
|
|
|
|
group->cvars = variable;
|
|
|
|
|
|
|
|
// make sure it can be zfreed
|
2005-03-28 00:11:59 +00:00
|
|
|
variable->string = (char*)Z_Malloc (1);
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2005-01-07 02:46:54 +00:00
|
|
|
//cheat prevention - engine set default is the one that stays.
|
2013-10-29 17:38:22 +00:00
|
|
|
if (initial != variable->enginevalue)
|
2009-04-01 22:03:56 +00:00
|
|
|
variable->defaultstr = Cvar_DefaultAlloc(initial);
|
|
|
|
else
|
|
|
|
variable->defaultstr = initial;
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2005-01-07 02:46:54 +00:00
|
|
|
// set it through the function to be consistant
|
|
|
|
if (old->latched_string)
|
|
|
|
Cvar_SetCore (variable, old->latched_string, true);
|
2004-08-21 01:25:48 +00:00
|
|
|
else
|
2005-01-07 02:46:54 +00:00
|
|
|
Cvar_SetCore (variable, old->string, true);
|
|
|
|
|
|
|
|
Cvar_Free(old);
|
2010-07-11 02:22:39 +00:00
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
Hash_AddInsensitive(&cvar_hash, variable->name, variable, &variable->hbn1);
|
2010-07-11 02:22:39 +00:00
|
|
|
if (variable->name2)
|
2014-03-30 08:55:06 +00:00
|
|
|
Hash_AddInsensitive(&cvar_hash, variable->name2, variable, &variable->hbn2);
|
2010-07-11 02:22:39 +00:00
|
|
|
|
2016-07-12 00:40:13 +00:00
|
|
|
return true;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
2005-07-03 15:16:20 +00:00
|
|
|
|
2005-07-28 15:22:15 +00:00
|
|
|
Con_Printf ("Can't register variable %s, already defined\n", variable->name);
|
2005-12-21 03:07:33 +00:00
|
|
|
return false;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// check for overlap with a command
|
|
|
|
if (Cmd_Exists (variable->name))
|
|
|
|
{
|
|
|
|
Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name);
|
2005-12-21 03:07:33 +00:00
|
|
|
return false;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
2018-10-11 10:31:23 +00:00
|
|
|
if (variable->name2 && (Cmd_Exists (variable->name2) || Cvar_FindVar (variable->name2)))
|
|
|
|
{
|
|
|
|
Con_Printf ("Cvar_RegisterVariable: %s is a command/exists\n", variable->name2);
|
|
|
|
variable->name2 = NULL;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
group = Cvar_GetGroup(groupname);
|
|
|
|
|
|
|
|
// link the variable in
|
|
|
|
variable->next = group->cvars;
|
|
|
|
variable->restriction = 0; //exe registered vars
|
|
|
|
group->cvars = variable;
|
|
|
|
|
2014-03-30 08:55:06 +00:00
|
|
|
Hash_AddInsensitive(&cvar_hash, variable->name, variable, &variable->hbn1);
|
2010-07-11 02:22:39 +00:00
|
|
|
if (variable->name2)
|
2014-03-30 08:55:06 +00:00
|
|
|
Hash_AddInsensitive(&cvar_hash, variable->name2, variable, &variable->hbn2);
|
2010-07-11 02:22:39 +00:00
|
|
|
|
2011-04-30 17:21:10 +00:00
|
|
|
variable->string = NULL;
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2013-10-29 17:38:22 +00:00
|
|
|
if (initial != variable->enginevalue)
|
2009-04-01 22:03:56 +00:00
|
|
|
variable->defaultstr = Cvar_DefaultAlloc(initial);
|
|
|
|
else
|
|
|
|
variable->defaultstr = initial;
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
// set it through the function to be consistant
|
2009-04-01 22:03:56 +00:00
|
|
|
Cvar_SetCore (variable, initial, true);
|
2005-12-21 03:07:33 +00:00
|
|
|
|
|
|
|
return true;
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
2009-04-01 22:03:56 +00:00
|
|
|
|
2015-02-02 08:01:53 +00:00
|
|
|
cvar_t *Cvar_Get2(const char *name, const char *defaultvalue, int flags, const char *description, const char *group)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
cvar_t *var;
|
|
|
|
var = Cvar_FindVar(name);
|
|
|
|
|
|
|
|
if (var)
|
|
|
|
return var;
|
2015-02-02 08:01:53 +00:00
|
|
|
if (!description)
|
|
|
|
description = "";
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2015-10-27 15:20:15 +00:00
|
|
|
//don't allow cvars with certain funny chars in their name. ever. such things get really messy when saved in configs or whatever.
|
|
|
|
if (!*name || strchr(name, '\"') || strchr(name, '^') || strchr(name, '$') || strchr(name, ' ') || strchr(name, '\t') || strchr(name, '\r') || strchr(name, '\n') || strchr(name, ';'))
|
|
|
|
return NULL;
|
|
|
|
|
2015-02-02 08:01:53 +00:00
|
|
|
var = (cvar_t*)Z_Malloc(sizeof(cvar_t)+strlen(name)+1+(description?(strlen(description)+1):0));
|
2004-08-21 01:25:48 +00:00
|
|
|
var->name = (char *)(var+1);
|
|
|
|
strcpy(var->name, name);
|
2005-03-28 00:11:59 +00:00
|
|
|
var->string = (char*)defaultvalue;
|
2013-10-29 17:38:22 +00:00
|
|
|
var->flags = flags|CVAR_POINTER|CVAR_USERCREATED;
|
2015-02-02 08:01:53 +00:00
|
|
|
if (description)
|
|
|
|
{
|
2016-02-10 23:23:43 +00:00
|
|
|
char *desc = var->name+strlen(var->name)+1;
|
|
|
|
strcpy(desc, description);
|
|
|
|
var->description = desc;
|
2015-02-02 08:01:53 +00:00
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
2005-12-21 03:07:33 +00:00
|
|
|
if (!Cvar_Register(var, group))
|
2016-07-12 00:40:13 +00:00
|
|
|
{
|
|
|
|
Z_Free(var);
|
2005-12-21 03:07:33 +00:00
|
|
|
return NULL;
|
2016-07-12 00:40:13 +00:00
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
return var;
|
|
|
|
}
|
|
|
|
|
|
|
|
//prevent the client from altering the cvar until they change map or the server resets the var to the default.
|
2005-03-28 00:11:59 +00:00
|
|
|
void Cvar_LockFromServer(cvar_t *var, const char *str)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
char *oldlatch;
|
|
|
|
|
2012-04-24 07:59:11 +00:00
|
|
|
if (!(var->flags & CVAR_SERVEROVERRIDE))
|
|
|
|
{
|
|
|
|
Con_DPrintf("Server taking control of cvar %s (%s)\n", var->name, str);
|
|
|
|
var->flags |= CVAR_SERVEROVERRIDE;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
oldlatch = var->latched_string;
|
|
|
|
if (oldlatch) //maintaining control
|
|
|
|
var->latched_string = NULL;
|
|
|
|
else //taking control
|
|
|
|
{
|
2005-03-28 00:11:59 +00:00
|
|
|
oldlatch = (char*)Z_Malloc(strlen(var->string)+1);
|
2004-08-21 01:25:48 +00:00
|
|
|
strcpy(oldlatch, var->string);
|
|
|
|
}
|
|
|
|
|
|
|
|
Cvar_SetCore (var, str, true); //will use all, quote included
|
|
|
|
|
2005-07-28 15:52:31 +00:00
|
|
|
var->latched_string = oldlatch; //keep track of the original value.
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_Command
|
|
|
|
|
|
|
|
Handles variable inspection and changing from the console
|
|
|
|
============
|
|
|
|
*/
|
|
|
|
qboolean Cvar_Command (int level)
|
|
|
|
{
|
|
|
|
cvar_t *v;
|
|
|
|
char *str;
|
2013-07-26 17:19:06 +00:00
|
|
|
char buffer[65536];
|
2015-06-15 20:11:27 +00:00
|
|
|
int olev;
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
// check variables
|
|
|
|
v = Cvar_FindVar (Cmd_Argv(0));
|
|
|
|
if (!v)
|
|
|
|
return false;
|
|
|
|
|
2015-09-18 20:30:10 +00:00
|
|
|
if (!level || (v->restriction?v->restriction:rcon_level.ival) > level)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
Con_Printf ("You do not have the priveledges for %s\n", v->name);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
if (v->flags & CVAR_NOTFROMSERVER && Cmd_IsInsecure())
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
Con_Printf ("Server tried setting %s cvar\n", v->name);
|
|
|
|
return true;
|
|
|
|
}
|
2015-06-24 17:59:57 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
// perform a variable print or set
|
|
|
|
if (Cmd_Argc() == 1)
|
|
|
|
{
|
|
|
|
if (v->latched_string)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
{
|
|
|
|
if (v->flags & CVAR_LATCH)
|
|
|
|
{
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf ("\"%s\" is currently \"%s\"\n", v->name, COM_QuotedString(v->string, buffer, sizeof(buffer), true));
|
|
|
|
Con_Printf ("Will be changed to \"%s\" on the next map\n", COM_QuotedString(v->latched_string, buffer, sizeof(buffer), true));
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
}
|
2018-01-22 19:18:04 +00:00
|
|
|
else if (v->flags & CVAR_VIDEOLATCH)
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
{
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf ("\"%s\" is \"%s\"\n", v->name, COM_QuotedString(v->string, buffer, sizeof(buffer), true));
|
|
|
|
Con_Printf ("Will be changed to \"%s\" on vid_restart\n", COM_QuotedString(v->latched_string, buffer, sizeof(buffer), true));
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
}
|
2018-01-22 19:18:04 +00:00
|
|
|
else if (v->flags & CVAR_RENDERERLATCH)
|
|
|
|
{
|
|
|
|
Con_Printf ("\"%s\" is \"%s\"\n", v->name, COM_QuotedString(v->string, buffer, sizeof(buffer), true));
|
|
|
|
Con_Printf ("Will be changed to \"%s\" on vid_reload\n", COM_QuotedString(v->latched_string, buffer, sizeof(buffer), true));
|
|
|
|
}
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
else
|
|
|
|
{
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf ("\"%s\" is \"%s\"\n", v->name, COM_QuotedString(v->latched_string, buffer, sizeof(buffer), true));
|
|
|
|
Con_Printf ("Effective value is \"%s\"\n", COM_QuotedString(v->string, buffer, sizeof(buffer), true));
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
}
|
2013-10-29 17:38:22 +00:00
|
|
|
if (v->defaultstr)
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf("Default: \"%s\"\n", COM_QuotedString(v->defaultstr, buffer, sizeof(buffer), true));
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-29 17:38:22 +00:00
|
|
|
if (v->defaultstr && !strcmp(v->string, v->defaultstr))
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf ("\"%s\" is \"%s\" (default)\n", v->name, COM_QuotedString(v->string, buffer, sizeof(buffer), true));
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
else
|
|
|
|
{
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf ("\"%s\" is \"%s\"\n", v->name, COM_QuotedString(v->string, buffer, sizeof(buffer), true));
|
2013-10-29 17:38:22 +00:00
|
|
|
if (v->defaultstr)
|
2015-10-27 15:20:15 +00:00
|
|
|
Con_Printf("Default: \"%s\"\n", COM_QuotedString(v->defaultstr, buffer, sizeof(buffer), true));
|
------------------------------------------------------------------------
r4169 | acceptthis | 2013-01-17 08:55:12 +0000 (Thu, 17 Jan 2013) | 31 lines
removed MAX_VISEDICTS limit.
PEXT2_REPLACEMENTDELTAS tweaked, now has 4 million entity limit. still not enabled by default.
TE_BEAM now maps to a separate TEQW_BEAM to avoid conflicts with QW.
added android multitouch emulation for windows/rawinput (in_simulatemultitouch).
split topcolor/bottomcolor from scoreboard, for dp's colormap|1024 feature.
now using utf-8 for windows consoles.
qcc warnings/errors now give clickable console links for quick+easy editing.
disabled menutint when the currently active item changes contrast or gamma (for OneManClan).
Added support for drawfont/drawfontscale.
tweaked the qcvm a little to reduce the number of pointers.
.doll file loading. still experimental and will likely crash. requires csqc active, even if its a dummy progs. this will be fixed in time. Still other things that need cleaning up.
windows: gl_font "?" shows the standard windows font-selection dialog, and can be used to select windows fonts. not all work. and you probably don't want to use windings.
fixed splitscreen support when playing mvds. added mini-scoreboards to splitscreen.
editor/debugger now shows asm if there's no linenumber info. also, pressing f1 for help shows the shortcuts.
Added support for .framegroups files for psk(psa) and iqm formats.
True support for ezquake's colour codes. Mutually exclusive with background colours.
path command output slightly more readable.
added support for digest_hex (MD4, SHA1, CRC16).
skingroups now colourmap correctly.
Fix terrain colour hints, and litdata from the wrong bsp.
fix ftp dual-homed issue. support epsv command, and enable ipv6 (eprt still not supported).
remove d3d11 compilation from the makefile. the required headers are not provided by mingw, and are not available to the build bot, so don't bother.
fix v *= v.x and similar opcodes.
fteqcc: fixed support for áéÃóú type chars in names. utf-8 files now properly supported (even with the utf-8 bom/identifier). utf-16 also supported.
fteqcc: fixed '#if 1 == 3 && 4' parsing.
fteqcc: -Werror acts on the warning, rather than as a separate error. Line numbers are thus more readable.
fteqcc: copyright message now includes compile date instead.
fteqccgui: the treeview control is now coloured depending on whether there were warnings/errors in the last compile.
fteqccgui: the output window is now focused and scrolls down as compilation progresses.
pr_dumpplatform command dumps out some pragmas to convert more serious warnings to errors. This is to avoid the infamous 'fteqcc sucks cos my code sucks' issue.
rewrote prespawn/modelist/soundlist code. server tracks progress now.
------------------------------------------------------------------------
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4167 fc73d0e0-1445-4013-8a0c-d673dee63da5
2013-03-12 22:29:40 +00:00
|
|
|
}
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Cmd_Argc() == 2)
|
|
|
|
str = Cmd_Argv(1);
|
|
|
|
else
|
|
|
|
str = Cmd_Args();
|
|
|
|
|
|
|
|
if (v->flags & CVAR_NOSET)
|
|
|
|
{
|
2012-11-29 13:37:48 +00:00
|
|
|
if (cl_warncmd.value || developer.value)
|
|
|
|
Con_Printf ("Cvar %s may not be set via the console\n", v->name);
|
2004-08-21 01:25:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-06-24 17:59:57 +00:00
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
#ifndef SERVERONLY
|
2015-06-24 17:59:57 +00:00
|
|
|
if (v->flags & CVAR_USERINFO)
|
|
|
|
{
|
2015-07-14 14:47:00 +00:00
|
|
|
int seat = CL_TargettedSplit(true);
|
2015-06-24 17:59:57 +00:00
|
|
|
if (Cmd_FromGamecode() && cls.protocol == CP_QUAKEWORLD)
|
|
|
|
{ //don't bother even changing the cvar locally, just update the server's version.
|
|
|
|
//fixme: quake2/quake3 latching.
|
|
|
|
if (seat)
|
2015-10-27 15:20:15 +00:00
|
|
|
CL_SendClientCommand(true, "%i setinfo %s %s", seat+1, v->name, COM_QuotedString(str, buffer, sizeof(buffer), false));
|
2015-06-24 17:59:57 +00:00
|
|
|
else
|
2015-10-27 15:20:15 +00:00
|
|
|
CL_SendClientCommand(true, "setinfo %s %s", v->name, COM_QuotedString(str, buffer, sizeof(buffer), false));
|
2015-06-24 17:59:57 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
CL_SetInfo(seat, v->name, str);
|
2004-08-21 01:25:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (v->flags & CVAR_SERVEROVERRIDE)
|
|
|
|
{
|
2005-04-16 16:21:27 +00:00
|
|
|
if (Cmd_FromGamecode())
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
2013-10-29 17:38:22 +00:00
|
|
|
if (!v->defaultstr || !strcmp(v->defaultstr, str)) //returning to default
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
v->flags &= ~CVAR_SERVEROVERRIDE;
|
|
|
|
if (v->latched_string)
|
|
|
|
str = v->latched_string; //set to the latched
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Cvar_LockFromServer(v, str);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//let cvar_set latch if needed.
|
|
|
|
}
|
2005-04-16 16:21:27 +00:00
|
|
|
else if (Cmd_FromGamecode())
|
2005-07-03 15:16:20 +00:00
|
|
|
{//it's not latched yet
|
2013-10-29 17:38:22 +00:00
|
|
|
if (v->defaultstr && strcmp(v->defaultstr, str))
|
2005-07-03 15:16:20 +00:00
|
|
|
{ //lock the cvar, unless it's going to it's default value.
|
|
|
|
Cvar_LockFromServer(v, str);
|
|
|
|
return true;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
#endif
|
2015-06-15 20:11:27 +00:00
|
|
|
|
|
|
|
olev = Cmd_ExecLevel;
|
|
|
|
Cmd_ExecLevel = 0;//just to try to detect any bugs that could happen from this
|
2004-08-21 01:25:48 +00:00
|
|
|
Cvar_Set (v, str); //will use all, quote included
|
2015-06-15 20:11:27 +00:00
|
|
|
Cmd_ExecLevel = olev;
|
2004-08-21 01:25:48 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-06-15 20:11:27 +00:00
|
|
|
static char *Cvar_AddDescription(char *buffer, size_t sizeofbuffer, const char *line, const char *cvardesc)
|
|
|
|
{
|
|
|
|
if (!cvardesc || !*cvardesc || strlen(line)+100 > sizeofbuffer)
|
|
|
|
Q_snprintfz(buffer, sizeofbuffer, "%s\n", line);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
//fixme: de-funstring.
|
|
|
|
char *out = buffer, *outend = out+sizeofbuffer-2; // 2 for \n\0
|
|
|
|
int i,pad;
|
|
|
|
Q_snprintfz(out, outend-out, "%s", line);
|
|
|
|
out += strlen(out);
|
|
|
|
|
|
|
|
pad = (strlen(line)+8) & ~7;
|
|
|
|
if (pad < 24)
|
|
|
|
pad = 24;
|
|
|
|
for(i = out-buffer; i < pad; i++)
|
|
|
|
*out++ = ' ';
|
|
|
|
*out++ = '/';
|
|
|
|
*out++ = '/';
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
if (!*cvardesc || out == outend)
|
|
|
|
{
|
|
|
|
*out++ = '\n';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (*cvardesc == '\n')
|
|
|
|
{
|
|
|
|
cvardesc++;
|
|
|
|
*out++ = '\n';
|
|
|
|
if (out + pad + 2 >= outend)
|
|
|
|
break;
|
|
|
|
for(i = 0; i < pad; i++)
|
|
|
|
*out++ = ' ';
|
|
|
|
*out++ = '/';
|
|
|
|
*out++ = '/';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
*out++ = *cvardesc++;
|
|
|
|
}
|
|
|
|
*out = 0;
|
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
============
|
|
|
|
Cvar_WriteVariables
|
|
|
|
|
|
|
|
Writes lines containing "set variable value" for all variables
|
|
|
|
with the archive flag set to true.
|
|
|
|
============
|
|
|
|
*/
|
2005-12-21 03:07:33 +00:00
|
|
|
void Cvar_WriteVariables (vfsfile_t *f, qboolean all)
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
|
|
|
qboolean writtengroupheader;
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *var;
|
|
|
|
char *val;
|
2005-12-21 03:07:33 +00:00
|
|
|
char *s;
|
2013-07-26 17:19:06 +00:00
|
|
|
char buffer[65536];
|
2004-08-21 01:25:48 +00:00
|
|
|
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
{
|
|
|
|
writtengroupheader = false;
|
|
|
|
for (var = grp->cvars ; var ; var = var->next)
|
2012-04-24 07:59:11 +00:00
|
|
|
if (var->flags & CVAR_ARCHIVE || (all && var != &cl_warncmd))
|
2004-08-21 01:25:48 +00:00
|
|
|
{
|
2013-11-21 23:02:28 +00:00
|
|
|
//yeah, don't force-save readonly cvars.
|
2014-02-11 17:51:29 +00:00
|
|
|
if (var->flags & (CVAR_NOSET|CVAR_NOSAVE))
|
2013-11-21 23:02:28 +00:00
|
|
|
continue;
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
if (!writtengroupheader)
|
|
|
|
{
|
|
|
|
writtengroupheader = true;
|
2005-12-21 03:07:33 +00:00
|
|
|
s = va("\n// %s\n", grp->name);
|
|
|
|
VFS_WRITE(f, s, strlen(s));
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
val = var->string; //latched vars should act differently.
|
|
|
|
if (var->latched_string)
|
|
|
|
val = var->latched_string;
|
|
|
|
|
|
|
|
if (var->flags & CVAR_USERCREATED)
|
|
|
|
{
|
|
|
|
if (var->flags & CVAR_ARCHIVE)
|
2015-06-15 20:11:27 +00:00
|
|
|
s = va("seta %s %s", var->name, COM_QuotedString(val, buffer, sizeof(buffer), false));
|
2004-08-21 01:25:48 +00:00
|
|
|
else
|
2015-06-15 20:11:27 +00:00
|
|
|
s = va("set %s %s", var->name, COM_QuotedString(val, buffer, sizeof(buffer), false));
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
else
|
2015-06-15 20:11:27 +00:00
|
|
|
s = va("%s %s", var->name, COM_QuotedString(val, buffer, sizeof(buffer), false));
|
|
|
|
s = Cvar_AddDescription(buffer, sizeof(buffer), s, var->description);
|
2005-12-21 03:07:33 +00:00
|
|
|
VFS_WRITE(f, s, strlen(s));
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-04-21 04:12:00 +00:00
|
|
|
void Cvar_Hook(cvar_t *cvar, void (QDECL *callback) (struct cvar_s *var, char *oldvalue))
|
2006-04-14 04:31:29 +00:00
|
|
|
{
|
|
|
|
cvar->callback = callback;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Cvar_Unhook(cvar_t *cvar)
|
|
|
|
{
|
|
|
|
cvar->callback = NULL;
|
|
|
|
}
|
|
|
|
|
2006-04-15 06:57:13 +00:00
|
|
|
void Cvar_ForceCallback(cvar_t *var)
|
|
|
|
{
|
2008-11-09 22:29:28 +00:00
|
|
|
if (var)
|
|
|
|
if (var->callback)
|
|
|
|
var->callback(var, var->string);
|
2006-04-15 06:57:13 +00:00
|
|
|
}
|
|
|
|
|
2006-04-14 04:31:29 +00:00
|
|
|
void Cvar_ApplyCallbacks(int callbackflag)
|
|
|
|
{
|
|
|
|
cvar_group_t *grp;
|
|
|
|
cvar_t *var;
|
|
|
|
|
|
|
|
for (grp=cvar_groups ; grp ; grp=grp->next)
|
|
|
|
for (var=grp->cvars ; var ; var=var->next)
|
|
|
|
{
|
|
|
|
if (var->flags & callbackflag)
|
|
|
|
{
|
|
|
|
if (var->callback)
|
|
|
|
var->callback(var, var->string);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-04-21 05:23:51 +00:00
|
|
|
// standard callbacks
|
2015-04-21 04:12:00 +00:00
|
|
|
void QDECL Cvar_Limiter_ZeroToOne_Callback(struct cvar_s *var, char *oldvalue)
|
2006-04-21 05:23:51 +00:00
|
|
|
{
|
|
|
|
if (var->value > 1)
|
|
|
|
{
|
|
|
|
Cvar_ForceSet(var, "1");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else if (var->value < 0)
|
|
|
|
{
|
|
|
|
Cvar_ForceSet(var, "0");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-07-11 02:22:39 +00:00
|
|
|
void Cvar_Init(void)
|
|
|
|
{
|
|
|
|
memset(cvar_buckets, 0, sizeof(cvar_buckets));
|
|
|
|
Hash_InitTable(&cvar_hash, sizeof(cvar_buckets)/Hash_BytesForBuckets(1), cvar_buckets);
|
|
|
|
}
|
|
|
|
|
2004-08-21 01:25:48 +00:00
|
|
|
void Cvar_Shutdown(void)
|
|
|
|
{
|
|
|
|
cvar_t *var;
|
|
|
|
cvar_group_t *grp;
|
|
|
|
while(cvar_groups)
|
|
|
|
{
|
|
|
|
while(cvar_groups->cvars)
|
|
|
|
{
|
|
|
|
var = cvar_groups->cvars;
|
|
|
|
cvar_groups->cvars = var->next;
|
|
|
|
|
2013-10-29 17:38:22 +00:00
|
|
|
if (var->defaultstr != var->enginevalue)
|
2009-04-01 22:03:56 +00:00
|
|
|
{
|
|
|
|
Cvar_DefaultFree(var->defaultstr);
|
|
|
|
var->defaultstr = NULL;
|
|
|
|
}
|
2014-04-12 03:31:59 +00:00
|
|
|
Z_Free(var->latched_string);
|
2004-08-21 01:25:48 +00:00
|
|
|
Z_Free(var->string);
|
|
|
|
if (var->flags & CVAR_POINTER)
|
|
|
|
Z_Free(var);
|
2009-04-01 22:03:56 +00:00
|
|
|
else
|
2014-04-12 03:31:59 +00:00
|
|
|
{
|
2009-04-01 22:03:56 +00:00
|
|
|
var->string = NULL;
|
2014-04-12 03:31:59 +00:00
|
|
|
var->latched_string = NULL;
|
|
|
|
}
|
2004-08-21 01:25:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
grp = cvar_groups;
|
|
|
|
cvar_groups = grp->next;
|
|
|
|
Z_Free(grp);
|
|
|
|
}
|
|
|
|
}
|