-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathdoomtypes.h
More file actions
231 lines (181 loc) · 5.25 KB
/
doomtypes.h
File metadata and controls
231 lines (181 loc) · 5.25 KB
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#ifndef DOOMTYPES_H
#define DOOMTYPES_H
#include <QtCore>
typedef qint32 fixed_t;
typedef quint32 angle_t;
#define FRACBITS 16
#define FRACUNIT (1<<FRACBITS)
inline static int D_abs(fixed_t x)
{
fixed_t _t = (x),_s;
_s = _t >> (8*sizeof _t-1);
return (_t^_s)-_s;
}
inline static fixed_t FixedDiv(fixed_t a, fixed_t b)
{
return ((unsigned)D_abs(a)>>14) >= (unsigned)D_abs(b) ? ((a^b)>>31) ^ INT_MAX :
(fixed_t)(((qint64) a << FRACBITS) / b);
}
//*************************************************************************************
//WAD file structs from Doom sources.
//*************************************************************************************
#pragma pack(push,1)
typedef struct
{
char identification[4]; // Should be "IWAD" or "PWAD".
qint32 numlumps;
qint32 infotableofs;
} wadinfo_t;
typedef struct
{
qint32 filepos;
qint32 size;
char name[8];
} filelump_t;
//
// Map level types.
// The following data structures define the persistent format
// used in the lumps of the WAD files.
//
// Lump order in a map WAD: each map needs a couple of lumps
// to provide a complete scene geometry description.
enum {
ML_LABEL, // A separator, name, ExMx or MAPxx
ML_THINGS, // Monsters, items..
ML_LINEDEFS, // LineDefs, from editing
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // SubSectors, list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
ML_BLOCKMAP // LUT, motion clipping, walls/grid element
};
//*************************************************************************************
//r_defs structs from Doom sources.
//*************************************************************************************
typedef struct
{
fixed_t x, y;
} vertex_t;
// A single Vertex.
typedef struct
{
short x,y;
} mapvertex_t;
#define NO_INDEX ((unsigned short)-1)
#define ML_TWOSIDED 4
typedef enum
{
ST_HORIZONTAL,
ST_VERTICAL,
ST_POSITIVE,
ST_NEGATIVE
} slopetype_t;
typedef enum
{ // cph:
RF_TOP_TILE = 1, // Upper texture needs tiling
RF_MID_TILE = 2, // Mid texture needs tiling
RF_BOT_TILE = 4, // Lower texture needs tiling
RF_IGNORE = 8, // Renderer can skip this line
RF_CLOSED =16, // Line blocks view
} r_flags;
/* Bounding box coordinate storage. */
enum
{
BOXTOP,
BOXBOTTOM,
BOXLEFT,
BOXRIGHT
}; /* bbox coordinates */
typedef struct line_s
{
vertex_t v1;
vertex_t v2; // Vertices, from v1 to v2.
quint32 lineno; //line number.
fixed_t dx, dy; // Precalculated v2 - v1 for side checking.
quint16 sidenum[2]; // Visual appearance: SideDefs.
fixed_t bbox[4]; //Line bounding box.
quint16 flags; // Animation related.
qint16 special;
qint16 tag;
quint16 slopetype; // To aid move clipping.
} line_t;
typedef struct {
unsigned short v1;
unsigned short v2;
unsigned short flags;
short special;
short tag;
// proff 07/23/2006 - support more than 32768 sidedefs
// use the unsigned value and special case the -1
// sidenum[1] will be -1 (NO_INDEX) if one sided
unsigned short sidenum[2];
} maplinedef_t;
// LineSeg, generated by splitting LineDefs
// using partition lines selected by BSP builder.
typedef struct {
unsigned short v1;
unsigned short v2;
short angle;
unsigned short linedef;
short side;
short offset;
} mapseg_t;
//
// The LineSeg.
//
typedef struct
{
vertex_t v1;
vertex_t v2; // Vertices, from v1 to v2.
fixed_t offset;
angle_t angle;
quint16 sidenum;
quint16 linenum;
quint16 frontsectornum;
quint16 backsectornum;
} seg_t;
// A SideDef, defining the visual appearance of a wall,
// by setting textures and offsets.
typedef struct
{
short textureoffset;
short rowoffset;
char toptexture[8];
char bottomtexture[8];
char midtexture[8];
short sector; // Front sector, towards viewer.
} mapsidedef_t;
// A SideDef, defining the visual appearance of a wall,
// by setting textures and offsets.
typedef struct
{
short textureoffset;
short rowoffset;
short toptexture;
short bottomtexture;
short midtexture;
short sector; // Front sector, towards viewer.
} sidedef_t;
typedef struct
{
short originx;
short originy;
short patch;
short stepdir; // unused in Doom but might be used in Phase 2 Boom
short colormap; // unused in Doom but might be used in Phase 2 Boom
} mappatch_t;
typedef struct
{
char name[8];
char pad2[4]; // unused
short width;
short height;
char pad[4]; // unused in Doom but might be used in Boom Phase 2
short patchcount;
mappatch_t patches[1];
} maptexture_t;
#pragma pack(pop)
#endif // DOOMTYPES_H