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
22 #ifndef __QFILES_H__
\r
23 #define __QFILES_H__
\r
26 // qfiles.h: quake file formats
\r
27 // This file must be identical in the quake and utils directories
\r
30 // surface geometry should not exceed these limits
\r
31 #define SHADER_MAX_VERTEXES 1000
\r
32 #define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES)
\r
35 // the maximum size of game reletive pathnames
\r
36 #define MAX_QPATH 64
\r
39 ========================================================================
\r
43 ========================================================================
\r
46 #define VM_MAGIC 0x12721444
\r
50 int instructionCount;
\r
57 int litLength; // ( dataLength - litLength ) should be byteswapped on load
\r
58 int bssLength; // zero filled memory appended to datalength
\r
63 ========================================================================
\r
65 PCX files are used for 8 bit images
\r
67 ========================================================================
\r
74 char bits_per_pixel;
\r
75 unsigned short xmin,ymin,xmax,ymax;
\r
76 unsigned short hres,vres;
\r
77 unsigned char palette[48];
\r
80 unsigned short bytes_per_line;
\r
81 unsigned short palette_type;
\r
83 unsigned char data; // unbounded
\r
88 ========================================================================
\r
90 TGA files are used for 24/32 bit images
\r
92 ========================================================================
\r
95 typedef struct _TargaHeader {
\r
96 unsigned char id_length, colormap_type, image_type;
\r
97 unsigned short colormap_index, colormap_length;
\r
98 unsigned char colormap_size;
\r
99 unsigned short x_origin, y_origin, width, height;
\r
100 unsigned char pixel_size, attributes;
\r
106 ========================================================================
\r
108 .MD3 triangle model file format
\r
110 ========================================================================
\r
113 #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
\r
114 #define MD3_VERSION 15
\r
117 #define MD3_MAX_LODS 4
\r
118 #define MD3_MAX_TRIANGLES 8192 // per surface
\r
119 #define MD3_MAX_VERTS 4096 // per surface
\r
120 #define MD3_MAX_SHADERS 256 // per surface
\r
121 #define MD3_MAX_FRAMES 1024 // per model
\r
122 #define MD3_MAX_SURFACES 32 // per model
\r
123 #define MD3_MAX_TAGS 16 // per frame
\r
126 #define MD3_XYZ_SCALE (1.0/64)
\r
128 typedef struct md3Frame_s {
\r
130 vec3_t localOrigin;
\r
135 typedef struct md3Tag_s {
\r
136 char name[MAX_QPATH]; // tag name
\r
145 ** header sizeof( md3Surface_t )
\r
146 ** shaders sizeof( md3Shader_t ) * numShaders
\r
147 ** triangles[0] sizeof( md3Triangle_t ) * numTriangles
\r
148 ** st sizeof( md3St_t ) * numVerts
\r
149 ** XyzNormals sizeof( md3XyzNormal_t ) * numVerts * numFrames
\r
154 char name[MAX_QPATH]; // polyset name
\r
157 int numFrames; // all surfaces in a model should have the same
\r
159 int numShaders; // all surfaces in a model should have the same
\r
165 int ofsShaders; // offset from start of md3Surface_t
\r
166 int ofsSt; // texture coords are common for all frames
\r
167 int ofsXyzNormals; // numVerts * numFrames
\r
169 int ofsEnd; // next surface follows
\r
173 char name[MAX_QPATH];
\r
174 int shaderIndex; // for in-game use
\r
194 char name[MAX_QPATH]; // model name
\r
204 int ofsFrames; // offset for first frame
\r
205 int ofsTags; // numFrames * numTags
\r
206 int ofsSurfaces; // first surface, others follow
\r
208 int ofsEnd; // end of file
\r
212 ==============================================================================
\r
216 ==============================================================================
\r
219 #define MD4_IDENT (('4'<<24)+('P'<<16)+('D'<<8)+'I')
\r
220 #define MD4_VERSION 1
\r
221 #define MD4_MAX_BONES 128
\r
224 int boneIndex; // these are indexes into the boneReferences,
\r
225 float boneWeight; // not the global per-frame bone list
\r
231 float texCoords[2];
\r
233 md4Weight_t weights[1]; // variable sized
\r
243 char name[MAX_QPATH]; // polyset name
\r
244 char shader[MAX_QPATH];
\r
245 int shaderIndex; // for in-game use
\r
247 int ofsHeader; // this will be a negative number
\r
255 // Bone references are a set of ints representing all the bones
\r
256 // present in any vertex weights for this surface. This is
\r
257 // needed because a model may have surfaces that need to be
\r
258 // drawn at different sort times, and we don't want to have
\r
259 // to re-interpolate all the bones for each surface.
\r
260 int numBoneReferences;
\r
261 int ofsBoneReferences;
\r
263 int ofsEnd; // next surface follows
\r
267 float matrix[3][4];
\r
271 vec3_t bounds[2]; // bounds of all surfaces of all LOD's for this frame
\r
272 vec3_t localOrigin; // midpoint of bounds, used for sphere cull
\r
273 float radius; // dist from localOrigin to corner
\r
275 md4Bone_t bones[1]; // [numBones]
\r
280 int ofsSurfaces; // first surface, others follow
\r
281 int ofsEnd; // next lod follows
\r
288 char name[MAX_QPATH]; // model name
\r
290 // frames and bones are shared by all levels of detail
\r
293 int ofsFrames; // md4Frame_t[numFrames]
\r
295 // each level of detail has completely separate sets of surfaces
\r
299 int ofsEnd; // end of file
\r
304 ==============================================================================
\r
308 ==============================================================================
\r
312 #define BSP_IDENT (('P'<<24)+('S'<<16)+('B'<<8)+'I')
\r
313 // little-endian "IBSP"
\r
315 //#define BSP_VERSION 46
\r
316 #define Q3_BSP_VERSION 46
\r
317 #define WOLF_BSP_VERSION 47
\r
319 // there shouldn't be any problem with increasing these values at the
\r
320 // expense of more memory allocation in the utilities
\r
321 #define MAX_MAP_MODELS 0x400
\r
322 #define MAX_MAP_BRUSHES 0x8000
\r
323 #define MAX_MAP_ENTITIES 0x800
\r
324 #define MAX_MAP_ENTSTRING 0x40000
\r
325 #define MAX_MAP_SHADERS 0x400
\r
327 #define MAX_MAP_AREAS 0x100 // MAX_MAP_AREA_BYTES in q_shared must match!
\r
328 #define MAX_MAP_FOGS 0x100
\r
329 #define MAX_MAP_PLANES 0x20000
\r
330 #define MAX_MAP_NODES 0x20000
\r
331 #define MAX_MAP_BRUSHSIDES 0x40000 //% 0x20000 /* ydnar */
\r
332 #define MAX_MAP_LEAFS 0x20000
\r
333 #define MAX_MAP_LEAFFACES 0x20000
\r
334 #define MAX_MAP_LEAFBRUSHES 0x40000
\r
335 #define MAX_MAP_PORTALS 0x20000
\r
336 #define MAX_MAP_LIGHTING 0x800000
\r
337 #define MAX_MAP_LIGHTGRID 0x800000
\r
338 #define MAX_MAP_VISIBILITY 0x200000
\r
340 #define MAX_MAP_DRAW_SURFS 0x20000
\r
341 #define MAX_MAP_DRAW_VERTS 0x80000
\r
342 #define MAX_MAP_DRAW_INDEXES 0x80000
\r
345 // key / value pair sizes in the entities lump
\r
347 #define MAX_VALUE 1024
\r
349 // the editor uses these predefined yaw angles to orient entities up or down
\r
350 #define ANGLE_UP -1
\r
351 #define ANGLE_DOWN -2
\r
353 #define LIGHTMAP_WIDTH 128
\r
354 #define LIGHTMAP_HEIGHT 128
\r
356 #define MIN_WORLD_COORD (-65536)
\r
357 #define MAX_WORLD_COORD (65536)
\r
358 #define WORLD_SIZE (MAX_WORLD_COORD - MIN_WORLD_COORD)
\r
360 //=============================================================================
\r
364 int fileofs, filelen;
\r
367 #define LUMP_ENTITIES 0
\r
368 #define LUMP_SHADERS 1
\r
369 #define LUMP_PLANES 2
\r
370 #define LUMP_NODES 3
\r
371 #define LUMP_LEAFS 4
\r
372 #define LUMP_LEAFSURFACES 5
\r
373 #define LUMP_LEAFBRUSHES 6
\r
374 #define LUMP_MODELS 7
\r
375 #define LUMP_BRUSHES 8
\r
376 #define LUMP_BRUSHSIDES 9
\r
377 #define LUMP_DRAWVERTS 10
\r
378 #define LUMP_DRAWINDEXES 11
\r
379 #define LUMP_FOGS 12
\r
380 #define LUMP_SURFACES 13
\r
381 #define LUMP_LIGHTMAPS 14
\r
382 #define LUMP_LIGHTGRID 15
\r
383 #define LUMP_VISIBILITY 16
\r
384 #define HEADER_LUMPS 17
\r
390 lump_t lumps[HEADER_LUMPS];
\r
394 float mins[3], maxs[3];
\r
395 int firstSurface, numSurfaces;
\r
396 int firstBrush, numBrushes;
\r
400 char shader[MAX_QPATH];
\r
405 // planes x^1 is allways the opposite of plane x
\r
414 int children[2]; // negative numbers are -(leafs+1), not nodes
\r
415 int mins[3]; // for frustom culling
\r
420 int cluster; // -1 = opaque cluster (do I still store these?)
\r
423 int mins[3]; // for frustum culling
\r
426 int firstLeafSurface;
\r
427 int numLeafSurfaces;
\r
429 int firstLeafBrush;
\r
430 int numLeafBrushes;
\r
434 int planeNum; // positive plane side faces out of the leaf
\r
441 int shaderNum; // the shader that determines the contents flags
\r
445 char shader[MAX_QPATH];
\r
447 int visibleSide; // the brush side that ray tests need to clip against (-1 == none)
\r
464 } mapSurfaceType_t;
\r
478 int lightmapX, lightmapY;
\r
479 int lightmapWidth, lightmapHeight;
\r
481 vec3_t lightmapOrigin;
\r
482 vec3_t lightmapVecs[3]; // for patches, [0] and [1] are lodbounds
\r