diff --git a/src/d_defcvars.cpp b/src/d_defcvars.cpp index a53fbe0a34..4d38e57fa0 100644 --- a/src/d_defcvars.cpp +++ b/src/d_defcvars.cpp @@ -34,6 +34,8 @@ #include "c_console.h" #include "d_main.h" #include "version.h" +#include "d_defcvars.h" + void D_GrabCVarDefaults() { @@ -104,9 +106,30 @@ void D_GrabCVarDefaults() break; } + bool blacklisted = false; + SHOULD_BLACKLIST(disablecrashlog) + SHOULD_BLACKLIST(gl_control_tear) + SHOULD_BLACKLIST(in_mouse) + SHOULD_BLACKLIST(joy_dinput) + SHOULD_BLACKLIST(joy_ps2raw) + SHOULD_BLACKLIST(joy_xinput) + SHOULD_BLACKLIST(k_allowfullscreentoggle) + SHOULD_BLACKLIST(k_mergekeys) + SHOULD_BLACKLIST(m_swapbuttons) + SHOULD_BLACKLIST(queryiwad_key) + SHOULD_BLACKLIST(vid_gpuswitch) + SHOULD_BLACKLIST(vr_enable_quadbuffered) + var = FindCVar(CurrentFindCVar, NULL); - if (var != NULL) + + if (blacklisted) { + sc.ScriptMessage("Cannot set cvar default for blacklisted cvar '%s'", sc.String); + sc.MustGetString(); // to ignore the value of the cvar + } + else if (var != NULL) + { + if (var->GetFlags() & CVAR_ARCHIVE) { UCVarValue val; @@ -115,14 +138,16 @@ void D_GrabCVarDefaults() val.String = const_cast(sc.String); var->SetGenericRepDefault(val, CVAR_String); } - else + else { sc.ScriptMessage("Cannot set cvar default for non-config cvar '%s'", sc.String); + sc.MustGetString(); // to ignore the value of the cvar } } else { sc.ScriptMessage("Unknown cvar '%s' in defcvars", sc.String); + sc.MustGetString(); // to ignore the value of the cvar } } } diff --git a/src/d_defcvars.h b/src/d_defcvars.h new file mode 100644 index 0000000000..73f110c707 --- /dev/null +++ b/src/d_defcvars.h @@ -0,0 +1,27 @@ +//----------------------------------------------------------------------------- +// Copyright 2021 Rachael Alexanderson +// +// 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 3 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 +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 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, see http://www.gnu.org/licenses/ +// +// +// DESCRIPTION: +// defcvars loader split from d_main.cpp +// +//----------------------------------------------------------------------------- + +#define SHOULD_BLACKLIST(name) \ + if (#name[0]==CurrentFindCVar[0]) \ + if (strcmp(CurrentFindCVar, #name) == 0) \ + blacklisted = true; +