cvar.h

Go to the documentation of this file.
00001 
00015 /*
00016 Copyright (C) 1997-2001 Id Software, Inc.
00017 
00018 This program is free software; you can redistribute it and/or
00019 modify it under the terms of the GNU General Public License
00020 as published by the Free Software Foundation; either version 2
00021 of the License, or (at your option) any later version.
00022 
00023 This program is distributed in the hope that it will be useful,
00024 but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00026 
00027 See the GNU General Public License for more details.
00028 
00029 You should have received a copy of the GNU General Public License
00030 along with this program; if not, write to the Free Software
00031 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00032 
00033 */
00034 
00035 #ifndef COMMON_CVAR
00036 #define COMMON_CVAR
00037 
00038 #define CVAR_ARCHIVE    1       
00039 #define CVAR_USERINFO   2       
00040 #define CVAR_SERVERINFO 4       
00041 #define CVAR_NOSET      8       
00042 #define CVAR_LATCH      16      
00043 #define CVAR_DEVELOPER  32      
00044 #define CVAR_CHEAT      64      
00045 #define CVAR_R_IMAGES   128     
00046 #define CVAR_R_CONTEXT    256     
00047 #define CVAR_R_PROGRAMS 512     
00049 #define CVAR_R_MASK (CVAR_R_IMAGES | CVAR_R_CONTEXT | CVAR_R_PROGRAMS)
00050 
00057 typedef void (*cvarChangeListenerFunc_t) (const char *cvarName, const char *oldValue, const char *newValue);
00058 
00059 typedef struct cvarListener_s {
00060     cvarChangeListenerFunc_t exec;
00061     struct cvarListener_s *next;
00062 } cvarChangeListener_t;
00063 
00068 typedef struct cvar_s {
00069     char *name;             
00070     char *string;           
00071     char *latchedString;    
00072     char *defaultString;    
00073     char *oldString;        
00074     char *description;      
00075     int flags;              
00076     qboolean modified;      
00077     float value;            
00078     int integer;            
00079     qboolean (*check) (struct cvar_s* cvar);    
00080     cvarChangeListener_t *changeListener;
00081     struct cvar_s *next;
00082     struct cvar_s *prev;
00083     struct cvar_s *hash_next;
00084 } cvar_t;
00085 
00086 typedef struct cvarList_s {
00087     const char *name;
00088     const char *value;
00089     cvar_t *var;
00090 } cvarList_t;
00091 
00097 cvar_t *Cvar_Get(const char *varName, const char *value, int flags, const char* desc);
00098 
00102 cvar_t *Cvar_Set(const char *varName, const char *value);
00103 
00107 cvar_t *Cvar_ForceSet(const char *varName, const char *value);
00108 
00109 cvar_t *Cvar_FullSet(const char *varName, const char *value, int flags);
00110 
00114 void Cvar_SetValue(const char *varName, float value);
00115 
00119 int Cvar_GetInteger(const char *varName);
00120 
00124 float Cvar_GetValue(const char *varName);
00125 
00129 const char *Cvar_GetString(const char *varName);
00130 
00134 const char *Cvar_VariableStringOld(const char *varName);
00135 
00140 int Cvar_CompleteVariable(const char *partial, const char **match);
00141 
00145 void Cvar_UpdateLatchedVars(void);
00146 
00152 qboolean Cvar_Command(void);
00153 
00154 void Cvar_Init(void);
00155 void Cvar_Shutdown(void);
00156 
00160 const char *Cvar_Userinfo(void);
00161 
00165 const char *Cvar_Serverinfo(void);
00166 
00170 qboolean Cvar_AssertValue(cvar_t * cvar, float minVal, float maxVal, qboolean shouldBeIntegral);
00171 
00175 qboolean Cvar_AssertString(cvar_t * cvar, char **array, int arraySize);
00176 
00180 qboolean Cvar_SetCheckFunction(const char *varName, qboolean (*check) (cvar_t* cvar));
00181 
00188 void Cvar_RegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc);
00194 void Cvar_UnRegisterChangeListener(const char *varName, cvarChangeListenerFunc_t listenerFunc);
00195 
00199 void Cvar_FixCheatVars(void);
00200 
00204 qboolean Cvar_Delete(const char *varName);
00205 
00209 cvar_t *Cvar_FindVar(const char *varName);
00210 
00216 qboolean Cvar_PendingCvars(int flags);
00217 
00218 void Com_SetUserinfoModified(qboolean modified);
00219 
00220 qboolean Com_IsUserinfoModified(void);
00221 
00222 void Com_SetRenderModified(qboolean modified);
00223 
00224 qboolean Com_IsRenderModified(void);
00225 
00226 void Cvar_ClearVars(int flags);
00227 
00228 #ifdef DEBUG
00229 void Cvar_PrintDebugCvars(void);
00230 #endif
00231 
00232 #endif
00233 

Generated by  doxygen 1.6.2