Add facility to describe cvars
This commit is contained in:
parent
f9c202f83e
commit
f83334d81b
6 changed files with 29 additions and 0 deletions
|
@ -3237,6 +3237,7 @@ void CL_InitRef( void ) {
|
||||||
ri.Cvar_Set = Cvar_Set;
|
ri.Cvar_Set = Cvar_Set;
|
||||||
ri.Cvar_SetValue = Cvar_SetValue;
|
ri.Cvar_SetValue = Cvar_SetValue;
|
||||||
ri.Cvar_CheckRange = Cvar_CheckRange;
|
ri.Cvar_CheckRange = Cvar_CheckRange;
|
||||||
|
ri.Cvar_SetDescription = Cvar_SetDescription;
|
||||||
ri.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
|
ri.Cvar_VariableIntegerValue = Cvar_VariableIntegerValue;
|
||||||
|
|
||||||
// cinematic stuff
|
// cinematic stuff
|
||||||
|
|
|
@ -1537,6 +1537,7 @@ void Com_InitHunkMemory( void ) {
|
||||||
|
|
||||||
// allocate the stack based hunk allocator
|
// allocate the stack based hunk allocator
|
||||||
cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
|
cv = Cvar_Get( "com_hunkMegs", DEF_COMHUNKMEGS_S, CVAR_LATCH | CVAR_ARCHIVE );
|
||||||
|
Cvar_SetDescription(cv, "The size of the hunk memory segment");
|
||||||
|
|
||||||
// if we are not dedicated min allocation is 56, otherwise min is 1
|
// if we are not dedicated min allocation is 56, otherwise min is 1
|
||||||
if (com_dedicated && com_dedicated->integer) {
|
if (com_dedicated && com_dedicated->integer) {
|
||||||
|
|
|
@ -438,6 +438,7 @@ cvar_t *Cvar_Get( const char *var_name, const char *var_value, int flags ) {
|
||||||
var->integer = atoi(var->string);
|
var->integer = atoi(var->string);
|
||||||
var->resetString = CopyString( var_value );
|
var->resetString = CopyString( var_value );
|
||||||
var->validate = qfalse;
|
var->validate = qfalse;
|
||||||
|
var->description = NULL;
|
||||||
|
|
||||||
// link the variable in
|
// link the variable in
|
||||||
var->next = cvar_vars;
|
var->next = cvar_vars;
|
||||||
|
@ -489,6 +490,10 @@ void Cvar_Print( cvar_t *v ) {
|
||||||
if ( v->latchedString ) {
|
if ( v->latchedString ) {
|
||||||
Com_Printf( "latched: \"%s\"\n", v->latchedString );
|
Com_Printf( "latched: \"%s\"\n", v->latchedString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( v->description ) {
|
||||||
|
Com_Printf( "%s\n", v->description );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1036,6 +1041,8 @@ cvar_t *Cvar_Unset(cvar_t *cv)
|
||||||
Z_Free(cv->latchedString);
|
Z_Free(cv->latchedString);
|
||||||
if(cv->resetString)
|
if(cv->resetString)
|
||||||
Z_Free(cv->resetString);
|
Z_Free(cv->resetString);
|
||||||
|
if(cv->description)
|
||||||
|
Z_Free(cv->description);
|
||||||
|
|
||||||
if(cv->prev)
|
if(cv->prev)
|
||||||
cv->prev->next = cv->next;
|
cv->prev->next = cv->next;
|
||||||
|
@ -1205,6 +1212,23 @@ void Cvar_CheckRange( cvar_t *var, float min, float max, qboolean integral )
|
||||||
Cvar_Set( var->name, var->string );
|
Cvar_Set( var->name, var->string );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=====================
|
||||||
|
Cvar_SetDescription
|
||||||
|
=====================
|
||||||
|
*/
|
||||||
|
void Cvar_SetDescription( cvar_t *var, const char *var_description )
|
||||||
|
{
|
||||||
|
if( var_description && var_description[0] != '\0' )
|
||||||
|
{
|
||||||
|
if( var->description != NULL )
|
||||||
|
{
|
||||||
|
Z_Free( var->description );
|
||||||
|
}
|
||||||
|
var->description = CopyString( var_description );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=====================
|
=====================
|
||||||
Cvar_Register
|
Cvar_Register
|
||||||
|
|
|
@ -921,6 +921,7 @@ struct cvar_s {
|
||||||
qboolean integral;
|
qboolean integral;
|
||||||
float min;
|
float min;
|
||||||
float max;
|
float max;
|
||||||
|
char *description;
|
||||||
|
|
||||||
cvar_t *next;
|
cvar_t *next;
|
||||||
cvar_t *prev;
|
cvar_t *prev;
|
||||||
|
|
|
@ -562,6 +562,7 @@ char *Cvar_InfoString_Big( int bit );
|
||||||
// in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc )
|
// in their flags ( CVAR_USERINFO, CVAR_SERVERINFO, CVAR_SYSTEMINFO, etc )
|
||||||
void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
|
void Cvar_InfoStringBuffer( int bit, char *buff, int buffsize );
|
||||||
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
|
void Cvar_CheckRange( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
|
||||||
|
void Cvar_SetDescription( cvar_t *var, const char *var_description );
|
||||||
|
|
||||||
void Cvar_Restart(qboolean unsetVM);
|
void Cvar_Restart(qboolean unsetVM);
|
||||||
void Cvar_Restart_f( void );
|
void Cvar_Restart_f( void );
|
||||||
|
|
|
@ -133,6 +133,7 @@ typedef struct {
|
||||||
void (*Cvar_Set)( const char *name, const char *value );
|
void (*Cvar_Set)( const char *name, const char *value );
|
||||||
void (*Cvar_SetValue) (const char *name, float value);
|
void (*Cvar_SetValue) (const char *name, float value);
|
||||||
void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
|
void (*Cvar_CheckRange)( cvar_t *cv, float minVal, float maxVal, qboolean shouldBeIntegral );
|
||||||
|
void (*Cvar_SetDescription)( cvar_t *cv, const char *description );
|
||||||
|
|
||||||
int (*Cvar_VariableIntegerValue) (const char *var_name);
|
int (*Cvar_VariableIntegerValue) (const char *var_name);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue