From 7a574b265ec4b34672ab4241b6194e10d9e2d078 Mon Sep 17 00:00:00 2001 From: svdijk Date: Tue, 17 Jan 2012 08:25:07 +0000 Subject: [PATCH] - 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: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@609 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/cvar.c | 14 ++++++++++++++ Quake/menu.c | 9 ++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Quake/cvar.c b/Quake/cvar.c index bb3d6d83..1dd9ff29 100644 --- a/Quake/cvar.c +++ b/Quake/cvar.c @@ -197,6 +197,19 @@ void Cvar_ResetAll_f (void) 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 @@ -217,6 +230,7 @@ void Cvar_Init (void) Cmd_AddCommand ("inc", Cvar_Inc_f); Cmd_AddCommand ("reset", Cvar_Reset_f); Cmd_AddCommand ("resetall", Cvar_ResetAll_f); + Cmd_AddCommand ("resetcfg", Cvar_ResetCfg_f); } //============================================================================== diff --git a/Quake/menu.c b/Quake/menu.c index 189b297a..afcfd7df 100644 --- a/Quake/menu.c +++ b/Quake/menu.c @@ -1120,7 +1120,7 @@ void M_Options_Draw (void) // OPT_CONSOLE: M_Print (16, 32 + 8*OPT_CONSOLE, " Goto console"); // OPT_DEFAULTS: - M_Print (16, 32 + 8*OPT_DEFAULTS, " Reset defaults"); + M_Print (16, 32 + 8*OPT_DEFAULTS, " Reset config"); // OPT_SCALE: M_Print (16, 32 + 8*OPT_SCALE, " Scale"); @@ -1210,8 +1210,11 @@ void M_Options_Key (int k) Con_ToggleConsole_f (); break; case OPT_DEFAULTS: - Cbuf_AddText ("resetall\n"); //johnfitz - Cbuf_AddText ("exec default.cfg\n"); + if (SCR_ModalMessage("Would you like to reset the\nconfiguration? (y/n)\n", 5.0f)) + { + Cbuf_AddText ("resetcfg\n"); + Cbuf_AddText ("exec default.cfg\n"); + } break; case OPT_VIDEO: M_Menu_Video_f ();