| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#ifndef __QFILES_H__ |
| 23 |
#define __QFILES_H__ |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#define SHADER_MAX_VERTEXES 1000 |
| 32 |
#define SHADER_MAX_INDEXES ( 6 * SHADER_MAX_VERTEXES ) |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
#define MAX_QPATH 64 |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
#define VM_MAGIC 0x12721444 |
| 47 |
typedef struct { |
| 48 |
int vmMagic; |
| 49 |
|
| 50 |
int instructionCount; |
| 51 |
|
| 52 |
int codeOffset; |
| 53 |
int codeLength; |
| 54 |
|
| 55 |
int dataOffset; |
| 56 |
int dataLength; |
| 57 |
int litLength; |
| 58 |
int bssLength; |
| 59 |
} vmHeader_t; |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
typedef struct { |
| 71 |
char manufacturer; |
| 72 |
char version; |
| 73 |
char encoding; |
| 74 |
char bits_per_pixel; |
| 75 |
unsigned short xmin,ymin,xmax,ymax; |
| 76 |
unsigned short hres,vres; |
| 77 |
unsigned char palette[48]; |
| 78 |
char reserved; |
| 79 |
char color_planes; |
| 80 |
unsigned short bytes_per_line; |
| 81 |
unsigned short palette_type; |
| 82 |
char filler[58]; |
| 83 |
unsigned char data; |
| 84 |
} pcx_t; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
typedef struct _TargaHeader { |
| 96 |
unsigned char id_length, colormap_type, image_type; |
| 97 |
unsigned short colormap_index, colormap_length; |
| 98 |
unsigned char colormap_size; |
| 99 |
unsigned short x_origin, y_origin, width, height; |
| 100 |
unsigned char pixel_size, attributes; |
| 101 |
} TargaHeader; |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
#define MD3_IDENT ( ( '3' << 24 ) + ( 'P' << 16 ) + ( 'D' << 8 ) + 'I' ) |
| 114 |
#define MD3_VERSION 15 |
| 115 |
|
| 116 |
|
| 117 |
#define MD3_MAX_LODS 4 |
| 118 |
#define MD3_MAX_TRIANGLES 8192 // per surface |
| 119 |
#define MD3_MAX_VERTS 4096 // per surface |
| 120 |
#define MD3_MAX_SHADERS 256 // per surface |
| 121 |
#define MD3_MAX_FRAMES 1024 // per model |
| 122 |
#define MD3_MAX_SURFACES 32 // per model |
| 123 |
#define MD3_MAX_TAGS 16 // per frame |
| 124 |
|
| 125 |
|
| 126 |
#define MD3_XYZ_SCALE ( 1.0 / 64 ) |
| 127 |
|
| 128 |
typedef struct md3Frame_s { |
| 129 |
vec3_t bounds[2]; |
| 130 |
vec3_t localOrigin; |
| 131 |
float radius; |
| 132 |
char name[16]; |
| 133 |
} md3Frame_t; |
| 134 |
|
| 135 |
typedef struct md3Tag_s { |
| 136 |
char name[MAX_QPATH]; |
| 137 |
vec3_t origin; |
| 138 |
vec3_t axis[3]; |
| 139 |
} md3Tag_t; |
| 140 |
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
typedef struct { |
| 152 |
int ident; |
| 153 |
|
| 154 |
char name[MAX_QPATH]; |
| 155 |
|
| 156 |
int flags; |
| 157 |
int numFrames; |
| 158 |
|
| 159 |
int numShaders; |
| 160 |
int numVerts; |
| 161 |
|
| 162 |
int numTriangles; |
| 163 |
int ofsTriangles; |
| 164 |
|
| 165 |
int ofsShaders; |
| 166 |
int ofsSt; |
| 167 |
int ofsXyzNormals; |
| 168 |
|
| 169 |
int ofsEnd; |
| 170 |
} md3Surface_t; |
| 171 |
|
| 172 |
typedef struct { |
| 173 |
char name[MAX_QPATH]; |
| 174 |
int shaderIndex; |
| 175 |
} md3Shader_t; |
| 176 |
|
| 177 |
typedef struct { |
| 178 |
int indexes[3]; |
| 179 |
} md3Triangle_t; |
| 180 |
|
| 181 |
typedef struct { |
| 182 |
float st[2]; |
| 183 |
} md3St_t; |
| 184 |
|
| 185 |
typedef struct { |
| 186 |
short xyz[3]; |
| 187 |
short normal; |
| 188 |
} md3XyzNormal_t; |
| 189 |
|
| 190 |
typedef struct { |
| 191 |
int ident; |
| 192 |
int version; |
| 193 |
|
| 194 |
char name[MAX_QPATH]; |
| 195 |
|
| 196 |
int flags; |
| 197 |
|
| 198 |
int numFrames; |
| 199 |
int numTags; |
| 200 |
int numSurfaces; |
| 201 |
|
| 202 |
int numSkins; |
| 203 |
|
| 204 |
int ofsFrames; |
| 205 |
int ofsTags; |
| 206 |
int ofsSurfaces; |
| 207 |
|
| 208 |
int ofsEnd; |
| 209 |
} md3Header_t; |
| 210 |
|
| 211 |
|
| 212 |
|
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
#define MD4_IDENT ( ( '4' << 24 ) + ( 'P' << 16 ) + ( 'D' << 8 ) + 'I' ) |
| 220 |
#define MD4_VERSION 1 |
| 221 |
#define MD4_MAX_BONES 128 |
| 222 |
|
| 223 |
typedef struct { |
| 224 |
int boneIndex; |
| 225 |
float boneWeight; |
| 226 |
} md4Weight_t; |
| 227 |
|
| 228 |
typedef struct { |
| 229 |
vec3_t vertex; |
| 230 |
vec3_t normal; |
| 231 |
float texCoords[2]; |
| 232 |
int numWeights; |
| 233 |
md4Weight_t weights[1]; |
| 234 |
} md4Vertex_t; |
| 235 |
|
| 236 |
typedef struct { |
| 237 |
int indexes[3]; |
| 238 |
} md4Triangle_t; |
| 239 |
|
| 240 |
typedef struct { |
| 241 |
int ident; |
| 242 |
|
| 243 |
char name[MAX_QPATH]; |
| 244 |
char shader[MAX_QPATH]; |
| 245 |
int shaderIndex; |
| 246 |
|
| 247 |
int ofsHeader; |
| 248 |
|
| 249 |
int numVerts; |
| 250 |
int ofsVerts; |
| 251 |
|
| 252 |
int numTriangles; |
| 253 |
int ofsTriangles; |
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
|
| 260 |
int numBoneReferences; |
| 261 |
int ofsBoneReferences; |
| 262 |
|
| 263 |
int ofsEnd; |
| 264 |
} md4Surface_t; |
| 265 |
|
| 266 |
typedef struct { |
| 267 |
float matrix[3][4]; |
| 268 |
} md4Bone_t; |
| 269 |
|
| 270 |
typedef struct { |
| 271 |
vec3_t bounds[2]; |
| 272 |
vec3_t localOrigin; |
| 273 |
float radius; |
| 274 |
char name[16]; |
| 275 |
md4Bone_t bones[1]; |
| 276 |
} md4Frame_t; |
| 277 |
|
| 278 |
typedef struct { |
| 279 |
int numSurfaces; |
| 280 |
int ofsSurfaces; |
| 281 |
int ofsEnd; |
| 282 |
} md4LOD_t; |
| 283 |
|
| 284 |
typedef struct { |
| 285 |
int ident; |
| 286 |
int version; |
| 287 |
|
| 288 |
char name[MAX_QPATH]; |
| 289 |
|
| 290 |
|
| 291 |
int numFrames; |
| 292 |
int numBones; |
| 293 |
int ofsFrames; |
| 294 |
|
| 295 |
|
| 296 |
int numLODs; |
| 297 |
int ofsLODs; |
| 298 |
|
| 299 |
int ofsEnd; |
| 300 |
} md4Header_t; |
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
#define BSP_IDENT ( ( 'P' << 24 ) + ( 'S' << 16 ) + ( 'B' << 8 ) + 'I' ) |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
#define Q3_BSP_VERSION 46 |
| 317 |
#define WOLF_BSP_VERSION 47 |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
#define MAX_MAP_MODELS 0x400 |
| 322 |
#define MAX_MAP_BRUSHES 0x8000 |
| 323 |
#define MAX_MAP_ENTITIES 0x800 |
| 324 |
#define MAX_MAP_ENTSTRING 0x40000 |
| 325 |
#define MAX_MAP_SHADERS 0x400 |
| 326 |
|
| 327 |
#define MAX_MAP_AREAS 0x100 // MAX_MAP_AREA_BYTES in q_shared must match! |
| 328 |
#define MAX_MAP_FOGS 0x100 |
| 329 |
#define MAX_MAP_PLANES 0x20000 |
| 330 |
#define MAX_MAP_NODES 0x20000 |
| 331 |
#define MAX_MAP_BRUSHSIDES 0x40000 //% 0x20000 |
| 332 |
#define MAX_MAP_LEAFS 0x20000 |
| 333 |
#define MAX_MAP_LEAFFACES 0x20000 |
| 334 |
#define MAX_MAP_LEAFBRUSHES 0x40000 |
| 335 |
#define MAX_MAP_PORTALS 0x20000 |
| 336 |
#define MAX_MAP_LIGHTING 0x800000 |
| 337 |
#define MAX_MAP_LIGHTGRID 0x800000 |
| 338 |
#define MAX_MAP_VISIBILITY 0x200000 |
| 339 |
|
| 340 |
#define MAX_MAP_DRAW_SURFS 0x20000 |
| 341 |
#define MAX_MAP_DRAW_VERTS 0x80000 |
| 342 |
#define MAX_MAP_DRAW_INDEXES 0x80000 |
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
#define MAX_KEY 32 |
| 347 |
#define MAX_VALUE 1024 |
| 348 |
|
| 349 |
|
| 350 |
#define ANGLE_UP -1 |
| 351 |
#define ANGLE_DOWN -2 |
| 352 |
|
| 353 |
#define LIGHTMAP_WIDTH 128 |
| 354 |
#define LIGHTMAP_HEIGHT 128 |
| 355 |
|
| 356 |
#define MIN_WORLD_COORD ( -65536 ) |
| 357 |
#define MAX_WORLD_COORD ( 65536 ) |
| 358 |
#define WORLD_SIZE ( MAX_WORLD_COORD - MIN_WORLD_COORD ) |
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
typedef struct { |
| 364 |
int fileofs, filelen; |
| 365 |
} lump_t; |
| 366 |
|
| 367 |
#define LUMP_ENTITIES 0 |
| 368 |
#define LUMP_SHADERS 1 |
| 369 |
#define LUMP_PLANES 2 |
| 370 |
#define LUMP_NODES 3 |
| 371 |
#define LUMP_LEAFS 4 |
| 372 |
#define LUMP_LEAFSURFACES 5 |
| 373 |
#define LUMP_LEAFBRUSHES 6 |
| 374 |
#define LUMP_MODELS 7 |
| 375 |
#define LUMP_BRUSHES 8 |
| 376 |
#define LUMP_BRUSHSIDES 9 |
| 377 |
#define LUMP_DRAWVERTS 10 |
| 378 |
#define LUMP_DRAWINDEXES 11 |
| 379 |
#define LUMP_FOGS 12 |
| 380 |
#define LUMP_SURFACES 13 |
| 381 |
#define LUMP_LIGHTMAPS 14 |
| 382 |
#define LUMP_LIGHTGRID 15 |
| 383 |
#define LUMP_VISIBILITY 16 |
| 384 |
#define HEADER_LUMPS 17 |
| 385 |
|
| 386 |
typedef struct { |
| 387 |
int ident; |
| 388 |
int version; |
| 389 |
|
| 390 |
lump_t lumps[HEADER_LUMPS]; |
| 391 |
} dheader_t; |
| 392 |
|
| 393 |
typedef struct { |
| 394 |
float mins[3], maxs[3]; |
| 395 |
int firstSurface, numSurfaces; |
| 396 |
int firstBrush, numBrushes; |
| 397 |
} dmodel_t; |
| 398 |
|
| 399 |
typedef struct { |
| 400 |
char shader[MAX_QPATH]; |
| 401 |
int surfaceFlags; |
| 402 |
int contentFlags; |
| 403 |
} dshader_t; |
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
typedef struct { |
| 408 |
float normal[3]; |
| 409 |
float dist; |
| 410 |
} dplane_t; |
| 411 |
|
| 412 |
typedef struct { |
| 413 |
int planeNum; |
| 414 |
int children[2]; |
| 415 |
int mins[3]; |
| 416 |
int maxs[3]; |
| 417 |
} dnode_t; |
| 418 |
|
| 419 |
typedef struct { |
| 420 |
int cluster; |
| 421 |
int area; |
| 422 |
|
| 423 |
int mins[3]; |
| 424 |
int maxs[3]; |
| 425 |
|
| 426 |
int firstLeafSurface; |
| 427 |
int numLeafSurfaces; |
| 428 |
|
| 429 |
int firstLeafBrush; |
| 430 |
int numLeafBrushes; |
| 431 |
} dleaf_t; |
| 432 |
|
| 433 |
typedef struct { |
| 434 |
int planeNum; |
| 435 |
int shaderNum; |
| 436 |
} dbrushside_t; |
| 437 |
|
| 438 |
typedef struct { |
| 439 |
int firstSide; |
| 440 |
int numSides; |
| 441 |
int shaderNum; |
| 442 |
} dbrush_t; |
| 443 |
|
| 444 |
typedef struct { |
| 445 |
char shader[MAX_QPATH]; |
| 446 |
int brushNum; |
| 447 |
int visibleSide; |
| 448 |
} dfog_t; |
| 449 |
|
| 450 |
typedef struct { |
| 451 |
vec3_t xyz; |
| 452 |
float st[2]; |
| 453 |
float lightmap[2]; |
| 454 |
vec3_t normal; |
| 455 |
byte color[4]; |
| 456 |
} drawVert_t; |
| 457 |
|
| 458 |
typedef enum { |
| 459 |
MST_BAD, |
| 460 |
MST_PLANAR, |
| 461 |
MST_PATCH, |
| 462 |
MST_TRIANGLE_SOUP, |
| 463 |
MST_FLARE |
| 464 |
} mapSurfaceType_t; |
| 465 |
|
| 466 |
typedef struct { |
| 467 |
int shaderNum; |
| 468 |
int fogNum; |
| 469 |
int surfaceType; |
| 470 |
|
| 471 |
int firstVert; |
| 472 |
int numVerts; |
| 473 |
|
| 474 |
int firstIndex; |
| 475 |
int numIndexes; |
| 476 |
|
| 477 |
int lightmapNum; |
| 478 |
int lightmapX, lightmapY; |
| 479 |
int lightmapWidth, lightmapHeight; |
| 480 |
|
| 481 |
vec3_t lightmapOrigin; |
| 482 |
vec3_t lightmapVecs[3]; |
| 483 |
|
| 484 |
int patchWidth; |
| 485 |
int patchHeight; |
| 486 |
} dsurface_t; |
| 487 |
|
| 488 |
|
| 489 |
#endif |