1 // SONIC ROBO BLAST 2
2 //-----------------------------------------------------------------------------
3 // Copyright (C) 1993-1996 by id Software, Inc.
4 // Copyright (C) 1998-2000 by DooM Legacy Team.
5 // Copyright (C) 1999-2020 by Sonic Team Junior.
6 //
7 // This program is free software distributed under the
8 // terms of the GNU General Public License, version 2.
9 // See the 'LICENSE' file for more details.
10 //-----------------------------------------------------------------------------
11 /// \file  doomdata.h
12 /// \brief all external data is defined here
13 ///
14 ///        most of the data is loaded into different structures at run time
15 ///        some internal structures shared by many modules are here
16 
17 #ifndef __DOOMDATA__
18 #define __DOOMDATA__
19 
20 // The most basic types we use, portability.
21 #include "doomtype.h"
22 
23 // Some global defines, that configure the game.
24 #include "doomdef.h"
25 
26 #include "taglist.h"
27 #include "m_fixed.h" // See the mapthing_t scale.
28 
29 //
30 // Map level types.
31 // The following data structures define the persistent format
32 // used in the lumps of the WAD files.
33 //
34 
35 // Lump order in a map WAD: each map needs a couple of lumps
36 // to provide a complete scene geometry description.
37 enum
38 {
39 	ML_LABEL,    // A separator, name, MAPxx
40 	ML_THINGS,   // Enemies, rings, monitors, scenery, etc.
41 	ML_LINEDEFS, // Linedefs, from editing
42 	ML_SIDEDEFS, // Sidedefs, from editing
43 	ML_VERTEXES, // Vertices, edited and BSP splits generated
44 	ML_SEGS,     // Linesegs, from linedefs split by BSP
45 	ML_SSECTORS, // Subsectors, list of linesegs
46 	ML_NODES,    // BSP nodes
47 	ML_SECTORS,  // Sectors, from editing
48 	ML_REJECT,    // LUT, sector-sector visibility
49 	ML_BLOCKMAP,  // LUT, motion clipping, walls/grid element
50 };
51 
52 // Extra flag for objects.
53 #define MTF_EXTRA 1
54 
55 // Reverse gravity flag for objects.
56 #define MTF_OBJECTFLIP 2
57 
58 // Special flag used with certain objects.
59 #define MTF_OBJECTSPECIAL 4
60 
61 // Deaf monsters/do not react to sound.
62 #define MTF_AMBUSH 8
63 
64 // Do not use bit five or after, as they are used for object z-offsets.
65 
66 #if defined(_MSC_VER)
67 #pragma pack(1)
68 #endif
69 
70 // A single Vertex.
71 typedef struct
72 {
73 	INT16 x, y;
74 }ATTRPACK  mapvertex_t;
75 
76 // A SideDef, defining the visual appearance of a wall,
77 // by setting textures and offsets.
78 typedef struct
79 {
80 	INT16 textureoffset, rowoffset;
81 	char toptexture[8], bottomtexture[8], midtexture[8];
82 	// Front sector, towards viewer.
83 	INT16 sector;
84 } ATTRPACK mapsidedef_t;
85 
86 // A LineDef, as used for editing, and as input
87 // to the BSP builder.
88 typedef struct
89 {
90 	INT16 v1, v2;
91 	INT16 flags;
92 	INT16 special;
93 	INT16 tag;
94 	// sidenum[1] will be 0xffff if one sided
95 	UINT16 sidenum[2];
96 } ATTRPACK maplinedef_t;
97 
98 //
99 // LineDef attributes.
100 //
101 
102 // Solid, is an obstacle.
103 #define ML_IMPASSIBLE           1
104 
105 // Blocks monsters only.
106 #define ML_BLOCKMONSTERS        2
107 
108 // Backside will not be present at all if not two sided.
109 #define ML_TWOSIDED             4
110 
111 // If a texture is pegged, the texture will have
112 // the end exposed to air held constant at the
113 // top or bottom of the texture (stairs or pulled
114 // down things) and will move with a height change
115 // of one of the neighbor sectors.
116 // Unpegged textures allways have the first row of
117 // the texture at the top pixel of the line for both
118 // top and bottom textures (use next to windows).
119 
120 // upper texture unpegged
121 #define ML_DONTPEGTOP           8
122 
123 // lower texture unpegged
124 #define ML_DONTPEGBOTTOM       16
125 
126 #define ML_EFFECT1             32
127 
128 // Don't let Knuckles climb on this line
129 #define ML_NOCLIMB             64
130 
131 #define ML_EFFECT2             128
132 #define ML_EFFECT3             256
133 #define ML_EFFECT4             512
134 #define ML_EFFECT5            1024
135 
136 #define ML_NETONLY           2048 // Apply effect only in netgames
137 #define ML_NONET             4096 // Apply  effect only in single player games
138 #define ML_EFFECT6           8192
139 
140 // Bounce off walls!
141 #define ML_BOUNCY           16384
142 
143 #define ML_TFERLINE         32768
144 
145 // Sector definition, from editing.
146 typedef struct
147 {
148 	INT16 floorheight;
149 	INT16 ceilingheight;
150 	char floorpic[8];
151 	char ceilingpic[8];
152 	INT16 lightlevel;
153 	INT16 special;
154 	INT16 tag;
155 } ATTRPACK mapsector_t;
156 
157 // SubSector, as generated by BSP.
158 typedef struct
159 {
160 	UINT16 numsegs;
161 	// Index of first one, segs are stored sequentially.
162 	UINT16 firstseg;
163 } ATTRPACK mapsubsector_t;
164 
165 
166 // LineSeg, generated by splitting LineDefs
167 // using partition lines selected by BSP builder.
168 typedef struct
169 {
170 	INT16 v1, v2;
171 	INT16 angle;
172 	INT16 linedef;
173 	INT16 side;
174 	INT16 offset;
175 } ATTRPACK mapseg_t;
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 	INT16 x, y;
186 	INT16 dx, dy;
187 
188 	// Bounding box for each child, clip against view frustum.
189 	INT16 bbox[2][4];
190 
191 	// If NF_SUBSECTOR it's a subsector, else it's a node of another subtree.
192 	UINT16 children[2];
193 } ATTRPACK mapnode_t;
194 
195 #if defined(_MSC_VER)
196 #pragma pack()
197 #endif
198 
199 #define NUMMAPTHINGARGS 6
200 #define NUMMAPTHINGSTRINGARGS 2
201 
202 // Thing definition, position, orientation and type,
203 // plus visibility flags and attributes.
204 typedef struct
205 {
206 	INT16 x, y;
207 	INT16 angle, pitch, roll;
208 	UINT16 type;
209 	UINT16 options;
210 	INT16 z;
211 	UINT8 extrainfo;
212 	taglist_t tags;
213 	fixed_t scale;
214 	INT32 args[NUMMAPTHINGARGS];
215 	char *stringargs[NUMMAPTHINGSTRINGARGS];
216 	struct mobj_s *mobj;
217 } mapthing_t;
218 
219 #define ZSHIFT 4
220 
221 #define NUMMAPS 1035
222 
223 #endif // __DOOMDATA__
224