FTEQW
Documentation of the FTE engine source tree.
bspfile.h
Go to the documentation of this file.
1/*
2Copyright (C) 1996-1997 Id Software, Inc.
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
13See the GNU General Public License for more details.
14
15You should have received a copy of the GNU General Public License
16along with this program; if not, write to the Free Software
17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20
21
22// upper design bounds
23
24#define MAX_MAP_HULLSDQ1 4
25#define MAX_MAP_HULLSDH2 8
26#define MAX_MAP_HULLSM 8
27#define RBSP_STYLESPERSURF 4
28#define Q1Q2BSP_STYLESPERSURF 4
29#ifdef Q1BSPS
30#define MAXCPULIGHTMAPS 16 //max lightmaps mixed by the cpu (vanilla q1bsp=4, fte extensions=no real cap, must be >=MAXRLIGHTMAPS)
31#elif defined(Q1BSPS)
32#define MAXCPULIGHTMAPS Q1Q2BSP_STYLESPERSURF //max lightmaps mixed by the cpu (vanilla q1bsp=4, fte extensions=no real cap, must be >=MAXRLIGHTMAPS)
33#else
34#define MAXCPULIGHTMAPS MAXRLIGHTMAPS //max lightmaps mixed by the cpu (vanilla q1bsp=4, fte extensions=no real cap, must be >=MAXRLIGHTMAPS)
35#endif
36
37//#define MAX_MAP_MODELS 256
38//#define MAX_MAP_BRUSHES 0x8000
39//#define MAX_MAP_ENTITIES 1024
40//#define MAX_MAP_ENTSTRING 65536
41
42//FIXME: make sure that any 16bit indexes are bounded properly
43//FIXME: ensure that we don't get any count*size overflows
44#define SANITY_LIMIT(t) ((unsigned int)(0x7fffffffu/sizeof(t))) //sanity limit for the array, to ensure a 32bit value cannot overflow us.
45//#define SANITY_MAX_MAP_PLANES 65536*64 //sanity
46//#define SANITY_MAX_MAP_NODES 65536*64 //sanity
47//#define SANITY_MAX_MAP_CLIPNODES 65536*64 //sanity
48//#define MAX_MAP_LEAFS 1 //pvs buffer size. not sanity.
49//#define SANITY_MAX_MAP_LEAFS 65536*64 //too many leafs results in massive amounts of ram used for pvs/phs caches.
50//#define SANITY_MAX_MAP_VERTS 65536 //sanity
51//#define SANITY_MAX_MAP_FACES 65536*64 //sanity
52//#define MAX_MAP_MARKSURFACES 65536 //sanity
53//#define MAX_MAP_TEXINFO 4096 //sanity
54//#define MAX_MAP_EDGES 256000
55//#define MAX_MAP_SURFEDGES 512000
56//#define MAX_MAP_MIPTEX 0x200000
57//#define MAX_MAP_LIGHTING 0x100000
58//#define MAX_MAP_VISIBILITY 0x200000
59
60#define SANITY_MAX_MAP_BRUSHSIDES ((~0u)/sizeof(q2cbrushside_t))
61
62// key / value pair sizes
63
64#define MAX_KEY 32
65#define MAX_VALUE 1024
66
67
68//=============================================================================
69
70#define BSPVERSIONQTEST "\x17\0\0\0",4 //qtest
71#define BSPVERSIONPREREL "\x1C\0\0\0",4 //prerelease
72#define BSPVERSION "\x1D\0\0\0",4 //vanilla
73#define BSPVERSIONHL "\x1E\0\0\0",4 //HalfLife support
74#define BSPVERSION_LONG1 "2PSB",4 /*RMQ support (2PSB). 32bits instead of shorts for all but bbox sizes*/
75#define BSPVERSION_LONG2 "BSP2",4 /*BSP2 support. 32bits instead of shorts for everything*/
76#define BSPVERSIONQ64 " 46Q",4 /* Remastered BSP format used for Quake 64 addon */
77
78typedef struct
79{
80 unsigned int fileofs, filelen;
81} lump_t;
82
83#define LUMP_ENTITIES 0
84#define LUMP_PLANES 1
85#define LUMP_TEXTURES 2
86#define LUMP_VERTEXES 3
87#define LUMP_VISIBILITY 4
88#define LUMP_NODES 5
89#define LUMP_TEXINFO 6
90#define LUMP_FACES 7
91#define LUMP_LIGHTING 8
92#define LUMP_CLIPNODES 9
93#define LUMP_LEAFS 10
94#define LUMP_MARKSURFACES 11
95#define LUMP_EDGES 12
96#define LUMP_SURFEDGES 13
97#define LUMP_MODELS 14
98
99#define HEADER_LUMPS 15
100
101typedef struct
102{
103 float mins[3], maxs[3];
104 float origin[3];
105 int headnode[MAX_MAP_HULLSDQ1];
106 int visleafs; // not including the solid leaf 0
107 int firstface, numfaces;
108} dq1model_t;
109
110typedef struct
111{
112 float mins[3], maxs[3];
113 float origin[3];
114 int headnode[MAX_MAP_HULLSDH2];
115 int visleafs; // not including the solid leaf 0
116 int firstface, numfaces;
117} dh2model_t;
118
119typedef struct
120{
122 lump_t lumps[HEADER_LUMPS];
123} dheader_t;
124
125typedef struct
126{
128 int dataofs[4]; // [nummiptex]
130
131#define MIPLEVELS 4
132typedef struct miptex_s
133{
134 char name[16];
135 unsigned width, height;
136 unsigned offsets[MIPLEVELS]; // four mip maps stored
138
139typedef struct q64miptex_s
140{
141 char name[16];
142 unsigned width, height, scale;
143 unsigned offsets[MIPLEVELS]; // four mip maps stored
145
146
147typedef struct
148{
149 float point[3];
150} dvertex_t;
151
152
153// 0-2 are axial planes
154#define PLANE_X 0
155#define PLANE_Y 1
156#define PLANE_Z 2
157
158// 3-5 are non-axial planes snapped to the nearest
159#define PLANE_ANYX 3
160#define PLANE_ANYY 4
161#define PLANE_ANYZ 5
162
163typedef struct
164{
165 float normal[3];
166 float dist;
167 int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
168} dplane_t;
169
170
172{ //q1 and halflife bsp contents values.
173 //also used for .skin for content forcing.
180//#define Q1CONTENTS_ORIGIN -7 /*not known to engine - origin or something*/
181 Q1CONTENTS_CLIP = -8, /*solid to players+monsters, but not tracelines*/
182 Q1CONTENTS_CURRENT_0 = -9, /*moves player*/
183 Q1CONTENTS_CURRENT_90 = -10, /*moves player*/
184 Q1CONTENTS_CURRENT_180 = -11, /*moves player*/
185 Q1CONTENTS_CURRENT_270 = -12, /*moves player*/
186 Q1CONTENTS_CURRENT_UP = -13, /*moves player*/
187 Q1CONTENTS_CURRENT_DOWN = -14, /*moves player*/
188 Q1CONTENTS_TRANS = -15, /*should be solid I guess*/
189 Q1CONTENTS_LADDER = -16, /*player can climb up/down*/
190 Q1CONTENTS_MONSTERCLIP = -17, /*solid to monster movement*/
191 Q1CONTENTS_PLAYERCLIP = -18, /*solid to player movement*/
192 Q1CONTENTS_CORPSE = -19, /*solid to tracelines*/
193};
194
195// !!! if this is changed, it must be changed in asm_i386.h too !!!
196typedef struct
197{
199 short children[2]; // negative numbers are -(leafs+1), not nodes
200 short mins[3]; // for sphere culling
201 short maxs[3];
202 unsigned short firstface;
203 unsigned short numfaces; // counting both sides
204} dsnode_t;
205typedef struct
206{
208 int children[2]; // negative numbers are -(leafs+1), not nodes
209 short mins[3]; // for sphere culling
210 short maxs[3];
211 unsigned int firstface;
212 unsigned int numfaces; // counting both sides
213} dl1node_t;
214typedef struct
215{
217 int children[2]; // negative numbers are -(leafs+1), not nodes
218 float mins[3]; // for sphere culling
219 float maxs[3];
220 unsigned int firstface;
221 unsigned int numfaces; // counting both sides
222} dl2node_t;
223
224typedef struct
225{
227 short children[2]; // negative numbers are contents
229typedef struct
230{
232 int children[2]; // negative numbers are contents
234
235typedef struct
236{
238 int children[2]; // negative numbers are contents
240
241typedef struct texinfo_s
242{
243 float vecs[2][4]; // [s/t][xyz offset]
245 int flags;
247#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
248
249// note that edge 0 is never used, because negative edge nums are used for
250// counterclockwise use of the edge in a face
251typedef struct
252{
253 unsigned short v[2]; // vertex numbers
254} dsedge_t;
255typedef struct
256{
257 unsigned int v[2]; // vertex numbers
258} dledge_t;
259
260#ifdef RFBSPS
261#define MAXRLIGHTMAPS 4 //max lightmaps mixed by the gpu (rbsp=4, otherwise 1)
262#else
263#define MAXRLIGHTMAPS 1 //max lightmaps mixed by the gpu (rbsp=4, otherwise 1)
264#endif
265typedef struct
266{
267 short planenum;
268 short side;
269
270 int firstedge; // we must support > 64k edges
271 short numedges;
272 short texinfo;
273
274// lighting info
275 qbyte styles[Q1Q2BSP_STYLESPERSURF];
276 int lightofs; // start of [numstyles*surfsize] samples
277} dsface_t;
278typedef struct
279{
281 int side;
282
283 int firstedge; // we must support > 64k edges
286
287// lighting info
288 qbyte styles[Q1Q2BSP_STYLESPERSURF];
289 int lightofs; // start of [numstyles*surfsize] samples
290} dlface_t;
291
292
293
294#define AMBIENT_WATER 0
295#define AMBIENT_SKY 1
296#define AMBIENT_SLIME 2
297#define AMBIENT_LAVA 3
298
299#define NUM_AMBIENTS 4 // automatic ambient sounds
300
301// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
302// all other leafs need visibility info
303typedef struct
304{
306 int visofs; // -1 = no visibility info
307
308 short mins[3]; // for frustum culling
309 short maxs[3];
310
311 unsigned short firstmarksurface;
312 unsigned short nummarksurfaces;
313
314 qbyte ambient_level[NUM_AMBIENTS];
315} dsleaf_t;
316typedef struct
317{
319 int visofs; // -1 = no visibility info
320
321 short mins[3]; // for frustum culling
322 short maxs[3];
323
324 unsigned int firstmarksurface;
325 unsigned int nummarksurfaces;
326
327 qbyte ambient_level[NUM_AMBIENTS];
328} dl1leaf_t;
329typedef struct
330{
332 int visofs; // -1 = no visibility info
333
334 float mins[3]; // for frustum culling
335 float maxs[3];
336
337 unsigned int firstmarksurface;
338 unsigned int nummarksurfaces;
339
340 qbyte ambient_level[NUM_AMBIENTS];
341} dl2leaf_t;
342
343//============================================================================
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359#define MIPLEVELS 4
360typedef struct q2miptex_s
361{
362 char name[32];
363 unsigned width, height;
364 unsigned offsets[MIPLEVELS]; // four mip maps stored
365 char animname[32]; // next frame in animation chain
366 int flags;
368 int value;
370
371
372
373/*
374==============================================================================
375
376 .BSP file format
377
378==============================================================================
379*/
380
381#define IDBSPHEADER "IBSP",4
382 // little-endian "IBSP"
383
384#define BSPVERSION_Q2 38
385#define BSPVERSION_Q2W 69
386#define BSPVERSION_Q3 46
387#define BSPVERSION_RTCW 47
388#define BSPVERSION_RBSP 1 //also fbsp(just bigger internal lightmaps)
389
390
391
392// upper design bounds
393// leaffaces, leafbrushes, planes, and verts are still bounded by
394// 16 bit short limits
395#define SANITY_MAX_Q2MAP_MODELS MAX_PRECACHE_MODELS
396//#define MAX_Q2MAP_ENTITIES 2048
397#define SANITY_MAX_MAP_BRUSHES (~0u/sizeof(*out))
398#define SANITY_MAX_MAP_LEAFFACES 262144 //sanity only
399
400#define MAX_Q2MAP_AREAS 256
401#define MAX_Q2MAP_AREAPORTALS 1024
402//#define MAX_Q2MAP_VERTS MAX_MAP_VERTS
403//#define MAX_Q2MAP_FACES MAX_MAP_FACES
404#define SANITY_MAX_MAP_LEAFBRUSHES (65536*64) //used in an array
405//#define MAX_Q2MAP_PORTALS 65536 //unused
406//#define MAX_Q2MAP_EDGES 128000 //unused
407//#define MAX_Q2MAP_SURFEDGES 256000 //unused
408//#define MAX_Q2MAP_LIGHTING 0x200000 //unused
409//#define MAX_Q2MAP_VISIBILITY MAX_MAP_VISIBILITY
410
411// key / value pair sizes
412
413#define MAX_KEY 32
414#define MAX_VALUE 1024
415
416//=============================================================================
417
418
419#define Q2LUMP_ENTITIES 0
420#define Q2LUMP_PLANES 1
421#define Q2LUMP_VERTEXES 2
422#define Q2LUMP_VISIBILITY 3
423#define Q2LUMP_NODES 4
424#define Q2LUMP_TEXINFO 5
425#define Q2LUMP_FACES 6
426#define Q2LUMP_LIGHTING 7
427#define Q2LUMP_LEAFS 8
428#define Q2LUMP_LEAFFACES 9
429#define Q2LUMP_LEAFBRUSHES 10
430#define Q2LUMP_EDGES 11
431#define Q2LUMP_SURFEDGES 12
432#define Q2LUMP_MODELS 13
433#define Q2LUMP_BRUSHES 14
434#define Q2LUMP_BRUSHSIDES 15
435#define Q2LUMP_POP 16
436#define Q2LUMP_AREAS 17
437#define Q2LUMP_AREAPORTALS 18
438#define Q2HEADER_LUMPS 19
439
441{
459#ifdef RFBSPS
461#endif
464
465typedef struct
466{
467 int ident;
469 lump_t lumps[50];
471
472typedef struct
473{
474 float mins[3], maxs[3];
475 float origin[3]; // for sounds or lights
477 int firstface, numfaces; // submodels just draw faces
478 // without walking the bsp tree
479} q2dmodel_t;
480
481typedef struct
482{
483 float mins[3];
484 float maxs[3];
489} q3dmodel_t;
490
491
492
493// 0-2 are axial planes
494#define PLANE_X 0
495#define PLANE_Y 1
496#define PLANE_Z 2
497
498// 3-5 are non-axial planes snapped to the nearest
499#define PLANE_ANYX 3
500#define PLANE_ANYY 4
501#define PLANE_ANYZ 5
502
503
504
505
506// contents flags are seperate bits
507// a given brush can contribute multiple content bits
508// multiple brushes can be in a single leaf
509
510#define FTECONTENTS_EMPTY 0x00000000
511#define FTECONTENTS_SOLID 0x00000001
512#define FTECONTENTS_WINDOW 0x00000002 //solid to bullets, but not sight/agro
513//q2aux 0x00000004
514#define FTECONTENTS_LAVA 0x00000008
515#define FTECONTENTS_SLIME 0x00000010
516#define FTECONTENTS_WATER 0x00000020
517#define FTECONTENTS_FLUID (FTECONTENTS_WATER|FTECONTENTS_SLIME|FTECONTENTS_LAVA|FTECONTENTS_SKY) //sky is a fluid for q1 code.
518//q2mist 0x00000040
519//q3notteam1 0x00000080
520//q3notteam2 0x00000100
521//q3nobotclip 0x00000200
522// 0x00000400
523// 0x00000800
524// 0x00001000
525// 0x00002000
526#define FTECONTENTS_LADDER 0x00004000
527//q2areaportal,q3areaportal 0x00008000
528#define FTECONTENTS_PLAYERCLIP 0x00010000
529#define FTECONTENTS_MONSTERCLIP 0x00020000
530//q2current0,q3teleporter 0x00040000
531//q2current90,q3jumppad 0x00080000
532//q2current180,q3clusterportal 0x00100000
533//q2current270,q3donotenter 0x00200000
534//q2currentup,q3botclip 0x00400000
535//q2currentdown,q3mover 0x00800000
536//q2origin,q3origin 0x01000000 //could define, but normally removed by compiler, so why?
537#define FTECONTENTS_BODY 0x02000000
538#define FTECONTENTS_CORPSE 0x04000000
539#define FTECONTENTS_DETAIL 0x08000000 //not very useful to us, but used by .map support
540//q2translucent,q3structual 0x10000000
541//q2ladder,q3translucent 0x20000000
542//q3trigger 0x40000000
543#define FTECONTENTS_SKY/*q3nodrop*/ 0x80000000
544
545// lower bits are stronger, and will eat weaker brushes completely
546#define Q2CONTENTS_SOLID FTECONTENTS_SOLID //0x00000001
547#define Q2CONTENTS_WINDOW 0x00000002 // translucent, but not watery
548#define Q2CONTENTS_AUX 0x00000004
549#define Q2CONTENTS_LAVA FTECONTENTS_LAVA //0x00000008
550#define Q2CONTENTS_SLIME FTECONTENTS_SLIME //0x00000010
551#define Q2CONTENTS_WATER FTECONTENTS_WATER //0x00000020
552#define Q2CONTENTS_MIST 0x00000040
553 //0x00000080
554 //0x00000100
555 //0x00000200
556 //0x00000400
557 //0x00000800
558 //0x00001000
559 //0x00002000
560 //FTECONTENTS_LADDER //0x00004000
561// remaining contents are non-visible, and don't eat brushes
562#define Q2CONTENTS_AREAPORTAL 0x00008000
563#define Q2CONTENTS_PLAYERCLIP FTECONTENTS_PLAYERCLIP //0x00010000
564#define Q2CONTENTS_MONSTERCLIP FTECONTENTS_MONSTERCLIP //0x00020000
565// currents can be added to any other contents, and may be mixed
566#define Q2CONTENTS_CURRENT_0 0x00040000
567#define Q2CONTENTS_CURRENT_90 0x00080000
568#define Q2CONTENTS_CURRENT_180 0x00100000
569#define Q2CONTENTS_CURRENT_270 0x00200000
570#define Q2CONTENTS_CURRENT_UP 0x00400000
571#define Q2CONTENTS_CURRENT_DOWN 0x00800000
572#define Q2CONTENTS_ORIGIN 0x01000000 // removed before bsping an entity
573#define Q2CONTENTS_MONSTER FTECONTENTS_BODY //0x02000000 // should never be on a brush, only in game
574#define Q2CONTENTS_DEADMONSTER FTECONTENTS_CORPSE //0x04000000
575#define Q2CONTENTS_DETAIL 0x08000000 // brushes to be added after vis leafs
576#define Q2CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
577#define Q2CONTENTS_LADDER 0x20000000
578 //0x40000000
579 //FTECONTENTS_SKY //0x80000000
580
581
582#define Q3CONTENTS_SOLID FTECONTENTS_SOLID //0x00000001 // should never be on a brush, only in game
583 //0x00000002
584 //0x00000004
585#define Q3CONTENTS_LAVA FTECONTENTS_LAVA //0x00000008
586#define Q3CONTENTS_SLIME FTECONTENTS_SLIME //0x00000010
587#define Q3CONTENTS_WATER FTECONTENTS_WATER //0x00000020
588 //0x00000040
589#define Q3CONTENTS_NOTTEAM1 0x00000080
590#define Q3CONTENTS_NOTTEAM2 0x00000100
591#define Q3CONTENTS_NOBOTCLIP 0x00000200
592 //0x00000400
593 //0x00000800
594 //0x00001000
595 //0x00002000
596 //FTECONTENTS_LADDER //0x00004000
597#define Q3CONTENTS_AREAPORTAL 0x00008000
598#define Q3CONTENTS_PLAYERCLIP FTECONTENTS_PLAYERCLIP //0x00010000
599#define Q3CONTENTS_MONSTERCLIP FTECONTENTS_MONSTERCLIP //0x00020000
600#define Q3CONTENTS_TELEPORTER 0x00040000
601#define Q3CONTENTS_JUMPPAD 0x00080000
602#define Q3CONTENTS_CLUSTERPORTAL 0x00100000
603#define Q3CONTENTS_DONOTENTER 0x00200000
604#define Q3CONTENTS_BOTCLIP 0x00400000
605#define Q3CONTENTS_MOVER 0x00800000
606#define Q3CONTENTS_ORIGIN Q2CONTENTS_ORIGIN //0x01000000
607#define Q3CONTENTS_BODY FTECONTENTS_BODY //0x02000000
608#define Q3CONTENTS_CORPSE FTECONTENTS_CORPSE //0x04000000
609#define Q3CONTENTS_DETAIL Q2CONTENTS_DETAIL //0x08000000
610#define Q3CONTENTS_STRUCTURAL 0x10000000
611#define Q3CONTENTS_TRANSLUCENT 0x20000000
612#define Q3CONTENTS_TRIGGER 0x40000000
613#define Q3CONTENTS_NODROP FTECONTENTS_SKY //0x80000000
614
615//qc compat only. not used internally.
616#define DPCONTENTS_SOLID 1 // hit a bmodel, not a bounding box
617#define DPCONTENTS_WATER 2
618#define DPCONTENTS_SLIME 4
619#define DPCONTENTS_LAVA 8
620#define DPCONTENTS_SKY 16
621#define DPCONTENTS_BODY 32 // hit a bounding box, not a bmodel
622#define DPCONTENTS_CORPSE 64 // hit a SOLID_CORPSE entity
623#define DPCONTENTS_NODROP 128 // an area where backpacks should not spawn
624#define DPCONTENTS_PLAYERCLIP 256 // blocks player movement
625#define DPCONTENTS_MONSTERCLIP 512 // blocks monster movement
626#define DPCONTENTS_DONOTENTER 1024 // AI hint brush
627#define DPCONTENTS_BOTCLIP 2048 // AI hint brush
628#define DPCONTENTS_OPAQUE 4096 // only fully opaque brushes get this (may be useful for line of sight checks)
629
630
631//Texinfo flags - warning: these mix with q3 surface flags
632#define TI_LIGHT 0x1 // value will hold the light strength
633
634#define TI_SLICK 0x2 // effects game physics
635
636#define TI_SKY 0x4 // don't draw, but add to skybox
637#define TI_WARP 0x8 // turbulent water warp
638#define TI_TRANS33 0x10
639#define TI_TRANS66 0x20
640#define TI_FLOWING 0x40 // scroll towards angle
641#define TI_NODRAW 0x80 // don't bother referencing the texture
642//#define TI_HINT 0x100 // handled by tools, engine can ignore.
643//#define TI_SKIP 0x200 // handled by tools, engine can ignore.
644
645//#define TI_KINGPIN_SPECULAR 0x400
646//#define TI_KINGPIN_DIFFUSE 0x800
647#define TI_KINGPIN_ALPHATEST 0x1000 //regular alphatest
648//#define TI_KINGPIN_MIRROR 0x2000
649//#define TI_KINGPIN_WNDW33 0x4000
650//#define TI_KINGPIN_WNDW64 0x8000
651
652//Surface flags
653//#define Q3SURFACEFLAG_NODAMAGE 0x1 // never give falling damage
654//#define Q3SURFACEFLAG_SLICK 0x2 // effects game physics
655//#define Q3SURFACEFLAG_SKY 0x4 // lighting from environment map
656#define Q3SURFACEFLAG_LADDER 0x8
657//#define Q3SURFACEFLAG_NOIMPACT 0x10 // don't make missile explosions
658//#define Q3SURFACEFLAG_NOMARKS 0x20 // don't leave missile marks
659//#define Q3SURFACEFLAG_FLESH 0x40 // make flesh sounds and effects
660//#define Q3SURFACEFLAG_NODRAW 0x80 // don't generate a drawsurface at all
661//#define Q3SURFACEFLAG_HINT 0x100 // make a primary bsp splitter
662//#define Q3SURFACEFLAG_SKIP 0x200 // completely ignore, allowing non-closed brushes
663//#define Q3SURFACEFLAG_NOLIGHTMAP 0x400 // surface doesn't need a lightmap
664//#define Q3SURFACEFLAG_POINTLIGHT 0x800 // generate lighting info at vertexes
665//#define Q3SURFACEFLAG_METALSTEPS 0x1000 // clanking footsteps
666//#define Q3SURFACEFLAG_NOSTEPS 0x2000 // no footstep sounds
667//#define Q3SURFACEFLAG_NONSOLID 0x4000 // don't collide against curves with this set
668//#define Q3SURFACEFLAG_LIGHTFILTER 0x8000 // act as a light filter during q3map -light
669//#define Q3SURFACEFLAG_ALPHASHADOW 0x10000 // do per-pixel light shadow casting in q3map
670//#define Q3SURFACEFLAG_NODLIGHT 0x20000 // don't dlight even if solid (solid lava, skies)
671//#define Q3SURFACEFLAG_DUST 0x40000 // leave a dust trail when walking on this surface
672
673// content masks. Allow q2contents_window in here
674//#define MASK_ALL (-1)
675#define MASK_WORLDSOLID (FTECONTENTS_SOLID|FTECONTENTS_WINDOW) /*default trace type for something simple that ignores non-bsp stuff*/
676#define MASK_POINTSOLID (FTECONTENTS_SOLID|FTECONTENTS_WINDOW|FTECONTENTS_BODY) /*default trace type for an entity of no size*/
677#define MASK_BOXSOLID (FTECONTENTS_SOLID|FTECONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW|FTECONTENTS_BODY) /*default trace type for an entity that does have size*/
678#define MASK_PLAYERSOLID MASK_BOXSOLID
679//#define MASK_DEADSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_PLAYERCLIP|Q2CONTENTS_WINDOW)
680//#define MASK_MONSTERSOLID (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTERCLIP|Q2CONTENTS_WINDOW|Q2CONTENTS_MONSTER)
681#define MASK_WATER (FTECONTENTS_WATER|FTECONTENTS_LAVA|FTECONTENTS_SLIME)
682//#define MASK_OPAQUE (Q2CONTENTS_SOLID|Q2CONTENTS_SLIME|Q2CONTENTS_LAVA)
683//#define MASK_SHOT (Q2CONTENTS_SOLID|Q2CONTENTS_MONSTER|Q2CONTENTS_WINDOW|Q2CONTENTS_DEADMONSTER)
684#define Q2MASK_CURRENT (Q2CONTENTS_CURRENT_0|Q2CONTENTS_CURRENT_90|Q2CONTENTS_CURRENT_180|Q2CONTENTS_CURRENT_270|Q2CONTENTS_CURRENT_UP|Q2CONTENTS_CURRENT_DOWN)
685
686
687
688typedef struct
689{
691 int children[2]; // negative numbers are -(leafs+1), not nodes
692 short mins[3]; // for frustom culling
693 short maxs[3];
694 unsigned short firstface;
695 unsigned short numfaces; // counting both sides
696} q2dnode_t;
697
698typedef struct
699{
700 int plane;
701 int children[2];
702 int mins[3];
703 int maxs[3];
704} q3dnode_t;
705
706
707typedef struct q2texinfo_s
708{
709 float vecs[2][4]; // [s/t][xyz offset]
710 int flags; // miptex flags + overrides
711 int value; // light emission, etc
712 char texture[32]; // texture name (textures/ *.wal)
713 int nexttexinfo; // for animations, -1 = end of chain
715
716
717
718typedef struct
719{
720 int contents; // OR of all brushes (not needed?)
721
722 short cluster;
723 short area;
724
725 short mins[3]; // for frustum culling
726 short maxs[3];
727
728 unsigned short firstleafface;
729 unsigned short numleaffaces;
730
731 unsigned short firstleafbrush;
732 unsigned short numleafbrushes;
733} q2dleaf_t;
734
735typedef struct
736{
738 int area;
739 int mins[3];
740 int maxs[3];
745} q3dleaf_t;
746
747
748typedef struct
749{
750 unsigned short planenum; // facing out of the leaf
751 short texinfo;
753
754typedef struct
755{
759typedef struct
760{
765
766typedef struct
767{
771} q2dbrush_t;
772
773
774typedef struct
775{
779} q3dbrush_t;
780
781#define ANGLE_UP -1
782#define ANGLE_DOWN -2
783
784
785// the visibility lump consists of a header with a count, then
786// qbyte offsets for the PVS and PHS of each cluster, then the raw
787// compressed bit vectors
788#define DVIS_PVS 0
789#define DVIS_PHS 1
790typedef struct
791{
793 int bitofs[8][2]; // bitofs[numclusters][2]
794} q2dvis_t;
795
796typedef struct
797{
800 unsigned char data[1];
801} q3dvis_t;
802
803// each area has a list of portals that lead into other areas
804// when portals are closed, other areas may not be visible or
805// hearable even if the vis info says that it should be
806typedef struct
807{
811
812typedef struct
813{
816} q2darea_t;
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836typedef struct
837{
838 char shadername[OLD_MAX_QPATH];
842
843typedef struct
844{
845 float n[3];
846 float d;
847} Q3PLANE_t;
848
850{
851 float mins[3];
852 float maxs[3];
857};
858
859
860typedef struct
861{
862 float point[3];
863 float texcoords[2][2];
864 float normal[3];
865 unsigned char color[4];
867
868typedef struct
869{
870 float point[3];
871 float stcoords[2];
872 float lmtexcoords[RBSP_STYLESPERSURF][2];
873 float normal[3];
874 unsigned char color[RBSP_STYLESPERSURF][4];
876
877struct Q3FOG
878{
879 char shadername[OLD_MAX_QPATH] ;
882};
883
885{
891 MST_FOLIAGE=5, //added in wolf/et
892 MST_PATCH_FIXED=256 //fte, fixed tessellation. Uses high parts of surf->patchwidth/height. if 0 then uses exact CPs instead.
894
895typedef struct
896{
905 int lightmap_offs[2];
908 float lightmap_origin[3];
909 float lightmap_vecs[2][3];
910 float normal[3];
913} q3dface_t;
914
915typedef struct
916{
924 unsigned char lm_styles[RBSP_STYLESPERSURF];
925 unsigned char vt_styles[RBSP_STYLESPERSURF];
926 int lightmapnum[RBSP_STYLESPERSURF];
927 int lightmap_offs[2][RBSP_STYLESPERSURF]; //yes, weird ordering.
930 float lightmap_origin[3];
931 float lightmap_vecs[2][3];
932 float normal[3];
935} rbspface_t;
936
937#define MAX_ENT_LEAFS 32
938typedef struct pvscache_s
939{
940 int num_leafs; //negative generally means resort-to-headnode.
941 unsigned int leafnums[MAX_ENT_LEAFS];
struct q2miptex_s q2miptex_t
struct q2texinfo_s q2texinfo_t
struct miptex_s miptex_t
struct pvscache_s pvscache_t
struct q64miptex_s q64miptex_t
q1contents_e
Definition: bspfile.h:172
@ Q1CONTENTS_MONSTERCLIP
Definition: bspfile.h:190
@ Q1CONTENTS_SOLID
Definition: bspfile.h:175
@ Q1CONTENTS_CLIP
Definition: bspfile.h:181
@ Q1CONTENTS_SKY
Definition: bspfile.h:179
@ Q1CONTENTS_LADDER
Definition: bspfile.h:189
@ Q1CONTENTS_CURRENT_DOWN
Definition: bspfile.h:187
@ Q1CONTENTS_CURRENT_0
Definition: bspfile.h:182
@ Q1CONTENTS_WATER
Definition: bspfile.h:176
@ Q1CONTENTS_CURRENT_270
Definition: bspfile.h:185
@ Q1CONTENTS_CURRENT_90
Definition: bspfile.h:183
@ Q1CONTENTS_LAVA
Definition: bspfile.h:178
@ Q1CONTENTS_EMPTY
Definition: bspfile.h:174
@ Q1CONTENTS_TRANS
Definition: bspfile.h:188
@ Q1CONTENTS_CORPSE
Definition: bspfile.h:192
@ Q1CONTENTS_PLAYERCLIP
Definition: bspfile.h:191
@ Q1CONTENTS_CURRENT_UP
Definition: bspfile.h:186
@ Q1CONTENTS_SLIME
Definition: bspfile.h:177
@ Q1CONTENTS_CURRENT_180
Definition: bspfile.h:184
q3surfacetype
Definition: bspfile.h:885
@ MST_FLARE
Definition: bspfile.h:890
@ MST_PATCH
Definition: bspfile.h:888
@ MST_PATCH_FIXED
Definition: bspfile.h:892
@ MST_TRIANGLE_SOUP
Definition: bspfile.h:889
@ MST_BAD
Definition: bspfile.h:886
@ MST_PLANAR
Definition: bspfile.h:887
@ MST_FOLIAGE
Definition: bspfile.h:891
Q3LUMP
Definition: bspfile.h:441
@ Q3LUMP_ENTITIES
Definition: bspfile.h:442
@ Q3LUMP_BRUSHES
Definition: bspfile.h:450
@ Q3LUMP_SURFACES
Definition: bspfile.h:455
@ Q3LUMP_VISIBILITY
Definition: bspfile.h:458
@ Q3LUMP_NODES
Definition: bspfile.h:445
@ Q3LUMP_LEAFS
Definition: bspfile.h:446
@ Q3LUMP_LIGHTGRID
Definition: bspfile.h:457
@ Q3LUMP_FOGS
Definition: bspfile.h:454
@ RBSPLUMP_LIGHTINDEXES
Definition: bspfile.h:460
@ Q3LUMP_MODELS
Definition: bspfile.h:449
@ Q3LUMP_LEAFSURFACES
Definition: bspfile.h:447
@ Q3LUMP_DRAWVERTS
Definition: bspfile.h:452
@ Q3LUMP_PLANES
Definition: bspfile.h:444
@ Q3LUMP_BRUSHSIDES
Definition: bspfile.h:451
@ Q3LUMP_SHADERS
Definition: bspfile.h:443
@ Q3LUMPS_TOTAL
Definition: bspfile.h:462
@ Q3LUMP_DRAWINDEXES
Definition: bspfile.h:453
@ Q3LUMP_LEAFBRUSHES
Definition: bspfile.h:448
@ Q3LUMP_LIGHTMAPS
Definition: bspfile.h:456
struct texinfo_s texinfo_t
unsigned char qbyte
Definition: common.h:127
GLuint GLcharARB * name
Definition: glquake.h:155
const GLfloat * v
Definition: glsupp.h:466
char ** data
Definition: p_script.c:63
evalc_t origin
Definition: pr_menu.c:1356
evalc_t mins
Definition: pr_menu.c:1354
evalc_t maxs
Definition: pr_menu.c:1355
static AL_API ALsizei n
Definition: snd_al.c:161
cvar_t ambient_level
Definition: snd_dma.c:102
Definition: bspfile.h:878
int brushnum
Definition: bspfile.h:880
char shadername[OLD_MAX_QPATH]
Definition: bspfile.h:879
int visibleside
Definition: bspfile.h:881
Definition: bspfile.h:850
int firstsurface
Definition: bspfile.h:853
float mins[3]
Definition: bspfile.h:851
int num_surfaces
Definition: bspfile.h:854
int firstbrush
Definition: bspfile.h:855
int num_brushes
Definition: bspfile.h:856
float maxs[3]
Definition: bspfile.h:852
Definition: bspfile.h:844
float d
Definition: bspfile.h:846
Definition: bspfile.h:111
int visleafs
Definition: bspfile.h:115
int firstface
Definition: bspfile.h:116
Definition: bspfile.h:120
int version
Definition: bspfile.h:121
Definition: bspfile.h:317
int contents
Definition: bspfile.h:318
unsigned int nummarksurfaces
Definition: bspfile.h:325
int visofs
Definition: bspfile.h:319
unsigned int firstmarksurface
Definition: bspfile.h:324
Definition: bspfile.h:206
unsigned int firstface
Definition: bspfile.h:211
int planenum
Definition: bspfile.h:207
unsigned int numfaces
Definition: bspfile.h:212
Definition: bspfile.h:330
unsigned int firstmarksurface
Definition: bspfile.h:337
int contents
Definition: bspfile.h:331
unsigned int nummarksurfaces
Definition: bspfile.h:338
int visofs
Definition: bspfile.h:332
Definition: bspfile.h:215
unsigned int firstface
Definition: bspfile.h:220
int planenum
Definition: bspfile.h:216
unsigned int numfaces
Definition: bspfile.h:221
Definition: bspfile.h:230
int planenum
Definition: bspfile.h:231
Definition: bspfile.h:256
Definition: bspfile.h:279
int texinfo
Definition: bspfile.h:285
int planenum
Definition: bspfile.h:280
int lightofs
Definition: bspfile.h:289
int side
Definition: bspfile.h:281
int numedges
Definition: bspfile.h:284
int firstedge
Definition: bspfile.h:283
Definition: bspfile.h:126
int nummiptex
Definition: bspfile.h:127
Definition: bspfile.h:164
float dist
Definition: bspfile.h:166
int type
Definition: bspfile.h:167
Definition: bspfile.h:102
int visleafs
Definition: bspfile.h:106
int firstface
Definition: bspfile.h:107
Definition: bspfile.h:837
int contents
Definition: bspfile.h:840
int surfflags
Definition: bspfile.h:839
Definition: bspfile.h:225
int planenum
Definition: bspfile.h:226
Definition: bspfile.h:252
Definition: bspfile.h:266
short planenum
Definition: bspfile.h:267
int firstedge
Definition: bspfile.h:270
short side
Definition: bspfile.h:268
int lightofs
Definition: bspfile.h:276
short numedges
Definition: bspfile.h:271
short texinfo
Definition: bspfile.h:272
Definition: bspfile.h:304
int contents
Definition: bspfile.h:305
int visofs
Definition: bspfile.h:306
unsigned short firstmarksurface
Definition: bspfile.h:311
unsigned short nummarksurfaces
Definition: bspfile.h:312
Definition: bspfile.h:197
unsigned short numfaces
Definition: bspfile.h:203
unsigned short firstface
Definition: bspfile.h:202
int planenum
Definition: bspfile.h:198
Definition: bspfile.h:148
Definition: bspfile.h:79
unsigned int filelen
Definition: bspfile.h:80
Definition: bspfile.h:236
int planenum
Definition: bspfile.h:237
Definition: bspfile.h:133
unsigned height
Definition: bspfile.h:135
unsigned offsets[MIPLEVELS]
Definition: bspfile.h:136
unsigned width
Definition: bspfile.h:135
Definition: bspfile.h:939
int areanum2
Definition: bspfile.h:943
int areanum
Definition: bspfile.h:942
int headnode
Definition: bspfile.h:944
unsigned int leafnums[MAX_ENT_LEAFS]
Definition: bspfile.h:941
int num_leafs
Definition: bspfile.h:940
Definition: bspfile.h:813
int firstareaportal
Definition: bspfile.h:815
int numareaportals
Definition: bspfile.h:814
Definition: bspfile.h:807
int otherarea
Definition: bspfile.h:809
int portalnum
Definition: bspfile.h:808
Definition: bspfile.h:767
int contents
Definition: bspfile.h:770
int numsides
Definition: bspfile.h:769
int firstside
Definition: bspfile.h:768
Definition: bspfile.h:749
short texinfo
Definition: bspfile.h:751
unsigned short planenum
Definition: bspfile.h:750
Definition: bspfile.h:466
int ident
Definition: bspfile.h:467
int version
Definition: bspfile.h:468
Definition: bspfile.h:719
unsigned short firstleafface
Definition: bspfile.h:728
unsigned short firstleafbrush
Definition: bspfile.h:731
short area
Definition: bspfile.h:723
unsigned short numleafbrushes
Definition: bspfile.h:732
unsigned short numleaffaces
Definition: bspfile.h:729
short cluster
Definition: bspfile.h:722
int contents
Definition: bspfile.h:720
Definition: bspfile.h:473
int headnode
Definition: bspfile.h:476
int firstface
Definition: bspfile.h:477
Definition: bspfile.h:689
unsigned short firstface
Definition: bspfile.h:694
int planenum
Definition: bspfile.h:690
unsigned short numfaces
Definition: bspfile.h:695
Definition: bspfile.h:791
int numclusters
Definition: bspfile.h:792
Definition: bspfile.h:361
unsigned width
Definition: bspfile.h:363
int contents
Definition: bspfile.h:367
char animname[32]
Definition: bspfile.h:365
unsigned offsets[MIPLEVELS]
Definition: bspfile.h:364
unsigned height
Definition: bspfile.h:363
int value
Definition: bspfile.h:368
int flags
Definition: bspfile.h:366
Definition: bspfile.h:708
int flags
Definition: bspfile.h:710
float vecs[2][4]
Definition: bspfile.h:709
int value
Definition: bspfile.h:711
int nexttexinfo
Definition: bspfile.h:713
char texture[32]
Definition: bspfile.h:712
Definition: bspfile.h:775
int num_sides
Definition: bspfile.h:777
int firstside
Definition: bspfile.h:776
int shadernum
Definition: bspfile.h:778
Definition: bspfile.h:755
int planenum
Definition: bspfile.h:756
int texinfo
Definition: bspfile.h:757
Definition: bspfile.h:896
int patchheight
Definition: bspfile.h:912
int lightmap_height
Definition: bspfile.h:907
int num_indexes
Definition: bspfile.h:903
int firstvertex
Definition: bspfile.h:900
int facetype
Definition: bspfile.h:899
int shadernum
Definition: bspfile.h:897
int lightmapnum
Definition: bspfile.h:904
int num_vertices
Definition: bspfile.h:901
int patchwidth
Definition: bspfile.h:911
int fognum
Definition: bspfile.h:898
int lightmap_width
Definition: bspfile.h:906
int firstindex
Definition: bspfile.h:902
Definition: bspfile.h:736
int firstleafbrush
Definition: bspfile.h:743
int area
Definition: bspfile.h:738
int num_leafsurfaces
Definition: bspfile.h:742
int firstleafsurface
Definition: bspfile.h:741
int cluster
Definition: bspfile.h:737
int num_leafbrushes
Definition: bspfile.h:744
Definition: bspfile.h:482
int num_surfaces
Definition: bspfile.h:486
int firstbrush
Definition: bspfile.h:487
int num_brushes
Definition: bspfile.h:488
int firstsurface
Definition: bspfile.h:485
Definition: bspfile.h:699
int plane
Definition: bspfile.h:700
Definition: bspfile.h:861
Definition: bspfile.h:797
int numclusters
Definition: bspfile.h:798
int rowsize
Definition: bspfile.h:799
Definition: bspfile.h:140
unsigned offsets[MIPLEVELS]
Definition: bspfile.h:143
unsigned height
Definition: bspfile.h:142
unsigned width
Definition: bspfile.h:142
unsigned scale
Definition: bspfile.h:142
Definition: bspfile.h:760
int texinfo
Definition: bspfile.h:762
int facenum
Definition: bspfile.h:763
int planenum
Definition: bspfile.h:761
Definition: bspfile.h:916
int num_indexes
Definition: bspfile.h:923
int patchwidth
Definition: bspfile.h:933
int firstvertex
Definition: bspfile.h:920
int firstindex
Definition: bspfile.h:922
int lightmap_width
Definition: bspfile.h:928
int patchheight
Definition: bspfile.h:934
int facetype
Definition: bspfile.h:919
int shadernum
Definition: bspfile.h:917
int fognum
Definition: bspfile.h:918
int lightmap_height
Definition: bspfile.h:929
int num_vertices
Definition: bspfile.h:921
Definition: bspfile.h:869
Definition: bspfile.h:242
float vecs[2][4]
Definition: bspfile.h:243
int flags
Definition: bspfile.h:245
int miptex
Definition: bspfile.h:244