/
mapdata.hs
323 lines (293 loc) · 13.3 KB
/
mapdata.hs
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# $Id$
# Runtime map data defitions. Processed by the makedmt.py script.
struct vertex
FLOAT float[2] pos
- uint numsecowners // Number of sector owners.
- uint* secowners // Sector indices [numsecowners] size.
- uint numlineowners // Number of line owners.
- lineowner_s* lineowners // Lineowner base ptr [numlineowners] size. A doubly, circularly linked list. The base is the line with the lowest angle and the next-most with the largest angle.
- boolean anchored // One or more of our line owners are one-sided.
end
internal
// Helper macros for accessing seg data elements.
#define FRONT 0
#define BACK 1
#define SG_v1 v[0]
#define SG_v2 v[1]
#define SG_frontsector sec[FRONT]
#define SG_backsector sec[BACK]
// Seg flags
#define SEGF_POLYOBJ 0x1 // Seg is part of a poly object.
// Seg frame flags
#define SEGINF_FACINGFRONT 0x0001
#define SEGINF_BACKSECSKYFIX 0x0002
end
struct seg
PTR vertex_s*[2] v // [Start, End] of the segment.
FLOAT float length // Accurate length of the segment (v1 -> v2).
FLOAT float offset
PTR side_s* sidedef
PTR line_s* linedef
PTR sector_s*[2] sec
ANGLE angle_t angle
BYTE byte side // 0=front, 1=back
BYTE byte flags
- short frameflags
- biastracker_s[3] tracker // 0=top, 1=middle, 2=bottom
- vertexillum_s[3][4] illum
- uint updated
- biasaffection_s[MAX_BIAS_AFFECTED] affected
end
struct subsector
PTR sector_s* sector
UINT uint segcount
PTR seg_s* firstseg
PTR polyobj_s* poly // NULL, if there is no polyobj.
BYTE byte flags
- ushort numverts
- fvertex_t* verts // A sorted list of edge vertices.
- fvertex_t bbox[2] // Min and max points.
- fvertex_t midpoint // Center of vertices.
- subplaneinfo_s** planes
- ushort numvertices
- fvertex_s* vertices
- int validcount
- shadowlink_s* shadows
- uint group
end
internal
// Surface flags.
#define SUF_TEXFIX 0x1 // Current texture is a fix replacement
// (not sent to clients, returned via DMU etc).
#define SUF_GLOW 0x2 // Surface glows (full bright).
#define SUF_BLEND 0x4 // Surface possibly has a blended texture.
#define SUF_NO_RADIO 0x8 // No fakeradio for this surface.
end
struct surface
INT int flags // SUF_ flags
- int oldflags
SHORT short texture
- short oldtexture
- boolean isflat // true if current texture is a flat
- boolean oldisflat
- float[3] normal // Surface normal
- float[3] oldnormal
FLOAT float[2] texmove // Texture movement X and Y
- float[2] oldtexmove
FLOAT float offx // Texture x offset
- float oldoffx
FLOAT float offy // Texture y offset
- float oldoffy
BYTE byte[4] rgba // Surface color tint
- byte[4] oldrgba
- translation_s* xlat
end
internal
enum {
PLN_FLOOR,
PLN_CEILING,
NUM_PLANE_TYPES
};
typedef struct skyfix_s {
float offset;
} skyfix_t;
end
struct plane
FLOAT float height // Current height
- float[2] oldheight
- surface_t surface
FLOAT float glow // Glow amount
BYTE byte[3] glowrgb // Glow color
FLOAT float target // Target height
FLOAT float speed // Move speed
PTR degenmobj_t soundorg // Sound origin for plane
PTR sector_s* sector // Owner of the plane (temp)
- float visheight // Visible plane height (smoothed)
- float visoffset
end
internal
// Helper macros for accessing sector floor/ceiling plane data elements.
#define SP_ceilsurface planes[PLN_CEILING]->surface
#define SP_ceilheight planes[PLN_CEILING]->height
#define SP_ceilnormal planes[PLN_CEILING]->normal
#define SP_ceilpic planes[PLN_CEILING]->surface.texture
#define SP_ceilisflat planes[PLN_CEILING]->surface.isflat
#define SP_ceiloffx planes[PLN_CEILING]->surface.offx
#define SP_ceiloffy planes[PLN_CEILING]->surface.offy
#define SP_ceilrgb planes[PLN_CEILING]->surface.rgba
#define SP_ceilglow planes[PLN_CEILING]->glow
#define SP_ceilglowrgb planes[PLN_CEILING]->glowrgb
#define SP_ceiltarget planes[PLN_CEILING]->target
#define SP_ceilspeed planes[PLN_CEILING]->speed
#define SP_ceiltexmove planes[PLN_CEILING]->surface.texmove
#define SP_ceilsoundorg planes[PLN_CEILING]->soundorg
#define SP_ceilvisheight planes[PLN_CEILING]->visheight
#define SP_floorsurface planes[PLN_FLOOR]->surface
#define SP_floorheight planes[PLN_FLOOR]->height
#define SP_floornormal planes[PLN_FLOOR]->normal
#define SP_floorpic planes[PLN_FLOOR]->surface.texture
#define SP_floorisflat planes[PLN_FLOOR]->surface.isflat
#define SP_flooroffx planes[PLN_FLOOR]->surface.offx
#define SP_flooroffy planes[PLN_FLOOR]->surface.offy
#define SP_floorrgb planes[PLN_FLOOR]->surface.rgba
#define SP_floorglow planes[PLN_FLOOR]->glow
#define SP_floorglowrgb planes[PLN_FLOOR]->glowrgb
#define SP_floortarget planes[PLN_FLOOR]->target
#define SP_floorspeed planes[PLN_FLOOR]->speed
#define SP_floortexmove planes[PLN_FLOOR]->surface.texmove
#define SP_floorsoundorg planes[PLN_FLOOR]->soundorg
#define SP_floorvisheight planes[PLN_FLOOR]->visheight
#define SECT_PLANE_HEIGHT(x, n) (x->planes[n]->visheight)
end
internal
// Sector frame flags
#define SIF_VISIBLE 0x1 // Sector is visible on this frame.
#define SIF_FRAME_CLEAR 0x1 // Flags to clear before each frame.
#define SIF_LIGHT_CHANGED 0x2
// Sector flags.
#define SECF_INVIS_FLOOR 0x1
#define SECF_INVIS_CEILING 0x2
typedef struct ssecgroup_s {
struct sector_s** linked; // [sector->planecount] size.
// Plane attached to another sector.
} ssecgroup_t;
end
struct sector
SHORT short lightlevel
- int oldlightlevel
BYTE byte[3] rgb
- byte[3] oldrgb
INT int validcount // if == validcount, already checked.
PTR mobj_s* thinglist // List of mobjs in the sector.
UINT uint linecount
PTR line_s** Lines // [linecount] size.
UINT uint subscount
PTR subsector_s** subsectors // [subscount] size.
- uint subsgroupcount
- ssecgroup_t* subsgroups // [subsgroupcount] size.
- skyfix_t[2] skyfix // floor, ceiling.
PTR degenmobj_t soundorg
FLOAT float[NUM_REVERB_DATA] reverb
- int[4] blockbox // Mapblock bounding box.
UINT uint planecount
- plane_s** planes // [planecount] size.
- sector_s* containsector // Sector that contains this (if any).
- boolean permanentlink
- boolean unclosed // An unclosed sector (some sort of fancy hack).
- boolean selfRefHack // A self-referencing hack sector which ISNT enclosed by the sector referenced. Bounding box for the sector.
- float[4] bounds // Bounding box for the sector
- int frameflags
- int addspritecount // frame number of last R_AddSprites
- sector_s* lightsource // Main sky light source
- uint blockcount // Number of gridblocks in the sector.
- uint changedblockcount // Number of blocks to mark changed.
- ushort* blocks // Light grid block indices.
end
internal
// Parts of a wall segment.
typedef enum segsection_e {
SEG_MIDDLE,
SEG_TOP,
SEG_BOTTOM
} segsection_t;
// Helper macros for accessing sidedef top/middle/bottom section data elements.
#define SW_middlesurface sections[SEG_MIDDLE]
#define SW_middleflags sections[SEG_MIDDLE].flags
#define SW_middlepic sections[SEG_MIDDLE].texture
#define SW_middleisflat sections[SEG_MIDDLE].isflat
#define SW_middlenormal sections[SEG_MIDDLE].normal
#define SW_middletexmove sections[SEG_MIDDLE].texmove
#define SW_middleoffx sections[SEG_MIDDLE].offx
#define SW_middleoffy sections[SEG_MIDDLE].offy
#define SW_middlergba sections[SEG_MIDDLE].rgba
#define SW_middletexlat sections[SEG_MIDDLE].xlat
#define SW_topsurface sections[SEG_TOP]
#define SW_topflags sections[SEG_TOP].flags
#define SW_toppic sections[SEG_TOP].texture
#define SW_topisflat sections[SEG_TOP].isflat
#define SW_topnormal sections[SEG_TOP].normal
#define SW_toptexmove sections[SEG_TOP].texmove
#define SW_topoffx sections[SEG_TOP].offx
#define SW_topoffy sections[SEG_TOP].offy
#define SW_toprgba sections[SEG_TOP].rgba
#define SW_toptexlat sections[SEG_TOP].xlat
#define SW_bottomsurface sections[SEG_BOTTOM]
#define SW_bottomflags sections[SEG_BOTTOM].flags
#define SW_bottompic sections[SEG_BOTTOM].texture
#define SW_bottomisflat sections[SEG_BOTTOM].isflat
#define SW_bottomnormal sections[SEG_BOTTOM].normal
#define SW_bottomtexmove sections[SEG_BOTTOM].texmove
#define SW_bottomoffx sections[SEG_BOTTOM].offx
#define SW_bottomoffy sections[SEG_BOTTOM].offy
#define SW_bottomrgba sections[SEG_BOTTOM].rgba
#define SW_bottomtexlat sections[SEG_BOTTOM].xlat
// Side frame flags
#define SIDEINF_TOPPVIS 0x0001
#define SIDEINF_MIDDLEPVIS 0x0002
#define SIDEINF_BOTTOMPVIS 0x0004
end
struct side
- surface_t[3] sections
BLENDMODE blendmode_t blendmode
PTR sector_s* sector
SHORT short flags
- short frameflags
- line_s*[2] neighbor // Left and right neighbour.
- boolean[2] pretendneighbor // If true, neighbor is not a "real" neighbor (it does not share a line with this side's sector).
- sector_s*[2] proxsector // Sectors behind the neighbors.
- line_s*[2] backneighbor // Neighbour in the backsector (if any).
- line_s*[2] alignneighbor // Aligned left and right neighbours.
end
internal
// Helper macros for accessing linedef data elements.
#define L_v1 v[0]
#define L_v2 v[1]
#define L_vo1 vo[0]
#define L_vo2 vo[1]
#define L_frontsector sec[FRONT]
#define L_backsector sec[BACK]
#define L_frontside sides[FRONT]
#define L_backside sides[BACK]
end
struct line
PTR vertex_s*[2] v
SHORT short flags
PTR sector_s*[2] sec // [front, back] sectors.
FLOAT float dx
FLOAT float dy
INT slopetype_t slopetype
INT int validcount
PTR side_s*[2] sides
FIXED fixed_t[4] bbox
- lineowner_s*[2] vo // Links to vertex line owner nodes [left, right]
- float length // Accurate length
- binangle_t angle // Calculated from front side's normal
- boolean selfrefhackroot // This line is the root of a self-referencing hack sector
end
struct polyobj
UINT uint numsegs
PTR seg_s** segs
INT int validcount
PTR degenmobj_t startSpot
ANGLE angle_t angle
INT int tag // reference tag assigned in HereticEd
- ddvertex_t* originalPts // used as the base for the rotations
- ddvertex_t* prevPts // use to restore the old point values
FIXED fixed_t[4] bbox
- fvertex_t dest
INT int speed // Destination XY and speed.
ANGLE angle_t destAngle // Destination angle.
ANGLE angle_t angleSpeed // Rotation speed.
BOOL boolean crush // should the polyobj attempt to crush mobjs?
INT int seqType
FIXED fixed_t size // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT)
PTR void* specialdata // pointer a thinker, if the poly is moving
end
struct node
FLOAT float x // Partition line.
FLOAT float y // Partition line.
FLOAT float dx // Partition line.
FLOAT float dy // Partition line.
FLOAT float[2][4] bbox // Bounding box for each child.
UINT uint[2] children // If NF_SUBSECTOR it's a subsector.
end