445c2d809852116f20fb3b388d65e0d0abe35b2d
1 // yes, this file serves both as format description and as template for code generation
2 // the engine will use this description to populate the corresponding records from MAP*.pas
3 // also, the engine will keep the loaded map as a list of these structures
5 // notes:
6 // field without offset is not in binary format
7 // fields with `omitdefault` won't be written when they contain default values
8 // fields with `internal` won't be written to any file ever (and won't be read)
9 // `ubyte` is unsigned byte, and `byte` is signed byte
10 // all strings are in utf-8
11 // struct named "mapheader" will contain all other structs and it's own fields
12 // as top-level entities
13 // in binary, `size` is two ushorts
14 // `as xy` will use `X` and `Y` for points
15 // `as txy` will use `tX` and `tY` for points
16 // `as wh` will use `Width` and `Height` for size
17 // `as twh` will use `tWidth` and `tHeight` for size
20 ////////////////////////////////////////////////////////////////////////////////
21 // main blocks
22 TMapHeaderRec_1 is "map" size 452 bytes header {
23 //_ is "version" type uint minvalue 1 maxvalue 1;
24 MapName is "name" type char[32] offset 0;
25 MapAuthor is "author" type char[32] offset 32 default "" omitdefault;
26 MapDescription is "description" type char[256] offset 64 default "" omitdefault;
27 MusicName is "music" type char[64] offset 320 default 'Standart.wad:D2DMUS\ПРОСТОТА' omitdefault;
28 SkyName is "sky" type char[64] offset 384 default 'Standart.wad:D2DSKY\RSKY1' omitdefault;
29 //Width is "width" type ushort offset 448;
30 //Height is "height" type ushort offset 450;
31 Size is "size" type size offset 448 as wh;
32 // not in binary
33 Title is "title" type string default "" omitdefault;
34 }
36 TTextureRec_1 is "texture" size 65 bytes {
37 Resource is "path" type char[64] offset 0;
38 Anim is "animated" type bool offset 64 default false omitdefault;
39 // internals
40 TexIdx is "texidx" type uint internal;
41 }
43 TPanelRec_1 is "panel" size 18 bytes {
44 //X is "x" type int offset 0;
45 //Y is "y" type int offset 4;
46 Pos is "position" type point offset 0 as xy;
47 //Width is "width" type ushort offset 8;
48 //Height is "height" type ushort offset 10;
49 Size is "size" type size offset 8 as wh as wh;
50 TextureNum is "texture" type ushort offset 12 texture;
51 PanelType is "type" type ushort offset 14 bitset unique PanelType;
52 Alpha is "alpha" type ubyte offset 16 default 0 omitdefault;
53 Flags is "flags" type ubyte offset 17 bitset PanelFlag default PANEL_FLAG_NONE omitdefault;
54 // not in binary
55 //Id is "id" type string default "" omitdefault;
56 // internals
57 PanIdx is "panidx" type uint internal;
58 }
60 TItemRec_1 is "item" size 10 bytes {
61 //X is "x" type int offset 0;
62 //Y is "y" type int offset 4;
63 Pos is "position" type point offset 0 as xy;
64 ItemType is "type" type ubyte offset 8 enum Item;
65 Options is "options" type ubyte offset 9 bitset ItemOption default ITEM_OPTION_NONE omitdefault;
66 // not in binary
67 //Id is "id" type string default "" omitdefault;
68 // internals
69 ItemIdx is "itemidx" type uint internal;
70 }
72 TMonsterRec_1 is "monster" size 10 bytes {
73 //X is "x" type int offset 0;
74 //Y is "y" type int offset 4;
75 Pos is "position" type point offset 0 as xy;
76 MonsterType is "type" type ubyte offset 8 enum Monster;
77 Direction is "direction" type ubyte offset 9 enum DirType default DIR_LEFT omitdefault;
78 // not in binary
79 //Id is "id" type string default "" omitdefault;
80 // internals
81 MonsIdx is "monsidx" type uint internal;
82 }
84 TAreaRec_1 is "area" size 10 bytes {
85 //X is "x" type int offset 0;
86 //Y is "y" type int offset 4;
87 Pos is "position" type point offset 0 as xy;
88 AreaType is "type" type ubyte offset 8 enum AreaType;
89 Direction is "direction" type ubyte offset 9 enum DirType default DIR_LEFT omitdefault;
90 // not in binary
91 //Id is "id" type string default "" omitdefault;
92 // internals
93 AreaIdx is "areaidx" type uint internal;
94 }
96 TTriggerRec_1 is "trigger" size 148 bytes {
97 //X is "x" type int offset 0;
98 //Y is "y" type int offset 4;
99 Pos is "position" type point offset 0 as xy;
100 //Width is "width" type ushort offset 8;
101 //Height is "height" type ushort offset 10;
102 Size is "size" type size offset 8 as wh;
103 Enabled is "enabled" type bool offset 12 default true omitdefault;
104 TexturePanel is "texturepanel" type int offset 13 panel default null omitdefault;
105 TriggerType is "type" type ubyte offset 17 enum TriggerType;
106 ActivateType is "activatetype" type ubyte offset 18 bitset ActivateType;
107 Keys is "keys" type ubyte offset 19 bitset Key default KEY_NONE omitdefault;
108 DATA is "triggerdata" type byte[128] offset 20 triggerdata; // the only special nested structure
109 // not in binary
110 //Id is "id" type string default "" omitdefault;
111 // internals
112 TrigIdx is "trigidx" type uint internal;
113 }
116 ////////////////////////////////////////////////////////////////////////////////
117 /*
118 enum {
119 TEXTURE_NAME_WATER = '_water_0',
120 TEXTURE_NAME_ACID1 = '_water_1',
121 TEXTURE_NAME_ACID2 = '_water_2',
122 }
123 */
125 enum TextureSpecial {
126 TEXTURE_SPECIAL_WATER = -1,
127 TEXTURE_SPECIAL_ACID1 = -2,
128 TEXTURE_SPECIAL_ACID2 = -3,
129 TEXTURE_NONE = -4,
130 }
132 // directions
133 enum DirType {
134 DIR_LEFT, // 0
135 DIR_RIGHT, // 1
136 }
138 // triggers
139 enum TriggerType {
140 TRIGGER_NONE, // 0
141 TRIGGER_EXIT, // 1
142 TRIGGER_TELEPORT, // 2
143 TRIGGER_OPENDOOR, // 3
144 TRIGGER_CLOSEDOOR, // 4
145 TRIGGER_DOOR, // 5
146 TRIGGER_DOOR5, // 6
147 TRIGGER_CLOSETRAP, // 7
148 TRIGGER_TRAP, // 8
149 TRIGGER_PRESS, // 9
150 TRIGGER_SECRET, // 10
151 TRIGGER_LIFTUP, // 11
152 TRIGGER_LIFTDOWN, // 12
153 TRIGGER_LIFT, // 13
154 TRIGGER_TEXTURE, // 14
155 TRIGGER_ON, // 15
156 TRIGGER_OFF, // 16
157 TRIGGER_ONOFF, // 17
158 TRIGGER_SOUND, // 18
159 TRIGGER_SPAWNMONSTER, // 19
160 TRIGGER_SPAWNITEM, // 20
161 TRIGGER_MUSIC, // 21
162 TRIGGER_PUSH, // 22
163 TRIGGER_SCORE, // 23
164 TRIGGER_MESSAGE, // 24
165 TRIGGER_DAMAGE, // 25
166 TRIGGER_HEALTH, // 26
167 TRIGGER_SHOT, // 27
168 TRIGGER_EFFECT, // 28
169 TRIGGER_SCRIPT, // 29
170 //
171 TRIGGER_MAX = MAX,
172 }
174 // "as XXX" means "generate this identifier for pascal sources
175 bitset PanelType {
176 PANEL_NONE = 0, // 0
177 PANEL_WALL, // 1
178 PANEL_BACK, // 2
179 PANEL_FORE, // 4
180 PANEL_WATER, // 8
181 PANEL_ACID1, // 16
182 PANEL_ACID2, // 32
183 PANEL_STEP, // 64
184 PANEL_LIFTUP, // 128
185 PANEL_LIFTDOWN, // 256
186 PANEL_OPENDOOR, // 512
187 PANEL_CLOSEDOOR, // 1024
188 PANEL_BLOCKMON, // 2048
189 PANEL_LIFTLEFT, // 4096
190 PANEL_LIFTRIGHT, // 8192
191 }
193 bitset PanelFlag {
194 PANEL_FLAG_NONE = 0, // 0
195 PANEL_FLAG_BLENDING, // 1
196 PANEL_FLAG_HIDE, // 2
197 PANEL_FLAG_WATERTEXTURES, // 4
198 }
200 enum EffectAction {
201 EFFECT_NONE, // 0
202 EFFECT_TELEPORT, // 1
203 EFFECT_RESPAWN, // 2
204 EFFECT_FIRE, // 3
205 }
207 enum Item {
208 ITEM_NONE, // 0
209 ITEM_MEDKIT_SMALL, // 1
210 ITEM_MEDKIT_LARGE, // 2
211 ITEM_MEDKIT_BLACK, // 3
212 ITEM_ARMOR_GREEN, // 4
213 ITEM_ARMOR_BLUE, // 5
214 ITEM_SPHERE_BLUE, // 6
215 ITEM_SPHERE_WHITE, // 7
216 ITEM_SUIT, // 8
217 ITEM_OXYGEN, // 9
218 ITEM_INVUL, // 10
219 ITEM_WEAPON_SAW, // 11
220 ITEM_WEAPON_SHOTGUN1, // 12
221 ITEM_WEAPON_SHOTGUN2, // 13
222 ITEM_WEAPON_CHAINGUN, // 14
223 ITEM_WEAPON_ROCKETLAUNCHER, // 15
224 ITEM_WEAPON_PLASMA, // 16
225 ITEM_WEAPON_BFG, // 17
226 ITEM_WEAPON_SUPERPULEMET, // 18
227 ITEM_AMMO_BULLETS, // 19
228 ITEM_AMMO_BULLETS_BOX, // 20
229 ITEM_AMMO_SHELLS, // 21
230 ITEM_AMMO_SHELLS_BOX, // 22
231 ITEM_AMMO_ROCKET, // 23
232 ITEM_AMMO_ROCKET_BOX, // 24
233 ITEM_AMMO_CELL, // 25
234 ITEM_AMMO_CELL_BIG, // 26
235 ITEM_AMMO_BACKPACK, // 27
236 ITEM_KEY_RED, // 28
237 ITEM_KEY_GREEN, // 29
238 ITEM_KEY_BLUE, // 30
239 ITEM_WEAPON_KASTET, // 31
240 ITEM_WEAPON_PISTOL, // 32
241 ITEM_BOTTLE, // 33
242 ITEM_HELMET, // 34
243 ITEM_JETPACK, // 35
244 ITEM_INVIS, // 36
245 ITEM_WEAPON_FLAMETHROWER, // 37
246 ITEM_AMMO_FUELCAN, // 38
247 //
248 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
249 }
251 bitset ItemOption {
252 ITEM_OPTION_NONE = 0, // 0
253 ITEM_OPTION_ONLYDM, // 1
254 ITEM_OPTION_FALL, // 2
255 }
257 enum AreaType {
258 AREA_NONE, // 0
259 AREA_PLAYERPOINT1, // 1
260 AREA_PLAYERPOINT2, // 2
261 AREA_DMPOINT, // 3
262 AREA_REDFLAG, // 4
263 AREA_BLUEFLAG, // 5
264 AREA_DOMFLAG, // 6
265 AREA_REDTEAMPOINT, // 7
266 AREA_BLUETEAMPOINT, // 8
267 }
269 enum Monster {
270 MONSTER_NONE, // 0
271 MONSTER_DEMON, // 1
272 MONSTER_IMP, // 2
273 MONSTER_ZOMBY, // 3
274 MONSTER_SERG, // 4
275 MONSTER_CYBER, // 5
276 MONSTER_CGUN, // 6
277 MONSTER_BARON, // 7
278 MONSTER_KNIGHT, // 8
279 MONSTER_CACO, // 9
280 MONSTER_SOUL, // 10
281 MONSTER_PAIN, // 11
282 MONSTER_SPIDER, // 12
283 MONSTER_BSP, // 13
284 MONSTER_MANCUB, // 14
285 MONSTER_SKEL, // 15
286 MONSTER_VILE, // 16
287 MONSTER_FISH, // 17
288 MONSTER_BARREL, // 18
289 MONSTER_ROBO, // 19
290 MONSTER_MAN, // 20
291 }
293 enum TriggerShot {
294 TRIGGER_SHOT_PISTOL, // 0
295 TRIGGER_SHOT_BULLET, // 1
296 TRIGGER_SHOT_SHOTGUN, // 2
297 TRIGGER_SHOT_SSG, // 3
298 TRIGGER_SHOT_IMP, // 4
299 TRIGGER_SHOT_PLASMA, // 5
300 TRIGGER_SHOT_SPIDER, // 6
301 TRIGGER_SHOT_CACO, // 7
302 TRIGGER_SHOT_BARON, // 8
303 TRIGGER_SHOT_MANCUB, // 9
304 TRIGGER_SHOT_REV, // 10
305 TRIGGER_SHOT_ROCKET, // 11
306 TRIGGER_SHOT_BFG, // 12
307 TRIGGER_SHOT_EXPL, // 13
308 TRIGGER_SHOT_BFGEXPL, // 14
309 //
310 TRIGGER_SHOT_MAX = MAX,
311 }
313 enum TriggerShotTarget {
314 TRIGGER_SHOT_TARGET_NONE, // 0
315 TRIGGER_SHOT_TARGET_MON, // 1
316 TRIGGER_SHOT_TARGET_PLR, // 2
317 TRIGGER_SHOT_TARGET_RED, // 3
318 TRIGGER_SHOT_TARGET_BLUE, // 4
319 TRIGGER_SHOT_TARGET_MONPLR, // 5
320 TRIGGER_SHOT_TARGET_PLRMON, // 6
321 }
323 enum TriggerShotAim {
324 TRIGGER_SHOT_AIM_DEFAULT, // 0
325 TRIGGER_SHOT_AIM_ALLMAP, // 1
326 TRIGGER_SHOT_AIM_TRACE, // 2
327 TRIGGER_SHOT_AIM_TRACEALL, // 3
328 }
330 enum TriggerEffect {
331 TRIGGER_EFFECT_PARTICLE, // 0
332 TRIGGER_EFFECT_ANIMATION, // 1
333 }
335 enum TriggerEffectType {
336 TRIGGER_EFFECT_SLIQUID, // 0
337 TRIGGER_EFFECT_LLIQUID, // 1
338 TRIGGER_EFFECT_DLIQUID, // 2
339 TRIGGER_EFFECT_BLOOD, // 3
340 TRIGGER_EFFECT_SPARK, // 4
341 TRIGGER_EFFECT_BUBBLE, // 5
342 TRIGGER_EFFECT_MAX = MAX,
343 }
345 enum TriggerEffectPos {
346 TRIGGER_EFFECT_POS_CENTER, // 0
347 TRIGGER_EFFECT_POS_AREA, // 1
348 }
350 bitset ActivateType {
351 ACTIVATE_NONE = 0, // 0
352 ACTIVATE_PLAYERCOLLIDE, // 1
353 ACTIVATE_MONSTERCOLLIDE, // 2
354 ACTIVATE_PLAYERPRESS, // 4
355 ACTIVATE_MONSTERPRESS, // 8
356 ACTIVATE_SHOT, // 16
357 ACTIVATE_NOMONSTER, // 32
358 ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
359 }
361 bitset Key {
362 KEY_NONE = 0, // 0
363 KEY_RED, // 1
364 KEY_GREEN, // 2
365 KEY_BLUE, // 4
366 KEY_REDTEAM, // 8
367 KEY_BLUETEAM, // 16
368 }
371 ////////////////////////////////////////////////////////////////////////////////
372 // various triggers
373 TriggerData for TRIGGER_EXIT {
374 MapName is "map" type char[16] offset 0;
375 }
377 TriggerData for TRIGGER_TELEPORT {
378 TargetPoint is "target" type point offset 0;
379 d2d_teleport is "d2d" type bool offset 8;
380 silent_teleport is "silent" type bool offset 9;
381 TlpDir is "direction" type ubyte offset 10 enum DirType;
382 }
384 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
385 PanelID is "panelid" type int offset 0 panel;
386 NoSound is "silent" type bool offset 4;
387 d2d_doors is "d2d" type bool offset 5;
388 }
390 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
391 //tX is "tx" type int offset 0;
392 //tY is "ty" type int offset 4;
393 Pos is "position" type point offset 0 as txy;
394 //tWidth is "width" type ushort offset 8;
395 //tHeight is "height" type ushort offset 10;
396 Size is "size" type size offset 8 as twh;
397 Wait is "wait" type ushort offset 12;
398 Count is "count" type ushort offset 14;
399 MonsterID is "monsterid" type int offset 16 monster;
400 ExtRandom is "extrandom" type bool offset 20;
401 }
403 TriggerData for TRIGGER_SECRET {
404 }
406 TriggerData for TRIGGER_TEXTURE {
407 ActivateOnce is "activateonce" type bool offset 0;
408 AnimOnce is "animateonce" type bool offset 1;
409 }
411 TriggerData for TRIGGER_SOUND {
412 SoundName is "soundname" type char[64] offset 0;
413 Volume is "volume" type ubyte offset 64;
414 Pan is "pan" type ubyte offset 65;
415 Local is "local" type bool offset 66;
416 PlayCount is "playcount" type ubyte offset 67;
417 SoundSwitch is "soundswitch" type bool offset 68;
418 }
420 TriggerData for TRIGGER_SPAWNMONSTER {
421 MonPos is "position" type point offset 0;
422 MonType is "type" type ubyte offset 8;
423 MonHealth is "health" type int offset 12;
424 MonDir is "direction" type ubyte offset 16 enum DirType;
425 MonActive is "active" type bool offset 17;
426 MonCount is "count" type int offset 20;
427 MonEffect is "effect" type ubyte offset 24;
428 MonMax is "max" type ushort offset 26;
429 MonDelay is "delay" type ushort offset 28;
430 MonBehav is "behaviour" type ubyte offset 30;
431 }
433 TriggerData for TRIGGER_SPAWNITEM {
434 ItemPos is "position" type point offset 0;
435 ItemType is "type" type ubyte offset 8;
436 ItemFalls is "gravity" type bool offset 9;
437 ItemOnlyDM is "dmonly" type bool offset 10;
438 ItemCount is "count" type int offset 12;
439 ItemEffect is "effect" type ubyte offset 16;
440 ItemMax is "max" type ushort offset 18;
441 ItemDelay is "delay" type ushort offset 20;
442 }
444 TriggerData for TRIGGER_MUSIC {
445 MusicName is "name" type char[64] offset 0;
446 MusicAction is "action" type ubyte offset 64;
447 }
449 TriggerData for TRIGGER_PUSH {
450 PushAngle is "angle" type ushort offset 0;
451 PushForce is "force" type ubyte offset 2;
452 ResetVel is "resetvelocity" type bool offset 3;
453 }
455 TriggerData for TRIGGER_SCORE {
456 ScoreAction is "action" type ubyte offset 0;
457 ScoreCount is "count" type ubyte offset 1;
458 ScoreTeam is "team" type ubyte offset 2;
459 ScoreCon is "console" type bool offset 3;
460 ScoreMsg is "message" type bool offset 4;
461 }
463 TriggerData for TRIGGER_MESSAGE {
464 MessageKind is "kind" type ubyte offset 0;
465 MessageSendTo is "sendto" type ubyte offset 1;
466 MessageText is "text" type char[100] offset 2;
467 MessageTime is "time" type ushort offset 102;
468 }
470 TriggerData for TRIGGER_DAMAGE {
471 DamageValue is "amount" type ushort offset 0;
472 DamageInterval is "interval" type ushort offset 2;
473 }
475 TriggerData for TRIGGER_HEALTH {
476 HealValue is "amount" type ushort offset 0;
477 HealInterval is "interval" type ushort offset 2;
478 HealMax is "max" type bool offset 4;
479 HealSilent is "silent" type bool offset 5;
480 }
482 TriggerData for TRIGGER_SHOT {
483 ShotPos is "position" type point offset 0;
484 ShotType is "type" type ubyte offset 8 enum TriggerShot;
485 ShotTarget is "target" type ubyte offset 9 enum TriggerShotTarget;
486 ShotSound is "silent" type negbool offset 10; // negbool!
487 ShotAllMap is "allmap" type bool offset 11;
488 ShotPanelID is "panelid" type int offset 12;
489 ShotIntSight is "sight" type ushort offset 16;
490 ShotAngle is "angle" type ushort offset 18;
491 ShotWait is "wait" type ushort offset 20;
492 ShotAccuracy is "accuracy" type ushort offset 22;
493 ShotAmmo is "ammo" type ushort offset 24;
494 ShotIntReload is "reload" type ushort offset 26;
495 }
497 TriggerData for TRIGGER_EFFECT {
498 FXCount is "count" type ubyte offset 0;
499 FXType is "type" type ubyte offset 1;
500 FXSubType is "subtype" type ubyte offset 2;
501 FXColorR is "colorr" type ubyte offset 3;
502 FXColorG is "colorg" type ubyte offset 4;
503 FXColorB is "colorb" type ubyte offset 5;
504 FXPos is "position" type ubyte offset 6;
505 FXWait is "wait" type ushort offset 8;
506 FXVelX is "velx" type byte offset 10;
507 FXVelY is "vely" type byte offset 11;
508 FXSpreadL is "spreadl" type ubyte offset 12;
509 FXSpreadR is "spreadr" type ubyte offset 13;
510 FXSpreadU is "spreadu" type ubyte offset 14;
511 FXSpreadD is "spreadd" type ubyte offset 15;
512 }