DEADSOFTWARE

network now always ticks at 36 tick
[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 tip "map name";
23 "author" type char[32] offset 32 default "" writedefault tip "map author";
24 "description" type char[256] offset 64 default "" writedefault tip "map description";
25 "music" type char[64] offset 320 default 'Standart.wad:D2DMUS\ПРОСТОТА' writedefault tip "music resource";
26 "sky" type char[64] offset 384 default 'Standart.wad:D2DSKY\RSKY1' writedefault tip "sky resource";
27 "size" type size offset 448 as wh writedefault;
28 // not in binary
29 // temporary, for lighting experiments
30 "light_ambient" type color default (0 0 0 255) tip "ambient light for the whole level";
31 }
33 "texture" size 65 bytes binblock 1 {
34 "path" type char[64] offset 0 writedefault;
35 "animated" type bool offset 64 default false;
36 }
38 "panel" size 18 bytes binblock 2 {
39 "position" type point offset 0 as xy writedefault;
40 "size" type size offset 8 as wh as wh writedefault;
41 "texture" type ushort offset 12 texture writedefault;
42 "type" type ushort offset 14 bitset unique PanelType writedefault;
43 "alpha" type ubyte offset 16 default 0;
44 "flags" type ubyte offset 17 bitset PanelFlag default PANEL_FLAG_NONE;
45 // moving platform options, not in binary
46 "move_speed" type point default (0 0);
47 "size_speed" type point default (0 0); // alas, `size` cannot be negative
48 "move_start" type point default (0 0);
49 "move_end" type point default (0 0);
50 "size_end" type size default (0 0);
51 "move_active" type bool default false;
52 "move_once" type bool default false;
53 "end_pos_trigger" trigger default null;
54 "end_size_trigger" trigger default null;
55 }
57 "item" size 10 bytes binblock 3 {
58 "position" type point offset 0 as xy writedefault;
59 "type" type ubyte offset 8 enum Item writedefault;
60 "options" type ubyte offset 9 bitset ItemOption default ITEM_OPTION_NONE;
61 }
63 "monster" size 10 bytes binblock 5 {
64 "position" type point offset 0 as xy writedefault;
65 "type" type ubyte offset 8 enum Monster writedefault;
66 "direction" type ubyte offset 9 enum DirType default DIR_LEFT;
67 }
69 "area" size 10 bytes binblock 4 {
70 "position" type point offset 0 as xy writedefault;
71 "type" type ubyte offset 8 enum AreaType writedefault;
72 "direction" type ubyte offset 9 enum DirType default DIR_LEFT;
73 }
75 "trigger" size 148 bytes binblock 6 {
76 "position" type point offset 0 as xy writedefault;
77 "size" type size offset 8 as wh writedefault;
78 "enabled" type bool offset 12 default true;
79 "texture_panel" type int offset 13 panel default null;
80 "type" type ubyte offset 17 enum TriggerType writedefault;
81 "activate_type" type ubyte offset 18 bitset ActivateType;
82 "keys" type ubyte offset 19 bitset Key default KEY_NONE;
83 //WARNING: "trigdata" MUST be defined before "type", and "type" MUST be named "type" (for now, can be changed later)
84 "triggerdata" type trigdata[128] offset 20; // the only special nested structure
85 //DO NOT USE! experimental feature! will be removed!
86 "exoma_init" type string default "" tip "will be called on trigger creation";
87 "exoma_think" type string default "" tip "will be called on each think step";
88 "exoma_check" type string default "" tip "will be called before activation";
89 "exoma_action" type string default "" tip "will be called on activation";
90 }
93 ////////////////////////////////////////////////////////////////////////////////
94 // special texture identifiers, used to generate pascal sources
95 enum TextureSpecial {
96 TEXTURE_SPECIAL_WATER = -1,
97 TEXTURE_SPECIAL_ACID1 = -2,
98 TEXTURE_SPECIAL_ACID2 = -3,
99 TEXTURE_NONE = -4,
102 // directions
103 enum DirType {
104 DIR_LEFT, // 0
105 DIR_RIGHT, // 1
106 DIR_SOMETHING2, // 2
109 // triggers
110 enum TriggerType {
111 TRIGGER_NONE, // 0
112 TRIGGER_EXIT, // 1
113 TRIGGER_TELEPORT, // 2
114 TRIGGER_OPENDOOR, // 3
115 TRIGGER_CLOSEDOOR, // 4
116 TRIGGER_DOOR, // 5
117 TRIGGER_DOOR5, // 6
118 TRIGGER_CLOSETRAP, // 7
119 TRIGGER_TRAP, // 8
120 TRIGGER_PRESS, // 9
121 TRIGGER_SECRET, // 10
122 TRIGGER_LIFTUP, // 11
123 TRIGGER_LIFTDOWN, // 12
124 TRIGGER_LIFT, // 13
125 TRIGGER_TEXTURE, // 14
126 TRIGGER_ON, // 15
127 TRIGGER_OFF, // 16
128 TRIGGER_ONOFF, // 17
129 TRIGGER_SOUND, // 18
130 TRIGGER_SPAWNMONSTER, // 19
131 TRIGGER_SPAWNITEM, // 20
132 TRIGGER_MUSIC, // 21
133 TRIGGER_PUSH, // 22
134 TRIGGER_SCORE, // 23
135 TRIGGER_MESSAGE, // 24
136 TRIGGER_DAMAGE, // 25
137 TRIGGER_HEALTH, // 26
138 TRIGGER_SHOT, // 27
139 TRIGGER_EFFECT, // 28
140 TRIGGER_SCRIPT, // 29
141 //
142 TRIGGER_MAX = MAX,
145 // "as XXX" means "generate this identifier for pascal sources
146 bitset PanelType {
147 PANEL_NONE = 0, // 0
148 PANEL_WALL, // 1
149 PANEL_BACK, // 2
150 PANEL_FORE, // 4
151 PANEL_WATER, // 8
152 PANEL_ACID1, // 16
153 PANEL_ACID2, // 32
154 PANEL_STEP, // 64
155 PANEL_LIFTUP, // 128
156 PANEL_LIFTDOWN, // 256
157 PANEL_OPENDOOR, // 512
158 PANEL_CLOSEDOOR, // 1024
159 PANEL_BLOCKMON, // 2048
160 PANEL_LIFTLEFT, // 4096
161 PANEL_LIFTRIGHT, // 8192
164 bitset PanelFlag {
165 PANEL_FLAG_NONE = 0, // 0
166 PANEL_FLAG_BLENDING, // 1
167 PANEL_FLAG_HIDE, // 2
168 PANEL_FLAG_WATERTEXTURES, // 4
171 enum EffectAction {
172 EFFECT_NONE, // 0
173 EFFECT_TELEPORT, // 1
174 EFFECT_RESPAWN, // 2
175 EFFECT_FIRE, // 3
178 //WARNING! max allowed items types is 127
179 enum Item {
180 ITEM_NONE, // 0
181 ITEM_MEDKIT_SMALL, // 1
182 ITEM_MEDKIT_LARGE, // 2
183 ITEM_MEDKIT_BLACK, // 3
184 ITEM_ARMOR_GREEN, // 4
185 ITEM_ARMOR_BLUE, // 5
186 ITEM_SPHERE_BLUE, // 6
187 ITEM_SPHERE_WHITE, // 7
188 ITEM_SUIT, // 8
189 ITEM_OXYGEN, // 9
190 ITEM_INVUL, // 10
191 ITEM_WEAPON_SAW, // 11
192 ITEM_WEAPON_SHOTGUN1, // 12
193 ITEM_WEAPON_SHOTGUN2, // 13
194 ITEM_WEAPON_CHAINGUN, // 14
195 ITEM_WEAPON_ROCKETLAUNCHER, // 15
196 ITEM_WEAPON_PLASMA, // 16
197 ITEM_WEAPON_BFG, // 17
198 ITEM_WEAPON_SUPERPULEMET, // 18
199 ITEM_AMMO_BULLETS, // 19
200 ITEM_AMMO_BULLETS_BOX, // 20
201 ITEM_AMMO_SHELLS, // 21
202 ITEM_AMMO_SHELLS_BOX, // 22
203 ITEM_AMMO_ROCKET, // 23
204 ITEM_AMMO_ROCKET_BOX, // 24
205 ITEM_AMMO_CELL, // 25
206 ITEM_AMMO_CELL_BIG, // 26
207 ITEM_AMMO_BACKPACK, // 27
208 ITEM_KEY_RED, // 28
209 ITEM_KEY_GREEN, // 29
210 ITEM_KEY_BLUE, // 30
211 ITEM_WEAPON_KASTET, // 31
212 ITEM_WEAPON_PISTOL, // 32
213 ITEM_BOTTLE, // 33
214 ITEM_HELMET, // 34
215 ITEM_JETPACK, // 35
216 ITEM_INVIS, // 36
217 ITEM_WEAPON_FLAMETHROWER, // 37
218 ITEM_AMMO_FUELCAN, // 38
219 //
220 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
223 bitset ItemOption {
224 ITEM_OPTION_NONE = 0, // 0
225 ITEM_OPTION_ONLYDM, // 1
226 ITEM_OPTION_FALL, // 2
229 enum AreaType {
230 AREA_NONE, // 0
231 AREA_PLAYERPOINT1, // 1
232 AREA_PLAYERPOINT2, // 2
233 AREA_DMPOINT, // 3
234 AREA_REDFLAG, // 4
235 AREA_BLUEFLAG, // 5
236 AREA_DOMFLAG, // 6
237 AREA_REDTEAMPOINT, // 7
238 AREA_BLUETEAMPOINT, // 8
241 enum Monster {
242 MONSTER_NONE, // 0
243 MONSTER_DEMON, // 1
244 MONSTER_IMP, // 2
245 MONSTER_ZOMBY, // 3
246 MONSTER_SERG, // 4
247 MONSTER_CYBER, // 5
248 MONSTER_CGUN, // 6
249 MONSTER_BARON, // 7
250 MONSTER_KNIGHT, // 8
251 MONSTER_CACO, // 9
252 MONSTER_SOUL, // 10
253 MONSTER_PAIN, // 11
254 MONSTER_SPIDER, // 12
255 MONSTER_BSP, // 13
256 MONSTER_MANCUB, // 14
257 MONSTER_SKEL, // 15
258 MONSTER_VILE, // 16
259 MONSTER_FISH, // 17
260 MONSTER_BARREL, // 18
261 MONSTER_ROBO, // 19
262 MONSTER_MAN, // 20
263 // aliases (fixme: it should be `MONSTER_ZOMBIE = MONSTER_ZOMBY`!)
264 MONSTER_ZOMBIE = 3,
267 enum MonsterBehaviour {
268 BH_NORMAL, // 0
269 BH_KILLER, // 1
270 BH_MANIAC, // 2
271 BH_INSANE, // 3
272 BH_CANNIBAL, // 4
273 BH_GOOD, // 5
276 enum TriggerShot {
277 TRIGGER_SHOT_PISTOL, // 0
278 TRIGGER_SHOT_BULLET, // 1
279 TRIGGER_SHOT_SHOTGUN, // 2
280 TRIGGER_SHOT_SSG, // 3
281 TRIGGER_SHOT_IMP, // 4
282 TRIGGER_SHOT_PLASMA, // 5
283 TRIGGER_SHOT_SPIDER, // 6
284 TRIGGER_SHOT_CACO, // 7
285 TRIGGER_SHOT_BARON, // 8
286 TRIGGER_SHOT_MANCUB, // 9
287 TRIGGER_SHOT_REV, // 10
288 TRIGGER_SHOT_ROCKET, // 11
289 TRIGGER_SHOT_BFG, // 12
290 TRIGGER_SHOT_EXPL, // 13
291 TRIGGER_SHOT_BFGEXPL, // 14
292 TRIGGER_SHOT_FLAME, // 15
293 //
294 TRIGGER_SHOT_MAX = MAX,
297 enum TriggerShotTarget {
298 TRIGGER_SHOT_TARGET_NONE, // 0
299 TRIGGER_SHOT_TARGET_MON, // 1
300 TRIGGER_SHOT_TARGET_PLR, // 2
301 TRIGGER_SHOT_TARGET_RED, // 3
302 TRIGGER_SHOT_TARGET_BLUE, // 4
303 TRIGGER_SHOT_TARGET_MONPLR, // 5
304 TRIGGER_SHOT_TARGET_PLRMON, // 6
307 enum TriggerShotAim {
308 TRIGGER_SHOT_AIM_DEFAULT, // 0
309 TRIGGER_SHOT_AIM_ALLMAP, // 1
310 TRIGGER_SHOT_AIM_TRACE, // 2
311 TRIGGER_SHOT_AIM_TRACEALL, // 3
314 enum TriggerEffect {
315 TRIGGER_EFFECT_PARTICLE, // 0
316 TRIGGER_EFFECT_ANIMATION, // 1
319 enum TriggerEffectType {
320 TRIGGER_EFFECT_SLIQUID, // 0
321 TRIGGER_EFFECT_LLIQUID, // 1
322 TRIGGER_EFFECT_DLIQUID, // 2
323 TRIGGER_EFFECT_BLOOD, // 3
324 TRIGGER_EFFECT_SPARK, // 4
325 TRIGGER_EFFECT_BUBBLE, // 5
326 TRIGGER_EFFECT_MAX = MAX,
329 enum TriggerEffectPos {
330 TRIGGER_EFFECT_POS_CENTER, // 0
331 TRIGGER_EFFECT_POS_AREA, // 1
334 enum TriggerMusicAction {
335 TRIGGER_MUSIC_ACTION_STOP, // 0
336 TRIGGER_MUSIC_ACTION_PLAY, // 1; unpause or restart
339 enum TriggerScoreAction {
340 TRIGGER_SCORE_ACTION_ADD, // 0
341 TRIGGER_SCORE_ACTION_SUB, // 1
342 TRIGGER_SCORE_ACTION_WIN, // 2
343 TRIGGER_SCORE_ACTION_LOOSE, // 3
346 enum TriggerMessageDest {
347 TRIGGER_MESSAGE_DEST_ME, // 0
348 TRIGGER_MESSAGE_DEST_MY_TEAM, // 1
349 TRIGGER_MESSAGE_DEST_ENEMY_TEAM, // 2
350 TRIGGER_MESSAGE_DEST_RED_TEAM, // 3
351 TRIGGER_MESSAGE_DEST_BLUE_TEAM, // 4
352 TRIGGER_MESSAGE_DEST_EVERYONE, // 5
355 enum TriggerMessageKind {
356 TRIGGER_MESSAGE_KIND_CHAT, // 0
357 TRIGGER_MESSAGE_KIND_GAME, // 1
360 bitset ActivateType {
361 ACTIVATE_NONE = 0, // 0
362 ACTIVATE_PLAYERCOLLIDE, // 1
363 ACTIVATE_MONSTERCOLLIDE, // 2
364 ACTIVATE_PLAYERPRESS, // 4
365 ACTIVATE_MONSTERPRESS, // 8
366 ACTIVATE_SHOT, // 16
367 ACTIVATE_NOMONSTER, // 32
368 ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
371 bitset Key {
372 KEY_NONE = 0, // 0
373 KEY_RED, // 1
374 KEY_GREEN, // 2
375 KEY_BLUE, // 4
376 KEY_REDTEAM, // 8
377 KEY_BLUETEAM, // 16
380 enum HitType {
381 HIT_SOME, // 0
382 HIT_ROCKET, // 1
383 HIT_BFG, // 2
384 HIT_TRAP, // 3
385 HIT_FALL, // 4
386 HIT_WATER, // 5
387 HIT_ACID, // 6
388 HIT_ELECTRO, // 7
389 HIT_FLAME, // 8
390 HIT_SELF, // 9
391 HIT_DISCON, // 10
395 ////////////////////////////////////////////////////////////////////////////////
396 // various triggers
397 TriggerData for TRIGGER_EXIT {
398 "map" type char[16] offset 0 writedefault;
401 TriggerData for TRIGGER_TELEPORT {
402 "target" type point offset 0 writedefault;
403 "d2d" type bool offset 8 default false;
404 "silent" type bool offset 9 default false;
405 "direction" type ubyte offset 10 enum DirType default DIR_LEFT;
408 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
409 "panelid" type int offset 0 panel writedefault;
410 "silent" type bool offset 4 default false;
411 "d2d" type bool offset 5 default false;
414 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
415 "position" type point offset 0 as txy default (0 0) writedefault;
416 "size" type size offset 8 as twh default (0 0);
417 "wait" type ushort offset 12 default 0;
418 "count" alias pressCount type ushort offset 14 default 0;
419 "monsterid" type int offset 16 monster as monsterid default null;
420 "ext_random" type bool offset 20 default false;
421 // this one is for moving platforms
422 "panelid" panel default null;
423 "silent" type bool default true;
424 "sound" type string default "";
427 enum TriggerScoreTeam {
428 TRIGGER_SCORE_TEAM_MINE_RED, // 0
429 TRIGGER_SCORE_TEAM_MINE_BLUE, // 1
430 TRIGGER_SCORE_TEAM_FORCE_RED, // 2
431 TRIGGER_SCORE_TEAM_FORCE_BLUE, // 3
434 TriggerData for TRIGGER_SECRET {
437 TriggerData for TRIGGER_TEXTURE {
438 "activate_once" type bool offset 0 default false writedefault;
439 "animate_once" type bool offset 1 default false writedefault;
442 TriggerData for TRIGGER_SOUND {
443 "sound_name" type char[64] offset 0 writedefault;
444 "volume" type ubyte offset 64 default 0 writedefault; //??? default ???
445 "pan" type ubyte offset 65 default 0;
446 "local" type bool offset 66 default true; //??? default ???
447 "play_count" type ubyte offset 67 default 1;
448 "sound_switch" type bool offset 68 default false; //??? default ???
451 TriggerData for TRIGGER_SPAWNMONSTER {
452 "position" type point offset 0 as txy writedefault;
453 "type" alias spawnMonsType type ubyte offset 8 enum Monster default MONSTER_IMP writedefault;
454 "health" type int offset 12 writedefault;
455 "direction" type ubyte offset 16 enum DirType default DIR_LEFT writedefault;
456 "active" type bool offset 17 default true;
457 "count" alias monsCount type int offset 20 default 1 writedefault;
458 "effect" type ubyte offset 24 enum EffectAction default EFFECT_NONE writedefault;
459 "max" type ushort offset 26 default 1 writedefault;
460 "delay" type ushort offset 28 default 1000 writedefault;
461 "behaviour" type ubyte offset 30 enum MonsterBehaviour default BH_NORMAL;
464 TriggerData for TRIGGER_SPAWNITEM {
465 "position" type point offset 0 as txy writedefault;
466 "type" alias spawnItemType type ubyte offset 8 enum Item default ITEM_NONE writedefault;
467 "gravity" type bool offset 9 default true;
468 "dmonly" type bool offset 10 default false;
469 "count" alias itemCount type int offset 12 default 1;
470 "effect" type ubyte offset 16 enum EffectAction default EFFECT_NONE writedefault;
471 "max" type ushort offset 18 default 1;
472 "delay" type ushort offset 20 default 1000 writedefault;
475 TriggerData for TRIGGER_MUSIC {
476 "name" alias musicName type char[64] offset 0 writedefault;
477 "action" alias musicAction type ubyte offset 64 enum TriggerMusicAction writedefault;
480 TriggerData for TRIGGER_PUSH {
481 "angle" type ushort offset 0 writedefault;
482 "force" type ubyte offset 2 writedefault;
483 "reset_velocity" type bool offset 3 default false writedefault;
486 TriggerData for TRIGGER_SCORE {
487 "action" alias scoreAction type ubyte offset 0 enum TriggerScoreAction default TRIGGER_SCORE_ACTION_ADD writedefault;
488 "count" alias scoreCount type ubyte offset 1 default 1 writedefault;
489 "team" alias scoreTeam type ubyte offset 2 enum TriggerScoreTeam writedefault;
490 "console" alias scoreCon type bool offset 3 default false writedefault;
491 "message" alias scoreMsg type bool offset 4 default true writedefault;
494 TriggerData for TRIGGER_MESSAGE {
495 "kind" type ubyte offset 0 enum TriggerMessageKind default TRIGGER_MESSAGE_KIND_GAME writedefault;
496 "dest" alias msgDest type ubyte enum TriggerMessageDest offset 1;
497 "text" type char[100] offset 2 writedefault;
498 "time" alias msgTime type ushort offset 102 writedefault;
501 TriggerData for TRIGGER_DAMAGE {
502 "amount" type ushort offset 0 writedefault;
503 "interval" type ushort offset 2 writedefault;
504 "kind" type ubyte offset 4 enum HitType default HIT_SOME writedefault;
507 TriggerData for TRIGGER_HEALTH {
508 "amount" type ushort offset 0 writedefault;
509 "interval" type ushort offset 2 writedefault;
510 "max" alias healMax type bool offset 4 writedefault;
511 "silent" type bool offset 5 writedefault;
514 TriggerData for TRIGGER_SHOT {
515 "position" type point offset 0 as txy writedefault;
516 "type" alias shotType type ubyte offset 8 enum TriggerShot writedefault;
517 "target" alias shotTarget type ubyte offset 9 enum TriggerShotTarget writedefault;
518 "sound" alias shotSound type negbool offset 10; // negbool!
519 "aim" type byte offset 11 enum TriggerShotAim default TRIGGER_SHOT_AIM_DEFAULT;
520 "panelid" type int offset 12 panel default null writedefault;
521 "sight" type ushort offset 16;
522 "angle" type ushort offset 18;
523 "wait" type ushort offset 20;
524 "accuracy" type ushort offset 22;
525 "ammo" type ushort offset 24;
526 "reload" type ushort offset 26;
529 TriggerData for TRIGGER_EFFECT {
530 "count" alias FXCount type ubyte offset 0 writedefault;
531 "type" alias FXType type ubyte offset 1 enum TriggerEffect default TRIGGER_EFFECT_PARTICLE writedefault;
532 "subtype" alias FXSubType type ubyte offset 2 enum TriggerEffectType default TRIGGER_EFFECT_SPARK writedefault;
533 "red" alias FXRed type ubyte offset 3 writedefault;
534 "green" alias FXGreen type ubyte offset 4 writedefault;
535 "blue" alias FXBlue type ubyte offset 5 writedefault;
536 "pos" alias FXPos type ubyte offset 6 enum TriggerEffectPos default TRIGGER_EFFECT_POS_CENTER writedefault;
537 "wait" type ushort offset 8 writedefault;
538 "vel_x" type byte offset 10 writedefault;
539 "vel_y" type byte offset 11 writedefault;
540 "spread_l" type ubyte offset 12 writedefault;
541 "spread_r" type ubyte offset 13 writedefault;
542 "spread_u" type ubyte offset 14 writedefault;
543 "spread_d" type ubyte offset 15 writedefault;