DEADSOFTWARE

mplat triggers can make sound now
[d2df-sdl.git] / src / mapdef / mapdef.txt
1 // yes, this file serves both as format description and as template for code generation
2 // the engine will use this description to parse legacy binary map format
4 // notes:
5 // * field without offset is not in binary format
6 // * fields with `writedefault` will be written even if they contain default values
7 // * fields with `internal` won't be written to any file ever (and won't be read)
8 // * `ubyte` is unsigned byte, and `byte` is signed byte
9 // * all strings are in utf-8
10 // * struct with `header` flag will contain all other structs and it's own fields as top-level entities
11 // * in binary, `size` is two ushorts
12 // * `as xy` will use `X` and `Y` for points
13 // * `as txy` will use `tX` and `tY` for points
14 // * `as wh` will use `Width` and `Height` for size
15 // * `as twh` will use `tWidth` and `tHeight` for size
16 // * `as monsterid`: special hack for triggers: monster record number+1 in binary (so 0 means "none")
17 // * `binblock` and `offset` (and `[]` arrays) are used to parse legacy binary format
19 ////////////////////////////////////////////////////////////////////////////////
20 // main blocks
21 "map" size 452 bytes header binblock 7 {
22 "name" type char[32] offset 0 writedefault;
23 "author" type char[32] offset 32 default "" writedefault;
24 "description" type char[256] offset 64 default "" writedefault;
25 "music" type char[64] offset 320 default 'Standart.wad:D2DMUS\ПРОСТОТА' writedefault;
26 "sky" type char[64] offset 384 default 'Standart.wad:D2DSKY\RSKY1' writedefault;
27 "size" type size offset 448 as wh writedefault;
28 }
30 "texture" size 65 bytes binblock 1 {
31 "path" type char[64] offset 0 writedefault;
32 "animated" type bool offset 64 default false;
33 }
35 "panel" size 18 bytes binblock 2 {
36 "position" type point offset 0 as xy writedefault;
37 "size" type size offset 8 as wh as wh writedefault;
38 "texture" type ushort offset 12 texture writedefault;
39 "type" type ushort offset 14 bitset unique PanelType writedefault;
40 "alpha" type ubyte offset 16 default 0;
41 "flags" type ubyte offset 17 bitset PanelFlag default PANEL_FLAG_NONE;
42 // moving platform options, not in binary
43 "move_speed" type point default (0 0);
44 "size_speed" type point default (0 0); // alas, `size` cannot be negative
45 "move_start" type point default (0 0);
46 "move_end" type point default (0 0);
47 "size_end" type size default (0 0);
48 "move_active" type bool default false;
49 "move_once" type bool default false;
50 "end_pos_trigger" trigger default null;
51 "end_size_trigger" trigger default null;
52 }
54 "item" size 10 bytes binblock 3 {
55 "position" type point offset 0 as xy writedefault;
56 "type" type ubyte offset 8 enum Item writedefault;
57 "options" type ubyte offset 9 bitset ItemOption default ITEM_OPTION_NONE;
58 }
60 "monster" size 10 bytes binblock 5 {
61 "position" type point offset 0 as xy writedefault;
62 "type" type ubyte offset 8 enum Monster writedefault;
63 "direction" type ubyte offset 9 enum DirType default DIR_LEFT;
64 }
66 "area" size 10 bytes binblock 4 {
67 "position" type point offset 0 as xy writedefault;
68 "type" type ubyte offset 8 enum AreaType writedefault;
69 "direction" type ubyte offset 9 enum DirType default DIR_LEFT;
70 }
72 "trigger" size 148 bytes binblock 6 {
73 "position" type point offset 0 as xy writedefault;
74 "size" type size offset 8 as wh writedefault;
75 "enabled" type bool offset 12 default true;
76 "texture_panel" type int offset 13 panel default null;
77 "type" type ubyte offset 17 enum TriggerType writedefault;
78 "activate_type" type ubyte offset 18 bitset ActivateType;
79 "keys" type ubyte offset 19 bitset Key default KEY_NONE;
80 //WARNING: "trigdata" MUST be defined before "type", and "type" MUST be named "type" (for now, can be changed later)
81 "triggerdata" type trigdata[128] offset 20; // the only special nested structure
82 }
85 ////////////////////////////////////////////////////////////////////////////////
86 // special texture identifiers, used to generate pascal sources
87 enum TextureSpecial {
88 TEXTURE_SPECIAL_WATER = -1,
89 TEXTURE_SPECIAL_ACID1 = -2,
90 TEXTURE_SPECIAL_ACID2 = -3,
91 TEXTURE_NONE = -4,
92 }
94 // directions
95 enum DirType {
96 DIR_LEFT, // 0
97 DIR_RIGHT, // 1
98 DIR_SOMETHING2, // 2
99 }
101 // triggers
102 enum TriggerType {
103 TRIGGER_NONE, // 0
104 TRIGGER_EXIT, // 1
105 TRIGGER_TELEPORT, // 2
106 TRIGGER_OPENDOOR, // 3
107 TRIGGER_CLOSEDOOR, // 4
108 TRIGGER_DOOR, // 5
109 TRIGGER_DOOR5, // 6
110 TRIGGER_CLOSETRAP, // 7
111 TRIGGER_TRAP, // 8
112 TRIGGER_PRESS, // 9
113 TRIGGER_SECRET, // 10
114 TRIGGER_LIFTUP, // 11
115 TRIGGER_LIFTDOWN, // 12
116 TRIGGER_LIFT, // 13
117 TRIGGER_TEXTURE, // 14
118 TRIGGER_ON, // 15
119 TRIGGER_OFF, // 16
120 TRIGGER_ONOFF, // 17
121 TRIGGER_SOUND, // 18
122 TRIGGER_SPAWNMONSTER, // 19
123 TRIGGER_SPAWNITEM, // 20
124 TRIGGER_MUSIC, // 21
125 TRIGGER_PUSH, // 22
126 TRIGGER_SCORE, // 23
127 TRIGGER_MESSAGE, // 24
128 TRIGGER_DAMAGE, // 25
129 TRIGGER_HEALTH, // 26
130 TRIGGER_SHOT, // 27
131 TRIGGER_EFFECT, // 28
132 TRIGGER_SCRIPT, // 29
133 //
134 TRIGGER_MAX = MAX,
137 // "as XXX" means "generate this identifier for pascal sources
138 bitset PanelType {
139 PANEL_NONE = 0, // 0
140 PANEL_WALL, // 1
141 PANEL_BACK, // 2
142 PANEL_FORE, // 4
143 PANEL_WATER, // 8
144 PANEL_ACID1, // 16
145 PANEL_ACID2, // 32
146 PANEL_STEP, // 64
147 PANEL_LIFTUP, // 128
148 PANEL_LIFTDOWN, // 256
149 PANEL_OPENDOOR, // 512
150 PANEL_CLOSEDOOR, // 1024
151 PANEL_BLOCKMON, // 2048
152 PANEL_LIFTLEFT, // 4096
153 PANEL_LIFTRIGHT, // 8192
156 bitset PanelFlag {
157 PANEL_FLAG_NONE = 0, // 0
158 PANEL_FLAG_BLENDING, // 1
159 PANEL_FLAG_HIDE, // 2
160 PANEL_FLAG_WATERTEXTURES, // 4
163 enum EffectAction {
164 EFFECT_NONE, // 0
165 EFFECT_TELEPORT, // 1
166 EFFECT_RESPAWN, // 2
167 EFFECT_FIRE, // 3
170 enum Item {
171 ITEM_NONE, // 0
172 ITEM_MEDKIT_SMALL, // 1
173 ITEM_MEDKIT_LARGE, // 2
174 ITEM_MEDKIT_BLACK, // 3
175 ITEM_ARMOR_GREEN, // 4
176 ITEM_ARMOR_BLUE, // 5
177 ITEM_SPHERE_BLUE, // 6
178 ITEM_SPHERE_WHITE, // 7
179 ITEM_SUIT, // 8
180 ITEM_OXYGEN, // 9
181 ITEM_INVUL, // 10
182 ITEM_WEAPON_SAW, // 11
183 ITEM_WEAPON_SHOTGUN1, // 12
184 ITEM_WEAPON_SHOTGUN2, // 13
185 ITEM_WEAPON_CHAINGUN, // 14
186 ITEM_WEAPON_ROCKETLAUNCHER, // 15
187 ITEM_WEAPON_PLASMA, // 16
188 ITEM_WEAPON_BFG, // 17
189 ITEM_WEAPON_SUPERPULEMET, // 18
190 ITEM_AMMO_BULLETS, // 19
191 ITEM_AMMO_BULLETS_BOX, // 20
192 ITEM_AMMO_SHELLS, // 21
193 ITEM_AMMO_SHELLS_BOX, // 22
194 ITEM_AMMO_ROCKET, // 23
195 ITEM_AMMO_ROCKET_BOX, // 24
196 ITEM_AMMO_CELL, // 25
197 ITEM_AMMO_CELL_BIG, // 26
198 ITEM_AMMO_BACKPACK, // 27
199 ITEM_KEY_RED, // 28
200 ITEM_KEY_GREEN, // 29
201 ITEM_KEY_BLUE, // 30
202 ITEM_WEAPON_KASTET, // 31
203 ITEM_WEAPON_PISTOL, // 32
204 ITEM_BOTTLE, // 33
205 ITEM_HELMET, // 34
206 ITEM_JETPACK, // 35
207 ITEM_INVIS, // 36
208 ITEM_WEAPON_FLAMETHROWER, // 37
209 ITEM_AMMO_FUELCAN, // 38
210 //
211 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
214 bitset ItemOption {
215 ITEM_OPTION_NONE = 0, // 0
216 ITEM_OPTION_ONLYDM, // 1
217 ITEM_OPTION_FALL, // 2
220 enum AreaType {
221 AREA_NONE, // 0
222 AREA_PLAYERPOINT1, // 1
223 AREA_PLAYERPOINT2, // 2
224 AREA_DMPOINT, // 3
225 AREA_REDFLAG, // 4
226 AREA_BLUEFLAG, // 5
227 AREA_DOMFLAG, // 6
228 AREA_REDTEAMPOINT, // 7
229 AREA_BLUETEAMPOINT, // 8
232 enum Monster {
233 MONSTER_NONE, // 0
234 MONSTER_DEMON, // 1
235 MONSTER_IMP, // 2
236 MONSTER_ZOMBY, // 3
237 MONSTER_SERG, // 4
238 MONSTER_CYBER, // 5
239 MONSTER_CGUN, // 6
240 MONSTER_BARON, // 7
241 MONSTER_KNIGHT, // 8
242 MONSTER_CACO, // 9
243 MONSTER_SOUL, // 10
244 MONSTER_PAIN, // 11
245 MONSTER_SPIDER, // 12
246 MONSTER_BSP, // 13
247 MONSTER_MANCUB, // 14
248 MONSTER_SKEL, // 15
249 MONSTER_VILE, // 16
250 MONSTER_FISH, // 17
251 MONSTER_BARREL, // 18
252 MONSTER_ROBO, // 19
253 MONSTER_MAN, // 20
254 // aliases (fixme: it should be `MONSTER_ZOMBIE = MONSTER_ZOMBY`!)
255 MONSTER_ZOMBIE = 3,
258 enum MonsterBehaviour {
259 BH_NORMAL, // 0
260 BH_KILLER, // 1
261 BH_MANIAC, // 2
262 BH_INSANE, // 3
263 BH_CANNIBAL, // 4
264 BH_GOOD, // 5
267 enum TriggerShot {
268 TRIGGER_SHOT_PISTOL, // 0
269 TRIGGER_SHOT_BULLET, // 1
270 TRIGGER_SHOT_SHOTGUN, // 2
271 TRIGGER_SHOT_SSG, // 3
272 TRIGGER_SHOT_IMP, // 4
273 TRIGGER_SHOT_PLASMA, // 5
274 TRIGGER_SHOT_SPIDER, // 6
275 TRIGGER_SHOT_CACO, // 7
276 TRIGGER_SHOT_BARON, // 8
277 TRIGGER_SHOT_MANCUB, // 9
278 TRIGGER_SHOT_REV, // 10
279 TRIGGER_SHOT_ROCKET, // 11
280 TRIGGER_SHOT_BFG, // 12
281 TRIGGER_SHOT_EXPL, // 13
282 TRIGGER_SHOT_BFGEXPL, // 14
283 //
284 TRIGGER_SHOT_MAX = MAX,
287 enum TriggerShotTarget {
288 TRIGGER_SHOT_TARGET_NONE, // 0
289 TRIGGER_SHOT_TARGET_MON, // 1
290 TRIGGER_SHOT_TARGET_PLR, // 2
291 TRIGGER_SHOT_TARGET_RED, // 3
292 TRIGGER_SHOT_TARGET_BLUE, // 4
293 TRIGGER_SHOT_TARGET_MONPLR, // 5
294 TRIGGER_SHOT_TARGET_PLRMON, // 6
297 enum TriggerShotAim {
298 TRIGGER_SHOT_AIM_DEFAULT, // 0
299 TRIGGER_SHOT_AIM_ALLMAP, // 1
300 TRIGGER_SHOT_AIM_TRACE, // 2
301 TRIGGER_SHOT_AIM_TRACEALL, // 3
304 enum TriggerEffect {
305 TRIGGER_EFFECT_PARTICLE, // 0
306 TRIGGER_EFFECT_ANIMATION, // 1
309 enum TriggerEffectType {
310 TRIGGER_EFFECT_SLIQUID, // 0
311 TRIGGER_EFFECT_LLIQUID, // 1
312 TRIGGER_EFFECT_DLIQUID, // 2
313 TRIGGER_EFFECT_BLOOD, // 3
314 TRIGGER_EFFECT_SPARK, // 4
315 TRIGGER_EFFECT_BUBBLE, // 5
316 TRIGGER_EFFECT_MAX = MAX,
319 enum TriggerEffectPos {
320 TRIGGER_EFFECT_POS_CENTER, // 0
321 TRIGGER_EFFECT_POS_AREA, // 1
324 enum TriggerMusicAction {
325 TRIGGER_MUSIC_ACTION_STOP, // 0
326 TRIGGER_MUSIC_ACTION_PLAY, // 1; unpause or restart
329 enum TriggerScoreAction {
330 TRIGGER_SCORE_ACTION_ADD, // 0
331 TRIGGER_SCORE_ACTION_SUB, // 1
332 TRIGGER_SCORE_ACTION_WIN, // 2
333 TRIGGER_SCORE_ACTION_LOOSE, // 3
336 enum TriggerMessageDest {
337 TRIGGER_MESSAGE_DEST_ME, // 0
338 TRIGGER_MESSAGE_DEST_MY_TEAM, // 1
339 TRIGGER_MESSAGE_DEST_ENEMY_TEAM, // 2
340 TRIGGER_MESSAGE_DEST_RED_TEAM, // 3
341 TRIGGER_MESSAGE_DEST_BLUE_TEAM, // 4
342 TRIGGER_MESSAGE_DEST_EVERYONE, // 5
345 enum TriggerMessageKind {
346 TRIGGER_MESSAGE_KIND_CHAT, // 0
347 TRIGGER_MESSAGE_KIND_GAME, // 1
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
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
371 ////////////////////////////////////////////////////////////////////////////////
372 // various triggers
373 TriggerData for TRIGGER_EXIT {
374 "map" type char[16] offset 0 writedefault;
377 TriggerData for TRIGGER_TELEPORT {
378 "target" type point offset 0 writedefault;
379 "d2d" type bool offset 8 default false;
380 "silent" type bool offset 9 default false;
381 "direction" type ubyte offset 10 enum DirType default DIR_LEFT;
384 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
385 "panelid" type int offset 0 panel writedefault;
386 "silent" type bool offset 4 default false;
387 "d2d" type bool offset 5 default false;
390 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
391 "position" type point offset 0 as txy default (0 0) writedefault;
392 "size" type size offset 8 as twh default (0 0);
393 "wait" type ushort offset 12 default 0;
394 "count" alias pressCount type ushort offset 14 default 0;
395 "monsterid" type int offset 16 monster as monsterid default null;
396 "ext_random" type bool offset 20 default false;
397 // this one is for moving platforms
398 "panelid" panel default null;
399 "silent" type bool default true;
400 "sound" type string default "";
403 enum TriggerScoreTeam {
404 TRIGGER_SCORE_TEAM_MINE_RED, // 0
405 TRIGGER_SCORE_TEAM_MINE_BLUE, // 1
406 TRIGGER_SCORE_TEAM_FORCE_RED, // 2
407 TRIGGER_SCORE_TEAM_FORCE_BLUE, // 3
410 TriggerData for TRIGGER_SECRET {
413 TriggerData for TRIGGER_TEXTURE {
414 "activate_once" type bool offset 0 default false writedefault;
415 "animate_once" type bool offset 1 default false writedefault;
418 TriggerData for TRIGGER_SOUND {
419 "sound_name" type char[64] offset 0 writedefault;
420 "volume" type ubyte offset 64 default 0 writedefault; //??? default ???
421 "pan" type ubyte offset 65 default 0;
422 "local" type bool offset 66 default true; //??? default ???
423 "play_count" type ubyte offset 67 default 1;
424 "sound_switch" type bool offset 68 default false; //??? default ???
427 TriggerData for TRIGGER_SPAWNMONSTER {
428 "position" type point offset 0 as txy writedefault;
429 "type" alias spawnMonsType type ubyte offset 8 enum Monster default MONSTER_IMP writedefault;
430 "health" type int offset 12 writedefault;
431 "direction" type ubyte offset 16 enum DirType default DIR_LEFT writedefault;
432 "active" type bool offset 17 default true;
433 "count" alias monsCount type int offset 20 default 1 writedefault;
434 "effect" type ubyte offset 24 enum EffectAction default EFFECT_NONE writedefault;
435 "max" type ushort offset 26 default 1 writedefault;
436 "delay" type ushort offset 28 default 1000 writedefault;
437 "behaviour" type ubyte offset 30 enum MonsterBehaviour default BH_NORMAL;
440 TriggerData for TRIGGER_SPAWNITEM {
441 "position" type point offset 0 as txy writedefault;
442 "type" alias spawnItemType type ubyte offset 8 enum Item default ITEM_NONE writedefault;
443 "gravity" type bool offset 9 default true;
444 "dmonly" type bool offset 10 default false;
445 "count" alias itemCount type int offset 12 default 1;
446 "effect" type ubyte offset 16 enum EffectAction default EFFECT_NONE writedefault;
447 "max" type ushort offset 18 default 1;
448 "delay" type ushort offset 20 default 1000 writedefault;
451 TriggerData for TRIGGER_MUSIC {
452 "name" alias musicName type char[64] offset 0 writedefault;
453 "action" alias musicAction type ubyte offset 64 enum TriggerMusicAction writedefault;
456 TriggerData for TRIGGER_PUSH {
457 "angle" type ushort offset 0 writedefault;
458 "force" type ubyte offset 2 writedefault;
459 "reset_velocity" type bool offset 3 default false writedefault;
462 TriggerData for TRIGGER_SCORE {
463 "action" alias scoreAction type ubyte offset 0 enum TriggerScoreAction default TRIGGER_SCORE_ACTION_ADD writedefault;
464 "count" alias scoreCount type ubyte offset 1 default 1 writedefault;
465 "team" alias scoreTeam type ubyte offset 2 enum TriggerScoreTeam writedefault;
466 "console" alias scoreCon type bool offset 3 default false writedefault;
467 "message" alias scoreMsg type bool offset 4 default true writedefault;
470 TriggerData for TRIGGER_MESSAGE {
471 "kind" type ubyte offset 0 enum TriggerMessageKind default TRIGGER_MESSAGE_KIND_GAME writedefault;
472 "dest" alias msgDest type ubyte enum TriggerMessageDest offset 1;
473 "text" type char[100] offset 2 writedefault;
474 "time" alias msgTime type ushort offset 102 writedefault;
477 TriggerData for TRIGGER_DAMAGE {
478 "amount" type ushort offset 0 writedefault;
479 "interval" type ushort offset 2 writedefault;
482 TriggerData for TRIGGER_HEALTH {
483 "amount" type ushort offset 0 writedefault;
484 "interval" type ushort offset 2 writedefault;
485 "max" alias healMax type bool offset 4 writedefault;
486 "silent" type bool offset 5 writedefault;
489 TriggerData for TRIGGER_SHOT {
490 "position" type point offset 0 as txy writedefault;
491 "type" alias shotType type ubyte offset 8 enum TriggerShot writedefault;
492 "target" alias shotTarget type ubyte offset 9 enum TriggerShotTarget writedefault;
493 "quiet" type negbool offset 10; // negbool!
494 "aim" type byte offset 11 enum TriggerShotAim default TRIGGER_SHOT_AIM_DEFAULT;
495 "panelid" type int offset 12 panel default null writedefault;
496 "sight" type ushort offset 16;
497 "angle" type ushort offset 18;
498 "wait" type ushort offset 20;
499 "accuracy" type ushort offset 22;
500 "ammo" type ushort offset 24;
501 "reload" type ushort offset 26;
504 TriggerData for TRIGGER_EFFECT {
505 "count" alias FXCount type ubyte offset 0 writedefault;
506 "type" alias FXType type ubyte offset 1 enum TriggerEffect default TRIGGER_EFFECT_PARTICLE writedefault;
507 "subtype" alias FXSubType type ubyte offset 2 enum TriggerEffectType default TRIGGER_EFFECT_SPARK writedefault;
508 "red" alias FXRed type ubyte offset 3 writedefault;
509 "green" alias FXGreen type ubyte offset 4 writedefault;
510 "blue" alias FXBlue type ubyte offset 5 writedefault;
511 "pos" alias FXPos type ubyte offset 6 enum TriggerEffectPos default TRIGGER_EFFECT_POS_CENTER writedefault;
512 "wait" type ushort offset 8 writedefault;
513 "vel_x" type byte offset 10 writedefault;
514 "vel_y" type byte offset 11 writedefault;
515 "spread_l" type ubyte offset 12 writedefault;
516 "spread_r" type ubyte offset 13 writedefault;
517 "spread_u" type ubyte offset 14 writedefault;
518 "spread_d" type ubyte offset 15 writedefault;