| 1 |
/* Emacs style mode select -*- C -*- |
| 2 |
*----------------------------------------------------------------------------- |
| 3 |
* |
| 4 |
* |
| 5 |
* PrBoom: a Doom port merged with LxDoom and LSDLDoom |
| 6 |
* based on BOOM, a modified and improved DOOM engine |
| 7 |
* Copyright (C) 1999 by |
| 8 |
* id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman |
| 9 |
* Copyright (C) 1999-2000 by |
| 10 |
* Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze |
| 11 |
* Copyright 2005, 2006 by |
| 12 |
* Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko |
| 13 |
* |
| 14 |
* This program is free software; you can redistribute it and/or |
| 15 |
* modify it under the terms of the GNU General Public License |
| 16 |
* as published by the Free Software Foundation; either version 2 |
| 17 |
* of the License, or (at your option) any later version. |
| 18 |
* |
| 19 |
* This program is distributed in the hope that it will be useful, |
| 20 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 22 |
* GNU General Public License for more details. |
| 23 |
* |
| 24 |
* You should have received a copy of the GNU General Public License |
| 25 |
* along with this program; if not, write to the Free Software |
| 26 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 27 |
* 02111-1307, USA. |
| 28 |
* |
| 29 |
* DESCRIPTION: |
| 30 |
* all external data is defined here |
| 31 |
* most of the data is loaded into different structures at run time |
| 32 |
* some internal structures shared by many modules are here |
| 33 |
* |
| 34 |
*-----------------------------------------------------------------------------*/ |
| 35 |
|
| 36 |
#ifndef __DOOMDATA__ |
| 37 |
#define __DOOMDATA__ |
| 38 |
|
| 39 |
// The most basic types we use, portability. |
| 40 |
#include "config.h" |
| 41 |
#include "doomtype.h" |
| 42 |
#include "m_fixed.h" |
| 43 |
|
| 44 |
// |
| 45 |
// Map level types. |
| 46 |
// The following data structures define the persistent format |
| 47 |
// used in the lumps of the WAD files. |
| 48 |
// |
| 49 |
|
| 50 |
// Lump order in a map WAD: each map needs a couple of lumps |
| 51 |
// to provide a complete scene geometry description. |
| 52 |
enum { |
| 53 |
ML_LABEL, // A separator, name, ExMx or MAPxx |
| 54 |
ML_THINGS, // Monsters, items.. |
| 55 |
ML_LINEDEFS, // LineDefs, from editing |
| 56 |
ML_SIDEDEFS, // SideDefs, from editing |
| 57 |
ML_VERTEXES, // Vertices, edited and BSP splits generated |
| 58 |
ML_SEGS, // LineSegs, from LineDefs split by BSP |
| 59 |
ML_SSECTORS, // SubSectors, list of LineSegs |
| 60 |
ML_NODES, // BSP nodes |
| 61 |
ML_SECTORS, // Sectors, from editing |
| 62 |
ML_REJECT, // LUT, sector-sector visibility |
| 63 |
ML_BLOCKMAP, // LUT, motion clipping, walls/grid element |
| 64 |
ML_BEHAVIOR |
| 65 |
}; |
| 66 |
|
| 67 |
#define ML_TEXTMAP 1 |
| 68 |
|
| 69 |
#ifdef _MSC_VER // proff: This is the same as __attribute__ ((packed)) in GNUC |
| 70 |
#pragma pack(push) |
| 71 |
#pragma pack(1) |
| 72 |
#endif //_MSC_VER |
| 73 |
|
| 74 |
// A single Vertex. |
| 75 |
typedef struct { |
| 76 |
short x,y; |
| 77 |
} PACKEDATTR mapvertex_t; |
| 78 |
|
| 79 |
// A SideDef, defining the visual appearance of a wall, |
| 80 |
// by setting textures and offsets. |
| 81 |
typedef struct { |
| 82 |
short textureoffset; |
| 83 |
short rowoffset; |
| 84 |
char toptexture[8]; |
| 85 |
char bottomtexture[8]; |
| 86 |
char midtexture[8]; |
| 87 |
short sector; // Front sector, towards viewer. |
| 88 |
} PACKEDATTR mapsidedef_t; |
| 89 |
|
| 90 |
// A LineDef, as used for editing, and as input to the BSP builder. |
| 91 |
|
| 92 |
typedef struct { |
| 93 |
unsigned short v1; |
| 94 |
unsigned short v2; |
| 95 |
unsigned short flags; |
| 96 |
byte special; |
| 97 |
byte arg1; |
| 98 |
byte arg2; |
| 99 |
byte arg3; |
| 100 |
byte arg4; |
| 101 |
byte arg5; |
| 102 |
unsigned short sidenum[2]; |
| 103 |
} PACKEDATTR hexen_maplinedef_t; |
| 104 |
|
| 105 |
typedef struct { |
| 106 |
unsigned short v1; |
| 107 |
unsigned short v2; |
| 108 |
unsigned short flags; |
| 109 |
short special; |
| 110 |
short tag; |
| 111 |
// proff 07/23/2006 - support more than 32768 sidedefs |
| 112 |
// use the unsigned value and special case the -1 |
| 113 |
// sidenum[1] will be -1 (NO_INDEX) if one sided |
| 114 |
unsigned short sidenum[2]; |
| 115 |
} PACKEDATTR doom_maplinedef_t; |
| 116 |
|
| 117 |
#define NO_INDEX ((unsigned short)-1) |
| 118 |
|
| 119 |
// |
| 120 |
// LineDef attributes. |
| 121 |
// |
| 122 |
|
| 123 |
// Solid, is an obstacle. |
| 124 |
#define ML_BLOCKING 0x0001 |
| 125 |
|
| 126 |
// Blocks monsters only. |
| 127 |
#define ML_BLOCKMONSTERS 0x0002 |
| 128 |
|
| 129 |
// Backside will not be drawn if not two sided. |
| 130 |
#define ML_TWOSIDED 0x0004 |
| 131 |
|
| 132 |
// If a texture is pegged, the texture will have |
| 133 |
// the end exposed to air held constant at the |
| 134 |
// top or bottom of the texture (stairs or pulled |
| 135 |
// down things) and will move with a height change |
| 136 |
// of one of the neighbor sectors. |
| 137 |
// Unpegged textures always have the first row of |
| 138 |
// the texture at the top pixel of the line for both |
| 139 |
// top and bottom textures (use next to windows). |
| 140 |
|
| 141 |
// upper texture unpegged |
| 142 |
#define ML_DONTPEGTOP 0x0008 |
| 143 |
|
| 144 |
// lower texture unpegged |
| 145 |
#define ML_DONTPEGBOTTOM 0x0010 |
| 146 |
|
| 147 |
// In AutoMap: don't map as two sided: IT'S A SECRET! |
| 148 |
#define ML_SECRET 0x0020 |
| 149 |
|
| 150 |
// Sound rendering: don't let sound cross two of these. |
| 151 |
#define ML_SOUNDBLOCK 0x0040 |
| 152 |
|
| 153 |
// Don't draw on the automap at all. |
| 154 |
#define ML_DONTDRAW 0x0080 |
| 155 |
|
| 156 |
// Set if already seen, thus drawn in automap. |
| 157 |
#define ML_MAPPED 0x0100 |
| 158 |
|
| 159 |
//jff 3/21/98 Set if line absorbs use by player |
| 160 |
//allow multiple push/switch triggers to be used on one push |
| 161 |
#define ML_PASSUSE 0x0200 |
| 162 |
|
| 163 |
// Reserved by EE |
| 164 |
// SoM 9/02/02: 3D Middletexture flag! |
| 165 |
#define ML_ETERNITY 0x0400 |
| 166 |
|
| 167 |
// haleyjd 05/02/06: Although it was believed until now that a reserved line |
| 168 |
// flag was unnecessary, a problem with Ultimate DOOM E2M7 has disproven this |
| 169 |
// theory. It has roughly 1000 linedefs with 0xFE00 masked into the flags, so |
| 170 |
// making the next line flag reserved and using it to toggle off ALL extended |
| 171 |
// flags will preserve compatibility for such maps. I have been told this map |
| 172 |
// is one of the first ever created, so it may have something to do with that. |
| 173 |
#define ML_RESERVED 0x0800 |
| 174 |
|
| 175 |
// mbf21 |
| 176 |
#define ML_BLOCKLANDMONSTERS 0x1000 |
| 177 |
#define ML_BLOCKPLAYERS 0x2000 |
| 178 |
|
| 179 |
#define ML_VANILLA 0x01ff |
| 180 |
#define ML_BOOM 0x03ff |
| 181 |
#define ML_MBF21 0x3fff |
| 182 |
|
| 183 |
// extensions |
| 184 |
#define ML_MONSTERSCANACTIVATE 0x4000 // zdoom |
| 185 |
#define ML_BLOCKEVERYTHING 0x8000 // zdoom |
| 186 |
|
| 187 |
#define ML_REPEATSPECIAL 0x00010000 // hexen |
| 188 |
|
| 189 |
// udmf |
| 190 |
#define ML_CLIPMIDTEX 0x00020000 |
| 191 |
#define ML_BLOCKSIGHT 0x00040000 |
| 192 |
#define ML_BLOCKHITSCAN 0x00080000 |
| 193 |
#define ML_BLOCKPROJECTILES 0x00100000 |
| 194 |
#define ML_BLOCKUSE 0x00200000 |
| 195 |
#define ML_BLOCKFLOATERS 0x00400000 |
| 196 |
#define ML_JUMPOVER 0x00800000 |
| 197 |
#define ML_3DMIDTEX 0x01000000 |
| 198 |
#define ML_3DMIDTEXIMPASSIBLE 0x02000000 |
| 199 |
#define ML_FIRSTSIDEONLY 0x04000000 |
| 200 |
#define ML_REVEALED 0x08000000 |
| 201 |
#define ML_CHECKSWITCHRANGE 0x10000000 |
| 202 |
#define ML_WRAPMIDTEX 0x20000000 |
| 203 |
|
| 204 |
// Sector definition, from editing. |
| 205 |
typedef struct { |
| 206 |
short floorheight; |
| 207 |
short ceilingheight; |
| 208 |
char floorpic[8]; |
| 209 |
char ceilingpic[8]; |
| 210 |
short lightlevel; |
| 211 |
short special; |
| 212 |
short tag; |
| 213 |
} PACKEDATTR mapsector_t; |
| 214 |
|
| 215 |
// SubSector, as generated by BSP. |
| 216 |
typedef struct { |
| 217 |
unsigned short numsegs; |
| 218 |
unsigned short firstseg; // Index of first one; segs are stored sequentially. |
| 219 |
} PACKEDATTR mapsubsector_t; |
| 220 |
|
| 221 |
typedef struct { |
| 222 |
unsigned short numsegs; |
| 223 |
int firstseg; |
| 224 |
} PACKEDATTR mapsubsector_v4_t; |
| 225 |
|
| 226 |
typedef struct { |
| 227 |
unsigned int numsegs; |
| 228 |
} PACKEDATTR mapsubsector_znod_t; |
| 229 |
|
| 230 |
// LineSeg, generated by splitting LineDefs |
| 231 |
// using partition lines selected by BSP builder. |
| 232 |
typedef struct { |
| 233 |
unsigned short v1; |
| 234 |
unsigned short v2; |
| 235 |
short angle; |
| 236 |
unsigned short linedef; |
| 237 |
short side; |
| 238 |
short offset; |
| 239 |
} PACKEDATTR mapseg_t; |
| 240 |
|
| 241 |
typedef struct { |
| 242 |
int v1; |
| 243 |
int v2; |
| 244 |
unsigned short angle; |
| 245 |
unsigned short linedef; |
| 246 |
short side; |
| 247 |
unsigned short offset; |
| 248 |
} PACKEDATTR mapseg_v4_t; |
| 249 |
|
| 250 |
typedef struct { |
| 251 |
unsigned int v1, v2; |
| 252 |
unsigned short linedef; |
| 253 |
unsigned char side; |
| 254 |
} PACKEDATTR mapseg_znod_t; |
| 255 |
|
| 256 |
typedef struct { |
| 257 |
unsigned int v1, v2; |
| 258 |
unsigned int linedef; |
| 259 |
unsigned char side; |
| 260 |
} PACKEDATTR mapseg_znod2_t; |
| 261 |
|
| 262 |
// BSP node structure. |
| 263 |
|
| 264 |
// Indicate a leaf. |
| 265 |
// e6y: support for extended nodes |
| 266 |
#define NF_SUBSECTOR 0x80000000 |
| 267 |
|
| 268 |
typedef struct { |
| 269 |
short x; // Partition line from (x,y) to x+dx,y+dy) |
| 270 |
short y; |
| 271 |
short dx; |
| 272 |
short dy; |
| 273 |
// Bounding box for each child, clip against view frustum. |
| 274 |
short bbox[2][4]; |
| 275 |
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree. |
| 276 |
unsigned short children[2]; |
| 277 |
} PACKEDATTR mapnode_t; |
| 278 |
|
| 279 |
typedef struct { |
| 280 |
short x; // Partition line from (x,y) to x+dx,y+dy) |
| 281 |
short y; |
| 282 |
short dx; |
| 283 |
short dy; |
| 284 |
// Bounding box for each child, clip against view frustum. |
| 285 |
short bbox[2][4]; |
| 286 |
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree. |
| 287 |
int children[2]; |
| 288 |
} PACKEDATTR mapnode_v4_t; |
| 289 |
|
| 290 |
typedef struct { |
| 291 |
short x; // Partition line from (x,y) to x+dx,y+dy) |
| 292 |
short y; |
| 293 |
short dx; |
| 294 |
short dy; |
| 295 |
// Bounding box for each child, clip against view frustum. |
| 296 |
short bbox[2][4]; |
| 297 |
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree. |
| 298 |
int children[2]; |
| 299 |
} PACKEDATTR mapnode_znod_t; |
| 300 |
|
| 301 |
typedef struct { |
| 302 |
int x; // Partition line from (x,y) to x+dx,y+dy) |
| 303 |
int y; |
| 304 |
int dx; |
| 305 |
int dy; |
| 306 |
// Bounding box for each child, clip against view frustum. |
| 307 |
short bbox[2][4]; |
| 308 |
// If NF_SUBSECTOR its a subsector, else it's a node of another subtree. |
| 309 |
int children[2]; |
| 310 |
} PACKEDATTR mapnode_znod2_t; |
| 311 |
|
| 312 |
// Thing definition, position, orientation and type, |
| 313 |
// plus skill/visibility flags and attributes. |
| 314 |
|
| 315 |
typedef struct { |
| 316 |
short tid; |
| 317 |
fixed_t x; |
| 318 |
fixed_t y; |
| 319 |
fixed_t height; |
| 320 |
short angle; |
| 321 |
short type; |
| 322 |
int options; |
| 323 |
int special; |
| 324 |
int special_args[5]; |
| 325 |
fixed_t gravity; |
| 326 |
fixed_t health; |
| 327 |
float alpha; |
| 328 |
} mapthing_t; |
| 329 |
|
| 330 |
typedef struct { |
| 331 |
short tid; |
| 332 |
short x; |
| 333 |
short y; |
| 334 |
short height; |
| 335 |
short angle; |
| 336 |
short type; |
| 337 |
short options; |
| 338 |
byte special; |
| 339 |
byte arg1; |
| 340 |
byte arg2; |
| 341 |
byte arg3; |
| 342 |
byte arg4; |
| 343 |
byte arg5; |
| 344 |
} PACKEDATTR hexen_mapthing_t; |
| 345 |
|
| 346 |
typedef struct { |
| 347 |
short x; |
| 348 |
short y; |
| 349 |
short angle; |
| 350 |
short type; |
| 351 |
short options; |
| 352 |
} PACKEDATTR doom_mapthing_t; |
| 353 |
|
| 354 |
// hexen |
| 355 |
#define HML_REPEATSPECIAL 0x0200 // special is repeatable |
| 356 |
#define HML_SPAC_SHIFT 10 |
| 357 |
#define HML_SPAC_MASK 0x1c00 |
| 358 |
#define GET_SPAC_INDEX(flags) ((flags&HML_SPAC_MASK)>>HML_SPAC_SHIFT) |
| 359 |
|
| 360 |
// zdoom |
| 361 |
#define ZML_MONSTERSCANACTIVATE 0x2000 // Monsters and players can activate |
| 362 |
#define ZML_BLOCKPLAYERS 0x4000 // Blocks players |
| 363 |
#define ZML_BLOCKEVERYTHING 0x8000 // Blocks everything |
| 364 |
|
| 365 |
// line activation |
| 366 |
#define SPAC_NONE 0x0000 |
| 367 |
#define SPAC_CROSS 0x0001 |
| 368 |
#define SPAC_USE 0x0002 |
| 369 |
#define SPAC_MCROSS 0x0004 |
| 370 |
#define SPAC_IMPACT 0x0008 |
| 371 |
#define SPAC_PUSH 0x0010 |
| 372 |
#define SPAC_PCROSS 0x0020 |
| 373 |
#define SPAC_USEBACK 0x0040 |
| 374 |
#define SPAC_MPUSH 0x0080 |
| 375 |
#define SPAC_MUSE 0x0100 |
| 376 |
#define SPAC_ANYCROSS 0x0200 |
| 377 |
#define SPAC_DAMAGE 0x0400 |
| 378 |
#define SPAC_DEATH 0x0800 |
| 379 |
|
| 380 |
#ifdef _MSC_VER |
| 381 |
#pragma pack(pop) |
| 382 |
#endif //_MSC_VER |
| 383 |
|
| 384 |
#endif // __DOOMDATA__ |