- Implemented sv_overridegetcvar: This will override the return value for GetCVar checks for certain CVars marked with the CVAR_OVERRIDEGET flag. Instead of returning their true value, they only return defaults instead.

- Implemented dummy CVar vid_renderer with a default value of 1. This allows mods not designed for the software renderer to run if sv_overridegetcvar is turned on.
This commit is contained in:
Rachael Alexanderson 2016-11-15 19:37:30 -05:00
commit 9b9ed64360
4 changed files with 34 additions and 0 deletions

View file

@ -4549,6 +4549,8 @@ static void DoSetCVar(FBaseCVar *cvar, int value, bool is_string, bool force=fal
}
}
EXTERN_CVAR(Bool, sv_overridegetcvar)
// Converts floating- to fixed-point as required.
static int DoGetCVar(FBaseCVar *cvar, bool is_string)
{
@ -4558,6 +4560,24 @@ static int DoGetCVar(FBaseCVar *cvar, bool is_string)
{
return 0;
}
else if (sv_overridegetcvar && (cvar->GetFlags() & CVAR_OVERRIDEGET))
{
if (is_string)
{
val = cvar->GetGenericRepDefault(CVAR_String);
return GlobalACSStrings.AddString(val.String);
}
else if (cvar->GetRealType() == CVAR_Float)
{
val = cvar->GetGenericRepDefault(CVAR_Float);
return DoubleToACS(val.Float);
}
else
{
val = cvar->GetGenericRepDefault(CVAR_Int);
return val.Int;
}
}
else if (is_string)
{
val = cvar->GetGenericRep(CVAR_String);