1 //------------------------------------------------------------------------ 2 // RAWDEF : Doom structures, raw on-disk layout 3 //------------------------------------------------------------------------ 4 // 5 // Eureka DOOM Editor 6 // 7 // Copyright (C) 2007-2016 Andrew Apted 8 // 9 // This program is free software; you can redistribute it and/or 10 // modify it under the terms of the GNU General Public License 11 // as published by the Free Software Foundation; either version 2 12 // of the License, or (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 //------------------------------------------------------------------------ 20 21 #ifndef __EUREKA_W_RAWDEF_H__ 22 #define __EUREKA_W_RAWDEF_H__ 23 24 25 /* ----- The wad structures ---------------------- */ 26 27 #define WAD_TEX_NAME 8 28 #define WAD_FLAT_NAME 8 29 30 // wad header 31 typedef struct raw_wad_header_s 32 { 33 char ident[4]; 34 35 u32_t num_entries; 36 u32_t dir_start; 37 38 } PACKEDATTR raw_wad_header_t; 39 40 41 // directory entry 42 typedef struct raw_wad_entry_s 43 { 44 u32_t pos; 45 u32_t size; 46 47 char name[8]; 48 49 } PACKEDATTR raw_wad_entry_t; 50 51 52 53 // Lump order in a map WAD: each map needs a couple of lumps 54 // to provide a complete scene geometry description. 55 typedef enum 56 { 57 LL_LABEL=0, // A separator name, ExMx or MAPxx 58 LL_THINGS, // Monsters, items.. 59 LL_LINEDEFS, // LineDefs, from editing 60 LL_SIDEDEFS, // SideDefs, from editing 61 LL_VERTEXES, // Vertices, edited and BSP splits generated 62 LL_SEGS, // LineSegs, from LineDefs split by BSP 63 LL_SSECTORS, // SubSectors, list of LineSegs 64 LL_NODES, // BSP nodes 65 LL_SECTORS, // Sectors, from editing 66 LL_REJECT, // LUT, sector-sector visibility 67 LL_BLOCKMAP, // LUT, motion clipping, walls/grid element 68 LL_BEHAVIOR // Hexen scripting stuff 69 } 70 lump_order_e; 71 72 73 /* ----- The level structures ---------------------- */ 74 75 typedef struct raw_vertex_s 76 { 77 s16_t x, y; 78 79 } PACKEDATTR raw_vertex_t; 80 81 typedef struct raw_v2_vertex_s 82 { 83 s32_t x, y; 84 85 } PACKEDATTR raw_v2_vertex_t; 86 87 88 typedef struct raw_linedef_s 89 { 90 u16_t start; // from this vertex... 91 u16_t end; // ... to this vertex 92 u16_t flags; // linedef flags (impassible, etc) 93 u16_t type; // special type (0 for none, 97 for teleporter, etc) 94 s16_t tag; // this linedef activates the sector with same tag 95 u16_t right; // right sidedef 96 u16_t left; // left sidedef (only if this line adjoins 2 sectors) 97 98 } PACKEDATTR raw_linedef_t; 99 100 typedef struct raw_hexen_linedef_s 101 { 102 u16_t start; // from this vertex... 103 u16_t end; // ... to this vertex 104 u16_t flags; // linedef flags (impassible, etc) 105 u8_t type; // special type 106 u8_t args[5]; // special arguments 107 u16_t right; // right sidedef 108 u16_t left; // left sidedef 109 110 } PACKEDATTR raw_hexen_linedef_t; 111 112 113 typedef struct raw_sidedef_s 114 { 115 s16_t x_offset; // X offset for texture 116 s16_t y_offset; // Y offset for texture 117 118 char upper_tex[8]; // texture name for the part above 119 char lower_tex[8]; // texture name for the part below 120 char mid_tex[8]; // texture name for the regular part 121 122 u16_t sector; // adjacent sector 123 124 } PACKEDATTR raw_sidedef_t; 125 126 127 typedef struct raw_sector_s 128 { 129 s16_t floorh; // floor height 130 s16_t ceilh; // ceiling height 131 132 char floor_tex[8]; // floor texture 133 char ceil_tex[8]; // ceiling texture 134 135 u16_t light; // light level (0-255) 136 u16_t type; // special type (0 = normal, 9 = secret, ...) 137 s16_t tag; // sector activated by a linedef with same tag 138 139 } PACKEDATTR raw_sector_t; 140 141 142 typedef struct raw_thing_s 143 { 144 s16_t x, y; // position of thing 145 s16_t angle; // angle thing faces (degrees) 146 u16_t type; // type of thing 147 u16_t options; // when appears, deaf, etc.. 148 149 } PACKEDATTR raw_thing_t; 150 151 152 // -JL- Hexen thing definition 153 typedef struct raw_hexen_thing_s 154 { 155 s16_t tid; // tag id (for scripts/specials) 156 s16_t x, y; // position 157 s16_t height; // start height above floor 158 s16_t angle; // angle thing faces 159 u16_t type; // type of thing 160 u16_t options; // when appears, deaf, dormant, etc.. 161 162 u8_t special; // special type 163 u8_t args[5]; // special arguments 164 165 } PACKEDATTR raw_hexen_thing_t; 166 167 168 /* ----- The BSP tree structures ----------------------- */ 169 170 typedef struct raw_seg_s 171 { 172 u16_t start; // from this vertex... 173 u16_t end; // ... to this vertex 174 u16_t angle; // angle (0 = east, 16384 = north, ...) 175 u16_t linedef; // linedef that this seg goes along 176 u16_t flip; // true if not the same direction as linedef 177 u16_t dist; // distance from starting point 178 179 } PACKEDATTR raw_seg_t; 180 181 182 typedef struct raw_gl_seg_s 183 { 184 u16_t start; // from this vertex... 185 u16_t end; // ... to this vertex 186 u16_t linedef; // linedef that this seg goes along, or -1 187 u16_t side; // 0 if on right of linedef, 1 if on left 188 u16_t partner; // partner seg number, or -1 189 190 } PACKEDATTR raw_gl_seg_t; 191 192 193 typedef struct raw_v5_seg_s 194 { 195 u32_t start; // from this vertex... 196 u32_t end; // ... to this vertex 197 u16_t linedef; // linedef that this seg goes along, or -1 198 u16_t side; // 0 if on right of linedef, 1 if on left 199 u32_t partner; // partner seg number, or -1 200 201 } PACKEDATTR raw_v5_seg_t; 202 203 204 typedef struct raw_zdoom_seg_s 205 { 206 u32_t start; // from this vertex... 207 u32_t end; // ... to this vertex 208 u16_t linedef; // linedef that this seg goes along, or -1 209 u8_t side; // 0 if on right of linedef, 1 if on left 210 211 } PACKEDATTR raw_zdoom_seg_t; 212 213 214 typedef struct raw_bbox_s 215 { 216 s16_t maxy, miny; 217 s16_t minx, maxx; 218 219 } PACKEDATTR raw_bbox_t; 220 221 222 typedef struct raw_node_s 223 { 224 s16_t x, y; // starting point 225 s16_t dx, dy; // offset to ending point 226 raw_bbox_t b1, b2; // bounding rectangles 227 u16_t right, left; // children: Node or SSector (if high bit is set) 228 229 } PACKEDATTR raw_node_t; 230 231 232 typedef struct raw_subsec_s 233 { 234 u16_t num; // number of Segs in this Sub-Sector 235 u16_t first; // first Seg 236 237 } PACKEDATTR raw_subsec_t; 238 239 240 typedef struct raw_v5_subsec_s 241 { 242 u32_t num; // number of Segs in this Sub-Sector 243 u32_t first; // first Seg 244 245 } PACKEDATTR raw_v5_subsec_t; 246 247 248 typedef struct raw_zdoom_subsec_s 249 { 250 u32_t segnum; 251 252 // NOTE : no "first" value, segs must be contiguous and appear 253 // in an order dictated by the subsector list, e.g. all 254 // segs of the second subsector must appear directly after 255 // all segs of the first subsector. 256 257 } PACKEDATTR raw_zdoom_subsec_t; 258 259 260 typedef struct raw_v5_node_s 261 { 262 // this structure used by ZDoom nodes too 263 264 s16_t x, y; // starting point 265 s16_t dx, dy; // offset to ending point 266 raw_bbox_t b1, b2; // bounding rectangles 267 u32_t right, left; // children: Node or SSector (if high bit is set) 268 269 } PACKEDATTR raw_v5_node_t; 270 271 272 typedef struct raw_blockmap_header_s 273 { 274 s16_t x_origin, y_origin; 275 s16_t x_blocks, y_blocks; 276 277 } PACKEDATTR raw_blockmap_header_t; 278 279 280 /* ----- Graphical structures ---------------------- */ 281 282 typedef struct 283 { 284 s16_t x_origin; 285 s16_t y_origin; 286 287 u16_t pname; // index into PNAMES 288 u16_t stepdir; // NOT USED 289 u16_t colormap; // NOT USED 290 291 } PACKEDATTR raw_patchdef_t; 292 293 294 typedef struct 295 { 296 s16_t x_origin; 297 s16_t y_origin; 298 u16_t pname; // index into PNAMES 299 300 } PACKEDATTR raw_strife_patchdef_t; 301 302 303 // Texture definition. 304 // 305 // Each texture is composed of one or more patches, 306 // with patches being lumps stored in the WAD. 307 // 308 typedef struct 309 { 310 char name[8]; 311 312 u32_t masked; // NOT USED 313 u16_t width; 314 u16_t height; 315 u16_t column_dir[2]; // NOT USED 316 u16_t patch_count; 317 318 raw_patchdef_t patches[1]; 319 320 } PACKEDATTR raw_texture_t; 321 322 323 typedef struct 324 { 325 char name[8]; 326 327 u32_t masked; // NOT USED 328 u16_t width; 329 u16_t height; 330 u16_t patch_count; 331 332 raw_strife_patchdef_t patches[1]; 333 334 } PACKEDATTR raw_strife_texture_t; 335 336 337 // Patches. 338 // 339 // A patch holds one or more columns. 340 // Patches are used for sprites and all masked pictures, 341 // and we compose textures from the TEXTURE1/2 lists 342 // of patches. 343 // 344 typedef struct patch_s 345 { 346 // bounding box size 347 s16_t width; 348 s16_t height; 349 350 // pixels to the left of origin 351 s16_t leftoffset; 352 353 // pixels below the origin 354 s16_t topoffset; 355 356 u32_t columnofs[1]; // only [width] used 357 358 } PACKEDATTR patch_t; 359 360 361 // 362 // LineDef attributes. 363 // 364 365 typedef enum 366 { 367 // solid, is an obstacle 368 MLF_Blocking = 0x0001, 369 370 // blocks monsters only 371 MLF_BlockMonsters = 0x0002, 372 373 // backside will not be present at all if not two sided 374 MLF_TwoSided = 0x0004, 375 376 // If a texture is pegged, the texture will have 377 // the end exposed to air held constant at the 378 // top or bottom of the texture (stairs or pulled 379 // down things) and will move with a height change 380 // of one of the neighbor sectors. 381 // 382 // Unpegged textures allways have the first row of 383 // the texture at the top pixel of the line for both 384 // top and bottom textures (use next to windows). 385 386 // upper texture unpegged 387 MLF_UpperUnpegged = 0x0008, 388 389 // lower texture unpegged 390 MLF_LowerUnpegged = 0x0010, 391 392 // in AutoMap: don't map as two sided: IT'S A SECRET! 393 MLF_Secret = 0x0020, 394 395 // sound rendering: don't let sound cross two of these 396 MLF_SoundBlock = 0x0040, 397 398 // don't draw on the automap at all 399 MLF_DontDraw = 0x0080, 400 401 // set as if already seen, thus drawn in automap 402 MLF_Mapped = 0x0100, 403 404 // -AJA- this one is from Boom. Allows multiple lines to 405 // be pushed simultaneously. 406 MLF_Boom_PassThru = 0x0200, 407 } 408 lineflag_e; 409 410 411 typedef enum 412 { 413 MLF_Eternity_3DMidTex = 0x0400, 414 } 415 eternity_lineflag_e; 416 417 418 typedef enum 419 { 420 // -AJA- these three are from XDoom 421 MLF_XDoom_Translucent = 0x0400, 422 MLF_XDoom_ShootBlock = 0x0800, 423 MLF_XDoom_SightBlock = 0x1000, 424 } 425 xdoom_lineflag_e; 426 427 428 typedef enum 429 { 430 // flags 0x001 .. 0x200 are same as DOOM above 431 432 MLF_Repeatable = 0x0200, 433 MLF_Activation = 0x1c00, 434 } 435 hexen_lineflag_e; 436 437 438 typedef enum 439 { 440 MLF_Strife_JumpOver = 0x0200, 441 MLF_Strife_BlockFloaters = 0x0400, 442 MLF_Strife_Translucent1 = 0x0800, 443 MLF_Strife_Translucent2 = 0x1000, 444 } 445 strife_lineflag_e; 446 447 448 typedef enum 449 { 450 // these are supported by ZDoom (and derived ports) 451 MLF_ZDoom_MonCanActivate = 0x2000, 452 MLF_ZDoom_BlockPlayers = 0x4000, 453 MLF_ZDoom_BlockEverything = 0x8000, 454 } 455 zdoom_lineflag_e; 456 457 458 #define BOOM_GENLINE_FIRST 0x2f80 459 #define BOOM_GENLINE_LAST 0x7fff 460 461 #define is_genline(tp) ((tp) >= BOOM_GENLINE_FIRST && (tp) <= BOOM_GENLINE_LAST) 462 463 464 typedef enum 465 { 466 SPAC_Cross = 0, // when line is crossed (W1 / WR) 467 SPAC_Use = 1, // when line is used (S1 / SR) 468 SPAC_Monster = 2, // when monster walks over line 469 SPAC_Impact = 3, // when bullet/projectile hits line (G1 / GR) 470 SPAC_Push = 4, // when line is bumped (player is stopped) 471 SPAC_PCross = 5, // when projectile crosses the line 472 } 473 hexen_activation_e; 474 475 476 // 477 // Sector attributes. 478 // 479 480 typedef enum 481 { 482 BoomSF_TypeMask = 0x001F, 483 BoomSF_DamageMask = 0x0060, 484 485 BoomSF_Secret = 0x0080, 486 BoomSF_Friction = 0x0100, 487 BoomSF_Wind = 0x0200, 488 BoomSF_NoSounds = 0x0400, 489 BoomSF_QuietPlane = 0x0800 490 } 491 boom_sectorflag_e; 492 493 #define MSF_BoomFlags 0x0FE0 494 495 496 // 497 // Thing attributes. 498 // 499 500 typedef enum 501 { 502 // these four used in Hexen too 503 MTF_Easy = 1, 504 MTF_Medium = 2, 505 MTF_Hard = 4, 506 MTF_Ambush = 8, 507 508 MTF_Not_SP = 16, 509 MTF_Not_DM = 32, 510 MTF_Not_COOP = 64, 511 512 MTF_Friend = 128, 513 MTF_Reserved = 256, 514 } 515 thing_option_e; 516 517 #define MTF_EXFLOOR_MASK 0x3C00 518 #define MTF_EXFLOOR_SHIFT 10 519 520 typedef enum 521 { 522 MTF_Hexen_Dormant = 16, 523 524 MTF_Hexen_Fighter = 32, 525 MTF_Hexen_Cleric = 64, 526 MTF_Hexen_Mage = 128, 527 528 MTF_Hexen_SP = 256, 529 MTF_Hexen_COOP = 512, 530 MTF_Hexen_DM = 1024, 531 } 532 hexen_option_e; 533 534 535 typedef enum 536 { 537 MTF_Strife_Stand = 8, 538 MTF_Strife_Ambush = 32, 539 MTF_Strife_Friend = 64, 540 541 MTF_Strife_Shadow = 256, 542 MTF_Strife_AltVis = 512, 543 } 544 strife_option_e; 545 546 547 // 548 // Polyobject stuff 549 // 550 #define HEXTYPE_POLY_START 1 551 #define HEXTYPE_POLY_EXPLICIT 5 552 553 // -JL- Hexen polyobj thing types 554 #define PO_ANCHOR_TYPE 3000 555 #define PO_SPAWN_TYPE 3001 556 #define PO_SPAWNCRUSH_TYPE 3002 557 558 // -JL- ZDoom polyobj thing types 559 #define ZDOOM_PO_ANCHOR_TYPE 9300 560 #define ZDOOM_PO_SPAWN_TYPE 9301 561 #define ZDOOM_PO_SPAWNCRUSH_TYPE 9302 562 563 #endif /* __EUREKA_W_RAWDEF_H__ */ 564 565 //--- editor settings --- 566 // vi:ts=4:sw=4:noexpandtab 567