mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-01-31 12:30:32 +00:00
Show CVar's default value in addition to current
# Conflicts: # src/c_dispatch.cpp
This commit is contained in:
parent
13a324dc7f
commit
493cc9af0d
3 changed files with 19 additions and 2 deletions
|
@ -154,6 +154,11 @@ const char *FBaseCVar::GetHumanString(int precision) const
|
|||
return GetGenericRep(CVAR_String).String;
|
||||
}
|
||||
|
||||
const char *FBaseCVar::GetHumanStringDefault(int precision) const
|
||||
{
|
||||
return GetGenericRepDefault(CVAR_String).String;
|
||||
}
|
||||
|
||||
void FBaseCVar::ForceSet (UCVarValue value, ECVarType type, bool nouserinfosend)
|
||||
{
|
||||
DoSet (value, type);
|
||||
|
@ -874,6 +879,16 @@ const char *FFloatCVar::GetHumanString(int precision) const
|
|||
return cstrbuf;
|
||||
}
|
||||
|
||||
const char *FFloatCVar::GetHumanStringDefault(int precision) const
|
||||
{
|
||||
if (precision < 0)
|
||||
{
|
||||
precision = 6;
|
||||
}
|
||||
mysnprintf(cstrbuf, countof(cstrbuf), "%.*g", precision, DefaultValue);
|
||||
return cstrbuf;
|
||||
}
|
||||
|
||||
UCVarValue FFloatCVar::GetGenericRep (ECVarType type) const
|
||||
{
|
||||
return FromFloat (Value, type);
|
||||
|
|
|
@ -132,6 +132,7 @@ public:
|
|||
virtual UCVarValue GetGenericRep (ECVarType type) const = 0;
|
||||
virtual UCVarValue GetFavoriteRep (ECVarType *type) const = 0;
|
||||
|
||||
virtual const char *GetHumanStringDefault(int precision = -1) const;
|
||||
virtual UCVarValue GetGenericRepDefault (ECVarType type) const = 0;
|
||||
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const = 0;
|
||||
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type) = 0;
|
||||
|
@ -301,6 +302,7 @@ public:
|
|||
virtual UCVarValue GetFavoriteRepDefault (ECVarType *type) const;
|
||||
virtual void SetGenericRepDefault (UCVarValue value, ECVarType type);
|
||||
const char *GetHumanString(int precision) const override;
|
||||
const char *GetHumanStringDefault(int precision) const override;
|
||||
|
||||
float operator= (float floatval)
|
||||
{ UCVarValue val; val.Float = floatval; SetGenericRep (val, CVAR_Float); return floatval; }
|
||||
|
|
|
@ -672,7 +672,8 @@ void C_DoCommand (const char *cmd, int keynum)
|
|||
}
|
||||
else
|
||||
{ // Get the variable's value
|
||||
Printf ("\"%s\" is \"%s\"\n", var->GetName(), var->GetHumanString());
|
||||
Printf ("\"%s\" is \"%s\" ", var->GetName(), var->GetHumanString());
|
||||
Printf ("(default: \"%s\")\n", var->GetHumanStringDefault());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1681,4 +1682,3 @@ CCMD (pullin)
|
|||
Printf (TEXTCOLOR_BOLD "Pullin" TEXTCOLOR_NORMAL " is only valid from .cfg\n"
|
||||
"files and only when used at startup.\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue