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