- Rename the "Reset defaults" menu option to "Reset config".

- Make it reset only those cvar's that are saved to config.cfg.
- Make it as the user for confirmation.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@609 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Sander van Dijk 2012-01-17 08:25:07 +00:00
parent d327fa302f
commit 7926cc5bf3
2 changed files with 20 additions and 3 deletions

View file

@ -197,6 +197,19 @@ void Cvar_ResetAll_f (void)
Cvar_Reset (var->name); Cvar_Reset (var->name);
} }
/*
============
Cvar_ResetCfg_f -- QuakeSpasm
============
*/
void Cvar_ResetCfg_f (void)
{
cvar_t *var;
for (var = cvar_vars ; var ; var = var->next)
if (var->flags & CVAR_ARCHIVE) Cvar_Reset (var->name);
}
//============================================================================== //==============================================================================
// //
// INIT // INIT
@ -217,6 +230,7 @@ void Cvar_Init (void)
Cmd_AddCommand ("inc", Cvar_Inc_f); Cmd_AddCommand ("inc", Cvar_Inc_f);
Cmd_AddCommand ("reset", Cvar_Reset_f); Cmd_AddCommand ("reset", Cvar_Reset_f);
Cmd_AddCommand ("resetall", Cvar_ResetAll_f); Cmd_AddCommand ("resetall", Cvar_ResetAll_f);
Cmd_AddCommand ("resetcfg", Cvar_ResetCfg_f);
} }
//============================================================================== //==============================================================================

View file

@ -1120,7 +1120,7 @@ void M_Options_Draw (void)
// OPT_CONSOLE: // OPT_CONSOLE:
M_Print (16, 32 + 8*OPT_CONSOLE, " Goto console"); M_Print (16, 32 + 8*OPT_CONSOLE, " Goto console");
// OPT_DEFAULTS: // OPT_DEFAULTS:
M_Print (16, 32 + 8*OPT_DEFAULTS, " Reset defaults"); M_Print (16, 32 + 8*OPT_DEFAULTS, " Reset config");
// OPT_SCALE: // OPT_SCALE:
M_Print (16, 32 + 8*OPT_SCALE, " Scale"); M_Print (16, 32 + 8*OPT_SCALE, " Scale");
@ -1210,8 +1210,11 @@ void M_Options_Key (int k)
Con_ToggleConsole_f (); Con_ToggleConsole_f ();
break; break;
case OPT_DEFAULTS: case OPT_DEFAULTS:
Cbuf_AddText ("resetall\n"); //johnfitz if (SCR_ModalMessage("Would you like to reset the\nconfiguration? (y/n)\n", 5.0f))
Cbuf_AddText ("exec default.cfg\n"); {
Cbuf_AddText ("resetcfg\n");
Cbuf_AddText ("exec default.cfg\n");
}
break; break;
case OPT_VIDEO: case OPT_VIDEO:
M_Menu_Video_f (); M_Menu_Video_f ();