Debian Codegraph @

tools/quake2/extra/common/bspfile.h

raw symbols SCIP
1 /*
2 ===========================================================================
3 Copyright (C) 1997-2006 Id Software, Inc.
4
5 This file is part of Quake 2 Tools source code.
6
7 Quake 2 Tools source code is free software; you can redistribute it
8 and/or modify it under the terms of the GNU General Public License as
9 published by the Free Software Foundation; either version 2 of the License,
10 or (at your option) any later version.
11
12 Quake 2 Tools source code is distributed in the hope that it will be
13 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with Quake 2 Tools source code; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ===========================================================================
21 */
22
23 #include "qfiles.h"
24
25
26 extern int nummodels;
27 extern dmodel_t dmodels[MAX_MAP_MODELS];
28
29 extern int visdatasize;
30 extern byte dvisdata[MAX_MAP_VISIBILITY];
31 extern dvis_t *dvis;
32
33 extern int lightdatasize;
34 extern byte dlightdata[MAX_MAP_LIGHTING];
35
36 extern int entdatasize;
37 extern char dentdata[MAX_MAP_ENTSTRING];
38
39 extern int numleafs;
40 extern dleaf_t dleafs[MAX_MAP_LEAFS];
41
42 extern int numplanes;
43 extern dplane_t dplanes[MAX_MAP_PLANES];
44
45 extern int numvertexes;
46 extern dvertex_t dvertexes[MAX_MAP_VERTS];
47
48 extern int numnodes;
49 extern dnode_t dnodes[MAX_MAP_NODES];
50
51 extern int numtexinfo;
52 extern texinfo_t texinfo[MAX_MAP_TEXINFO];
53
54 extern int numfaces;
55 extern dface_t dfaces[MAX_MAP_FACES];
56
57 extern int numedges;
58 extern dedge_t dedges[MAX_MAP_EDGES];
59
60 extern int numleaffaces;
61 extern unsigned short dleaffaces[MAX_MAP_LEAFFACES];
62
63 extern int numleafbrushes;
64 extern unsigned short dleafbrushes[MAX_MAP_LEAFBRUSHES];
65
66 extern int numsurfedges;
67 extern int dsurfedges[MAX_MAP_SURFEDGES];
68
69 extern int numareas;
70 extern darea_t dareas[MAX_MAP_AREAS];
71
72 extern int numareaportals;
73 extern dareaportal_t dareaportals[MAX_MAP_AREAPORTALS];
74
75 extern int numbrushes;
76 extern dbrush_t dbrushes[MAX_MAP_BRUSHES];
77
78 extern int numbrushsides;
79 extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES];
80
81 extern byte dpop[256];
82
83 void DecompressVis (byte *in, byte *decompressed);
84 int CompressVis (byte *vis, byte *dest);
85
86 void LoadBSPFile (char *filename);
87 void LoadBSPFileTexinfo (char *filename); // just for qdata
88 void WriteBSPFile (char *filename);
89 void PrintBSPFileSizes (void);
90
91 //===============
92
93
94 typedef struct epair_s
95 {
96 struct epair_s *next;
97 char *key;
98 char *value;
99 } epair_t;
100
101 typedef struct
102 {
103 vec3_t origin;
104 int firstbrush;
105 int numbrushes;
106 epair_t *epairs;
107
108 // only valid for func_areaportals
109 int areaportalnum;
110 int portalareas[2];
111 } entity_t;
112
113 extern int num_entities;
114 extern entity_t entities[MAX_MAP_ENTITIES];
115
116 void ParseEntities (void);
117 void UnparseEntities (void);
118
119 void SetKeyValue (entity_t *ent, char *key, char *value);
120 char *ValueForKey (entity_t *ent, char *key);
121 // will return "" if not present
122
123 vec_t FloatForKey (entity_t *ent, char *key);
124 void GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
125
126 epair_t *ParseEpair (void);
127
128 void PrintEntity (entity_t *ent);
129