-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdoomdata.h
207 lines (161 loc) · 4.8 KB
/
doomdata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
//
// Copyright (C) 1993-1996 Id Software, Inc.
// Copyright (C) 2023 Frenkel Smeijers
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// DoomData.h
// all external data is defined here
// most of the data is loaded into different structures at run time
#ifndef __DOOMDATA__
#define __DOOMDATA__
/*
===============================================================================
map level types
===============================================================================
*/
// lump order in a map wad
enum {ML_LABEL, ML_THINGS, ML_LINEDEFS, ML_SIDEDEFS, ML_VERTEXES, ML_SEGS,
ML_SSECTORS, ML_NODES, ML_SECTORS , ML_REJECT, ML_BLOCKMAP};
typedef struct
{
int16_t x,y;
} mapvertex_t;
typedef struct
{
int16_t textureoffset;
int16_t rowoffset;
char toptexture[8], bottomtexture[8], midtexture[8];
int16_t sector; // on viewer's side
} mapsidedef_t;
typedef struct
{
int16_t v1, v2;
int16_t flags;
int16_t special, tag;
int16_t sidenum[2]; // sidenum[1] will be -1 if one sided
} maplinedef_t;
#define ML_BLOCKING 1
#define ML_BLOCKMONSTERS 2
#define ML_TWOSIDED 4 // backside will not be present at all
// if not two sided
// if a texture is pegged, the texture will have the end exposed to air held
// constant at the top or bottom of the texture (stairs or pulled down things)
// and will move with a height change of one of the neighbor sectors
// Unpegged textures allways have the first row of the texture at the top
// pixel of the line for both top and bottom textures (windows)
#define ML_DONTPEGTOP 8
#define ML_DONTPEGBOTTOM 16
#define ML_SECRET 32 // don't map as two sided: IT'S A SECRET!
#define ML_SOUNDBLOCK 64 // don't let sound cross two of these
#define ML_DONTDRAW 128 // don't draw on the automap
#define ML_MAPPED 256 // set if allready drawn in automap
typedef struct
{
int16_t floorheight, ceilingheight;
char floorpic[8], ceilingpic[8];
int16_t lightlevel;
int16_t special, tag;
} mapsector_t;
typedef struct
{
int16_t numsegs;
int16_t firstseg; // segs are stored sequentially
} mapsubsector_t;
typedef struct
{
int16_t v1, v2;
int16_t angle;
int16_t linedef, side;
int16_t offset;
} mapseg_t;
enum {BOXTOP,BOXBOTTOM,BOXLEFT,BOXRIGHT}; // bbox coordinates
#define NF_SUBSECTOR 0x8000
typedef struct
{
int16_t x,y,dx,dy; // partition line
int16_t bbox[2][4]; // bounding box for each child
uint16_t children[2]; // if NF_SUBSECTOR its a subsector
} mapnode_t;
typedef struct
{
int16_t x,y;
int16_t angle;
int16_t type;
int16_t options;
} mapthing_t;
#define MTF_EASY 1
#define MTF_NORMAL 2
#define MTF_HARD 4
#define MTF_AMBUSH 8
/*
===============================================================================
texture definition
===============================================================================
*/
typedef struct
{
int16_t originx;
int16_t originy;
int16_t patch;
int16_t stepdir;
int16_t colormap;
} mappatch_t;
typedef struct
{
char name[8];
boolean masked;
int16_t width;
int16_t height;
void **columndirectory; // OBSOLETE
int16_t patchcount;
mappatch_t patches[1];
} maptexture_t;
/*
===============================================================================
graphics
===============================================================================
*/
// posts are runs of non masked source pixels
typedef struct
{
byte topdelta; // -1 is the last post in a column
byte length;
// length data bytes follows
} post_t;
// column_t is a list of 0 or more post_t, (byte)-1 terminated
typedef post_t column_t;
// a patch holds one or more columns
// patches are used for sprites and all masked pictures
typedef struct
{
int16_t width; // bounding box size
int16_t height;
int16_t leftoffset; // pixels to the left of origin
int16_t topoffset; // pixels below the origin
int32_t columnofs[8]; // only [width] used
// the [0] is &columnofs[width]
} patch_t;
// a pic is an unmasked block of pixels
typedef struct
{
byte width,height;
byte data;
} pic_t;
/*
===============================================================================
status
===============================================================================
*/
#endif // __DOOMDATA__