mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-10 14:51:46 +00:00
- implement 'defcvars'
# Conflicts: # src/d_main.cpp
This commit is contained in:
parent
b4ba7dfec2
commit
2b05bfed68
2 changed files with 57 additions and 0 deletions
|
@ -48,6 +48,8 @@
|
|||
#include "menu/menu.h"
|
||||
#include "vm.h"
|
||||
|
||||
#include "version.h"
|
||||
|
||||
struct FLatchedValue
|
||||
{
|
||||
FBaseCVar *Variable;
|
||||
|
@ -1745,3 +1747,55 @@ CCMD (archivecvar)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void C_GrabCVarDefaults ()
|
||||
{
|
||||
int lump, lastlump = 0;
|
||||
int lumpversion, gamelastrunversion;
|
||||
gamelastrunversion = atoi(LASTRUNVERSION);
|
||||
|
||||
while ((lump = Wads.FindLump("DEFCVARS", &lastlump)) != -1)
|
||||
{
|
||||
FScanner sc(lump);
|
||||
|
||||
sc.MustGetString();
|
||||
if (!sc.Compare("version"))
|
||||
sc.ScriptError("Must declare version for defcvars!");
|
||||
sc.MustGetNumber();
|
||||
lumpversion = sc.Number;
|
||||
if (lumpversion > gamelastrunversion)
|
||||
sc.ScriptError("Unsupported version %i (%i supported)", lumpversion, gamelastrunversion);
|
||||
if (lumpversion < 218)
|
||||
sc.ScriptError("Version must be at least 218 (current version %i)", gamelastrunversion);
|
||||
|
||||
FBaseCVar *var;
|
||||
|
||||
while (sc.GetString())
|
||||
{
|
||||
if (sc.Compare("set"))
|
||||
{
|
||||
sc.MustGetString();
|
||||
}
|
||||
var = FindCVar (sc.String, NULL);
|
||||
if (var != NULL)
|
||||
{
|
||||
if (var->GetFlags() & CVAR_ARCHIVE)
|
||||
{
|
||||
UCVarValue val;
|
||||
|
||||
sc.MustGetString();
|
||||
val.String = const_cast<char *>(sc.String);
|
||||
var->SetGenericRepDefault(val, CVAR_String);
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Cannot set cvar default for non-config cvar '%s'", sc.String);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ScriptError("Unknown cvar '%s'", sc.String);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -145,6 +145,7 @@ void DrawFullscreenSubtitle(const char *text);
|
|||
void D_Cleanup();
|
||||
void FreeSBarInfoScript();
|
||||
void I_UpdateWindowTitle();
|
||||
void C_GrabCVarDefaults ();
|
||||
|
||||
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
|
||||
|
||||
|
@ -2531,6 +2532,8 @@ static int D_DoomMain_Internal (void)
|
|||
allwads.ShrinkToFit();
|
||||
SetMapxxFlag();
|
||||
|
||||
C_GrabCVarDefaults(); //parse DEFCVARS
|
||||
|
||||
GameConfig->DoKeySetup(gameinfo.ConfigName);
|
||||
|
||||
// Now that wads are loaded, define mod-specific cvars.
|
||||
|
|
Loading…
Reference in a new issue