Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

aas_cfg.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  cfg_s

Defines

#define BBOXFL_GROUNDED   1
#define BBOXFL_NOTGROUNDED   2

Typedefs

typedef cfg_s cfg_t

Functions

void DefaultCfg (void)
int LoadCfgFile (char *filename)

Variables

cfg_t cfg


Define Documentation

#define BBOXFL_GROUNDED   1
 

Definition at line 23 of file aas_cfg.h.

#define BBOXFL_NOTGROUNDED   2
 

Definition at line 24 of file aas_cfg.h.


Typedef Documentation

typedef struct cfg_s cfg_t
 

Referenced by LoadCfgFile().


Function Documentation

void DefaultCfg void   ) 
 

Definition at line 106 of file aas_cfg.c.

References cfg_s::allpresencetypes, cfg_s::bboxes, cfg, cfg_fields, aas_bbox_s::flags, i, aas_bbox_s::maxs, aas_bbox_s::mins, fielddef_s::name, cfg_s::numbboxes, fielddef_s::offset, cfg_s::phys_gravitydirection, cfg_s::phys_maxsteepness, PRESENCE_NORMAL, aas_bbox_s::presencetype, and fielddef_s::type.

Referenced by main().

00107 {
00108     int i;
00109 
00110     // default all float values to infinite
00111     for (i = 0; cfg_fields[i].name; i++)
00112     {
00113         if ((cfg_fields[i].type & FT_TYPE) == FT_FLOAT)
00114             *(float *)( ((char*)&cfg) + cfg_fields[i].offset ) = FLT_MAX;
00115     } //end for
00116     //
00117     cfg.numbboxes = 2;
00118     //bbox 0
00119     cfg.bboxes[0].presencetype = PRESENCE_NORMAL;
00120     cfg.bboxes[0].flags = 0;
00121     cfg.bboxes[0].mins[0] = -15;
00122     cfg.bboxes[0].mins[1] = -15;
00123     cfg.bboxes[0].mins[2] = -24;
00124     cfg.bboxes[0].maxs[0] = 15;
00125     cfg.bboxes[0].maxs[1] = 15;
00126     cfg.bboxes[0].maxs[2] = 32;
00127     //bbox 1
00128     cfg.bboxes[1].presencetype = PRESENCE_CROUCH;
00129     cfg.bboxes[1].flags = 1;
00130     cfg.bboxes[1].mins[0] = -15;
00131     cfg.bboxes[1].mins[1] = -15;
00132     cfg.bboxes[1].mins[2] = -24;
00133     cfg.bboxes[1].maxs[0] = 15;
00134     cfg.bboxes[1].maxs[1] = 15;
00135     cfg.bboxes[1].maxs[2] = 16;
00136     //
00137     cfg.allpresencetypes = PRESENCE_NORMAL|PRESENCE_CROUCH;
00138     cfg.phys_gravitydirection[0]    = 0;
00139     cfg.phys_gravitydirection[1]    = 0;
00140     cfg.phys_gravitydirection[2]    = -1;
00141     cfg.phys_maxsteepness           = 0.7;
00142 } //end of the function DefaultCfg

int LoadCfgFile char *  filename  ) 
 

Definition at line 194 of file aas_cfg.c.

References cfg_s::allpresencetypes, bbox_struct, cfg_s::bboxes, cfg, cfg_struct, cfg_t, FreeSource(), LoadSourceFile(), Log_Print(), memset(), cfg_s::numbboxes, PC_ReadToken(), cfg_s::phys_gravitydirection, aas_bbox_s::presencetype, ReadStructure(), SetCfgLibVars(), source, source_t, SourceError(), SourceWarning(), token_s::string, token, token_t, and VectorLength().

Referenced by main().

00195 {
00196     source_t *source;
00197     token_t token;
00198     int settingsdefined;
00199 
00200     source = LoadSourceFile(filename);
00201     if (!source)
00202     {
00203         Log_Print("couldn't open cfg file %s\n", filename);
00204         return false;
00205     } //end if
00206 
00207     settingsdefined = false;
00208     memset(&cfg, 0, sizeof(cfg_t));
00209 
00210     while(PC_ReadToken(source, &token))
00211     {
00212         if (!stricmp(token.string, "bbox"))
00213         {
00214             if (cfg.numbboxes >= AAS_MAX_BBOXES)
00215             {
00216                 SourceError(source, "too many bounding box volumes defined");
00217             } //end if
00218             if (!ReadStructure(source, &bbox_struct, (char *) &cfg.bboxes[cfg.numbboxes]))
00219             {
00220                 FreeSource(source);
00221                 return false;
00222             } //end if
00223             cfg.allpresencetypes |= cfg.bboxes[cfg.numbboxes].presencetype;
00224             cfg.numbboxes++;
00225         } //end if
00226         else if (!stricmp(token.string, "settings"))
00227         {
00228             if (settingsdefined)
00229             {
00230                 SourceWarning(source, "settings already defined\n");
00231             } //end if
00232             settingsdefined = true;
00233             if (!ReadStructure(source, &cfg_struct, (char *) &cfg))
00234             {
00235                 FreeSource(source);
00236                 return false;
00237             } //end if
00238         } //end else if
00239     } //end while
00240     if (VectorLength(cfg.phys_gravitydirection) < 0.9 || VectorLength(cfg.phys_gravitydirection) > 1.1)
00241     {
00242         SourceError(source, "invalid gravity direction specified");
00243     } //end if
00244     if (cfg.numbboxes <= 0)
00245     {
00246         SourceError(source, "no bounding volumes specified");
00247     } //end if
00248     FreeSource(source);
00249     SetCfgLibVars();
00250     Log_Print("using cfg file %s\n", filename);
00251     return true;
00252 } //end of the function LoadCfgFile

Here is the call graph for this function:


Variable Documentation

cfg_t cfg
 

Definition at line 97 of file aas_cfg.c.

Referenced by AAS_CreateArea(), AAS_CreateMapBrushes(), AAS_FindBestAreaSplitPlane(), AAS_GapFace(), AAS_GroundFace(), AAS_StoreBoundingBoxes(), DefaultCfg(), LeafNode(), and LoadCfgFile().


Generated on Thu Aug 25 12:44:48 2005 for Quake III Arena by  doxygen 1.3.9.1