37#include "../shared/shared.h"
38#include "../common/scripts_lua.h"
41#define CVAR_USERINFO 2
42#define CVAR_SERVERINFO 4
45#define CVAR_DEVELOPER 32
47#define CVAR_R_IMAGES 128
48#define CVAR_R_CONTEXT 256
49#define CVAR_R_PROGRAMS 512
51#define CVAR_R_MASK (CVAR_R_IMAGES | CVAR_R_CONTEXT | CVAR_R_PROGRAMS)
61typedef struct cvarChangeListener_s {
63 struct cvarChangeListener_s*
next;
71typedef struct cvar_s {
82 bool (*check) (
struct cvar_s* cvar);
89typedef struct cvarList_s {
101 virtual void onCreate (
const struct cvar_s* cvar) = 0;
102 virtual void onDelete (
const struct cvar_s* cvar) = 0;
117cvar_t*
Cvar_Get(
const char* varName,
const char* value =
"",
int flags = 0,
const char* desc =
nullptr);
259void Cvar_PrintDebugCvars(
void);
Listener for cvar changes.
virtual void onDelete(const struct cvar_s *cvar)=0
virtual void onCreate(const struct cvar_s *cvar)=0
bool Cvar_PendingCvars(int flags)
Checks whether there are pending cvars for the given flags.
cvarChangeListener_t * Cvar_RegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Registers a listener that is executed each time a cvar changed its value.
const char * Cvar_Userinfo(char *info, size_t infoSize)
returns an info string containing all the CVAR_USERINFO cvars
void Com_SetRenderModified(bool modified)
void Cvar_SetValue(const char *varName, float value)
expands value to a string and calls Cvar_Set
const char * Cvar_VariableStringOld(const char *varName)
returns an empty string if not defined
void Cvar_UnRegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc)
Unregisters a cvar change listener.
bool Cvar_SetCheckFunction(const char *varName, bool(*check)(cvar_t *cvar))
Sets the check functions for a cvar (e.g. Cvar_Assert)
bool Cvar_Delete(const char *varName)
Function to remove the cvar and free the space.
int Cvar_GetInteger(const char *varName)
returns 0 if not defined or non numeric
bool Com_IsRenderModified(void)
void Cvar_RegisterCvarListener(CvarListenerPtr listener)
Registers a cvar listener.
cvar_t * Cvar_Set(const char *varName, const char *value,...) __attribute__((format(__printf__
will create the variable if it doesn't exist
bool Cvar_AssertValue(cvar_t *cvar, float minVal, float maxVal, bool shouldBeIntegral)
this function checks cvar ranges and integral values
void Cvar_UnRegisterCvarListener(CvarListenerPtr listener)
Unregisters a cvar listener.
void Cvar_Reset(cvar_t *cvar)
Sets the cvar value back to the old value.
SharedPtr< CvarListener > CvarListenerPtr
cvar_t * Cvar_FullSet(const char *varName, const char *value, int flags)
Sets a cvar from console with the given flags.
float Cvar_GetValue(const char *varName)
returns 0.0 if not defined or non numeric
cvar_t * Cvar_FindVar(const char *varName)
Searches for a cvar given by parameter.
bool Cvar_Command(void)
called by Cmd_ExecuteString when Cmd_Argv(0) doesn't match a known command. Returns true if the comma...
void(* cvarChangeListenerFunc_t)(const char *cvarName, const char *oldValue, const char *newValue, void *data)
Callback for the change listener.
void Cvar_ClearVars(int flags)
bool Com_IsUserinfoModified(void)
cvar_t * Cvar_GetFirst(void)
Return the first cvar of the cvar list.
void Cvar_Init(void)
Reads in all archived cvars.
cvar_t * Cvar_Get(const char *varName, const char *value="", int flags=0, const char *desc=nullptr)
creates the variable if it doesn't exist, or returns the existing one if it exists,...
cvar_t cvar_t * Cvar_ForceSet(const char *varName, const char *value)
will set the variable even if NOSET or LATCH
const char * Cvar_GetString(const char *varName)
returns an empty string if not defined
void Cvar_UpdateLatchedVars(void)
any CVAR_LATCHED variables that have been set will now take effect
void Cvar_FixCheatVars(void)
Reset cheat cvar values to default.
void Com_SetUserinfoModified(bool modified)
int Cvar_CompleteVariable(const char *partial, const char **match)
attempts to match a partial variable name for command line completion returns nullptr if nothing fits
const char * Cvar_Serverinfo(char *info, size_t infoSize)
returns an info string containing all the CVAR_SERVERINFO cvars
void format(__printf__, 1, 2)))
QGL_EXTERN void(APIENTRY *qglActiveTexture)(GLenum texture)
QGL_EXTERN GLsizei const GLvoid * data
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
struct cvar_s * hash_next
cvarChangeListener_t * changeListener
struct cvarChangeListener_s * next
cvarChangeListenerFunc_t exec