Use game functions to safely change dvar value

This commit is contained in:
Diavolo
2021-09-01 23:19:44 +02:00
parent dded312064
commit 36a025e1d0
4 changed files with 24 additions and 12 deletions

View File

@ -280,6 +280,9 @@ namespace Game
Dvar_SetFromStringByNameFromSource_t Dvar_SetFromStringByNameFromSource = Dvar_SetFromStringByNameFromSource_t(0x4FC770);
Dvar_SetStringByName_t Dvar_SetStringByName = Dvar_SetStringByName_t(0x44F060);
Dvar_SetString_t Dvar_SetString = Dvar_SetString_t(0x4A9580);
Dvar_SetBool_t Dvar_SetBool = Dvar_SetBool_t(0x4A9510);
Dvar_SetFloat_t Dvar_SetFloat = Dvar_SetFloat_t(0x40BB20);
Dvar_SetInt_t Dvar_SetInt = Dvar_SetInt_t(0x421DA0);
SL_ConvertToString_t SL_ConvertToString = SL_ConvertToString_t(0x4EC1D0);
SL_GetString_t SL_GetString = SL_GetString_t(0x4CDC10);

View File

@ -247,6 +247,15 @@ namespace Game
typedef void (__cdecl * Dvar_SetString_t)(dvar_t* cvar, const char* value);
extern Dvar_SetString_t Dvar_SetString;
typedef void (__cdecl * Dvar_SetBool_t)(dvar_t* cvar, bool enabled);
extern Dvar_SetBool_t Dvar_SetBool;
typedef void (__cdecl * Dvar_SetFloat_t)(dvar_t* cvar, float value);
extern Dvar_SetFloat_t Dvar_SetFloat;
typedef void (__cdecl * Dvar_SetInt_t)(dvar_t* cvar, int integer);
extern Dvar_SetInt_t Dvar_SetInt;
typedef void(__cdecl * Dvar_GetUnpackedColorByName_t)(const char* name, float* color);
extern Dvar_GetUnpackedColorByName_t Dvar_GetUnpackedColorByName;

View File

@ -90,7 +90,6 @@ namespace Game
DVAR_FLAG_SERVERINFO = 0x400, //in the getstatus oob
DVAR_FLAG_WRITEPROTECTED = 0x800, //write protected
DVAR_FLAG_UNKNOWN1000 = 0x1000, //unknown
DVAR_FLAG_UNKNOWN1800 = 0x1800, //unknown
DVAR_FLAG_READONLY = 0x2000, //read only (same as 0x800?)
DVAR_FLAG_UNKNOWN4000 = 0x4000, //unknown
DVAR_FLAG_UNKNOWN8000 = 0x8000, //unknown
@ -2382,7 +2381,7 @@ namespace Game
const char *name;
const char *description;
unsigned int flags;
char type;
dvar_type type;
bool modified;
DvarValue current;
DvarValue latched;