-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstructs.h
145 lines (125 loc) · 4.47 KB
/
structs.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
#include "config.h"
#include <inttypes.h>
/*- Doom Structures .. Colin Reed 1994 -------------------------------------*/
struct wad_header /* Linked wad files list.*/
{
char type[4];
uint32_t num_entries;
uint32_t dir_start;
} __attribute__((packed));
struct directory /* The directory entry header*/
{
uint32_t start;
uint32_t length;
char name[8];
} __attribute__((packed));
struct Block
{
int16_t minx;
int16_t miny;
int16_t xblocks;
int16_t yblocks;
} __attribute__((packed));
struct lumplist {
struct lumplist *next;
struct directory *dir;
void *data;
struct lumplist *level;
};
/*- The level structures ---------------------------------------------------*/
struct Thing
{
int16_t xpos; /* x position */
int16_t ypos; /* y position */
int16_t angle; /* facing angle */
int16_t type; /* thing type */
int16_t when; /* appears when? */
} __attribute__((packed));
struct Vertex
{
int16_t x; /* X coordinate */
int16_t y; /* Y coordinate */
} __attribute__((packed));
struct LineDef
{
uint16_t start; /* from this vertex ... */
uint16_t end; /* ... to this vertex */
uint16_t flags; /* see NAMES.C for more info */
uint16_t type; /* see NAMES.C for more info */
uint16_t tag; /* crossing this linedef activates the sector with the same tag */
int16_t sidedef1; /* sidedef */
int16_t sidedef2; /* only if this line adjoins 2 sectors */
} __attribute__((packed));
struct SideDef
{
int16_t xoff; /* X offset for texture */
int16_t yoff; /* Y offset for texture */
char tex1[8]; /* texture name for the part above */
char tex2[8]; /* texture name for the part below */
char tex3[8]; /* texture name for the regular part */
int16_t sector; /* adjacent sector */
} __attribute__((packed));
struct Sector
{
int16_t floorh; /* floor height */
int16_t ceilh; /* ceiling height */
char floort[8];/* floor texture */
char ceilt[8]; /* ceiling texture */
int16_t light; /* light level (0-255) */
int16_t special; /* special behaviour (0 = normal, 9 = secret, ...) */
int16_t tag; /* sector activated by a linedef with the same tag */
} __attribute__((packed));
/*--------------------------------------------------------------------------*/
/* These are the structure used for creating the NODE bsp tree. */
/*--------------------------------------------------------------------------*/
struct Seg
{
short int start; /* from this vertex ... */
short int end; /* ... to this vertex */
unsigned short angle;/* angle (0 = east, 16384 = north, ...) */
short int linedef; /* linedef that this seg goes along*/
short int flip; /* true if not the same direction as linedef */
unsigned short dist; /* distance from starting point */
struct Seg *next;
short psx,psy,pex,pey; /* Start, end coordinates */
long pdx,pdy,ptmp; /* Used in intersection calculations */
long len;
short sector;
} __attribute__((packed));
struct Pseg
{
short int start; /* from this vertex ... */
short int end; /* ... to this vertex */
unsigned short angle;/* angle (0 = east, 16384 = north, ...) */
short int linedef; /* linedef that this seg goes along*/
short int flip; /* true if not the same direction as linedef */
unsigned short dist; /* distance from starting point */
} __attribute__((packed));
/* cph - dedicated type for bounding boxes, as in the Doom source */
typedef int16_t bbox_t[4];
enum { BB_TOP, BB_BOTTOM, BB_LEFT, BB_RIGHT };
struct Node
{
int16_t x, y; /* starting point*/
int16_t dx, dy; /* offset to ending point*/
bbox_t rightbox; /* bounding rectangle 1*/
bbox_t leftbox; /* bounding rectangle 2*/
int16_t chright, chleft; /* Node or SSector (if high bit is set)*/
struct Node *nextr,*nextl;
int16_t node_num; /* starting at 0 (but reversed when done)*/
long ptmp;
} __attribute__((packed));
struct Pnode
{
int16_t x, y; /* starting point*/
int16_t dx, dy; /* offset to ending point*/
bbox_t rightbox; /* bounding rectangle 1*/
bbox_t leftbox; /* bounding rectangle 2*/
int16_t chright, chleft; /* Node or SSector (if high bit is set)*/
} __attribute__((packed));
struct SSector
{
uint16_t num; /* number of Segs in this Sub-Sector */
uint16_t first; /* first Seg */
} __attribute__((packed));
/*--------------------------------------------------------------------------*/