2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
24 // qfiles.h: quake file formats
\r
25 // This file must be identical in the quake and utils directories
\r
29 ========================================================================
\r
31 The .pak files are just a linear collapse of a directory tree
\r
33 ========================================================================
\r
36 #define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P')
\r
41 int filepos, filelen;
\r
46 int ident; // == IDPAKHEADER
\r
51 #define MAX_FILES_IN_PACK 6144
\r
55 ========================================================================
\r
57 PCX files are used for as many images as possible
\r
59 ========================================================================
\r
67 char bits_per_pixel;
\r
68 unsigned short xmin,ymin,xmax,ymax;
\r
69 unsigned short hres,vres;
\r
70 unsigned char palette[48];
\r
73 unsigned short bytes_per_line;
\r
74 unsigned short palette_type;
\r
76 unsigned char data; // unbounded
\r
80 ========================================================================
\r
82 .MD2 compressed triangle model file format
\r
84 ========================================================================
\r
86 #define IDCOMPRESSEDALIASHEADER (('2'<<24)+('C'<<16)+('D'<<8)+'I')
\r
89 ========================================================================
\r
91 .MD2 compressed triangle model file format
\r
93 ========================================================================
\r
95 #define IDJOINTEDALIASHEADER (('2'<<24)+('J'<<16)+('D'<<8)+'I')
\r
98 ========================================================================
\r
100 .MD2 triangle model file format
\r
102 ========================================================================
\r
105 #define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
\r
106 #define ALIAS_VERSION 8
\r
108 #define MAX_TRIANGLES 4096
\r
109 #define MAX_VERTS 2048
\r
110 #define MAX_FRAMES 512
\r
111 #define MAX_MD2SKINS 64
\r
112 #define MAX_SKINNAME 64
\r
122 short index_xyz[3];
\r
132 byte v[3]; // scaled byte to fit in frame mins/maxs
\r
133 byte lightnormalindex;
\r
140 #define DTRIVERTX_V0 0
\r
141 #define DTRIVERTX_V1 1
\r
142 #define DTRIVERTX_V2 2
\r
143 #define DTRIVERTX_LNI 3
\r
144 #define DTRIVERTX_SIZE 4
\r
148 float scale[3]; // multiply byte verts by this
\r
149 float translate[3]; // then add this
\r
150 char name[16]; // frame name from grabbing
\r
151 dtrivertx_t verts[1]; // variable sized
\r
155 // the glcmd format:
\r
156 // a positive integer starts a tristrip command, followed by that many
\r
157 // vertex structures.
\r
158 // a negative integer starts a trifan command, followed by -x vertexes
\r
159 // a zero indicates the end of the command list.
\r
160 // a vertex consists of a floating point s, a floating point t,
\r
161 // and an integer vertex index.
\r
171 int framesize; // byte size of each frame
\r
175 int num_st; // greater than num_xyz for seams
\r
177 int num_glcmds; // dwords in strip/fan command list
\r
180 int ofs_skins; // each skin is a MAX_SKINNAME string
\r
181 int ofs_st; // byte offset from start for stverts
\r
182 int ofs_tris; // offset for dtriangles
\r
183 int ofs_frames; // offset for first frame
\r
185 int ofs_end; // end of file
\r
189 // compressed model
\r
190 typedef struct dcompmdl_s
\r
193 short CompressedFrameSize;
\r
196 float *translate; // then add this
\r
197 float *scale; // multiply byte verts by this
\r
201 float *ctranslate;
\r
208 dcompmdl_t compModInfo;
\r
211 struct ModelSkeleton_s *skeletons;
\r
215 ========================================================================
\r
219 ========================================================================
\r
222 #define IDBOOKHEADER (('K'<<24)+('O'<<16)+('O'<<8)+'B')
\r
223 #define BOOK_VERSION 2
\r
225 typedef struct bookframe_s
\r
231 char name[MAX_SKINNAME]; // name of gfx file
\r
234 typedef struct bookheader_s
\r
236 unsigned int ident;
\r
237 unsigned int version;
\r
243 typedef struct book_s
\r
245 bookheader_t bheader;
\r
246 bookframe_t bframes[MAX_MD2SKINS];
\r
250 ========================================================================
\r
252 .SP2 sprite file format
\r
254 ========================================================================
\r
257 #define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
\r
258 // little-endian "IDS2"
\r
259 #define SPRITE_VERSION 2
\r
264 int origin_x, origin_y; // raster coordinates inside pic
\r
265 char name[MAX_SKINNAME]; // name of pcx file
\r
272 dsprframe_t frames[1]; // variable sized
\r
276 ==============================================================================
\r
278 .M8 texture file format
\r
280 ==============================================================================
\r
283 typedef struct palette_s
\r
294 #define MIP_VERSION 2
\r
295 #define PAL_SIZE 256
\r
296 #define MIPLEVELS 16
\r
298 typedef struct miptex_s
\r
302 unsigned width[MIPLEVELS], height[MIPLEVELS];
\r
303 unsigned offsets[MIPLEVELS]; // four mip maps stored
\r
304 char animname[32]; // next frame in animation chain
\r
305 palette_t palette[PAL_SIZE];
\r
313 #define MIP32_VERSION 4
\r
315 typedef struct miptex32_s
\r
319 char altname[128]; // texture substitution
\r
320 char animname[128]; // next frame in animation chain
\r
321 char damagename[128]; // image that should be shown when damaged
\r
322 unsigned width[MIPLEVELS], height[MIPLEVELS];
\r
323 unsigned offsets[MIPLEVELS];
\r
327 float scale_x, scale_y;
\r
330 // detail texturing info
\r
331 char dt_name[128]; // detailed texture name
\r
332 float dt_scale_x, dt_scale_y;
\r
335 int dt_src_blend_mode, dt_dst_blend_mode;
\r
337 int unused[20]; // future expansion to maintain compatibility with h2
\r
342 ==============================================================================
\r
346 ==============================================================================
\r
349 #define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
\r
350 // little-endian "IBSP"
\r
352 #define BSPVERSION 38
\r
355 // upper design bounds
\r
356 // leaffaces, leafbrushes, planes, and verts are still bounded by
\r
357 // 16 bit short limits
\r
358 #define MAX_MAP_MODELS 1024
\r
359 //#define MAX_MAP_BRUSHES 8192 // Quake 2 original
\r
360 #define MAX_MAP_BRUSHES 10240
\r
361 #define MAX_MAP_ENTITIES 2048
\r
362 #define MAX_MAP_ENTSTRING 0x40000
\r
363 #define MAX_MAP_TEXINFO 8192
\r
365 #define MAX_MAP_AREAS 256
\r
366 #define MAX_MAP_AREAPORTALS 1024
\r
367 #define MAX_MAP_PLANES 65536
\r
368 #define MAX_MAP_NODES 65536
\r
369 #define MAX_MAP_BRUSHSIDES 65536
\r
370 #define MAX_MAP_LEAFS 65536
\r
371 #define MAX_MAP_VERTS 65536
\r
372 #define MAX_MAP_FACES 65536
\r
373 #define MAX_MAP_LEAFFACES 65536
\r
374 #define MAX_MAP_LEAFBRUSHES 65536
\r
375 #define MAX_MAP_PORTALS 65536
\r
376 #define MAX_MAP_EDGES 128000
\r
377 #define MAX_MAP_SURFEDGES 256000
\r
378 #define MAX_MAP_LIGHTING 0x200000
\r
379 #define MAX_MAP_VISIBILITY 0x180000
\r
381 // key / value pair sizes
\r
384 #define MAX_VALUE 1024
\r
386 //=============================================================================
\r
390 int fileofs, filelen;
\r
393 #define LUMP_ENTITIES 0
\r
394 #define LUMP_PLANES 1
\r
395 #define LUMP_VERTEXES 2
\r
396 #define LUMP_VISIBILITY 3
\r
397 #define LUMP_NODES 4
\r
398 #define LUMP_TEXINFO 5
\r
399 #define LUMP_FACES 6
\r
400 #define LUMP_LIGHTING 7
\r
401 #define LUMP_LEAFS 8
\r
402 #define LUMP_LEAFFACES 9
\r
403 #define LUMP_LEAFBRUSHES 10
\r
404 #define LUMP_EDGES 11
\r
405 #define LUMP_SURFEDGES 12
\r
406 #define LUMP_MODELS 13
\r
407 #define LUMP_BRUSHES 14
\r
408 #define LUMP_BRUSHSIDES 15
\r
409 #define LUMP_POP 16
\r
410 #define LUMP_AREAS 17
\r
411 #define LUMP_AREAPORTALS 18
\r
412 #define HEADER_LUMPS 19
\r
418 lump_t lumps[HEADER_LUMPS];
\r
423 float mins[3], maxs[3];
\r
424 float origin[3]; // for sounds or lights
\r
426 int firstface, numfaces; // submodels just draw faces
\r
427 // without walking the bsp tree
\r
437 // 0-2 are axial planes
\r
442 // 3-5 are non-axial planes snapped to the nearest
\r
443 #define PLANE_ANYX 3
\r
444 #define PLANE_ANYY 4
\r
445 #define PLANE_ANYZ 5
\r
447 // planes (x&~1) and (x&~1)+1 are allways opposites
\r
453 int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
\r
457 // contents flags are seperate bits
\r
458 // a given brush can contribute multiple content bits
\r
459 // multiple brushes can be in a single leaf
\r
461 // These definitions also need to be in q_shared.h!
\r
463 // ************************************************************************************************
\r
467 // ************************************************************************************************
\r
469 // Lower bits are stronger, and will eat weaker brushes completely.
\r
471 #define CONTENTS_SOLID 0x00000001 // An eye is never valid in a solid.
\r
472 #define CONTENTS_WINDOW 0x00000002 // Translucent, but not watery.
\r
473 #define CONTENTS_AUX 0x00000004
\r
474 #define CONTENTS_LAVA 0x00000008
\r
475 #define CONTENTS_SLIME 0x00000010
\r
476 #define CONTENTS_WATER 0x00000020
\r
477 #define CONTENTS_MIST 0x00000040
\r
478 #define LAST_VISIBLE_CONTENTS CONTENTS_MIST
\r
480 // Remaining contents are non-visible, and don't eat brushes.
\r
482 #define CONTENTS_AREAPORTAL 0x00008000
\r
483 #define CONTENTS_PLAYERCLIP 0x00010000
\r
484 #define CONTENTS_MONSTERCLIP 0x00020000
\r
486 // Currents can be added to any other contents, and may be mixed.
\r
488 #define CONTENTS_CURRENT_0 0x00040000
\r
489 #define CONTENTS_CURRENT_90 0x00080000
\r
490 #define CONTENTS_CURRENT_180 0x00100000
\r
491 #define CONTENTS_CURRENT_270 0x00200000
\r
492 #define CONTENTS_CURRENT_UP 0x00400000
\r
493 #define CONTENTS_CURRENT_DOWN 0x00800000
\r
494 #define CONTENTS_ORIGIN 0x01000000 // Removed before bsping an entity.
\r
495 #define CONTENTS_MONSTER 0x02000000 // Should never be on a brush, only in game.
\r
496 #define CONTENTS_DEADMONSTER 0x04000000
\r
497 #define CONTENTS_DETAIL 0x08000000 // Brushes to be added after vis leaves.
\r
498 #define CONTENTS_TRANSLUCENT 0x10000000 // Auto set if any surface has transparency.
\r
499 #define CONTENTS_LADDER 0x20000000
\r
500 #define CONTENTS_CAMERANOBLOCK 0x40000000 // Camera LOS ignores any brushes with this flag.
\r
505 int children[2]; // negative numbers are -(leafs+1), not nodes
\r
506 short mins[3]; // for frustom culling
\r
508 unsigned short firstface;
\r
509 unsigned short numfaces; // counting both sides
\r
513 typedef struct texinfo_s
\r
515 float vecs[2][4]; // [s/t][xyz offset]
\r
516 int flags; // miptex flags + overrides
\r
517 int value; // light emission, etc
\r
518 char texture[32]; // texture name (textures/*.wal)
\r
519 int nexttexinfo; // for animations, -1 = end of chain
\r
523 // note that edge 0 is never used, because negative edge nums are used for
\r
524 // counterclockwise use of the edge in a face
\r
527 unsigned short v[2]; // vertex numbers
\r
530 #define MAXLIGHTMAPS 4
\r
533 unsigned short planenum;
\r
536 int firstedge; // we must support > 64k edges
\r
541 byte styles[MAXLIGHTMAPS];
\r
542 int lightofs; // start of [numstyles*surfsize] samples
\r
547 int contents; // OR of all brushes (not needed?)
\r
552 short mins[3]; // for frustum culling
\r
555 unsigned short firstleafface;
\r
556 unsigned short numleaffaces;
\r
558 unsigned short firstleafbrush;
\r
559 unsigned short numleafbrushes;
\r
564 unsigned short planenum; // facing out of the leaf
\r
575 #define ANGLE_UP -1
\r
576 #define ANGLE_DOWN -2
\r
579 // the visibility lump consists of a header with a count, then
\r
580 // byte offsets for the PVS and PHS of each cluster, then the raw
\r
581 // compressed bit vectors
\r
587 int bitofs[8][2]; // bitofs[numclusters][2]
\r
590 // each area has a list of portals that lead into other areas
\r
591 // when portals are closed, other areas may not be visible or
\r
592 // hearable even if the vis info says that it should be
\r
601 int numareaportals;
\r
602 int firstareaportal;
\r