]> icculus.org git repositories - theoddone33/hheretic.git/blob - include/doomdata.h
967c7efbb047b69ce66fad1e6130c44828836f4c
[theoddone33/hheretic.git] / include / doomdata.h
1 // DoomData.h
2
3 // all external data is defined here
4 // most of the data is loaded into different structures at run time
5
6 #ifndef __DOOMDATA__
7 #define __DOOMDATA__
8
9 #ifndef __BYTEBOOL__
10 #define __BYTEBOOL__
11 typedef enum {false, true} boolean;
12 typedef unsigned char byte;
13 #endif
14
15 /*
16 ===============================================================================
17
18                                                 map level types
19
20 ===============================================================================
21 */
22
23 // lump order in a map wad
24 enum {ML_LABEL, ML_THINGS, ML_LINEDEFS, ML_SIDEDEFS, ML_VERTEXES, ML_SEGS,
25 ML_SSECTORS, ML_NODES, ML_SECTORS , ML_REJECT, ML_BLOCKMAP};
26
27
28 typedef struct
29 {
30         short           x,y;
31 } mapvertex_t;
32
33 typedef struct
34 {
35         short           textureoffset;
36         short           rowoffset;
37         char            toptexture[8], bottomtexture[8], midtexture[8];
38         short           sector;                         // on viewer's side
39 } mapsidedef_t;
40
41 typedef struct
42 {
43         short           v1, v2;
44         short           flags;
45         short           special, tag;
46         short           sidenum[2];                     // sidenum[1] will be -1 if one sided
47 } maplinedef_t;
48
49 #define ML_BLOCKING                     1
50 #define ML_BLOCKMONSTERS        2
51 #define ML_TWOSIDED                     4               // backside will not be present at all 
52                                                                         // if not two sided
53
54 // if a texture is pegged, the texture will have the end exposed to air held
55 // constant at the top or bottom of the texture (stairs or pulled down things)
56 // and will move with a height change of one of the neighbor sectors
57 // Unpegged textures allways have the first row of the texture at the top
58 // pixel of the line for both top and bottom textures (windows)
59 #define ML_DONTPEGTOP           8
60 #define ML_DONTPEGBOTTOM        16
61
62 #define ML_SECRET                       32      // don't map as two sided: IT'S A SECRET!
63 #define ML_SOUNDBLOCK           64      // don't let sound cross two of these
64 #define ML_DONTDRAW                     128     // don't draw on the automap
65 #define ML_MAPPED                       256     // set if allready drawn in automap
66
67
68 typedef struct
69 {
70         short           floorheight, ceilingheight;
71         char            floorpic[8], ceilingpic[8];
72         short           lightlevel;
73         short           special, tag;
74 } mapsector_t;
75
76 typedef struct
77 {
78         short           numsegs;
79         short           firstseg;                       // segs are stored sequentially
80 } mapsubsector_t;
81
82 typedef struct
83 {
84         short           v1, v2;
85         short           angle;          
86         short           linedef, side;
87         short           offset;
88 } mapseg_t;
89
90 enum {BOXTOP,BOXBOTTOM,BOXLEFT,BOXRIGHT};       // bbox coordinates
91
92 #define NF_SUBSECTOR    0x8000
93 typedef struct
94 {
95         short           x,y,dx,dy;                      // partition line
96         short           bbox[2][4];                     // bounding box for each child
97         unsigned short  children[2];            // if NF_SUBSECTOR its a subsector
98 } mapnode_t;
99
100 typedef struct
101 {
102         short           x,y;
103         short           angle;
104         short           type;
105         short           options;
106 } mapthing_t;
107
108 #define MTF_EASY                1
109 #define MTF_NORMAL              2
110 #define MTF_HARD                4
111 #define MTF_AMBUSH              8
112
113 /*
114 ===============================================================================
115
116                                                 texture definition
117
118 ===============================================================================
119 */
120
121 typedef struct
122 {
123         short   originx;
124         short   originy;
125         short   patch;
126         short   stepdir;
127         short   colormap;
128 } mappatch_t;
129
130 typedef struct
131 {
132         char            name[8];
133         boolean         masked; 
134         short           width;
135         short           height;
136         void            **columndirectory;      // OBSOLETE
137         short           patchcount;
138         mappatch_t      patches[1];
139 } maptexture_t;
140
141
142 /*
143 ===============================================================================
144
145                                                         graphics
146
147 ===============================================================================
148 */
149
150 // posts are runs of non masked source pixels
151 typedef struct
152 {
153         byte            topdelta;               // -1 is the last post in a column
154         byte            length;
155 // length data bytes follows
156 } post_t;
157
158 // column_t is a list of 0 or more post_t, (byte)-1 terminated
159 typedef post_t  column_t;
160
161 // a patch holds one or more columns
162 // patches are used for sprites and all masked pictures
163 typedef struct
164 {
165         short           width;                          // bounding box size
166         short           height;
167         short           leftoffset;                     // pixels to the left of origin
168         short           topoffset;                      // pixels below the origin
169         int                     columnofs[8];           // only [width] used
170                                                                         // the [0] is &columnofs[width]
171 } patch_t;
172
173 // a pic is an unmasked block of pixels
174 typedef struct
175 {
176         byte            width,height;
177         byte            data;
178 } pic_t;
179
180
181
182
183 /*
184 ===============================================================================
185
186                                                         status
187
188 ===============================================================================
189 */
190
191
192
193
194 #endif                  // __DOOMDATA__
195