]> icculus.org git repositories - theoddone33/hhexen.git/blob - include/xddefs.h
Round 1: $HOME/.hhexen/ for configs and savegames.
[theoddone33/hhexen.git] / include / xddefs.h
1
2 //**************************************************************************
3 //**
4 //** xddefs.h : Heretic 2 : Raven Software, Corp.
5 //**
6 //** $RCSfile$
7 //** $Revision$
8 //** $Date$
9 //** $Author$
10 //**
11 //**************************************************************************
12
13 #ifndef __XDDEFS__
14 #define __XDDEFS__
15
16 #ifndef __BYTEBOOL__
17 #define __BYTEBOOL__
18 #if defined(__cplusplus)
19 typedef bool boolean;
20 #else
21 typedef enum {false, true} boolean;
22 #endif
23 typedef unsigned char byte;
24 #endif
25
26 //--------------------------------------------------------------------------
27 //
28 // Map level types
29 //
30 //--------------------------------------------------------------------------
31
32 // lump order in a map wad
33 enum
34 {
35         ML_LABEL,
36         ML_THINGS,
37         ML_LINEDEFS,
38         ML_SIDEDEFS,
39         ML_VERTEXES,
40         ML_SEGS,
41         ML_SSECTORS,
42         ML_NODES,
43         ML_SECTORS,
44         ML_REJECT,
45         ML_BLOCKMAP,
46         ML_BEHAVIOR
47 };
48
49 typedef struct
50 {
51         short x;
52         short y;
53 } mapvertex_t;
54
55 typedef struct
56 {
57         short textureoffset;
58         short rowoffset;
59         char toptexture[8];
60         char bottomtexture[8];
61         char midtexture[8];
62         short sector; // on viewer's side
63 } mapsidedef_t;
64
65 typedef struct
66 {
67         short v1;
68         short v2;
69         short flags;
70         byte special;
71         byte arg1;
72         byte arg2;
73         byte arg3;
74         byte arg4;
75         byte arg5;
76         short sidenum[2]; // sidenum[1] will be -1 if one sided
77 } maplinedef_t;
78
79 #define ML_BLOCKING                     0x0001
80 #define ML_BLOCKMONSTERS        0x0002
81 #define ML_TWOSIDED                     0x0004
82 #define ML_DONTPEGTOP           0x0008
83 #define ML_DONTPEGBOTTOM        0x0010
84 #define ML_SECRET                       0x0020  // don't map as two sided: IT'S A SECRET!
85 #define ML_SOUNDBLOCK           0x0040  // don't let sound cross two of these
86 #define ML_DONTDRAW                     0x0080  // don't draw on the automap
87 #define ML_MAPPED                       0x0100  // set if already drawn in automap
88 #define ML_REPEAT_SPECIAL       0x0200  // special is repeatable
89 #define ML_SPAC_SHIFT           10
90 #define ML_SPAC_MASK            0x1c00
91 #define GET_SPAC(flags) ((flags&ML_SPAC_MASK)>>ML_SPAC_SHIFT)
92
93 // Special activation types
94 #define SPAC_CROSS              0       // when player crosses line
95 #define SPAC_USE                1       // when player uses line
96 #define SPAC_MCROSS             2       // when monster crosses line
97 #define SPAC_IMPACT             3       // when projectile hits line
98 #define SPAC_PUSH               4       // when player/monster pushes line
99 #define SPAC_PCROSS             5       // when projectile crosses line
100
101 typedef struct
102 {
103         short floorheight;
104         short ceilingheight;
105         char floorpic[8];
106         char ceilingpic[8];
107         short lightlevel;
108         short special;
109         short tag;
110 } mapsector_t;
111
112 typedef struct
113 {
114         short numsegs;
115         short firstseg; // segs are stored sequentially
116 } mapsubsector_t;
117
118 typedef struct
119 {
120         short v1;
121         short v2;
122         short angle;
123         short linedef;
124         short side;
125         short offset;
126 } mapseg_t;
127
128 enum
129 { // bbox coordinates
130         BOXTOP,
131         BOXBOTTOM,
132         BOXLEFT,
133         BOXRIGHT
134 };
135
136 #define NF_SUBSECTOR    0x8000
137 typedef struct
138 {
139         short           x,y,dx,dy;                      // partition line
140         short           bbox[2][4];                     // bounding box for each child
141         unsigned short  children[2];            // if NF_SUBSECTOR its a subsector
142 } mapnode_t;
143
144 typedef struct
145 {
146         short tid;
147         short x;
148         short y;
149         short height;
150         short angle;
151         short type;
152         short options;
153         byte special;
154         byte arg1;
155         byte arg2;
156         byte arg3;
157         byte arg4;
158         byte arg5;
159 } mapthing_t;
160
161 #define MTF_EASY                1
162 #define MTF_NORMAL              2
163 #define MTF_HARD                4
164 #define MTF_AMBUSH              8
165 #define MTF_DORMANT             16
166 #define MTF_FIGHTER             32
167 #define MTF_CLERIC              64
168 #define MTF_MAGE                128
169 #define MTF_GSINGLE             256
170 #define MTF_GCOOP               512
171 #define MTF_GDEATHMATCH 1024
172
173 //--------------------------------------------------------------------------
174 //
175 // Texture definition
176 //
177 //--------------------------------------------------------------------------
178
179 typedef struct
180 {
181         short   originx;
182         short   originy;
183         short   patch;
184         short   stepdir;
185         short   colormap;
186 } mappatch_t;
187
188 typedef struct
189 {
190         char            name[8];
191         boolean         masked; 
192         short           width;
193         short           height;
194         void            **columndirectory;      // OBSOLETE
195         short           patchcount;
196         mappatch_t      patches[1];
197 } maptexture_t;
198
199 //--------------------------------------------------------------------------
200 //
201 // Graphics
202 //
203 //--------------------------------------------------------------------------
204
205 // posts are runs of non masked source pixels
206 typedef struct
207 {
208         byte            topdelta;               // -1 is the last post in a column
209         byte            length;
210 // length data bytes follows
211 } post_t;
212
213 // column_t is a list of 0 or more post_t, (byte)-1 terminated
214 typedef post_t  column_t;
215
216 // a patch holds one or more columns
217 // patches are used for sprites and all masked pictures
218 typedef struct
219 {
220         short           width;                          // bounding box size
221         short           height;
222         short           leftoffset;                     // pixels to the left of origin
223         short           topoffset;                      // pixels below the origin
224         int                     columnofs[8];           // only [width] used
225                                                                         // the [0] is &columnofs[width]
226 } patch_t;
227
228 // a pic is an unmasked block of pixels
229 typedef struct
230 {
231         byte            width,height;
232         byte            data;
233 } pic_t;
234
235 #endif // __XDDEFS__