cvar_t *var;
// restore the default values of all cvars
for (var = cvar_vars ; var ; var = var->next)
- Cvar_SetQuick(var, var->defstring);
+ if((var->flags & CVAR_NORESETTODEFAULTS) == 0)
+ Cvar_SetQuick(var, var->defstring);
}
cvar_t *var;
// restore the default values of all cvars
for (var = cvar_vars ; var ; var = var->next)
- if (!(var->flags & CVAR_SAVE))
+ if ((var->flags & (CVAR_NORESETTODEFAULTS | CVAR_SAVE)) == 0)
Cvar_SetQuick(var, var->defstring);
}
cvar_t *var;
// restore the default values of all cvars
for (var = cvar_vars ; var ; var = var->next)
- if (var->flags & CVAR_SAVE)
+ if ((var->flags & (CVAR_NORESETTODEFAULTS | CVAR_SAVE)) == CVAR_SAVE)
Cvar_SetQuick(var, var->defstring);
}
// this means that this cvar should update a userinfo key but the name does not correspond directly to the userinfo key to update, and may require additional conversion ("_cl_color" for example should update "topcolor" and "bottomcolor")
#define CVAR_NQUSERINFOHACK 64
// used to determine if flags is valid
-#define CVAR_MAXFLAGSVAL 127
+#define CVAR_NORESETTODEFAULTS 128
+// for engine-owned cvars that must not be reset on gametype switch (e.g. scr_screenshot_name, which otherwise isn't set to the mod name properly)
+#define CVAR_MAXFLAGSVAL 255
// for internal use only!
#define CVAR_DEFAULTSET (1<<30)
#define CVAR_ALLOCATED (1<<31)
gamedir_t *fs_all_gamedirs = NULL;
int fs_all_gamedirs_count = 0;
-cvar_t scr_screenshot_name = {0, "scr_screenshot_name","dp", "prefix name for saved screenshots (changes based on -game commandline, as well as which game mode is running; the date is encoded using strftime escapes)"};
+cvar_t scr_screenshot_name = {CVAR_NORESETTODEFAULTS, "scr_screenshot_name","dp", "prefix name for saved screenshots (changes based on -game commandline, as well as which game mode is running; the date is encoded using strftime escapes)"};
cvar_t fs_empty_files_in_pack_mark_deletions = {0, "fs_empty_files_in_pack_mark_deletions", "0", "if enabled, empty files in a pak/pk3 count as not existing but cancel the search in further packs, effectively allowing patch pak/pk3 files to 'delete' files"};
+cvar_t cvar_fs_gamedir = {CVAR_READONLY | CVAR_NORESETTODEFAULTS, "fs_gamedir", "", "the list of currently selected gamedirs (use the 'gamedir' command to change this)"};
/*
{
int i;
qboolean fs_modified = false;
+ char gamedirbuf[MAX_INPUTLINE];
FS_ClearSearchPath();
// Adds basedir/gamedir as an override game
// LordHavoc: now supports multiple -game directories
// set the com_modname (reported in server info)
+ *gamedirbuf = 0;
for (i = 0;i < fs_numgamedirs;i++)
{
fs_modified = true;
FS_AddGameHierarchy (fs_gamedirs[i]);
// update the com_modname (used server info)
strlcpy (com_modname, fs_gamedirs[i], sizeof (com_modname));
+ if(i)
+ strlcat(gamedirbuf, va(" %s", fs_gamedirs[i]), sizeof(gamedirbuf));
+ else
+ strlcpy(gamedirbuf, fs_gamedirs[i], sizeof(gamedirbuf));
}
+ Cvar_SetQuick(&cvar_fs_gamedir, gamedirbuf); // so QC or console code can query it
// set the default screenshot name to either the mod name or the
// gamemode screenshot name
{
Cvar_RegisterVariable (&scr_screenshot_name);
Cvar_RegisterVariable (&fs_empty_files_in_pack_mark_deletions);
+ Cvar_RegisterVariable (&cvar_fs_gamedir);
Cmd_AddCommand ("gamedir", FS_GameDir_f, "changes active gamedir list (can take multiple arguments), not including base directory (example usage: gamedir ctf)");
Cmd_AddCommand ("fs_rescan", FS_Rescan_f, "rescans filesystem for new pack archives and any other changes");