Added option for alt vkbd layout
[d2df-sdl.git] / src / mapdef / mapdef.txt
blobdf3298a5ae34967472c81aea9aebf6c4790f5547
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";
33 "texture" size 65 bytes binblock 1 {
34   "path" type char[64] offset 0 writedefault;
35   "animated" type bool offset 64 default false;
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;
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;
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;
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;
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";
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   //
293   TRIGGER_SHOT_MAX = MAX,
296 enum TriggerShotTarget {
297   TRIGGER_SHOT_TARGET_NONE, // 0
298   TRIGGER_SHOT_TARGET_MON, // 1
299   TRIGGER_SHOT_TARGET_PLR, // 2
300   TRIGGER_SHOT_TARGET_RED, // 3
301   TRIGGER_SHOT_TARGET_BLUE, // 4
302   TRIGGER_SHOT_TARGET_MONPLR, // 5
303   TRIGGER_SHOT_TARGET_PLRMON, // 6
306 enum TriggerShotAim {
307   TRIGGER_SHOT_AIM_DEFAULT, // 0
308   TRIGGER_SHOT_AIM_ALLMAP, // 1
309   TRIGGER_SHOT_AIM_TRACE, // 2
310   TRIGGER_SHOT_AIM_TRACEALL, // 3
313 enum TriggerEffect {
314   TRIGGER_EFFECT_PARTICLE, // 0
315   TRIGGER_EFFECT_ANIMATION, // 1
318 enum TriggerEffectType {
319   TRIGGER_EFFECT_SLIQUID, // 0
320   TRIGGER_EFFECT_LLIQUID, // 1
321   TRIGGER_EFFECT_DLIQUID, // 2
322   TRIGGER_EFFECT_BLOOD, // 3
323   TRIGGER_EFFECT_SPARK, // 4
324   TRIGGER_EFFECT_BUBBLE, // 5
325   TRIGGER_EFFECT_MAX = MAX,
328 enum TriggerEffectPos {
329   TRIGGER_EFFECT_POS_CENTER, // 0
330   TRIGGER_EFFECT_POS_AREA, // 1
333 enum TriggerMusicAction {
334   TRIGGER_MUSIC_ACTION_STOP, // 0
335   TRIGGER_MUSIC_ACTION_PLAY, // 1; unpause or restart
338 enum TriggerScoreAction {
339   TRIGGER_SCORE_ACTION_ADD, // 0
340   TRIGGER_SCORE_ACTION_SUB, // 1
341   TRIGGER_SCORE_ACTION_WIN, // 2
342   TRIGGER_SCORE_ACTION_LOOSE, // 3
345 enum TriggerMessageDest {
346   TRIGGER_MESSAGE_DEST_ME, // 0
347   TRIGGER_MESSAGE_DEST_MY_TEAM, // 1
348   TRIGGER_MESSAGE_DEST_ENEMY_TEAM, // 2
349   TRIGGER_MESSAGE_DEST_RED_TEAM, // 3
350   TRIGGER_MESSAGE_DEST_BLUE_TEAM, // 4
351   TRIGGER_MESSAGE_DEST_EVERYONE, // 5
354 enum TriggerMessageKind {
355   TRIGGER_MESSAGE_KIND_CHAT, // 0
356   TRIGGER_MESSAGE_KIND_GAME, // 1
359 bitset ActivateType {
360   ACTIVATE_NONE = 0, // 0
361   ACTIVATE_PLAYERCOLLIDE, // 1
362   ACTIVATE_MONSTERCOLLIDE, // 2
363   ACTIVATE_PLAYERPRESS, // 4
364   ACTIVATE_MONSTERPRESS, // 8
365   ACTIVATE_SHOT, // 16
366   ACTIVATE_NOMONSTER, // 32
367   ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
370 bitset Key {
371   KEY_NONE = 0, // 0
372   KEY_RED, // 1
373   KEY_GREEN, // 2
374   KEY_BLUE, // 4
375   KEY_REDTEAM, // 8
376   KEY_BLUETEAM, // 16
379 enum HitType {
380   HIT_SOME, // 0
381   HIT_ROCKET, // 1
382   HIT_BFG, // 2
383   HIT_TRAP, // 3
384   HIT_FALL, // 4
385   HIT_WATER, // 5
386   HIT_ACID, // 6
387   HIT_ELECTRO, // 7
388   HIT_FLAME, // 8
389   HIT_SELF, // 9
390   HIT_DISCON, // 10
394 ////////////////////////////////////////////////////////////////////////////////
395 // various triggers
396 TriggerData for TRIGGER_EXIT {
397   "map" type char[16] offset 0 writedefault;
400 TriggerData for TRIGGER_TELEPORT {
401   "target" type point offset 0 writedefault;
402   "d2d" type bool offset 8 default false;
403   "silent" type bool offset 9 default false;
404   "direction" type ubyte offset 10 enum DirType default DIR_LEFT;
407 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
408   "panelid" type int offset 0 panel writedefault;
409   "silent" type bool offset 4 default false;
410   "d2d" type bool offset 5 default false;
413 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
414   "position" type point offset 0 as txy default (0 0) writedefault;
415   "size" type size offset 8 as twh default (0 0);
416   "wait" type ushort offset 12 default 0;
417   "count" alias pressCount type ushort offset 14 default 0;
418   "monsterid" type int offset 16 monster as monsterid default null;
419   "ext_random" type bool offset 20 default false;
420   // this one is for moving platforms
421   "panelid" panel default null;
422   "silent" type bool default true;
423   "sound" type string default "";
426 enum TriggerScoreTeam {
427   TRIGGER_SCORE_TEAM_MINE_RED, // 0
428   TRIGGER_SCORE_TEAM_MINE_BLUE, // 1
429   TRIGGER_SCORE_TEAM_FORCE_RED, // 2
430   TRIGGER_SCORE_TEAM_FORCE_BLUE, // 3
433 TriggerData for TRIGGER_SECRET {
436 TriggerData for TRIGGER_TEXTURE {
437   "activate_once" type bool offset 0 default false writedefault;
438   "animate_once" type bool offset 1 default false writedefault;
441 TriggerData for TRIGGER_SOUND {
442   "sound_name" type char[64] offset 0 writedefault;
443   "volume" type ubyte offset 64 default 0 writedefault; //??? default ???
444   "pan" type ubyte offset 65 default 0;
445   "local" type bool offset 66 default true; //??? default ???
446   "play_count" type ubyte offset 67 default 1;
447   "sound_switch" type bool offset 68 default false; //??? default ???
450 TriggerData for TRIGGER_SPAWNMONSTER {
451   "position" type point offset 0 as txy writedefault;
452   "type" alias spawnMonsType type ubyte offset 8 enum Monster default MONSTER_IMP writedefault;
453   "health" type int offset 12 writedefault;
454   "direction" type ubyte offset 16 enum DirType default DIR_LEFT writedefault;
455   "active" type bool offset 17 default true;
456   "count" alias monsCount type int offset 20 default 1 writedefault;
457   "effect" type ubyte offset 24 enum EffectAction default EFFECT_NONE writedefault;
458   "max" type ushort offset 26 default 1 writedefault;
459   "delay" type ushort offset 28 default 1000 writedefault;
460   "behaviour" type ubyte offset 30 enum MonsterBehaviour default BH_NORMAL;
463 TriggerData for TRIGGER_SPAWNITEM {
464   "position" type point offset 0 as txy writedefault;
465   "type" alias spawnItemType type ubyte offset 8 enum Item default ITEM_NONE writedefault;
466   "gravity" type bool offset 9 default true;
467   "dmonly" type bool offset 10 default false;
468   "count" alias itemCount type int offset 12 default 1;
469   "effect" type ubyte offset 16 enum EffectAction default EFFECT_NONE writedefault;
470   "max" type ushort offset 18 default 1;
471   "delay" type ushort offset 20 default 1000 writedefault;
474 TriggerData for TRIGGER_MUSIC {
475   "name" alias musicName type char[64] offset 0 writedefault;
476   "action" alias musicAction type ubyte offset 64 enum TriggerMusicAction writedefault;
479 TriggerData for TRIGGER_PUSH {
480   "angle" type ushort offset 0 writedefault;
481   "force" type ubyte offset 2 writedefault;
482   "reset_velocity" type bool offset 3 default false writedefault;
485 TriggerData for TRIGGER_SCORE {
486   "action" alias scoreAction type ubyte offset 0 enum TriggerScoreAction default TRIGGER_SCORE_ACTION_ADD writedefault;
487   "count" alias scoreCount type ubyte offset 1 default 1 writedefault;
488   "team" alias scoreTeam type ubyte offset 2 enum TriggerScoreTeam writedefault;
489   "console" alias scoreCon type bool offset 3 default false writedefault;
490   "message" alias scoreMsg type bool offset 4 default true writedefault;
493 TriggerData for TRIGGER_MESSAGE {
494   "kind" type ubyte offset 0 enum TriggerMessageKind default TRIGGER_MESSAGE_KIND_GAME writedefault;
495   "dest" alias msgDest type ubyte enum TriggerMessageDest offset 1;
496   "text" type char[100] offset 2 writedefault;
497   "time" alias msgTime type ushort offset 102 writedefault;
500 TriggerData for TRIGGER_DAMAGE {
501   "amount" type ushort offset 0 writedefault;
502   "interval" type ushort offset 2 writedefault;
505 TriggerData for TRIGGER_HEALTH {
506   "amount" type ushort offset 0 writedefault;
507   "interval" type ushort offset 2 writedefault;
508   "max" alias healMax type bool offset 4 writedefault;
509   "silent" type bool offset 5 writedefault;
512 TriggerData for TRIGGER_SHOT {
513   "position" type point offset 0 as txy writedefault;
514   "type" alias shotType type ubyte offset 8 enum TriggerShot writedefault;
515   "target" alias shotTarget type ubyte offset 9 enum TriggerShotTarget writedefault;
516   "quiet" type negbool offset 10; // negbool!
517   "aim" type byte offset 11 enum TriggerShotAim default TRIGGER_SHOT_AIM_DEFAULT;
518   "panelid" type int offset 12 panel default null writedefault;
519   "sight" type ushort offset 16;
520   "angle" type ushort offset 18;
521   "wait" type ushort offset 20;
522   "accuracy" type ushort offset 22;
523   "ammo" type ushort offset 24;
524   "reload" type ushort offset 26;
527 TriggerData for TRIGGER_EFFECT {
528   "count" alias FXCount type ubyte offset 0 writedefault;
529   "type" alias FXType type ubyte offset 1 enum TriggerEffect default TRIGGER_EFFECT_PARTICLE writedefault;
530   "subtype" alias FXSubType type ubyte offset 2 enum TriggerEffectType default TRIGGER_EFFECT_SPARK writedefault;
531   "red" alias FXRed type ubyte offset 3 writedefault;
532   "green" alias FXGreen type ubyte offset 4 writedefault;
533   "blue" alias FXBlue type ubyte offset 5 writedefault;
534   "pos" alias FXPos type ubyte offset 6 enum TriggerEffectPos default TRIGGER_EFFECT_POS_CENTER writedefault;
535   "wait" type ushort offset 8 writedefault;
536   "vel_x" type byte offset 10 writedefault;
537   "vel_y" type byte offset 11 writedefault;
538   "spread_l" type ubyte offset 12 writedefault;
539   "spread_r" type ubyte offset 13 writedefault;
540   "spread_u" type ubyte offset 14 writedefault;
541   "spread_d" type ubyte offset 15 writedefault;