altEngine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
qbsptypes.h
Go to the documentation of this file.
1 #define BSPVERSION 29
2 
3 #define LUMP_ENTITIES 0
4 #define LUMP_PLANES 1
5 #define LUMP_TEXTURES 2
6 #define LUMP_VERTEXES 3
7 #define LUMP_VISIBILITY 4
8 #define LUMP_NODES 5
9 #define LUMP_TEXINFO 6
10 #define LUMP_FACES 7
11 #define LUMP_LIGHTING 8
12 #define LUMP_CLIPNODES 9
13 #define LUMP_LEAFS 10
14 #define LUMP_MARKSURFACES 11
15 #define LUMP_EDGES 12
16 #define LUMP_SURFEDGES 13
17 #define LUMP_MODELS 14
18 #define HEADER_LUMPS 15
19 
20 #define CONTENTS_EMPTY -1
21 #define CONTENTS_SOLID -2
22 #define CONTENTS_WATER -3
23 #define CONTENTS_SLIME -4
24 #define CONTENTS_LAVA -5
25 #define CONTENTS_SKY -6
26 
27 #define AMBIENT_WATER 0
28 #define AMBIENT_SKY 1
29 #define AMBIENT_SLIME 2
30 #define AMBIENT_LAVA 3
31 #define NUM_AMBIENTS 4 // automatic ambient sounds
32 
33 #define MAX_MAP_HULLS 4
34 
35 // 0-2 are axial planes
36 #define PLANE_X 0
37 #define PLANE_Y 1
38 #define PLANE_Z 2
39 
40 // 3-5 are non-axial planes snapped to the nearest
41 #define PLANE_ANYX 3
42 #define PLANE_ANYY 4
43 #define PLANE_ANYZ 5
44 
45 #define is_marked(x) (vis_face[(x) >> 3] & (1 << ((x) & 7)))
46 #define mark_face(x) (vis_face[(x) >> 3] |= (1 << ((x) & 7)))
47 #define unmark_face(x) (vis_face[(x) >> 3] &= ~(1 << ((x) & 7)))
48 
49 typedef unsigned char byte;
50 typedef int fix;
51 
52 typedef struct {
53  char *bits;
54  int wid;
55  int ht;
56 } bitmap;
57 
58 
59 typedef unsigned short fixang;
60 
61 typedef struct
62 {
63  fixang tx, ty, tz;
64 } angvec;
65 
66 typedef struct
67 {
68  int offset;
69  int size;
70 } lump_t;
71 
72 typedef struct
73 {
74  int version;
90 } qbsp_t;
91 
92 typedef struct
93 {
94  float mins[3], maxs[3];
95  float origin[3];
96  int headnode[MAX_MAP_HULLS];
97  int visleafs; // not including the solid leaf 0
98  int firstface, numfaces;
99 } dmodel_t;
100 
101 typedef struct
102 {
103  int version;
105 } dheader_t;
106 
107 typedef struct
108 {
110  int dataofs[4]; // [nummiptex]
111 } dmiptexlump_t;
112 
113 #define MIPLEVELS 4
114 typedef struct miptex_s
115 {
116  char name[16];
117  unsigned width, height;
118  unsigned offsets[MIPLEVELS]; // four mip maps stored
119 } miptex_t;
120 
121 
122 typedef struct
123 {
124  float point[3];
125 } dvertex_t;
126 
127 
128 
129 typedef struct
130 {
131  float normal[3];
132  float dist;
133  int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
134 } dplane_t;
135 
136 // !!! if this is changed, it must be changed in asm_i386.h too !!!
137 typedef struct
138 {
139  int planenum;
140  short children[2]; // negative numbers are -(leafs+1), not nodes
141  short mins[3]; // for sphere culling
142  short maxs[3];
143  unsigned short firstface;
144  unsigned short numfaces; // counting both sides
145 } dnode_t;
146 
147 typedef struct
148 {
149  int planenum;
150  short children[2]; // negative numbers are contents
151 } dclipnode_t;
152 
153 
154 typedef struct texinfo_s
155 {
156  float vecs[2][4]; // [s/t][xyz offset]
157  int miptex;
158  int flags;
159 } texinfo_t;
160 #define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
161 
162 // note that edge 0 is never used, because negative edge nums are used for
163 // counterclockwise use of the edge in a face
164 typedef struct
165 {
166  unsigned short v[2]; // vertex numbers
167 } dedge_t;
168 
169 
170 typedef unsigned char byte;
171 
172 #define MAXLIGHTMAPS 4
173 typedef struct
174 {
175  short planenum;
176  short side;
177 
178  int firstedge; // we must support > 64k edges
179  short numedges;
180  short texinfo;
181 
182  // lighting info
184  int lightofs; // start of [numstyles*surfsize] samples
185 } dface_t;
186 
187 // leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
188 // all other leafs need visibility info
189 typedef struct
190 {
191  int contents;
192  int visofs; // -1 = no visibility info
193 
194  short mins[3]; // for frustum culling
195  short maxs[3];
196 
197  unsigned short firstmarksurface;
198  unsigned short nummarksurfaces;
199 
200  byte ambient_level[NUM_AMBIENTS];
201 } dleaf_t;
202 
203 typedef struct
204 {
205  float x, y, z;
206 } vector;
207 
208 typedef struct
209 {
211  unsigned char ccodes;
212  unsigned char pad0, pad1, pad2;
213  fix sx, sy;
214  float u, v;
215 } point_3d; // 32 bytes