Subversion Repositories Kolibri OS

Rev

Rev 325 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. // Emacs style mode select   -*- C++ -*-
  2. //-----------------------------------------------------------------------------
  3. //
  4. // $Id:$
  5. //
  6. // Copyright (C) 1993-1996 by id Software, Inc.
  7. //
  8. // This source is available for distribution and/or modification
  9. // only under the terms of the DOOM Source Code License as
  10. // published by id Software. All rights reserved.
  11. //
  12. // The source is distributed in the hope that it will be useful,
  13. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
  15. // for more details.
  16. //
  17. // DESCRIPTION:
  18. //  all external data is defined here
  19. //  most of the data is loaded into different structures at run time
  20. //  some internal structures shared by many modules are here
  21. //
  22. //-----------------------------------------------------------------------------
  23.  
  24. #ifndef __DOOMDATA__
  25. #define __DOOMDATA__
  26.  
  27. // The most basic types we use, portability.
  28. #include "doomtype.h"
  29.  
  30. // Some global defines, that configure the game.
  31. #include "doomdef.h"
  32.  
  33.  
  34.  
  35. //
  36. // Map level types.
  37. // The following data structures define the persistent format
  38. // used in the lumps of the WAD files.
  39. //
  40.  
  41. // Lump order in a map WAD: each map needs a couple of lumps
  42. // to provide a complete scene geometry description.
  43. enum
  44. {
  45.   ML_LABEL,             // A separator, name, ExMx or MAPxx
  46.   ML_THINGS,            // Monsters, items..
  47.   ML_LINEDEFS,          // LineDefs, from editing
  48.   ML_SIDEDEFS,          // SideDefs, from editing
  49.   ML_VERTEXES,          // Vertices, edited and BSP splits generated
  50.   ML_SEGS,              // LineSegs, from LineDefs split by BSP
  51.   ML_SSECTORS,          // SubSectors, list of LineSegs
  52.   ML_NODES,             // BSP nodes
  53.   ML_SECTORS,           // Sectors, from editing
  54.   ML_REJECT,            // LUT, sector-sector visibility        
  55.   ML_BLOCKMAP           // LUT, motion clipping, walls/grid element
  56. };
  57.  
  58.  
  59. // A single Vertex.
  60. typedef struct
  61. {
  62.   short         x;
  63.   short         y;
  64. } mapvertex_t;
  65.  
  66.  
  67. // A SideDef, defining the visual appearance of a wall,
  68. // by setting textures and offsets.
  69. typedef struct
  70. {
  71.   short         textureoffset;
  72.   short         rowoffset;
  73.   char          toptexture[8];
  74.   char          bottomtexture[8];
  75.   char          midtexture[8];
  76.   // Front sector, towards viewer.
  77.   short         sector;
  78. } mapsidedef_t;
  79.  
  80.  
  81.  
  82. // A LineDef, as used for editing, and as input
  83. // to the BSP builder.
  84. typedef struct
  85. {
  86.   short         v1;
  87.   short         v2;
  88.   short         flags;
  89.   short         special;
  90.   short         tag;
  91.   // sidenum[1] will be -1 if one sided
  92.   short         sidenum[2];            
  93. } maplinedef_t;
  94.  
  95.  
  96. //
  97. // LineDef attributes.
  98. //
  99.  
  100. // Solid, is an obstacle.
  101. #define ML_BLOCKING             1
  102.  
  103. // Blocks monsters only.
  104. #define ML_BLOCKMONSTERS        2
  105.  
  106. // Backside will not be present at all
  107. //  if not two sided.
  108. #define ML_TWOSIDED             4
  109.  
  110. // If a texture is pegged, the texture will have
  111. // the end exposed to air held constant at the
  112. // top or bottom of the texture (stairs or pulled
  113. // down things) and will move with a height change
  114. // of one of the neighbor sectors.
  115. // Unpegged textures allways have the first row of
  116. // the texture at the top pixel of the line for both
  117. // top and bottom textures (use next to windows).
  118.  
  119. // upper texture unpegged
  120. #define ML_DONTPEGTOP           8
  121.  
  122. // lower texture unpegged
  123. #define ML_DONTPEGBOTTOM        16      
  124.  
  125. // In AutoMap: don't map as two sided: IT'S A SECRET!
  126. #define ML_SECRET               32
  127.  
  128. // Sound rendering: don't let sound cross two of these.
  129. #define ML_SOUNDBLOCK           64
  130.  
  131. // Don't draw on the automap at all.
  132. #define ML_DONTDRAW             128
  133.  
  134. // Set if already seen, thus drawn in automap.
  135. #define ML_MAPPED               256
  136.  
  137.  
  138.  
  139.  
  140. // Sector definition, from editing.
  141. typedef struct
  142. {
  143.   short         floorheight;
  144.   short         ceilingheight;
  145.   char          floorpic[8];
  146.   char          ceilingpic[8];
  147.   short         lightlevel;
  148.   short         special;
  149.   short         tag;
  150. } mapsector_t;
  151.  
  152. // SubSector, as generated by BSP.
  153. typedef struct
  154. {
  155.   short         numsegs;
  156.   // Index of first one, segs are stored sequentially.
  157.   short         firstseg;      
  158. } mapsubsector_t;
  159.  
  160.  
  161. // LineSeg, generated by splitting LineDefs
  162. // using partition lines selected by BSP builder.
  163. typedef struct
  164. {
  165.   short         v1;
  166.   short         v2;
  167.   short         angle;          
  168.   short         linedef;
  169.   short         side;
  170.   short         offset;
  171. } mapseg_t;
  172.  
  173.  
  174.  
  175. // BSP node structure.
  176.  
  177. // Indicate a leaf.
  178. #define NF_SUBSECTOR    0x8000
  179.  
  180. typedef struct
  181. {
  182.   // Partition line from (x,y) to x+dx,y+dy)
  183.   short         x;
  184.   short         y;
  185.   short         dx;
  186.   short         dy;
  187.  
  188.   // Bounding box for each child,
  189.   // clip against view frustum.
  190.   short         bbox[2][4];
  191.  
  192.   // If NF_SUBSECTOR its a subsector,
  193.   // else it's a node of another subtree.
  194.   unsigned short        children[2];
  195.  
  196. } mapnode_t;
  197.  
  198.  
  199.  
  200.  
  201. // Thing definition, position, orientation and type,
  202. // plus skill/visibility flags and attributes.
  203. typedef struct
  204. {
  205.     short               x;
  206.     short               y;
  207.     short               angle;
  208.     short               type;
  209.     short               options;
  210. } mapthing_t;
  211.  
  212.  
  213.  
  214.  
  215.  
  216. #endif                  // __DOOMDATA__
  217. //-----------------------------------------------------------------------------
  218. //
  219. // $Log:$
  220. //
  221. //-----------------------------------------------------------------------------
  222.  
  223.