| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
#define IDPAKHEADER ( ( 'K' << 24 ) + ( 'C' << 16 ) + ( 'A' << 8 ) + 'P' ) |
| 37 |
|
| 38 |
typedef struct |
| 39 |
{ |
| 40 |
char name[56]; |
| 41 |
int filepos, filelen; |
| 42 |
} dpackfile_t; |
| 43 |
|
| 44 |
typedef struct |
| 45 |
{ |
| 46 |
int ident; |
| 47 |
int dirofs; |
| 48 |
int dirlen; |
| 49 |
} dpackheader_t; |
| 50 |
|
| 51 |
#define MAX_FILES_IN_PACK 6144 |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
typedef struct |
| 63 |
{ |
| 64 |
char manufacturer; |
| 65 |
char version; |
| 66 |
char encoding; |
| 67 |
char bits_per_pixel; |
| 68 |
unsigned short xmin,ymin,xmax,ymax; |
| 69 |
unsigned short hres,vres; |
| 70 |
unsigned char palette[48]; |
| 71 |
char reserved; |
| 72 |
char color_planes; |
| 73 |
unsigned short bytes_per_line; |
| 74 |
unsigned short palette_type; |
| 75 |
char filler[58]; |
| 76 |
unsigned char data; |
| 77 |
} pcx_t; |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
#define IDCOMPRESSEDALIASHEADER ( ( '2' << 24 ) + ( 'C' << 16 ) + ( 'D' << 8 ) + 'I' ) |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
#define IDJOINTEDALIASHEADER ( ( '2' << 24 ) + ( 'J' << 16 ) + ( 'D' << 8 ) + 'I' ) |
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
#define IDALIASHEADER ( ( '2' << 24 ) + ( 'P' << 16 ) + ( 'D' << 8 ) + 'I' ) |
| 106 |
#define ALIAS_VERSION 8 |
| 107 |
|
| 108 |
#define MAX_TRIANGLES 4096 |
| 109 |
#define MAX_VERTS 2048 |
| 110 |
#define MAX_FRAMES 512 |
| 111 |
#define MAX_MD2SKINS 64 |
| 112 |
#define MAX_SKINNAME 64 |
| 113 |
|
| 114 |
typedef struct |
| 115 |
{ |
| 116 |
short s; |
| 117 |
short t; |
| 118 |
} dstvert_t; |
| 119 |
|
| 120 |
typedef struct |
| 121 |
{ |
| 122 |
short index_xyz[3]; |
| 123 |
short index_st[3]; |
| 124 |
} dtriangle_t; |
| 125 |
|
| 126 |
typedef struct |
| 127 |
{ |
| 128 |
union |
| 129 |
{ |
| 130 |
struct |
| 131 |
{ |
| 132 |
byte v[3]; |
| 133 |
byte lightnormalindex; |
| 134 |
}; |
| 135 |
|
| 136 |
int vert; |
| 137 |
}; |
| 138 |
} dtrivertx_t; |
| 139 |
|
| 140 |
#define DTRIVERTX_V0 0 |
| 141 |
#define DTRIVERTX_V1 1 |
| 142 |
#define DTRIVERTX_V2 2 |
| 143 |
#define DTRIVERTX_LNI 3 |
| 144 |
#define DTRIVERTX_SIZE 4 |
| 145 |
|
| 146 |
typedef struct |
| 147 |
{ |
| 148 |
float scale[3]; |
| 149 |
float translate[3]; |
| 150 |
char name[16]; |
| 151 |
dtrivertx_t verts[1]; |
| 152 |
} daliasframe_t; |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
typedef struct |
| 165 |
{ |
| 166 |
int ident; |
| 167 |
int version; |
| 168 |
|
| 169 |
int skinwidth; |
| 170 |
int skinheight; |
| 171 |
int framesize; |
| 172 |
|
| 173 |
int num_skins; |
| 174 |
int num_xyz; |
| 175 |
int num_st; |
| 176 |
int num_tris; |
| 177 |
int num_glcmds; |
| 178 |
int num_frames; |
| 179 |
|
| 180 |
int ofs_skins; |
| 181 |
int ofs_st; |
| 182 |
int ofs_tris; |
| 183 |
int ofs_frames; |
| 184 |
int ofs_glcmds; |
| 185 |
int ofs_end; |
| 186 |
|
| 187 |
} dmdl_t; |
| 188 |
|
| 189 |
|
| 190 |
typedef struct dcompmdl_s |
| 191 |
{ |
| 192 |
dmdl_t header; |
| 193 |
short CompressedFrameSize; |
| 194 |
short UniqueVerts; |
| 195 |
short *remap; |
| 196 |
float *translate; |
| 197 |
float *scale; |
| 198 |
char *mat; |
| 199 |
char *frames; |
| 200 |
char *base; |
| 201 |
float *ctranslate; |
| 202 |
float *cscale; |
| 203 |
char data[1]; |
| 204 |
} dcompmdl_t; |
| 205 |
|
| 206 |
typedef struct |
| 207 |
{ |
| 208 |
dcompmdl_t compModInfo; |
| 209 |
int rootCluster; |
| 210 |
int skeletalType; |
| 211 |
struct ModelSkeleton_s *skeletons; |
| 212 |
} JointedModel_t; |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
#define IDBOOKHEADER ( ( 'K' << 24 ) + ( 'O' << 16 ) + ( 'O' << 8 ) + 'B' ) |
| 223 |
#define BOOK_VERSION 2 |
| 224 |
|
| 225 |
typedef struct bookframe_s |
| 226 |
{ |
| 227 |
int x; |
| 228 |
int y; |
| 229 |
int w; |
| 230 |
int h; |
| 231 |
char name[MAX_SKINNAME]; |
| 232 |
} bookframe_t; |
| 233 |
|
| 234 |
typedef struct bookheader_s |
| 235 |
{ |
| 236 |
unsigned int ident; |
| 237 |
unsigned int version; |
| 238 |
int num_segments; |
| 239 |
int total_w; |
| 240 |
int total_h; |
| 241 |
} bookheader_t; |
| 242 |
|
| 243 |
typedef struct book_s |
| 244 |
{ |
| 245 |
bookheader_t bheader; |
| 246 |
bookframe_t bframes[MAX_MD2SKINS]; |
| 247 |
} book_t; |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
#define IDSPRITEHEADER ( ( '2' << 24 ) + ( 'S' << 16 ) + ( 'D' << 8 ) + 'I' ) |
| 258 |
|
| 259 |
#define SPRITE_VERSION 2 |
| 260 |
|
| 261 |
typedef struct |
| 262 |
{ |
| 263 |
int width, height; |
| 264 |
int origin_x, origin_y; |
| 265 |
char name[MAX_SKINNAME]; |
| 266 |
} dsprframe_t; |
| 267 |
|
| 268 |
typedef struct { |
| 269 |
int ident; |
| 270 |
int version; |
| 271 |
int numframes; |
| 272 |
dsprframe_t frames[1]; |
| 273 |
} dsprite_t; |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
typedef struct palette_s |
| 284 |
{ |
| 285 |
union |
| 286 |
{ |
| 287 |
struct |
| 288 |
{ |
| 289 |
byte r,g,b; |
| 290 |
}; |
| 291 |
}; |
| 292 |
} palette_t; |
| 293 |
|
| 294 |
#define MIP_VERSION 2 |
| 295 |
#define PAL_SIZE 256 |
| 296 |
#define MIPLEVELS 16 |
| 297 |
|
| 298 |
typedef struct miptex_s |
| 299 |
{ |
| 300 |
int version; |
| 301 |
char name[32]; |
| 302 |
unsigned width[MIPLEVELS], height[MIPLEVELS]; |
| 303 |
unsigned offsets[MIPLEVELS]; |
| 304 |
char animname[32]; |
| 305 |
palette_t palette[PAL_SIZE]; |
| 306 |
int flags; |
| 307 |
int contents; |
| 308 |
int value; |
| 309 |
} miptex_t; |
| 310 |
|
| 311 |
|
| 312 |
|
| 313 |
#define MIP32_VERSION 4 |
| 314 |
|
| 315 |
typedef struct miptex32_s |
| 316 |
{ |
| 317 |
int version; |
| 318 |
char name[128]; |
| 319 |
char altname[128]; |
| 320 |
char animname[128]; |
| 321 |
char damagename[128]; |
| 322 |
unsigned width[MIPLEVELS], height[MIPLEVELS]; |
| 323 |
unsigned offsets[MIPLEVELS]; |
| 324 |
int flags; |
| 325 |
int contents; |
| 326 |
int value; |
| 327 |
float scale_x, scale_y; |
| 328 |
int mip_scale; |
| 329 |
|
| 330 |
|
| 331 |
char dt_name[128]; |
| 332 |
float dt_scale_x, dt_scale_y; |
| 333 |
float dt_u, dt_v; |
| 334 |
float dt_alpha; |
| 335 |
int dt_src_blend_mode, dt_dst_blend_mode; |
| 336 |
|
| 337 |
int unused[20]; |
| 338 |
} miptex32_t; |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
#define IDBSPHEADER ( ( 'P' << 24 ) + ( 'S' << 16 ) + ( 'B' << 8 ) + 'I' ) |
| 350 |
|
| 351 |
|
| 352 |
#define BSPVERSION 38 |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
#define MAX_MAP_MODELS 1024 |
| 359 |
|
| 360 |
#define MAX_MAP_BRUSHES 10240 |
| 361 |
#define MAX_MAP_ENTITIES 2048 |
| 362 |
#define MAX_MAP_ENTSTRING 0x40000 |
| 363 |
#define MAX_MAP_TEXINFO 8192 |
| 364 |
|
| 365 |
#define MAX_MAP_AREAS 256 |
| 366 |
#define MAX_MAP_AREAPORTALS 1024 |
| 367 |
#define MAX_MAP_PLANES 65536 |
| 368 |
#define MAX_MAP_NODES 65536 |
| 369 |
#define MAX_MAP_BRUSHSIDES 65536 |
| 370 |
#define MAX_MAP_LEAFS 65536 |
| 371 |
#define MAX_MAP_VERTS 65536 |
| 372 |
#define MAX_MAP_FACES 65536 |
| 373 |
#define MAX_MAP_LEAFFACES 65536 |
| 374 |
#define MAX_MAP_LEAFBRUSHES 65536 |
| 375 |
#define MAX_MAP_PORTALS 65536 |
| 376 |
#define MAX_MAP_EDGES 128000 |
| 377 |
#define MAX_MAP_SURFEDGES 256000 |
| 378 |
#define MAX_MAP_LIGHTING 0x200000 |
| 379 |
#define MAX_MAP_VISIBILITY 0x180000 |
| 380 |
|
| 381 |
|
| 382 |
|
| 383 |
#define MAX_KEY 32 |
| 384 |
#define MAX_VALUE 1024 |
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
typedef struct |
| 389 |
{ |
| 390 |
int fileofs, filelen; |
| 391 |
} lump_t; |
| 392 |
|
| 393 |
#define LUMP_ENTITIES 0 |
| 394 |
#define LUMP_PLANES 1 |
| 395 |
#define LUMP_VERTEXES 2 |
| 396 |
#define LUMP_VISIBILITY 3 |
| 397 |
#define LUMP_NODES 4 |
| 398 |
#define LUMP_TEXINFO 5 |
| 399 |
#define LUMP_FACES 6 |
| 400 |
#define LUMP_LIGHTING 7 |
| 401 |
#define LUMP_LEAFS 8 |
| 402 |
#define LUMP_LEAFFACES 9 |
| 403 |
#define LUMP_LEAFBRUSHES 10 |
| 404 |
#define LUMP_EDGES 11 |
| 405 |
#define LUMP_SURFEDGES 12 |
| 406 |
#define LUMP_MODELS 13 |
| 407 |
#define LUMP_BRUSHES 14 |
| 408 |
#define LUMP_BRUSHSIDES 15 |
| 409 |
#define LUMP_POP 16 |
| 410 |
#define LUMP_AREAS 17 |
| 411 |
#define LUMP_AREAPORTALS 18 |
| 412 |
#define HEADER_LUMPS 19 |
| 413 |
|
| 414 |
typedef struct |
| 415 |
{ |
| 416 |
int ident; |
| 417 |
int version; |
| 418 |
lump_t lumps[HEADER_LUMPS]; |
| 419 |
} dheader_t; |
| 420 |
|
| 421 |
typedef struct |
| 422 |
{ |
| 423 |
float mins[3], maxs[3]; |
| 424 |
float origin[3]; |
| 425 |
int headnode; |
| 426 |
int firstface, numfaces; |
| 427 |
|
| 428 |
} dmodel_t; |
| 429 |
|
| 430 |
|
| 431 |
typedef struct |
| 432 |
{ |
| 433 |
float point[3]; |
| 434 |
} dvertex_t; |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
#define PLANE_X 0 |
| 439 |
#define PLANE_Y 1 |
| 440 |
#define PLANE_Z 2 |
| 441 |
|
| 442 |
|
| 443 |
#define PLANE_ANYX 3 |
| 444 |
#define PLANE_ANYY 4 |
| 445 |
#define PLANE_ANYZ 5 |
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
typedef struct |
| 450 |
{ |
| 451 |
float normal[3]; |
| 452 |
float dist; |
| 453 |
int type; |
| 454 |
} dplane_t; |
| 455 |
|
| 456 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
#define CONTENTS_SOLID 0x00000001 // An eye is never valid in a solid. |
| 472 |
#define CONTENTS_WINDOW 0x00000002 // Translucent, but not watery. |
| 473 |
#define CONTENTS_AUX 0x00000004 |
| 474 |
#define CONTENTS_LAVA 0x00000008 |
| 475 |
#define CONTENTS_SLIME 0x00000010 |
| 476 |
#define CONTENTS_WATER 0x00000020 |
| 477 |
#define CONTENTS_MIST 0x00000040 |
| 478 |
#define LAST_VISIBLE_CONTENTS CONTENTS_MIST |
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
#define CONTENTS_AREAPORTAL 0x00008000 |
| 483 |
#define CONTENTS_PLAYERCLIP 0x00010000 |
| 484 |
#define CONTENTS_MONSTERCLIP 0x00020000 |
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
#define CONTENTS_CURRENT_0 0x00040000 |
| 489 |
#define CONTENTS_CURRENT_90 0x00080000 |
| 490 |
#define CONTENTS_CURRENT_180 0x00100000 |
| 491 |
#define CONTENTS_CURRENT_270 0x00200000 |
| 492 |
#define CONTENTS_CURRENT_UP 0x00400000 |
| 493 |
#define CONTENTS_CURRENT_DOWN 0x00800000 |
| 494 |
#define CONTENTS_ORIGIN 0x01000000 // Removed before bsping an entity. |
| 495 |
#define CONTENTS_MONSTER 0x02000000 // Should never be on a brush, only in game. |
| 496 |
#define CONTENTS_DEADMONSTER 0x04000000 |
| 497 |
#define CONTENTS_DETAIL 0x08000000 // Brushes to be added after vis leaves. |
| 498 |
#define CONTENTS_TRANSLUCENT 0x10000000 // Auto set if any surface has transparency. |
| 499 |
#define CONTENTS_LADDER 0x20000000 |
| 500 |
#define CONTENTS_CAMERANOBLOCK 0x40000000 // Camera LOS ignores any brushes with this flag. |
| 501 |
|
| 502 |
typedef struct |
| 503 |
{ |
| 504 |
int planenum; |
| 505 |
int children[2]; |
| 506 |
short mins[3]; |
| 507 |
short maxs[3]; |
| 508 |
unsigned short firstface; |
| 509 |
unsigned short numfaces; |
| 510 |
} dnode_t; |
| 511 |
|
| 512 |
|
| 513 |
typedef struct texinfo_s |
| 514 |
{ |
| 515 |
float vecs[2][4]; |
| 516 |
int flags; |
| 517 |
int value; |
| 518 |
char texture[32]; |
| 519 |
int nexttexinfo; |
| 520 |
} texinfo_t; |
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
|
| 525 |
typedef struct |
| 526 |
{ |
| 527 |
unsigned short v[2]; |
| 528 |
} dedge_t; |
| 529 |
|
| 530 |
#define MAXLIGHTMAPS 4 |
| 531 |
typedef struct |
| 532 |
{ |
| 533 |
unsigned short planenum; |
| 534 |
short side; |
| 535 |
|
| 536 |
int firstedge; |
| 537 |
short numedges; |
| 538 |
short texinfo; |
| 539 |
|
| 540 |
|
| 541 |
byte styles[MAXLIGHTMAPS]; |
| 542 |
int lightofs; |
| 543 |
} dface_t; |
| 544 |
|
| 545 |
typedef struct |
| 546 |
{ |
| 547 |
int contents; |
| 548 |
|
| 549 |
short cluster; |
| 550 |
short area; |
| 551 |
|
| 552 |
short mins[3]; |
| 553 |
short maxs[3]; |
| 554 |
|
| 555 |
unsigned short firstleafface; |
| 556 |
unsigned short numleaffaces; |
| 557 |
|
| 558 |
unsigned short firstleafbrush; |
| 559 |
unsigned short numleafbrushes; |
| 560 |
} dleaf_t; |
| 561 |
|
| 562 |
typedef struct |
| 563 |
{ |
| 564 |
unsigned short planenum; |
| 565 |
short texinfo; |
| 566 |
} dbrushside_t; |
| 567 |
|
| 568 |
typedef struct |
| 569 |
{ |
| 570 |
int firstside; |
| 571 |
int numsides; |
| 572 |
int contents; |
| 573 |
} dbrush_t; |
| 574 |
|
| 575 |
#define ANGLE_UP -1 |
| 576 |
#define ANGLE_DOWN -2 |
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
#define DVIS_PVS 0 |
| 583 |
#define DVIS_PHS 1 |
| 584 |
typedef struct |
| 585 |
{ |
| 586 |
int numclusters; |
| 587 |
int bitofs[8][2]; |
| 588 |
} dvis_t; |
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
typedef struct |
| 594 |
{ |
| 595 |
int portalnum; |
| 596 |
int otherarea; |
| 597 |
} dareaportal_t; |
| 598 |
|
| 599 |
typedef struct |
| 600 |
{ |
| 601 |
int numareaportals; |
| 602 |
int firstareaportal; |
| 603 |
} darea_t; |