DEADSOFTWARE

mapdef cleanup; renamed some fields; mapdef.txt is RC0 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 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 `writedefault` 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 with `header` flag 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
18 // `as monsterid`: special hack for triggers: monster record number+1 in binary (so 0 means "none")
21 ////////////////////////////////////////////////////////////////////////////////
22 // main blocks
23 "map" size 452 bytes header binblock 7 {
24 "name" type char[32] offset 0 writedefault;
25 "author" type char[32] offset 32 default "";
26 "description" type char[256] offset 64 default "";
27 "music" type char[64] offset 320 default 'Standart.wad:D2DMUS\ПРОСТОТА';
28 "sky" type char[64] offset 384 default 'Standart.wad:D2DSKY\RSKY1';
29 "size" type size offset 448 as wh writedefault;
30 }
32 "texture" size 65 bytes binblock 1 {
33 "path" type char[64] offset 0 writedefault;
34 "animated" type bool offset 64 default false;
35 }
37 "panel" size 18 bytes binblock 2 {
38 "position" type point offset 0 as xy writedefault;
39 "size" type size offset 8 as wh as wh writedefault;
40 "texture" type ushort offset 12 texture writedefault;
41 "type" type ushort offset 14 bitset unique PanelType writedefault;
42 "alpha" type ubyte offset 16 default 0;
43 "flags" type ubyte offset 17 bitset PanelFlag default PANEL_FLAG_NONE;
44 // moving platform options, not in binary
45 "move_speed" type point default (0 0);
46 "size_speed" type point default (0 0); // alas, `size` cannot be negative
47 "move_start" type point default (0 0);
48 "move_end" type point default (0 0);
49 "size_end" type size default (0 0);
50 "move_active" type bool default false;
51 "move_once" type bool default false;
52 "end_pos_trigger" trigger default null;
53 "end_size_trigger" trigger default null;
54 }
56 "item" size 10 bytes binblock 3 {
57 "position" type point offset 0 as xy writedefault;
58 "type" type ubyte offset 8 enum Item writedefault;
59 "options" type ubyte offset 9 bitset ItemOption default ITEM_OPTION_NONE;
60 }
62 "monster" size 10 bytes binblock 5 {
63 "position" type point offset 0 as xy writedefault;
64 "type" type ubyte offset 8 enum Monster writedefault;
65 "direction" type ubyte offset 9 enum DirType default DIR_LEFT;
66 }
68 "area" size 10 bytes binblock 4 {
69 "position" type point offset 0 as xy writedefault;
70 "type" type ubyte offset 8 enum AreaType writedefault;
71 "direction" type ubyte offset 9 enum DirType default DIR_LEFT;
72 }
74 "trigger" size 148 bytes binblock 6 {
75 "position" type point offset 0 as xy writedefault;
76 "size" type size offset 8 as wh writedefault;
77 "enabled" type bool offset 12 default true;
78 "texture_panel" type int offset 13 panel default null;
79 "type" type ubyte offset 17 enum TriggerType writedefault;
80 "activate_type" type ubyte offset 18 bitset ActivateType;
81 "keys" type ubyte offset 19 bitset Key default KEY_NONE;
82 //WARNING: "trigdata" MUST be defined before "type", and "type" MUST be named "type" (for now, can be changed later)
83 "triggerdata" type trigdata[128] offset 20; // the only special nested structure
84 }
87 ////////////////////////////////////////////////////////////////////////////////
88 // special texture identifiers, used to generate pascal sources
89 enum TextureSpecial {
90 TEXTURE_SPECIAL_WATER = -1,
91 TEXTURE_SPECIAL_ACID1 = -2,
92 TEXTURE_SPECIAL_ACID2 = -3,
93 TEXTURE_NONE = -4,
94 }
96 // directions
97 enum DirType {
98 DIR_LEFT, // 0
99 DIR_RIGHT, // 1
100 DIR_SOMETHING2, // 2
103 // triggers
104 enum TriggerType {
105 TRIGGER_NONE, // 0
106 TRIGGER_EXIT, // 1
107 TRIGGER_TELEPORT, // 2
108 TRIGGER_OPENDOOR, // 3
109 TRIGGER_CLOSEDOOR, // 4
110 TRIGGER_DOOR, // 5
111 TRIGGER_DOOR5, // 6
112 TRIGGER_CLOSETRAP, // 7
113 TRIGGER_TRAP, // 8
114 TRIGGER_PRESS, // 9
115 TRIGGER_SECRET, // 10
116 TRIGGER_LIFTUP, // 11
117 TRIGGER_LIFTDOWN, // 12
118 TRIGGER_LIFT, // 13
119 TRIGGER_TEXTURE, // 14
120 TRIGGER_ON, // 15
121 TRIGGER_OFF, // 16
122 TRIGGER_ONOFF, // 17
123 TRIGGER_SOUND, // 18
124 TRIGGER_SPAWNMONSTER, // 19
125 TRIGGER_SPAWNITEM, // 20
126 TRIGGER_MUSIC, // 21
127 TRIGGER_PUSH, // 22
128 TRIGGER_SCORE, // 23
129 TRIGGER_MESSAGE, // 24
130 TRIGGER_DAMAGE, // 25
131 TRIGGER_HEALTH, // 26
132 TRIGGER_SHOT, // 27
133 TRIGGER_EFFECT, // 28
134 TRIGGER_SCRIPT, // 29
135 //
136 TRIGGER_MAX = MAX,
139 // "as XXX" means "generate this identifier for pascal sources
140 bitset PanelType {
141 PANEL_NONE = 0, // 0
142 PANEL_WALL, // 1
143 PANEL_BACK, // 2
144 PANEL_FORE, // 4
145 PANEL_WATER, // 8
146 PANEL_ACID1, // 16
147 PANEL_ACID2, // 32
148 PANEL_STEP, // 64
149 PANEL_LIFTUP, // 128
150 PANEL_LIFTDOWN, // 256
151 PANEL_OPENDOOR, // 512
152 PANEL_CLOSEDOOR, // 1024
153 PANEL_BLOCKMON, // 2048
154 PANEL_LIFTLEFT, // 4096
155 PANEL_LIFTRIGHT, // 8192
158 bitset PanelFlag {
159 PANEL_FLAG_NONE = 0, // 0
160 PANEL_FLAG_BLENDING, // 1
161 PANEL_FLAG_HIDE, // 2
162 PANEL_FLAG_WATERTEXTURES, // 4
165 enum EffectAction {
166 EFFECT_NONE, // 0
167 EFFECT_TELEPORT, // 1
168 EFFECT_RESPAWN, // 2
169 EFFECT_FIRE, // 3
172 enum Item {
173 ITEM_NONE, // 0
174 ITEM_MEDKIT_SMALL, // 1
175 ITEM_MEDKIT_LARGE, // 2
176 ITEM_MEDKIT_BLACK, // 3
177 ITEM_ARMOR_GREEN, // 4
178 ITEM_ARMOR_BLUE, // 5
179 ITEM_SPHERE_BLUE, // 6
180 ITEM_SPHERE_WHITE, // 7
181 ITEM_SUIT, // 8
182 ITEM_OXYGEN, // 9
183 ITEM_INVUL, // 10
184 ITEM_WEAPON_SAW, // 11
185 ITEM_WEAPON_SHOTGUN1, // 12
186 ITEM_WEAPON_SHOTGUN2, // 13
187 ITEM_WEAPON_CHAINGUN, // 14
188 ITEM_WEAPON_ROCKETLAUNCHER, // 15
189 ITEM_WEAPON_PLASMA, // 16
190 ITEM_WEAPON_BFG, // 17
191 ITEM_WEAPON_SUPERPULEMET, // 18
192 ITEM_AMMO_BULLETS, // 19
193 ITEM_AMMO_BULLETS_BOX, // 20
194 ITEM_AMMO_SHELLS, // 21
195 ITEM_AMMO_SHELLS_BOX, // 22
196 ITEM_AMMO_ROCKET, // 23
197 ITEM_AMMO_ROCKET_BOX, // 24
198 ITEM_AMMO_CELL, // 25
199 ITEM_AMMO_CELL_BIG, // 26
200 ITEM_AMMO_BACKPACK, // 27
201 ITEM_KEY_RED, // 28
202 ITEM_KEY_GREEN, // 29
203 ITEM_KEY_BLUE, // 30
204 ITEM_WEAPON_KASTET, // 31
205 ITEM_WEAPON_PISTOL, // 32
206 ITEM_BOTTLE, // 33
207 ITEM_HELMET, // 34
208 ITEM_JETPACK, // 35
209 ITEM_INVIS, // 36
210 ITEM_WEAPON_FLAMETHROWER, // 37
211 ITEM_AMMO_FUELCAN, // 38
212 //
213 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
216 bitset ItemOption {
217 ITEM_OPTION_NONE = 0, // 0
218 ITEM_OPTION_ONLYDM, // 1
219 ITEM_OPTION_FALL, // 2
222 enum AreaType {
223 AREA_NONE, // 0
224 AREA_PLAYERPOINT1, // 1
225 AREA_PLAYERPOINT2, // 2
226 AREA_DMPOINT, // 3
227 AREA_REDFLAG, // 4
228 AREA_BLUEFLAG, // 5
229 AREA_DOMFLAG, // 6
230 AREA_REDTEAMPOINT, // 7
231 AREA_BLUETEAMPOINT, // 8
234 enum Monster {
235 MONSTER_NONE, // 0
236 MONSTER_DEMON, // 1
237 MONSTER_IMP, // 2
238 MONSTER_ZOMBY, // 3
239 MONSTER_SERG, // 4
240 MONSTER_CYBER, // 5
241 MONSTER_CGUN, // 6
242 MONSTER_BARON, // 7
243 MONSTER_KNIGHT, // 8
244 MONSTER_CACO, // 9
245 MONSTER_SOUL, // 10
246 MONSTER_PAIN, // 11
247 MONSTER_SPIDER, // 12
248 MONSTER_BSP, // 13
249 MONSTER_MANCUB, // 14
250 MONSTER_SKEL, // 15
251 MONSTER_VILE, // 16
252 MONSTER_FISH, // 17
253 MONSTER_BARREL, // 18
254 MONSTER_ROBO, // 19
255 MONSTER_MAN, // 20
256 // aliases (fixme: it should be `MONSTER_ZOMBIE = MONSTER_ZOMBY`!)
257 MONSTER_ZOMBIE = 3,
260 enum MonsterBehaviour {
261 BH_NORMAL, // 0
262 BH_KILLER, // 1
263 BH_MANIAC, // 2
264 BH_INSANE, // 3
265 BH_CANNIBAL, // 4
266 BH_GOOD, // 5
269 enum TriggerShot {
270 TRIGGER_SHOT_PISTOL, // 0
271 TRIGGER_SHOT_BULLET, // 1
272 TRIGGER_SHOT_SHOTGUN, // 2
273 TRIGGER_SHOT_SSG, // 3
274 TRIGGER_SHOT_IMP, // 4
275 TRIGGER_SHOT_PLASMA, // 5
276 TRIGGER_SHOT_SPIDER, // 6
277 TRIGGER_SHOT_CACO, // 7
278 TRIGGER_SHOT_BARON, // 8
279 TRIGGER_SHOT_MANCUB, // 9
280 TRIGGER_SHOT_REV, // 10
281 TRIGGER_SHOT_ROCKET, // 11
282 TRIGGER_SHOT_BFG, // 12
283 TRIGGER_SHOT_EXPL, // 13
284 TRIGGER_SHOT_BFGEXPL, // 14
285 //
286 TRIGGER_SHOT_MAX = MAX,
289 enum TriggerShotTarget {
290 TRIGGER_SHOT_TARGET_NONE, // 0
291 TRIGGER_SHOT_TARGET_MON, // 1
292 TRIGGER_SHOT_TARGET_PLR, // 2
293 TRIGGER_SHOT_TARGET_RED, // 3
294 TRIGGER_SHOT_TARGET_BLUE, // 4
295 TRIGGER_SHOT_TARGET_MONPLR, // 5
296 TRIGGER_SHOT_TARGET_PLRMON, // 6
299 enum TriggerShotAim {
300 TRIGGER_SHOT_AIM_DEFAULT, // 0
301 TRIGGER_SHOT_AIM_ALLMAP, // 1
302 TRIGGER_SHOT_AIM_TRACE, // 2
303 TRIGGER_SHOT_AIM_TRACEALL, // 3
306 enum TriggerEffect {
307 TRIGGER_EFFECT_PARTICLE, // 0
308 TRIGGER_EFFECT_ANIMATION, // 1
311 enum TriggerEffectType {
312 TRIGGER_EFFECT_SLIQUID, // 0
313 TRIGGER_EFFECT_LLIQUID, // 1
314 TRIGGER_EFFECT_DLIQUID, // 2
315 TRIGGER_EFFECT_BLOOD, // 3
316 TRIGGER_EFFECT_SPARK, // 4
317 TRIGGER_EFFECT_BUBBLE, // 5
318 TRIGGER_EFFECT_MAX = MAX,
321 enum TriggerEffectPos {
322 TRIGGER_EFFECT_POS_CENTER, // 0
323 TRIGGER_EFFECT_POS_AREA, // 1
326 enum TriggerMusicAction {
327 TRIGGER_MUSIC_ACTION_STOP, // 0
328 TRIGGER_MUSIC_ACTION_PLAY, // 1; unpause or restart
331 enum TriggerScoreAction {
332 TRIGGER_SCORE_ACTION_ADD, // 0
333 TRIGGER_SCORE_ACTION_SUB, // 1
334 TRIGGER_SCORE_ACTION_WIN, // 2
335 TRIGGER_SCORE_ACTION_LOOSE, // 3
338 enum TriggerMessageDest {
339 TRIGGER_MESSAGE_DEST_ME, // 0
340 TRIGGER_MESSAGE_DEST_MY_TEAM, // 1
341 TRIGGER_MESSAGE_DEST_ENEMY_TEAM, // 2
342 TRIGGER_MESSAGE_DEST_RED_TEAM, // 3
343 TRIGGER_MESSAGE_DEST_BLUE_TEAM, // 4
344 TRIGGER_MESSAGE_DEST_EVERYONE, // 5
347 enum TriggerMessageKind {
348 TRIGGER_MESSAGE_KIND_CHAT, // 0
349 TRIGGER_MESSAGE_KIND_GAME, // 1
352 bitset ActivateType {
353 ACTIVATE_NONE = 0, // 0
354 ACTIVATE_PLAYERCOLLIDE, // 1
355 ACTIVATE_MONSTERCOLLIDE, // 2
356 ACTIVATE_PLAYERPRESS, // 4
357 ACTIVATE_MONSTERPRESS, // 8
358 ACTIVATE_SHOT, // 16
359 ACTIVATE_NOMONSTER, // 32
360 ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
363 bitset Key {
364 KEY_NONE = 0, // 0
365 KEY_RED, // 1
366 KEY_GREEN, // 2
367 KEY_BLUE, // 4
368 KEY_REDTEAM, // 8
369 KEY_BLUETEAM, // 16
373 ////////////////////////////////////////////////////////////////////////////////
374 // various triggers
375 TriggerData for TRIGGER_EXIT {
376 "map" type char[16] offset 0 writedefault;
379 TriggerData for TRIGGER_TELEPORT {
380 "target" type point offset 0 writedefault;
381 "d2d" type bool offset 8 default false;
382 "silent" type bool offset 9 default false;
383 "direction" type ubyte offset 10 enum DirType default DIR_LEFT;
386 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
387 "panelid" type int offset 0 panel writedefault;
388 "silent" type bool offset 4 default false;
389 "d2d" type bool offset 5 default false;
392 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
393 "position" type point offset 0 as txy default (0 0) writedefault;
394 "size" type size offset 8 as twh default (0 0);
395 "wait" type ushort offset 12 default 0;
396 "count" alias pressCount type ushort offset 14 default 0;
397 "monsterid" type int offset 16 monster as monsterid default null;
398 "ext_random" type bool offset 20 default false;
399 // this one is for moving platforms
400 "panelid" panel default null;
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;