UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bspfile.h
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 1997-2001 Id Software, Inc.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #pragma once
26 
27 #include "../../../common/qfiles.h"
28 
29 dMapTile_t* LoadBSPFile(const char* filename);
30 long WriteBSPFile(const char* filename);
31 void PrintBSPFileSizes(void);
32 
36 typedef struct epair_s {
37  struct epair_s* next;
38  const char* key;
39  const char* value;
40  bool ump;
41 } epair_t;
42 
46 typedef struct {
48  int firstbrush;
49  int numbrushes;
51  bool skip;
53 } entity_t;
54 
55 extern int num_entities;
57 
58 entity_t* FindTargetEntity(const char* target);
59 void ParseEntities(void);
60 const char* UnparseEntities(void);
61 
62 void SetKeyValue(entity_t* ent, const char* key, const char* value);
63 /* will return "" if not present */
64 const char* ValueForKey(const entity_t* ent, const char* key);
65 
66 vec_t FloatForKey(const entity_t* ent, const char* key);
67 void GetVectorFromString(const char* value, vec3_t vec);
68 void GetVectorForKey(const entity_t* ent, const char* key, vec3_t vec);
69 epair_t* ParseEpair(int entNum);
70 bool EpairCheckForDuplicate(const entity_t* ent, const epair_t *e);
71 epair_t* AddEpair(const char* key, const char* value, int entNum);
72 byte* CompressRouting(byte* dataStart, byte* destStart, int l);
struct epair_s epair_t
epair_t * ParseEpair(int entNum)
Parses one key and value for an entity from the current tokens.
Definition: bspfile.cpp:453
#define MAX_MAP_ENTITIES
Definition: defines.h:136
void GetVectorForKey(const entity_t *ent, const char *key, vec3_t vec)
Converts the value of a entity parameter into a vec3_t.
Definition: bspfile.cpp:592
bool ump
Definition: bspfile.h:40
vec3_t origin
Definition: bspfile.h:47
struct epair_s * next
Definition: bspfile.h:37
int num_entities
Definition: bspfile.cpp:394
bool skip
Definition: bspfile.h:51
int firstbrush
Definition: bspfile.h:48
byte * CompressRouting(byte *dataStart, byte *destStart, int l)
Compress the routing data of a map.
Definition: bspfile.cpp:37
const char * filename
Definition: ioapi.h:41
float vec_t
Definition: ufotypes.h:37
const char * value
Definition: bspfile.h:39
void PrintBSPFileSizes(void)
Dumps info about current file.
Definition: bspfile.cpp:364
const char * ValueForKey(const entity_t *ent, const char *key)
Definition: bspfile.cpp:558
void GetVectorFromString(const char *value, vec3_t vec)
Converts a string into a vec3_t.
Definition: bspfile.cpp:575
unsigned int key
Definition: cl_input.cpp:68
entity_t * FindTargetEntity(const char *target)
Searches the entities array for an entity with the parameter targetname that matches the searched tar...
Definition: map.cpp:911
const char * UnparseEntities(void)
Generates the curTile->entdata string from all the entities.
Definition: bspfile.cpp:515
vec_t FloatForKey(const entity_t *ent, const char *key)
Definition: bspfile.cpp:566
epair_t * AddEpair(const char *key, const char *value, int entNum)
Definition: bspfile.cpp:428
dMapTile_t * LoadBSPFile(const char *filename)
Definition: bspfile.cpp:231
int numbrushes
Definition: bspfile.h:49
const char * key
Definition: bspfile.h:38
long WriteBSPFile(const char *filename)
Swaps the bsp file in place, so it should not be referenced again.
Definition: bspfile.cpp:316
vec_t vec3_t[3]
Definition: ufotypes.h:39
void ParseEntities(void)
Parses the curTile->entdata string into entities.
Definition: bspfile.cpp:502
struct entity_s entity_t
void SetKeyValue(entity_t *ent, const char *key, const char *value)
Definition: bspfile.cpp:546
uint8_t byte
Definition: ufotypes.h:34
epair_t * epairs
Definition: bspfile.h:50
bool EpairCheckForDuplicate(const entity_t *ent, const epair_t *e)
Definition: bspfile.cpp:418
entity_t entities[MAX_MAP_ENTITIES]
Definition: bspfile.cpp:395