]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - tools/quake2/qdata_heretic2/common/bspfile.h
Merge branch 'nomagicpath' into 'master'
[xonotic/netradiant.git] / tools / quake2 / qdata_heretic2 / common / bspfile.h
1 /*
2    Copyright (C) 1999-2007 id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    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 GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #ifndef _QBSP3_H
23 #define _QBSP3_H
24
25
26 #include "qfiles.h"
27
28
29 extern int nummodels;
30 extern dmodel_t dmodels[MAX_MAP_MODELS];
31
32 extern int visdatasize;
33 extern byte dvisdata[MAX_MAP_VISIBILITY];
34 extern dvis_t      *dvis;
35
36 extern int lightdatasize;
37 extern byte dlightdata[MAX_MAP_LIGHTING];
38
39 extern int entdatasize;
40 extern char dentdata[MAX_MAP_ENTSTRING];
41
42 extern int numleafs;
43 extern dleaf_t dleafs[MAX_MAP_LEAFS];
44
45 extern int numplanes;
46 extern dplane_t dplanes[MAX_MAP_PLANES];
47
48 extern int numvertexes;
49 extern dvertex_t dvertexes[MAX_MAP_VERTS];
50
51 extern int numnodes;
52 extern dnode_t dnodes[MAX_MAP_NODES];
53
54 extern int numtexinfo;
55 extern texinfo_t texinfo[MAX_MAP_TEXINFO];
56
57 extern int numfaces;
58 extern dface_t dfaces[MAX_MAP_FACES];
59
60 extern int numedges;
61 extern dedge_t dedges[MAX_MAP_EDGES];
62
63 extern int numleaffaces;
64 extern unsigned short dleaffaces[MAX_MAP_LEAFFACES];
65
66 extern int numleafbrushes;
67 extern unsigned short dleafbrushes[MAX_MAP_LEAFBRUSHES];
68
69 extern int numsurfedges;
70 extern int dsurfedges[MAX_MAP_SURFEDGES];
71
72 extern int numareas;
73 extern darea_t dareas[MAX_MAP_AREAS];
74
75 extern int numareaportals;
76 extern dareaportal_t dareaportals[MAX_MAP_AREAPORTALS];
77
78 extern int numbrushes;
79 extern dbrush_t dbrushes[MAX_MAP_BRUSHES];
80
81 extern int numbrushsides;
82 extern dbrushside_t dbrushsides[MAX_MAP_BRUSHSIDES];
83
84 extern byte dpop[256];
85
86 void DecompressVis( byte *in, byte *decompressed );
87 int CompressVis( byte *vis, byte *dest );
88
89 void    LoadBSPFile( char *filename );
90 void    LoadBSPFileTexinfo( char *filename );    // just for qdata
91 void    WriteBSPFile( char *filename );
92 void    PrintBSPFileSizes( void );
93
94 //===============
95
96
97 typedef struct epair_s
98 {
99         struct epair_s  *next;
100         char    *key;
101         char    *value;
102 } epair_t;
103
104 typedef struct
105 {
106         vec3_t origin;
107         int firstbrush;
108         int numbrushes;
109         epair_t     *epairs;
110
111 // only valid for func_areaportals
112         int areaportalnum;
113         int portalareas[2];
114 } entity_t;
115
116 extern int num_entities;
117 extern entity_t entities[MAX_MAP_ENTITIES];
118
119 void    ParseEntities( void );
120 void    UnparseEntities( void );
121
122 void    SetKeyValue( entity_t *ent, char *key, char *value );
123 char    *ValueForKey( entity_t *ent, char *key );
124 // will return "" if not present
125
126 vec_t   FloatForKey( entity_t *ent, char *key );
127 void    GetVectorForKey( entity_t *ent, char *key, vec3_t vec );
128
129 epair_t *ParseEpair( void );
130
131 void PrintEntity( entity_t *ent );
132
133 #endif //_QBSP3_H