1 #include "config.h"
2 
3 #include <inttypes.h>
4 
5 /*- Doom Structures .. Colin Reed 1994 -------------------------------------*/
6 
7 struct wad_header 					/* Linked wad files list.*/
8 {
9 	char type[4];
10 	uint32_t num_entries;
11 	uint32_t dir_start;
12 } __attribute__((packed));
13 
14 struct directory 						/* The directory entry header*/
15 {
16 	uint32_t start;
17 	uint32_t length;
18 	char name[8];
19 } __attribute__((packed));
20 
21 struct Block
22 {
23 	int16_t minx;
24 	int16_t miny;
25 	int16_t xblocks;
26 	int16_t yblocks;
27 } __attribute__((packed));
28 
29 struct lumplist {
30  struct lumplist *next;
31  struct directory *dir;
32  void *data;
33  struct lumplist *level;
34 };
35 
36 /*- The level structures ---------------------------------------------------*/
37 
38 struct Thing
39 {
40    int16_t xpos;      /* x position */
41    int16_t ypos;      /* y position */
42    int16_t angle;     /* facing angle */
43    int16_t type;      /* thing type */
44    int16_t when;      /* appears when? */
45 } __attribute__((packed));
46 
47 struct Vertex
48 {
49    int16_t x;         /* X coordinate */
50    int16_t y;         /* Y coordinate */
51 } __attribute__((packed));
52 
53 struct LineDef
54 {
55    uint16_t start;     /* from this vertex ... */
56    uint16_t end;       /* ... to this vertex */
57    uint16_t flags;     /* see NAMES.C for more info */
58    uint16_t type;      /* see NAMES.C for more info */
59    uint16_t tag;       /* crossing this linedef activates the sector with the same tag */
60    int16_t sidedef1;  /* sidedef */
61    int16_t sidedef2;  /* only if this line adjoins 2 sectors */
62 } __attribute__((packed));
63 
64 struct SideDef
65 {
66    int16_t xoff;      /* X offset for texture */
67    int16_t yoff;      /* Y offset for texture */
68    char tex1[8];  /* texture name for the part above */
69    char tex2[8];  /* texture name for the part below */
70    char tex3[8];  /* texture name for the regular part */
71    int16_t sector;    /* adjacent sector */
72 } __attribute__((packed));
73 
74 struct Sector
75 {
76    int16_t floorh;    /* floor height */
77    int16_t ceilh;     /* ceiling height */
78    char floort[8];/* floor texture */
79    char ceilt[8]; /* ceiling texture */
80    int16_t light;     /* light level (0-255) */
81    int16_t special;   /* special behaviour (0 = normal, 9 = secret, ...) */
82    int16_t tag;       /* sector activated by a linedef with the same tag */
83 } __attribute__((packed));
84 
85 /*--------------------------------------------------------------------------*/
86 /* These are the structure used for creating the NODE bsp tree.             */
87 /*--------------------------------------------------------------------------*/
88 
89 struct Seg
90 {
91    short int start;     /* from this vertex ... */
92    short int end;       /* ... to this vertex */
93    unsigned short angle;/* angle (0 = east, 16384 = north, ...) */
94    short int linedef;   /* linedef that this seg goes along*/
95    short int flip;      /* true if not the same direction as linedef */
96    unsigned short dist; /* distance from starting point */
97 	struct Seg *next;
98         short psx,psy,pex,pey;  /* Start, end coordinates */
99         long pdx,pdy,ptmp;      /* Used in intersection calculations */
100         long len;
101         short sector;
102 } __attribute__((packed));
103 
104 struct Pseg
105 {
106    short int start;     /* from this vertex ... */
107    short int end;       /* ... to this vertex */
108    unsigned short angle;/* angle (0 = east, 16384 = north, ...) */
109    short int linedef;   /* linedef that this seg goes along*/
110    short int flip;      /* true if not the same direction as linedef */
111    unsigned short dist; /* distance from starting point */
112 } __attribute__((packed));
113 
114 /* cph - dedicated type for bounding boxes, as in the Doom source */
115 typedef int16_t bbox_t[4];
116 enum { BB_TOP, BB_BOTTOM, BB_LEFT, BB_RIGHT };
117 
118 struct Node
119 {
120    int16_t x, y;			/* starting point*/
121    int16_t dx, dy;			/* offset to ending point*/
122    bbox_t rightbox;			/* bounding rectangle 1*/
123    bbox_t leftbox;			/* bounding rectangle 2*/
124    int16_t chright, chleft;		/* Node or SSector (if high bit is set)*/
125 	struct Node *nextr,*nextl;
126 	int16_t node_num;	        		/* starting at 0 (but reversed when done)*/
127         long ptmp;
128 } __attribute__((packed));
129 
130 struct Pnode
131 {
132    int16_t x, y;		/* starting point*/
133    int16_t dx, dy;		/* offset to ending point*/
134    bbox_t rightbox;		/* bounding rectangle 1*/
135    bbox_t leftbox;		/* bounding rectangle 2*/
136    int16_t chright, chleft;	/* Node or SSector (if high bit is set)*/
137 } __attribute__((packed));
138 
139 struct SSector
140 {
141    uint16_t num;       /* number of Segs in this Sub-Sector */
142    uint16_t first;     /* first Seg */
143 } __attribute__((packed));
144 
145 /*--------------------------------------------------------------------------*/
146