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
25 #include "q_typedef.h"
\r
28 // qfiles.h: quake file formats
\r
29 // This file must be identical in the quake and utils directories
\r
33 ========================================================================
\r
35 The .pak files are just a linear collapse of a directory tree
\r
37 ========================================================================
\r
40 #define IDPAKHEADER (('K'<<24)+('C'<<16)+('A'<<8)+'P')
\r
45 int filepos, filelen;
\r
50 int ident; // == IDPAKHEADER
\r
55 #define MAX_FILES_IN_PACK 4096
\r
59 ========================================================================
\r
61 PCX files are used for as many images as possible
\r
63 ========================================================================
\r
71 char bits_per_pixel;
\r
72 unsigned short xmin,ymin,xmax,ymax;
\r
73 unsigned short hres,vres;
\r
74 unsigned char palette[48];
\r
77 unsigned short bytes_per_line;
\r
78 unsigned short palette_type;
\r
80 unsigned char data; // unbounded
\r
85 ========================================================================
\r
87 .MD2 compressed triangle model file format
\r
89 ========================================================================
\r
91 #define IDJOINTEDALIASHEADER (('2'<<24)+('J'<<16)+('D'<<8)+'I')
\r
94 ========================================================================
\r
96 .MD2 triangle model file format
\r
98 ========================================================================
\r
101 #define IDALIASHEADER (('2'<<24)+('P'<<16)+('D'<<8)+'I')
\r
102 #define ALIAS_VERSION 8
\r
104 #define MAX_TRIANGLES 2048
\r
105 #define MAX_VERTS 2048
\r
106 #define MAX_FRAMES 512
\r
107 #define MAX_MD2SKINS 64
\r
108 #define MAX_SKINNAME 64
\r
118 short index_xyz[3];
\r
124 byte v[3]; // scaled byte to fit in frame mins/maxs
\r
125 byte lightnormalindex;
\r
128 #define DTRIVERTX_V0 0
\r
129 #define DTRIVERTX_V1 1
\r
130 #define DTRIVERTX_V2 2
\r
131 #define DTRIVERTX_LNI 3
\r
132 #define DTRIVERTX_SIZE 4
\r
136 float scale[3]; // multiply byte verts by this
\r
137 float translate[3]; // then add this
\r
138 char name[16]; // frame name from grabbing
\r
139 dtrivertx_t verts[1]; // variable sized
\r
143 // the glcmd format:
\r
144 // a positive integer starts a tristrip command, followed by that many
\r
145 // vertex structures.
\r
146 // a negative integer starts a trifan command, followed by -x vertexes
\r
147 // a zero indicates the end of the command list.
\r
148 // a vertex consists of a floating point s, a floating point t,
\r
149 // and an integer vertex index.
\r
159 int framesize; // byte size of each frame
\r
163 int num_st; // greater than num_xyz for seams
\r
165 int num_glcmds; // dwords in strip/fan command list
\r
168 int ofs_skins; // each skin is a MAX_SKINNAME string
\r
169 int ofs_st; // byte offset from start for stverts
\r
170 int ofs_tris; // offset for dtriangles
\r
171 int ofs_frames; // offset for first frame
\r
173 int ofs_end; // end of file
\r
178 ========================================================================
\r
182 ========================================================================
\r
185 #define IDBOOKHEADER (('K'<<24)+('O'<<16)+('O'<<8)+'B')
\r
186 #define BOOK_VERSION 2
\r
188 typedef struct bookframe_s
\r
194 char name[MAX_SKINNAME]; // name of gfx file
\r
197 typedef struct bookheader_s
\r
199 unsigned int ident;
\r
200 unsigned int version;
\r
206 typedef struct book_s
\r
208 bookheader_t bheader;
\r
209 bookframe_t bframes[MAX_MD2SKINS];
\r
213 ========================================================================
\r
215 .SP2 sprite file format
\r
217 ========================================================================
\r
220 #define IDSPRITEHEADER (('2'<<24)+('S'<<16)+('D'<<8)+'I')
\r
221 // little-endian "IDS2"
\r
222 #define SPRITE_VERSION 2
\r
227 int origin_x, origin_y; // raster coordinates inside pic
\r
228 char name[MAX_SKINNAME]; // name of pcx file
\r
235 dsprframe_t frames[1]; // variable sized
\r
239 ==============================================================================
\r
241 .M8 texture file format
\r
243 ==============================================================================
\r
246 typedef struct palette_s
\r
257 #define MIP_VERSION 2
\r
258 #define PAL_SIZE 256
\r
259 #define MIPLEVELS 16
\r
261 typedef struct miptex_s
\r
265 unsigned width[MIPLEVELS], height[MIPLEVELS];
\r
266 unsigned offsets[MIPLEVELS]; // four mip maps stored
\r
267 char animname[32]; // next frame in animation chain
\r
268 palette_t palette[PAL_SIZE];
\r
275 #define MIP32_VERSION 4
\r
277 #define MIP32_NOMIP_FLAG2 0x00000001
\r
278 #define MIP32_DETAILER_FLAG2 0x00000002
\r
280 typedef struct miptex32_s
\r
284 char altname[128]; // texture substitution
\r
285 char animname[128]; // next frame in animation chain
\r
286 char damagename[128]; // image that should be shown when damaged
\r
287 unsigned width[MIPLEVELS], height[MIPLEVELS];
\r
288 unsigned offsets[MIPLEVELS];
\r
292 float scale_x, scale_y;
\r
295 // detail texturing info
\r
296 char dt_name[128]; // detailed texture name
\r
297 float dt_scale_x, dt_scale_y;
\r
300 int dt_src_blend_mode, dt_dst_blend_mode;
\r
303 int unused[19]; // future expansion to maintain compatibility with h2
\r
309 ==============================================================================
\r
313 ==============================================================================
\r
316 #define IDBSPHEADER (('P'<<24)+('S'<<16)+('B'<<8)+'I')
\r
317 // little-endian "IBSP"
\r
319 #define BSPVERSION 38
\r
322 // upper design bounds
\r
323 // leaffaces, leafbrushes, planes, and verts are still bounded by
\r
324 // 16 bit short limits
\r
325 #define MAX_MAP_MODELS 1024
\r
326 #define MAX_MAP_BRUSHES 8192
\r
327 #define MAX_MAP_ENTITIES 2048
\r
328 #define MAX_MAP_ENTSTRING 0x40000
\r
329 #define MAX_MAP_TEXINFO 8192
\r
331 #define MAX_MAP_AREAS 256
\r
332 #define MAX_MAP_AREAPORTALS 1024
\r
333 #define MAX_MAP_PLANES 65536
\r
334 #define MAX_MAP_NODES 65536
\r
335 #define MAX_MAP_BRUSHSIDES 65536
\r
336 #define MAX_MAP_LEAFS 65536
\r
337 #define MAX_MAP_VERTS 65536
\r
338 #define MAX_MAP_FACES 65536
\r
339 #define MAX_MAP_LEAFFACES 65536
\r
340 #define MAX_MAP_LEAFBRUSHES 65536
\r
341 #define MAX_MAP_PORTALS 65536
\r
342 #define MAX_MAP_EDGES 128000
\r
343 #define MAX_MAP_SURFEDGES 256000
\r
344 #define MAX_MAP_LIGHTING 0x200000
\r
345 #define MAX_MAP_VISIBILITY 0x180000
\r
347 // key / value pair sizes
\r
350 #define MAX_VALUE 1024
\r
352 //=============================================================================
\r
356 int fileofs, filelen;
\r
359 #define LUMP_ENTITIES 0
\r
360 #define LUMP_PLANES 1
\r
361 #define LUMP_VERTEXES 2
\r
362 #define LUMP_VISIBILITY 3
\r
363 #define LUMP_NODES 4
\r
364 #define LUMP_TEXINFO 5
\r
365 #define LUMP_FACES 6
\r
366 #define LUMP_LIGHTING 7
\r
367 #define LUMP_LEAFS 8
\r
368 #define LUMP_LEAFFACES 9
\r
369 #define LUMP_LEAFBRUSHES 10
\r
370 #define LUMP_EDGES 11
\r
371 #define LUMP_SURFEDGES 12
\r
372 #define LUMP_MODELS 13
\r
373 #define LUMP_BRUSHES 14
\r
374 #define LUMP_BRUSHSIDES 15
\r
375 #define LUMP_POP 16
\r
376 #define LUMP_AREAS 17
\r
377 #define LUMP_AREAPORTALS 18
\r
378 #define HEADER_LUMPS 19
\r
384 lump_t lumps[HEADER_LUMPS];
\r
389 float mins[3], maxs[3];
\r
390 float origin[3]; // for sounds or lights
\r
392 int firstface, numfaces; // submodels just draw faces
\r
393 // without walking the bsp tree
\r
403 // 0-2 are axial planes
\r
408 // 3-5 are non-axial planes snapped to the nearest
\r
409 #define PLANE_ANYX 3
\r
410 #define PLANE_ANYY 4
\r
411 #define PLANE_ANYZ 5
\r
413 // planes (x&~1) and (x&~1)+1 are allways opposites
\r
419 int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
\r
423 // contents flags are seperate bits
\r
424 // a given brush can contribute multiple content bits
\r
425 // multiple brushes can be in a single leaf
\r
427 // these definitions also need to be in q_shared.h!
\r
429 // lower bits are stronger, and will eat weaker brushes completely
\r
430 #define CONTENTS_SOLID 0x00000001 // an eye is never valid in a solid
\r
431 #define CONTENTS_WINDOW 0x00000002 // translucent, but not watery
\r
432 #define CONTENTS_PUSHPULL 0x00000004
\r
433 #define CONTENTS_LAVA 0x00000008
\r
434 #define CONTENTS_SLIME 0x00000010
\r
435 #define CONTENTS_WATER 0x00000020
\r
436 #define CONTENTS_MIST 0x00000040 // 64
\r
437 #define LAST_VISIBLE_CONTENTS 64 // this one worries me a bit JKH
\r
439 // remaining contents are non-visible, and don't eat brushes
\r
441 #define CONTENTS_AREAPORTAL 0x00008000
\r
443 #define CONTENTS_PLAYERCLIP 0x00010000
\r
444 #define CONTENTS_MONSTERCLIP 0x00020000
\r
446 // currents can be added to any other contents, and may be mixed
\r
447 #define CONTENTS_CURRENT_0 0x00040000
\r
448 #define CONTENTS_CURRENT_90 0x00080000
\r
449 #define CONTENTS_CURRENT_180 0x00100000
\r
450 #define CONTENTS_CURRENT_270 0x00200000
\r
451 #define CONTENTS_CURRENT_UP 0x00400000
\r
452 #define CONTENTS_CURRENT_DOWN 0x00800000
\r
454 #define CONTENTS_ORIGIN 0x01000000 // removed before bsping an entity
\r
456 #define CONTENTS_MONSTER 0x02000000 // should never be on a brush, only in game
\r
457 #define CONTENTS_DEADMONSTER 0x04000000
\r
458 #define CONTENTS_DETAIL 0x08000000 // brushes to be added after vis leafs
\r
459 #define CONTENTS_TRANSLUCENT 0x10000000 // auto set if any surface has trans
\r
460 #define CONTENTS_LADDER 0x20000000
\r
464 #define SURF_LIGHT 0x00000001 // value will hold the light strength
\r
466 #define SURF_SLICK 0x00000002 // effects game physics
\r
468 #define SURF_SKY 0x00000004 // don't draw, but add to skybox
\r
469 #define SURF_WARP 0x00000008 // turbulent water warp
\r
470 #define SURF_TRANS33 0x00000010
\r
471 #define SURF_TRANS66 0x00000020
\r
472 #define SURF_FLOWING 0x00000040 // scroll towards angle
\r
473 #define SURF_NODRAW 0x00000080 // don't bother referencing the texture
\r
475 #define SURF_HINT 0x00000100 // make a primary bsp splitter
\r
476 #define SURF_SKIP 0x00000200 // completely ignore, allowing non-closed brushes
\r
477 #define SURF_TALL_WALL 0x00000400 // face doesn't get broken up as normal
\r
479 #define SURF_ALPHA_TEXTURE 0x00000800 // texture has alpha in it, and should show through in bsp process
\r
480 #define SURF_ANIMSPEED 0x00001000 // value will hold the anim speed in fps
\r
482 #define SURF_UNDULATE 0x00002000 // rock surface up and down...
\r
483 #define SURF_SKYREFLECT 0x00004000 // liquid will somewhat reflect the sky - not quite finished....
\r
485 #define SURF_TYPE_GRAVEL 0x00000000
\r
486 #define SURF_TYPE_METAL 0x01000000
\r
487 #define SURF_TYPE_STONE 0x02000000
\r
488 #define SURF_TYPE_WOOD 0x03000000
\r
489 #define SURF_MATERIAL 0xFF000000
\r
496 int children[2]; // negative numbers are -(leafs+1), not nodes
\r
497 short mins[3]; // for frustom culling
\r
499 unsigned short firstface;
\r
500 unsigned short numfaces; // counting both sides
\r
504 typedef struct texinfo_s
\r
506 float vecs[2][4]; // [s/t][xyz offset]
\r
507 int flags; // miptex flags + overrides
\r
508 int value; // light emission, etc
\r
509 char texture[32]; // texture name (textures/*.wal)
\r
510 int nexttexinfo; // for animations, -1 = end of chain
\r
514 // note that edge 0 is never used, because negative edge nums are used for
\r
515 // counterclockwise use of the edge in a face
\r
518 unsigned short v[2]; // vertex numbers
\r
521 #define MAXLIGHTMAPS 4
\r
524 unsigned short planenum;
\r
527 int firstedge; // we must support > 64k edges
\r
533 byte styles[MAXLIGHTMAPS];
\r
534 paletteRGBA_t lighting;
\r
536 int lightofs; // start of [numstyles*surfsize] samples
\r
541 int contents; // OR of all brushes (not needed?)
\r
546 short mins[3]; // for frustum culling
\r
549 unsigned short firstleafface;
\r
550 unsigned short numleaffaces;
\r
552 unsigned short firstleafbrush;
\r
553 unsigned short numleafbrushes;
\r
558 unsigned short planenum; // facing out of the leaf
\r
569 #define ANGLE_UP -1
\r
570 #define ANGLE_DOWN -2
\r
573 // the visibility lump consists of a header with a count, then
\r
574 // byte offsets for the PVS and PHS of each cluster, then the raw
\r
575 // compressed bit vectors
\r
581 int bitofs[8][2]; // bitofs[numclusters][2]
\r
584 // each area has a list of portals that lead into other areas
\r
585 // when portals are closed, other areas may not be visible or
\r
586 // hearable even if the vis info says that it should be
\r
596 int numareaportals;
\r
597 int firstareaportal;
\r
614 materialtype_t *materialtypes;
\r
616 void QFile_ReadMaterialTypes(char* filename);
\r