00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __QFILES_H__
00023 #define __QFILES_H__
00024
00025
00026
00027
00028
00029
00030
00031 #define SHADER_MAX_VERTEXES 1000
00032 #define SHADER_MAX_INDEXES (6*SHADER_MAX_VERTEXES)
00033
00034
00035
00036 #define MAX_QPATH 64
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #define VM_MAGIC 0x12721444
00047 typedef struct {
00048 int vmMagic;
00049
00050 int instructionCount;
00051
00052 int codeOffset;
00053 int codeLength;
00054
00055 int dataOffset;
00056 int dataLength;
00057 int litLength;
00058 int bssLength;
00059 } vmHeader_t;
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 typedef struct {
00071 char manufacturer;
00072 char version;
00073 char encoding;
00074 char bits_per_pixel;
00075 unsigned short xmin,ymin,xmax,ymax;
00076 unsigned short hres,vres;
00077 unsigned char palette[48];
00078 char reserved;
00079 char color_planes;
00080 unsigned short bytes_per_line;
00081 unsigned short palette_type;
00082 char filler[58];
00083 unsigned char data;
00084 } pcx_t;
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095 typedef struct _TargaHeader {
00096 unsigned char id_length, colormap_type, image_type;
00097 unsigned short colormap_index, colormap_length;
00098 unsigned char colormap_size;
00099 unsigned short x_origin, y_origin, width, height;
00100 unsigned char pixel_size, attributes;
00101 } TargaHeader;
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113 #define MD3_IDENT (('3'<<24)+('P'<<16)+('D'<<8)+'I')
00114 #define MD3_VERSION 15
00115
00116
00117 #define MD3_MAX_LODS 3
00118 #define MD3_MAX_TRIANGLES 8192 // per surface
00119 #define MD3_MAX_VERTS 4096 // per surface
00120 #define MD3_MAX_SHADERS 256 // per surface
00121 #define MD3_MAX_FRAMES 1024 // per model
00122 #define MD3_MAX_SURFACES 32 // per model
00123 #define MD3_MAX_TAGS 16 // per frame
00124
00125
00126 #define MD3_XYZ_SCALE (1.0/64)
00127
00128 typedef struct md3Frame_s {
00129 vec3_t bounds[2];
00130 vec3_t localOrigin;
00131 float radius;
00132 char name[16];
00133 } md3Frame_t;
00134
00135 typedef struct md3Tag_s {
00136 char name[MAX_QPATH];
00137 vec3_t origin;
00138 vec3_t axis[3];
00139 } md3Tag_t;
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151 typedef struct {
00152 int ident;
00153
00154 char name[MAX_QPATH];
00155
00156 int flags;
00157 int numFrames;
00158
00159 int numShaders;
00160 int numVerts;
00161
00162 int numTriangles;
00163 int ofsTriangles;
00164
00165 int ofsShaders;
00166 int ofsSt;
00167 int ofsXyzNormals;
00168
00169 int ofsEnd;
00170 } md3Surface_t;
00171
00172 typedef struct {
00173 char name[MAX_QPATH];
00174 int shaderIndex;
00175 } md3Shader_t;
00176
00177 typedef struct {
00178 int indexes[3];
00179 } md3Triangle_t;
00180
00181 typedef struct {
00182 float st[2];
00183 } md3St_t;
00184
00185 typedef struct {
00186 short xyz[3];
00187 short normal;
00188 } md3XyzNormal_t;
00189
00190 typedef struct {
00191 int ident;
00192 int version;
00193
00194 char name[MAX_QPATH];
00195
00196 int flags;
00197
00198 int numFrames;
00199 int numTags;
00200 int numSurfaces;
00201
00202 int numSkins;
00203
00204 int ofsFrames;
00205 int ofsTags;
00206 int ofsSurfaces;
00207
00208 int ofsEnd;
00209 } md3Header_t;
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219 #define MD4_IDENT (('4'<<24)+('P'<<16)+('D'<<8)+'I')
00220 #define MD4_VERSION 1
00221 #define MD4_MAX_BONES 128
00222
00223 typedef struct {
00224 int boneIndex;
00225 float boneWeight;
00226 vec3_t offset;
00227 } md4Weight_t;
00228
00229 typedef struct {
00230 vec3_t normal;
00231 vec2_t texCoords;
00232 int numWeights;
00233 md4Weight_t weights[1];
00234 } md4Vertex_t;
00235
00236 typedef struct {
00237 int indexes[3];
00238 } md4Triangle_t;
00239
00240 typedef struct {
00241 int ident;
00242
00243 char name[MAX_QPATH];
00244 char shader[MAX_QPATH];
00245 int shaderIndex;
00246
00247 int ofsHeader;
00248
00249 int numVerts;
00250 int ofsVerts;
00251
00252 int numTriangles;
00253 int ofsTriangles;
00254
00255
00256
00257
00258
00259
00260 int numBoneReferences;
00261 int ofsBoneReferences;
00262
00263 int ofsEnd;
00264 } md4Surface_t;
00265
00266 typedef struct {
00267 float matrix[3][4];
00268 } md4Bone_t;
00269
00270 typedef struct {
00271 vec3_t bounds[2];
00272 vec3_t localOrigin;
00273 float radius;
00274 md4Bone_t bones[1];
00275 } md4Frame_t;
00276
00277 typedef struct {
00278 int numSurfaces;
00279 int ofsSurfaces;
00280 int ofsEnd;
00281 } md4LOD_t;
00282
00283 typedef struct {
00284 int ident;
00285 int version;
00286
00287 char name[MAX_QPATH];
00288
00289
00290 int numFrames;
00291 int numBones;
00292 int ofsBoneNames;
00293 int ofsFrames;
00294
00295
00296 int numLODs;
00297 int ofsLODs;
00298
00299 int ofsEnd;
00300 } md4Header_t;
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 #define BSP_IDENT (('P'<<24)+('S'<<16)+('B'<<8)+'I')
00313
00314
00315 #define BSP_VERSION 46
00316
00317
00318
00319
00320 #define MAX_MAP_MODELS 0x400
00321 #define MAX_MAP_BRUSHES 0x8000
00322 #define MAX_MAP_ENTITIES 0x800
00323 #define MAX_MAP_ENTSTRING 0x40000
00324 #define MAX_MAP_SHADERS 0x400
00325
00326 #define MAX_MAP_AREAS 0x100 // MAX_MAP_AREA_BYTES in q_shared must match!
00327 #define MAX_MAP_FOGS 0x100
00328 #define MAX_MAP_PLANES 0x20000
00329 #define MAX_MAP_NODES 0x20000
00330 #define MAX_MAP_BRUSHSIDES 0x20000
00331 #define MAX_MAP_LEAFS 0x20000
00332 #define MAX_MAP_LEAFFACES 0x20000
00333 #define MAX_MAP_LEAFBRUSHES 0x40000
00334 #define MAX_MAP_PORTALS 0x20000
00335 #define MAX_MAP_LIGHTING 0x800000
00336 #define MAX_MAP_LIGHTGRID 0x800000
00337 #define MAX_MAP_VISIBILITY 0x200000
00338
00339 #define MAX_MAP_DRAW_SURFS 0x20000
00340 #define MAX_MAP_DRAW_VERTS 0x80000
00341 #define MAX_MAP_DRAW_INDEXES 0x80000
00342
00343
00344
00345 #define MAX_KEY 32
00346 #define MAX_VALUE 1024
00347
00348
00349 #define ANGLE_UP -1
00350 #define ANGLE_DOWN -2
00351
00352 #define LIGHTMAP_WIDTH 128
00353 #define LIGHTMAP_HEIGHT 128
00354
00355 #define MAX_WORLD_COORD ( 128*1024 )
00356 #define MIN_WORLD_COORD ( -128*1024 )
00357 #define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD )
00358
00359
00360
00361
00362 typedef struct {
00363 int fileofs, filelen;
00364 } lump_t;
00365
00366 #define LUMP_ENTITIES 0
00367 #define LUMP_SHADERS 1
00368 #define LUMP_PLANES 2
00369 #define LUMP_NODES 3
00370 #define LUMP_LEAFS 4
00371 #define LUMP_LEAFSURFACES 5
00372 #define LUMP_LEAFBRUSHES 6
00373 #define LUMP_MODELS 7
00374 #define LUMP_BRUSHES 8
00375 #define LUMP_BRUSHSIDES 9
00376 #define LUMP_DRAWVERTS 10
00377 #define LUMP_DRAWINDEXES 11
00378 #define LUMP_FOGS 12
00379 #define LUMP_SURFACES 13
00380 #define LUMP_LIGHTMAPS 14
00381 #define LUMP_LIGHTGRID 15
00382 #define LUMP_VISIBILITY 16
00383 #define HEADER_LUMPS 17
00384
00385 typedef struct {
00386 int ident;
00387 int version;
00388
00389 lump_t lumps[HEADER_LUMPS];
00390 } dheader_t;
00391
00392 typedef struct {
00393 float mins[3], maxs[3];
00394 int firstSurface, numSurfaces;
00395 int firstBrush, numBrushes;
00396 } dmodel_t;
00397
00398 typedef struct {
00399 char shader[MAX_QPATH];
00400 int surfaceFlags;
00401 int contentFlags;
00402 } dshader_t;
00403
00404
00405
00406 typedef struct {
00407 float normal[3];
00408 float dist;
00409 } dplane_t;
00410
00411 typedef struct {
00412 int planeNum;
00413 int children[2];
00414 int mins[3];
00415 int maxs[3];
00416 } dnode_t;
00417
00418 typedef struct {
00419 int cluster;
00420 int area;
00421
00422 int mins[3];
00423 int maxs[3];
00424
00425 int firstLeafSurface;
00426 int numLeafSurfaces;
00427
00428 int firstLeafBrush;
00429 int numLeafBrushes;
00430 } dleaf_t;
00431
00432 typedef struct {
00433 int planeNum;
00434 int shaderNum;
00435 } dbrushside_t;
00436
00437 typedef struct {
00438 int firstSide;
00439 int numSides;
00440 int shaderNum;
00441 } dbrush_t;
00442
00443 typedef struct {
00444 char shader[MAX_QPATH];
00445 int brushNum;
00446 int visibleSide;
00447 } dfog_t;
00448
00449 typedef struct {
00450 vec3_t xyz;
00451 float st[2];
00452 float lightmap[2];
00453 vec3_t normal;
00454 byte color[4];
00455 } drawVert_t;
00456
00457 typedef enum {
00458 MST_BAD,
00459 MST_PLANAR,
00460 MST_PATCH,
00461 MST_TRIANGLE_SOUP,
00462 MST_FLARE
00463 } mapSurfaceType_t;
00464
00465 typedef struct {
00466 int shaderNum;
00467 int fogNum;
00468 int surfaceType;
00469
00470 int firstVert;
00471 int numVerts;
00472
00473 int firstIndex;
00474 int numIndexes;
00475
00476 int lightmapNum;
00477 int lightmapX, lightmapY;
00478 int lightmapWidth, lightmapHeight;
00479
00480 vec3_t lightmapOrigin;
00481 vec3_t lightmapVecs[3];
00482
00483 int patchWidth;
00484 int patchHeight;
00485 } dsurface_t;
00486
00487
00488 #endif