doomdata.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. #ifndef __DOOMDATA__
  36. #define __DOOMDATA__
  37. // The most basic types we use, portability.
  38. #include "config.h"
  39. #include "doomtype.h"
  40. //
  41. // Map level types.
  42. // The following data structures define the persistent format
  43. // used in the lumps of the WAD files.
  44. //
  45. // Lump order in a map WAD: each map needs a couple of lumps
  46. // to provide a complete scene geometry description.
  47. enum {
  48. ML_LABEL, // A separator, name, ExMx or MAPxx
  49. ML_THINGS, // Monsters, items..
  50. ML_LINEDEFS, // LineDefs, from editing
  51. ML_SIDEDEFS, // SideDefs, from editing
  52. ML_VERTEXES, // Vertices, edited and BSP splits generated
  53. ML_SEGS, // LineSegs, from LineDefs split by BSP
  54. ML_SSECTORS, // SubSectors, list of LineSegs
  55. ML_NODES, // BSP nodes
  56. ML_SECTORS, // Sectors, from editing
  57. ML_REJECT, // LUT, sector-sector visibility
  58. ML_BLOCKMAP // LUT, motion clipping, walls/grid element
  59. };
  60. #ifdef _MSC_VER // proff: This is the same as __attribute__ ((packed)) in GNUC
  61. #pragma pack(push)
  62. #pragma pack(1)
  63. #endif //_MSC_VER
  64. // A single Vertex.
  65. typedef struct {
  66. short x,y;
  67. } PACKEDATTR mapvertex_t;
  68. // A SideDef, defining the visual appearance of a wall,
  69. // by setting textures and offsets.
  70. typedef struct {
  71. short textureoffset;
  72. short rowoffset;
  73. char toptexture[8];
  74. char bottomtexture[8];
  75. char midtexture[8];
  76. short sector; // Front sector, towards viewer.
  77. } PACKEDATTR mapsidedef_t;
  78. // A LineDef, as used for editing, and as input to the BSP builder.
  79. typedef struct {
  80. unsigned short v1;
  81. unsigned short v2;
  82. unsigned short flags;
  83. short special;
  84. short tag;
  85. // proff 07/23/2006 - support more than 32768 sidedefs
  86. // use the unsigned value and special case the -1
  87. // sidenum[1] will be -1 (NO_INDEX) if one sided
  88. unsigned short sidenum[2];
  89. } PACKEDATTR maplinedef_t;
  90. #define NO_INDEX ((unsigned short)-1)
  91. //
  92. // LineDef attributes.
  93. //
  94. // Solid, is an obstacle.
  95. #define ML_BLOCKING 1
  96. // Blocks monsters only.
  97. #define ML_BLOCKMONSTERS 2
  98. // Backside will not be drawn if not two sided.
  99. #define ML_TWOSIDED 4
  100. // If a texture is pegged, the texture will have
  101. // the end exposed to air held constant at the
  102. // top or bottom of the texture (stairs or pulled
  103. // down things) and will move with a height change
  104. // of one of the neighbor sectors.
  105. // Unpegged textures always have the first row of
  106. // the texture at the top pixel of the line for both
  107. // top and bottom textures (use next to windows).
  108. // upper texture unpegged
  109. #define ML_DONTPEGTOP 8
  110. // lower texture unpegged
  111. #define ML_DONTPEGBOTTOM 16
  112. // In AutoMap: don't map as two sided: IT'S A SECRET!
  113. #define ML_SECRET 32
  114. // Sound rendering: don't let sound cross two of these.
  115. #define ML_SOUNDBLOCK 64
  116. // Don't draw on the automap at all.
  117. #define ML_DONTDRAW 128
  118. // Set if already seen, thus drawn in automap.
  119. #define ML_MAPPED 256
  120. //jff 3/21/98 Set if line absorbs use by player
  121. //allow multiple push/switch triggers to be used on one push
  122. #define ML_PASSUSE 512
  123. // Sector definition, from editing.
  124. typedef struct {
  125. short floorheight;
  126. short ceilingheight;
  127. char floorpic[8];
  128. char ceilingpic[8];
  129. short lightlevel;
  130. short special;
  131. short tag;
  132. } PACKEDATTR mapsector_t;
  133. // SubSector, as generated by BSP.
  134. typedef struct {
  135. unsigned short numsegs;
  136. unsigned short firstseg; // Index of first one; segs are stored sequentially.
  137. } PACKEDATTR mapsubsector_t;
  138. // LineSeg, generated by splitting LineDefs
  139. // using partition lines selected by BSP builder.
  140. typedef struct {
  141. unsigned short v1;
  142. unsigned short v2;
  143. short angle;
  144. unsigned short linedef;
  145. short side;
  146. short offset;
  147. } PACKEDATTR mapseg_t;
  148. // BSP node structure.
  149. // Indicate a leaf.
  150. #define NF_SUBSECTOR 0x8000
  151. typedef struct {
  152. short x; // Partition line from (x,y) to x+dx,y+dy)
  153. short y;
  154. short dx;
  155. short dy;
  156. // Bounding box for each child, clip against view frustum.
  157. short bbox[2][4];
  158. // If NF_SUBSECTOR its a subsector, else it's a node of another subtree.
  159. unsigned short children[2];
  160. } PACKEDATTR mapnode_t;
  161. // Thing definition, position, orientation and type,
  162. // plus skill/visibility flags and attributes.
  163. typedef struct {
  164. short x;
  165. short y;
  166. short angle;
  167. short type;
  168. short options;
  169. } PACKEDATTR mapthing_t;
  170. #ifdef _MSC_VER
  171. #pragma pack(pop)
  172. #endif //_MSC_VER
  173. #endif // __DOOMDATA__