Debian Codegraph @

prboom2/src/dsda/udmf.h

raw
1 //
2 // Copyright(C) 2022 by Ryan Krafnick
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // DESCRIPTION:
15 // DSDA UDMF
16 //
17
18 #ifndef __DSDA_UDMF__
19 #define __DSDA_UDMF__
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 #include <inttypes.h>
26
27 #define UDMF_ML_BLOCKING 0x0000000000000001ull
28 #define UDMF_ML_BLOCKMONSTERS 0x0000000000000002ull
29 #define UDMF_ML_TWOSIDED 0x0000000000000004ull
30 #define UDMF_ML_DONTPEGTOP 0x0000000000000008ull
31 #define UDMF_ML_DONTPEGBOTTOM 0x0000000000000010ull
32 #define UDMF_ML_SECRET 0x0000000000000020ull
33 #define UDMF_ML_SOUNDBLOCK 0x0000000000000040ull
34 #define UDMF_ML_DONTDRAW 0x0000000000000080ull
35 #define UDMF_ML_MAPPED 0x0000000000000100ull
36 #define UDMF_ML_PASSUSE 0x0000000000000200ull
37 #define UDMF_ML_TRANSLUCENT 0x0000000000000400ull
38 #define UDMF_ML_JUMPOVER 0x0000000000000800ull
39 #define UDMF_ML_BLOCKFLOATERS 0x0000000000001000ull
40 #define UDMF_ML_PLAYERCROSS 0x0000000000002000ull
41 #define UDMF_ML_PLAYERUSE 0x0000000000004000ull
42 #define UDMF_ML_MONSTERCROSS 0x0000000000008000ull
43 #define UDMF_ML_MONSTERUSE 0x0000000000010000ull
44 #define UDMF_ML_IMPACT 0x0000000000020000ull
45 #define UDMF_ML_PLAYERPUSH 0x0000000000040000ull
46 #define UDMF_ML_MONSTERPUSH 0x0000000000080000ull
47 #define UDMF_ML_MISSILECROSS 0x0000000000100000ull
48 #define UDMF_ML_REPEATSPECIAL 0x0000000000200000ull
49 #define UDMF_ML_PLAYERUSEBACK 0x0000000000400000ull
50 #define UDMF_ML_ANYCROSS 0x0000000000800000ull
51 #define UDMF_ML_MONSTERACTIVATE 0x0000000001000000ull
52 #define UDMF_ML_BLOCKPLAYERS 0x0000000002000000ull
53 #define UDMF_ML_BLOCKEVERYTHING 0x0000000004000000ull
54 #define UDMF_ML_FIRSTSIDEONLY 0x0000000008000000ull
55 #define UDMF_ML_ZONEBOUNDARY 0x0000000010000000ull
56 #define UDMF_ML_CLIPMIDTEX 0x0000000020000000ull
57 #define UDMF_ML_WRAPMIDTEX 0x0000000040000000ull
58 #define UDMF_ML_MIDTEX3D 0x0000000080000000ull
59 #define UDMF_ML_MIDTEX3DIMPASSIBLE 0x0000000100000000ull
60 #define UDMF_ML_CHECKSWITCHRANGE 0x0000000200000000ull
61 #define UDMF_ML_BLOCKPROJECTILES 0x0000000400000000ull
62 #define UDMF_ML_BLOCKUSE 0x0000000800000000ull
63 #define UDMF_ML_BLOCKSIGHT 0x0000001000000000ull
64 #define UDMF_ML_BLOCKHITSCAN 0x0000002000000000ull
65 #define UDMF_ML_TRANSPARENT 0x0000004000000000ull
66 #define UDMF_ML_REVEALED 0x0000008000000000ull
67 #define UDMF_ML_NOSKYWALLS 0x0000010000000000ull
68 #define UDMF_ML_DRAWFULLHEIGHT 0x0000020000000000ull
69 #define UDMF_ML_DAMAGESPECIAL 0x0000040000000000ull
70 #define UDMF_ML_DEATHSPECIAL 0x0000080000000000ull
71 #define UDMF_ML_BLOCKLANDMONSTERS 0x0000100000000000ull
72
73 typedef uint64_t udmf_line_flags_t;
74
75 typedef struct {
76 int id;
77 char* moreids;
78 int v1;
79 int v2;
80 int special;
81 int arg0;
82 int arg1;
83 int arg2;
84 int arg3;
85 int arg4;
86 char* arg0str;
87 int sidefront;
88 int sideback;
89 float alpha;
90 int locknumber;
91 int automapstyle;
92 int health;
93 int healthgroup;
94 udmf_line_flags_t flags;
95 } udmf_line_t;
96
97 #define UDMF_SF_LIGHTABSOLUTE 0x0001
98 #define UDMF_SF_LIGHTFOG 0x0002
99 #define UDMF_SF_NOFAKECONTRAST 0x0004
100 #define UDMF_SF_SMOOTHLIGHTING 0x0008
101 #define UDMF_SF_CLIPMIDTEX 0x0010
102 #define UDMF_SF_WRAPMIDTEX 0x0020
103 #define UDMF_SF_NODECALS 0x0040
104 #define UDMF_SF_LIGHTABSOLUTETOP 0x0080
105 #define UDMF_SF_LIGHTABSOLUTEMID 0x0100
106 #define UDMF_SF_LIGHTABSOLUTEBOTTOM 0x0200
107
108 typedef uint16_t udmf_side_flags_t;
109
110 typedef struct {
111 int offsetx;
112 int offsety;
113 char texturetop[9];
114 char texturebottom[9];
115 char texturemiddle[9];
116 int sector;
117 float scalex_top;
118 float scaley_top;
119 float scalex_mid;
120 float scaley_mid;
121 float scalex_bottom;
122 float scaley_bottom;
123 float offsetx_top;
124 float offsety_top;
125 float offsetx_mid;
126 float offsety_mid;
127 float offsetx_bottom;
128 float offsety_bottom;
129 int light;
130 int light_top;
131 int light_mid;
132 int light_bottom;
133 float xscroll;
134 float yscroll;
135 float xscrolltop;
136 float yscrolltop;
137 float xscrollmid;
138 float yscrollmid;
139 float xscrollbottom;
140 float yscrollbottom;
141 udmf_side_flags_t flags;
142 } udmf_side_t;
143
144 typedef struct {
145 const char* x;
146 const char* y;
147 } udmf_vertex_t;
148
149 #define UDMF_SECF_LIGHTFLOORABSOLUTE 0x0001
150 #define UDMF_SECF_LIGHTCEILINGABSOLUTE 0x0002
151 #define UDMF_SECF_SILENT 0x0004
152 #define UDMF_SECF_NOFALLINGDAMAGE 0x0008
153 #define UDMF_SECF_DROPACTORS 0x0010
154 #define UDMF_SECF_NORESPAWN 0x0020
155 #define UDMF_SECF_HIDDEN 0x0040
156 #define UDMF_SECF_WATERZONE 0x0080
157 #define UDMF_SECF_DAMAGETERRAINEFFECT 0x0100
158 #define UDMF_SECF_DAMAGEHAZARD 0x0200
159 #define UDMF_SECF_NOATTACK 0x0400
160
161 #define UDMF_SCROLL_TEXTURE 0x01
162 #define UDMF_SCROLL_STATIC 0x02
163 #define UDMF_SCROLL_PLAYER 0x04
164 #define UDMF_SCROLL_MONSTER 0x08
165
166 #define UDMF_THRUST_STATIC 0x01
167 #define UDMF_THRUST_PLAYER 0x02
168 #define UDMF_THRUST_MONSTER 0x04
169 #define UDMF_THRUST_PROJECTILE 0x08
170 #define UDMF_THRUST_GROUNDED 0x10
171 #define UDMF_THRUST_AIRBORNE 0x20
172 #define UDMF_THRUST_CEILING 0x40
173 #define UDMF_THRUST_WINDTHRUST 0x80
174
175 typedef uint16_t udmf_sector_flags_t;
176
177 typedef struct {
178 int heightfloor;
179 int heightceiling;
180 char texturefloor[9];
181 char textureceiling[9];
182 int lightlevel;
183 int special;
184 int id;
185 char* skyfloor;
186 char* skyceiling;
187 char* colormap;
188 char* moreids;
189 float xpanningfloor;
190 float ypanningfloor;
191 float xpanningceiling;
192 float ypanningceiling;
193 float xscalefloor;
194 float yscalefloor;
195 float xscaleceiling;
196 float yscaleceiling;
197 float rotationfloor;
198 float rotationceiling;
199 int lightfloor;
200 int lightceiling;
201 const char* gravity;
202 int damageamount;
203 int damageinterval;
204 int leakiness;
205 float xscrollfloor;
206 float yscrollfloor;
207 int scrollfloormode;
208 float xscrollceiling;
209 float yscrollceiling;
210 int scrollceilingmode;
211 char* xthrust;
212 char* ythrust;
213 int thrustgroup;
214 int thrustlocation;
215 char* frictionfactor;
216 char* movefactor;
217 udmf_sector_flags_t flags;
218 } udmf_sector_t;
219
220 #define UDMF_TF_SKILL1 0x00000001
221 #define UDMF_TF_SKILL2 0x00000002
222 #define UDMF_TF_SKILL3 0x00000004
223 #define UDMF_TF_SKILL4 0x00000008
224 #define UDMF_TF_SKILL5 0x00000010
225 #define UDMF_TF_AMBUSH 0x00000020
226 #define UDMF_TF_SINGLE 0x00000040
227 #define UDMF_TF_DM 0x00000080
228 #define UDMF_TF_COOP 0x00000100
229 #define UDMF_TF_FRIEND 0x00000200
230 #define UDMF_TF_DORMANT 0x00000400
231 #define UDMF_TF_CLASS1 0x00000800
232 #define UDMF_TF_CLASS2 0x00001000
233 #define UDMF_TF_CLASS3 0x00002000
234 #define UDMF_TF_STANDING 0x00004000
235 #define UDMF_TF_STRIFEALLY 0x00008000
236 #define UDMF_TF_TRANSLUCENT 0x00010000
237 #define UDMF_TF_INVISIBLE 0x00020000
238 #define UDMF_TF_COUNTSECRET 0x00040000
239
240 typedef uint32_t udmf_thing_flags_t;
241
242 typedef struct {
243 int id;
244 const char* x;
245 const char* y;
246 const char* height;
247 int angle;
248 int type;
249 int special;
250 int arg0;
251 int arg1;
252 int arg2;
253 int arg3;
254 int arg4;
255 char* arg0str;
256 const char* gravity;
257 const char* health;
258 float scalex;
259 float scaley;
260 float scale;
261 float alpha;
262 int floatbobphase;
263 udmf_thing_flags_t flags;
264 } udmf_thing_t;
265
266 typedef struct {
267 size_t num_lines;
268 udmf_line_t* lines;
269
270 size_t num_sides;
271 udmf_side_t* sides;
272
273 size_t num_vertices;
274 udmf_vertex_t* vertices;
275
276 size_t num_sectors;
277 udmf_sector_t* sectors;
278
279 size_t num_things;
280 udmf_thing_t* things;
281 } udmf_t;
282
283 extern udmf_t udmf;
284
285 typedef void (*udmf_errorfunc)(const char *fmt, ...); // this must not return!
286
287 void dsda_ParseUDMF(const unsigned char* buffer, size_t length, udmf_errorfunc err);
288
289 #ifdef __cplusplus
290 }
291 #endif
292
293 #endif