-
Notifications
You must be signed in to change notification settings - Fork 0
/
w_level_lumps.h
112 lines (92 loc) · 3.02 KB
/
w_level_lumps.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
/*
* level data lumps
*/
#ifndef W_LEVEL_LUMPS_H
#define W_LEVEL_LUMPS_H
#include <stdint.h>
/* level lump order */
enum {
ML_LABEL,
ML_THINGS,
ML_LINEDEFS,
ML_SIDEDEFS,
ML_VERTEXES,
ML_SEGS,
ML_SSECTORS,
ML_NODES,
ML_SECTORS,
ML_REJECT,
ML_BLOCKMAP
};
/* lump data layout */
/* vertex */
typedef struct {
int16_t x;
int16_t y;
} vertexlump_t;
/* sidedef, defines wall appearance */
typedef struct {
int16_t xoff; // texture x offset
int16_t yoff; // texture y offset
char toptexture[8]; // top texture name
char bottomtexture[8]; // bottom texture name
char midtexture[8]; // middle texture name
int16_t sector; // sector number the wall is facing
} sidedeflump_t;
/* linedef, used for editing and input for BSP builder */
typedef struct {
int16_t v1; // start vertex
int16_t v2; // end vertex
int16_t flags; // flags
int16_t special; // special type
int16_t tag; // sector tag
int16_t sidenum[2]; // sidedefs, sidenum[1] = -1 if one sided
} linedeflump_t;
/* map sector, from editing */
typedef struct {
int16_t floorheight;
int16_t ceilingheight;
char floortexture[8]; // floor texture name
char ceilingtexture[8]; // ceiling texture name
int16_t lightlevel; // sector brightness
int16_t special; // sector properties (blink, player damage)
int16_t tag; // tag for actions specified in linedefs
} sectorlump_t;
/* subsectors as generated by BSP */
typedef struct {
int16_t numsegs; // number of line segments in subsector
int16_t firstseg; // index of first line segment, stored sequentially
} subsectorlump_t;
/* line segment, result of splitting linedefs with BSP splitter */
typedef struct {
int16_t v1; // start vertex
int16_t v2; // end vertex
int16_t angle; // seg angle
int16_t linedef; // linedef index this seg belongs to
int16_t side; // 0: right (front) side of linedef, 1: left (back) side
int16_t offset; // distance from start of linedef to start of seg
} seglump_t;
/* BSP node */
#define NF_SUBSECTOR 0x8000 // sign bit is used to indicate a leaf
typedef struct {
// partition line from (x,y) to (x+dx,y+dy)
int16_t x;
int16_t y;
int16_t dx;
int16_t dy;
// bounding box for each child
// each bounding box has top, bottom, left, right coordinates
int16_t bbox[2][4];
// child node indices
// if NF_SUBSECTOR is set the child is a leaf
uint16_t children[2];
} nodelump_t;
/* map thing (item, monster, player, ...) */
typedef struct {
int16_t x; // x position
int16_t y; // y position
int16_t angle; // angle facing
int16_t type; // thing type
int16_t flags; // skill/visibility flags
} thinglump_t;
#endif // W_LEVEL_LUMPS_H