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