UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bspfile.h File Reference

Go to the source code of this file.

Data Structures

struct  epair_s
 
struct  entity_t
 

Typedefs

typedef struct epair_s epair_t
 

Functions

dMapTile_tLoadBSPFile (const char *filename)
 
long WriteBSPFile (const char *filename)
 Swaps the bsp file in place, so it should not be referenced again. More...
 
void PrintBSPFileSizes (void)
 Dumps info about current file. More...
 
entity_tFindTargetEntity (const char *target)
 Searches the entities array for an entity with the parameter targetname that matches the searched target parameter. More...
 
void ParseEntities (void)
 Parses the curTile->entdata string into entities. More...
 
const char * UnparseEntities (void)
 Generates the curTile->entdata string from all the entities. More...
 
void SetKeyValue (entity_t *ent, const char *key, const char *value)
 
const char * ValueForKey (const entity_t *ent, const char *key)
 
vec_t FloatForKey (const entity_t *ent, const char *key)
 
void GetVectorFromString (const char *value, vec3_t vec)
 Converts a string into a vec3_t. More...
 
void GetVectorForKey (const entity_t *ent, const char *key, vec3_t vec)
 Converts the value of a entity parameter into a vec3_t. More...
 
epair_tParseEpair (int entNum)
 Parses one key and value for an entity from the current tokens. More...
 
bool EpairCheckForDuplicate (const entity_t *ent, const epair_t *e)
 
epair_tAddEpair (const char *key, const char *value, int entNum)
 
byteCompressRouting (byte *dataStart, byte *destStart, int l)
 Compress the routing data of a map. More...
 

Variables

int num_entities
 
entity_t entities [MAX_MAP_ENTITIES]
 

Typedef Documentation

typedef struct epair_s epair_t
See also
entity_t

Function Documentation

epair_t* AddEpair ( const char *  key,
const char *  value,
int  entNum 
)
byte* CompressRouting ( byte dataStart,
byte destStart,
int  l 
)

Compress the routing data of a map.

See also
CMod_DeCompressRouting
CMod_LoadRouting

Definition at line 37 of file bspfile.cpp.

Referenced by DoRouting().

bool EpairCheckForDuplicate ( const entity_t ent,
const epair_t e 
)

Definition at line 418 of file bspfile.cpp.

References entity_t::epairs, epair_s::key, epair_s::next, and Q_streq.

Referenced by ParseMapEntity().

entity_t* FindTargetEntity ( const char *  target)

Searches the entities array for an entity with the parameter targetname that matches the searched target parameter.

Parameters
[in]targetThe targetname value that the entity should have that we are looking for

Definition at line 911 of file map.cpp.

References entities, i, num_entities, Q_streq, and ValueForKey().

Referenced by BuildLights().

vec_t FloatForKey ( const entity_t ent,
const char *  key 
)

Definition at line 566 of file bspfile.cpp.

References ValueForKey().

Referenced by BuildLights().

void GetVectorForKey ( const entity_t ent,
const char *  key,
vec3_t  vec 
)

Converts the value of a entity parameter into a vec3_t.

Definition at line 592 of file bspfile.cpp.

References GetVectorFromString(), and ValueForKey().

Referenced by BuildLights(), BuildPatches(), and ParseMapEntity().

void GetVectorFromString ( const char *  value,
vec3_t  vec 
)

Converts a string into a vec3_t.

Definition at line 575 of file bspfile.cpp.

References Sys_Error(), VectorClear, and VectorSet.

Referenced by BuildLights(), and GetVectorForKey().

dMapTile_t* LoadBSPFile ( const char *  filename)
See also
WriteBSPFile

Definition at line 231 of file bspfile.cpp.

References cBspBrush_s::brushContentFlags, dBspBrush_t::brushContentFlags, dMapTile_t::brushes, dMapTile_t::brushsides, BSP_SwapHeader, BSPVERSION, CopyLump(), curTile, dMapTile_t::dbrushes, dMapTile_t::edges, dMapTile_t::entdata, dMapTile_t::entdatasize, dMapTile_t::faces, cBspBrush_s::firstbrushside, dBspBrush_t::firstbrushside, FS_FreeFile(), FS_LoadFile(), i, IDBSPHEADER, dBspHeader_t::ident, dMapTile_t::leafbrushes, dMapTile_t::leafs, dMapTile_t::lightdata, dMapTile_t::lightdatasize, LIGHTMAP_DAY, LIGHTMAP_NIGHT, LUMP_BRUSHES, LUMP_BRUSHSIDES, LUMP_EDGES, LUMP_ENTITIES, LUMP_FACES, LUMP_LEAFBRUSHES, LUMP_LEAFS, LUMP_LIGHTING_DAY, LUMP_LIGHTING_NIGHT, LUMP_MODELS, LUMP_NODES, LUMP_NORMALS, LUMP_PLANES, LUMP_ROUTING, LUMP_SURFEDGES, LUMP_TEXINFO, LUMP_VERTEXES, mapTiles, mapTiles_s::mapTiles, dMapTile_t::models, dMapTile_t::nodes, dMapTile_t::normals, dMapTile_t::numbrushes, dMapTile_t::numbrushsides, dMapTile_t::numedges, dMapTile_t::numfaces, dMapTile_t::numleafbrushes, dMapTile_t::numleafs, dMapTile_t::nummodels, dMapTile_t::numnodes, dMapTile_t::numnormals, dMapTile_t::numplanes, cBspBrush_s::numsides, dBspBrush_t::numsides, dMapTile_t::numsurfedges, dMapTile_t::numtexinfo, mapTiles_s::numTiles, dMapTile_t::numvertexes, OBJZERO, dMapTile_t::planes, dMapTile_t::routedata, dMapTile_t::routedatasize, dMapTile_t::surfedges, SwapBSPFile(), Sys_Error(), dMapTile_t::texinfo, dBspHeader_t::version, and dMapTile_t::vertexes.

Referenced by main().

void ParseEntities ( void  )

Parses the curTile->entdata string into entities.

See also
UnparseEntities
ParseEntity

Definition at line 502 of file bspfile.cpp.

References curTile, dMapTile_t::entdata, dMapTile_t::entdatasize, num_entities, ParseEntity(), and ParseFromMemory().

Referenced by PrintBSPFileSizes().

epair_t* ParseEpair ( int  entNum)

Parses one key and value for an entity from the current tokens.

See also
parsedToken
GetToken
ParseEntity
ParseMapEntity

Definition at line 453 of file bspfile.cpp.

References AddEpair(), GetToken(), key, Mem_StrDup, parsedToken, and StripTrailingWhitespaces().

Referenced by ParseEntity(), and ParseMapEntity().

void SetKeyValue ( entity_t ent,
const char *  key,
const char *  value 
)

Definition at line 546 of file bspfile.cpp.

References AddEpair(), entity_t::epairs, Mem_StrDup, epair_s::next, and Q_streq.

Referenced by CheckEntities(), ParseBrush(), and SetModelNumbers().

const char* UnparseEntities ( void  )

Generates the curTile->entdata string from all the entities.

See also
ParseEntities

Definition at line 515 of file bspfile.cpp.

References curTile, dMapTile_t::entdata, dMapTile_t::entdatasize, entity_t::epairs, i, IsInvalidEntityToken(), epair_s::key, key, epair_s::next, num_entities, Q_strcat(), Q_strncpyz(), StripTrailingWhitespaces(), Sys_Error(), and epair_s::value.

Referenced by EndBSPFile(), and main().

Variable Documentation