DEADSOFTWARE

ambient light for level (doesn't work with dynamic lights; I. WANT. SHADERS!)
[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 }
88 ////////////////////////////////////////////////////////////////////////////////
89 // special texture identifiers, used to generate pascal sources
90 enum TextureSpecial {
91 TEXTURE_SPECIAL_WATER = -1,
92 TEXTURE_SPECIAL_ACID1 = -2,
93 TEXTURE_SPECIAL_ACID2 = -3,
94 TEXTURE_NONE = -4,
95 }
97 // directions
98 enum DirType {
99 DIR_LEFT, // 0
100 DIR_RIGHT, // 1
101 DIR_SOMETHING2, // 2
104 // triggers
105 enum TriggerType {
106 TRIGGER_NONE, // 0
107 TRIGGER_EXIT, // 1
108 TRIGGER_TELEPORT, // 2
109 TRIGGER_OPENDOOR, // 3
110 TRIGGER_CLOSEDOOR, // 4
111 TRIGGER_DOOR, // 5
112 TRIGGER_DOOR5, // 6
113 TRIGGER_CLOSETRAP, // 7
114 TRIGGER_TRAP, // 8
115 TRIGGER_PRESS, // 9
116 TRIGGER_SECRET, // 10
117 TRIGGER_LIFTUP, // 11
118 TRIGGER_LIFTDOWN, // 12
119 TRIGGER_LIFT, // 13
120 TRIGGER_TEXTURE, // 14
121 TRIGGER_ON, // 15
122 TRIGGER_OFF, // 16
123 TRIGGER_ONOFF, // 17
124 TRIGGER_SOUND, // 18
125 TRIGGER_SPAWNMONSTER, // 19
126 TRIGGER_SPAWNITEM, // 20
127 TRIGGER_MUSIC, // 21
128 TRIGGER_PUSH, // 22
129 TRIGGER_SCORE, // 23
130 TRIGGER_MESSAGE, // 24
131 TRIGGER_DAMAGE, // 25
132 TRIGGER_HEALTH, // 26
133 TRIGGER_SHOT, // 27
134 TRIGGER_EFFECT, // 28
135 TRIGGER_SCRIPT, // 29
136 //
137 TRIGGER_MAX = MAX,
140 // "as XXX" means "generate this identifier for pascal sources
141 bitset PanelType {
142 PANEL_NONE = 0, // 0
143 PANEL_WALL, // 1
144 PANEL_BACK, // 2
145 PANEL_FORE, // 4
146 PANEL_WATER, // 8
147 PANEL_ACID1, // 16
148 PANEL_ACID2, // 32
149 PANEL_STEP, // 64
150 PANEL_LIFTUP, // 128
151 PANEL_LIFTDOWN, // 256
152 PANEL_OPENDOOR, // 512
153 PANEL_CLOSEDOOR, // 1024
154 PANEL_BLOCKMON, // 2048
155 PANEL_LIFTLEFT, // 4096
156 PANEL_LIFTRIGHT, // 8192
159 bitset PanelFlag {
160 PANEL_FLAG_NONE = 0, // 0
161 PANEL_FLAG_BLENDING, // 1
162 PANEL_FLAG_HIDE, // 2
163 PANEL_FLAG_WATERTEXTURES, // 4
166 enum EffectAction {
167 EFFECT_NONE, // 0
168 EFFECT_TELEPORT, // 1
169 EFFECT_RESPAWN, // 2
170 EFFECT_FIRE, // 3
173 enum Item {
174 ITEM_NONE, // 0
175 ITEM_MEDKIT_SMALL, // 1
176 ITEM_MEDKIT_LARGE, // 2
177 ITEM_MEDKIT_BLACK, // 3
178 ITEM_ARMOR_GREEN, // 4
179 ITEM_ARMOR_BLUE, // 5
180 ITEM_SPHERE_BLUE, // 6
181 ITEM_SPHERE_WHITE, // 7
182 ITEM_SUIT, // 8
183 ITEM_OXYGEN, // 9
184 ITEM_INVUL, // 10
185 ITEM_WEAPON_SAW, // 11
186 ITEM_WEAPON_SHOTGUN1, // 12
187 ITEM_WEAPON_SHOTGUN2, // 13
188 ITEM_WEAPON_CHAINGUN, // 14
189 ITEM_WEAPON_ROCKETLAUNCHER, // 15
190 ITEM_WEAPON_PLASMA, // 16
191 ITEM_WEAPON_BFG, // 17
192 ITEM_WEAPON_SUPERPULEMET, // 18
193 ITEM_AMMO_BULLETS, // 19
194 ITEM_AMMO_BULLETS_BOX, // 20
195 ITEM_AMMO_SHELLS, // 21
196 ITEM_AMMO_SHELLS_BOX, // 22
197 ITEM_AMMO_ROCKET, // 23
198 ITEM_AMMO_ROCKET_BOX, // 24
199 ITEM_AMMO_CELL, // 25
200 ITEM_AMMO_CELL_BIG, // 26
201 ITEM_AMMO_BACKPACK, // 27
202 ITEM_KEY_RED, // 28
203 ITEM_KEY_GREEN, // 29
204 ITEM_KEY_BLUE, // 30
205 ITEM_WEAPON_KASTET, // 31
206 ITEM_WEAPON_PISTOL, // 32
207 ITEM_BOTTLE, // 33
208 ITEM_HELMET, // 34
209 ITEM_JETPACK, // 35
210 ITEM_INVIS, // 36
211 ITEM_WEAPON_FLAMETHROWER, // 37
212 ITEM_AMMO_FUELCAN, // 38
213 //
214 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
217 bitset ItemOption {
218 ITEM_OPTION_NONE = 0, // 0
219 ITEM_OPTION_ONLYDM, // 1
220 ITEM_OPTION_FALL, // 2
223 enum AreaType {
224 AREA_NONE, // 0
225 AREA_PLAYERPOINT1, // 1
226 AREA_PLAYERPOINT2, // 2
227 AREA_DMPOINT, // 3
228 AREA_REDFLAG, // 4
229 AREA_BLUEFLAG, // 5
230 AREA_DOMFLAG, // 6
231 AREA_REDTEAMPOINT, // 7
232 AREA_BLUETEAMPOINT, // 8
235 enum Monster {
236 MONSTER_NONE, // 0
237 MONSTER_DEMON, // 1
238 MONSTER_IMP, // 2
239 MONSTER_ZOMBY, // 3
240 MONSTER_SERG, // 4
241 MONSTER_CYBER, // 5
242 MONSTER_CGUN, // 6
243 MONSTER_BARON, // 7
244 MONSTER_KNIGHT, // 8
245 MONSTER_CACO, // 9
246 MONSTER_SOUL, // 10
247 MONSTER_PAIN, // 11
248 MONSTER_SPIDER, // 12
249 MONSTER_BSP, // 13
250 MONSTER_MANCUB, // 14
251 MONSTER_SKEL, // 15
252 MONSTER_VILE, // 16
253 MONSTER_FISH, // 17
254 MONSTER_BARREL, // 18
255 MONSTER_ROBO, // 19
256 MONSTER_MAN, // 20
257 // aliases (fixme: it should be `MONSTER_ZOMBIE = MONSTER_ZOMBY`!)
258 MONSTER_ZOMBIE = 3,
261 enum MonsterBehaviour {
262 BH_NORMAL, // 0
263 BH_KILLER, // 1
264 BH_MANIAC, // 2
265 BH_INSANE, // 3
266 BH_CANNIBAL, // 4
267 BH_GOOD, // 5
270 enum TriggerShot {
271 TRIGGER_SHOT_PISTOL, // 0
272 TRIGGER_SHOT_BULLET, // 1
273 TRIGGER_SHOT_SHOTGUN, // 2
274 TRIGGER_SHOT_SSG, // 3
275 TRIGGER_SHOT_IMP, // 4
276 TRIGGER_SHOT_PLASMA, // 5
277 TRIGGER_SHOT_SPIDER, // 6
278 TRIGGER_SHOT_CACO, // 7
279 TRIGGER_SHOT_BARON, // 8
280 TRIGGER_SHOT_MANCUB, // 9
281 TRIGGER_SHOT_REV, // 10
282 TRIGGER_SHOT_ROCKET, // 11
283 TRIGGER_SHOT_BFG, // 12
284 TRIGGER_SHOT_EXPL, // 13
285 TRIGGER_SHOT_BFGEXPL, // 14
286 //
287 TRIGGER_SHOT_MAX = MAX,
290 enum TriggerShotTarget {
291 TRIGGER_SHOT_TARGET_NONE, // 0
292 TRIGGER_SHOT_TARGET_MON, // 1
293 TRIGGER_SHOT_TARGET_PLR, // 2
294 TRIGGER_SHOT_TARGET_RED, // 3
295 TRIGGER_SHOT_TARGET_BLUE, // 4
296 TRIGGER_SHOT_TARGET_MONPLR, // 5
297 TRIGGER_SHOT_TARGET_PLRMON, // 6
300 enum TriggerShotAim {
301 TRIGGER_SHOT_AIM_DEFAULT, // 0
302 TRIGGER_SHOT_AIM_ALLMAP, // 1
303 TRIGGER_SHOT_AIM_TRACE, // 2
304 TRIGGER_SHOT_AIM_TRACEALL, // 3
307 enum TriggerEffect {
308 TRIGGER_EFFECT_PARTICLE, // 0
309 TRIGGER_EFFECT_ANIMATION, // 1
312 enum TriggerEffectType {
313 TRIGGER_EFFECT_SLIQUID, // 0
314 TRIGGER_EFFECT_LLIQUID, // 1
315 TRIGGER_EFFECT_DLIQUID, // 2
316 TRIGGER_EFFECT_BLOOD, // 3
317 TRIGGER_EFFECT_SPARK, // 4
318 TRIGGER_EFFECT_BUBBLE, // 5
319 TRIGGER_EFFECT_MAX = MAX,
322 enum TriggerEffectPos {
323 TRIGGER_EFFECT_POS_CENTER, // 0
324 TRIGGER_EFFECT_POS_AREA, // 1
327 enum TriggerMusicAction {
328 TRIGGER_MUSIC_ACTION_STOP, // 0
329 TRIGGER_MUSIC_ACTION_PLAY, // 1; unpause or restart
332 enum TriggerScoreAction {
333 TRIGGER_SCORE_ACTION_ADD, // 0
334 TRIGGER_SCORE_ACTION_SUB, // 1
335 TRIGGER_SCORE_ACTION_WIN, // 2
336 TRIGGER_SCORE_ACTION_LOOSE, // 3
339 enum TriggerMessageDest {
340 TRIGGER_MESSAGE_DEST_ME, // 0
341 TRIGGER_MESSAGE_DEST_MY_TEAM, // 1
342 TRIGGER_MESSAGE_DEST_ENEMY_TEAM, // 2
343 TRIGGER_MESSAGE_DEST_RED_TEAM, // 3
344 TRIGGER_MESSAGE_DEST_BLUE_TEAM, // 4
345 TRIGGER_MESSAGE_DEST_EVERYONE, // 5
348 enum TriggerMessageKind {
349 TRIGGER_MESSAGE_KIND_CHAT, // 0
350 TRIGGER_MESSAGE_KIND_GAME, // 1
353 bitset ActivateType {
354 ACTIVATE_NONE = 0, // 0
355 ACTIVATE_PLAYERCOLLIDE, // 1
356 ACTIVATE_MONSTERCOLLIDE, // 2
357 ACTIVATE_PLAYERPRESS, // 4
358 ACTIVATE_MONSTERPRESS, // 8
359 ACTIVATE_SHOT, // 16
360 ACTIVATE_NOMONSTER, // 32
361 ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
364 bitset Key {
365 KEY_NONE = 0, // 0
366 KEY_RED, // 1
367 KEY_GREEN, // 2
368 KEY_BLUE, // 4
369 KEY_REDTEAM, // 8
370 KEY_BLUETEAM, // 16
374 ////////////////////////////////////////////////////////////////////////////////
375 // various triggers
376 TriggerData for TRIGGER_EXIT {
377 "map" type char[16] offset 0 writedefault;
380 TriggerData for TRIGGER_TELEPORT {
381 "target" type point offset 0 writedefault;
382 "d2d" type bool offset 8 default false;
383 "silent" type bool offset 9 default false;
384 "direction" type ubyte offset 10 enum DirType default DIR_LEFT;
387 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
388 "panelid" type int offset 0 panel writedefault;
389 "silent" type bool offset 4 default false;
390 "d2d" type bool offset 5 default false;
393 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
394 "position" type point offset 0 as txy default (0 0) writedefault;
395 "size" type size offset 8 as twh default (0 0);
396 "wait" type ushort offset 12 default 0;
397 "count" alias pressCount type ushort offset 14 default 0;
398 "monsterid" type int offset 16 monster as monsterid default null;
399 "ext_random" type bool offset 20 default false;
400 // this one is for moving platforms
401 "panelid" panel default null;
402 "silent" type bool default true;
403 "sound" type string default "";
406 enum TriggerScoreTeam {
407 TRIGGER_SCORE_TEAM_MINE_RED, // 0
408 TRIGGER_SCORE_TEAM_MINE_BLUE, // 1
409 TRIGGER_SCORE_TEAM_FORCE_RED, // 2
410 TRIGGER_SCORE_TEAM_FORCE_BLUE, // 3
413 TriggerData for TRIGGER_SECRET {
416 TriggerData for TRIGGER_TEXTURE {
417 "activate_once" type bool offset 0 default false writedefault;
418 "animate_once" type bool offset 1 default false writedefault;
421 TriggerData for TRIGGER_SOUND {
422 "sound_name" type char[64] offset 0 writedefault;
423 "volume" type ubyte offset 64 default 0 writedefault; //??? default ???
424 "pan" type ubyte offset 65 default 0;
425 "local" type bool offset 66 default true; //??? default ???
426 "play_count" type ubyte offset 67 default 1;
427 "sound_switch" type bool offset 68 default false; //??? default ???
430 TriggerData for TRIGGER_SPAWNMONSTER {
431 "position" type point offset 0 as txy writedefault;
432 "type" alias spawnMonsType type ubyte offset 8 enum Monster default MONSTER_IMP writedefault;
433 "health" type int offset 12 writedefault;
434 "direction" type ubyte offset 16 enum DirType default DIR_LEFT writedefault;
435 "active" type bool offset 17 default true;
436 "count" alias monsCount type int offset 20 default 1 writedefault;
437 "effect" type ubyte offset 24 enum EffectAction default EFFECT_NONE writedefault;
438 "max" type ushort offset 26 default 1 writedefault;
439 "delay" type ushort offset 28 default 1000 writedefault;
440 "behaviour" type ubyte offset 30 enum MonsterBehaviour default BH_NORMAL;
443 TriggerData for TRIGGER_SPAWNITEM {
444 "position" type point offset 0 as txy writedefault;
445 "type" alias spawnItemType type ubyte offset 8 enum Item default ITEM_NONE writedefault;
446 "gravity" type bool offset 9 default true;
447 "dmonly" type bool offset 10 default false;
448 "count" alias itemCount type int offset 12 default 1;
449 "effect" type ubyte offset 16 enum EffectAction default EFFECT_NONE writedefault;
450 "max" type ushort offset 18 default 1;
451 "delay" type ushort offset 20 default 1000 writedefault;
454 TriggerData for TRIGGER_MUSIC {
455 "name" alias musicName type char[64] offset 0 writedefault;
456 "action" alias musicAction type ubyte offset 64 enum TriggerMusicAction writedefault;
459 TriggerData for TRIGGER_PUSH {
460 "angle" type ushort offset 0 writedefault;
461 "force" type ubyte offset 2 writedefault;
462 "reset_velocity" type bool offset 3 default false writedefault;
465 TriggerData for TRIGGER_SCORE {
466 "action" alias scoreAction type ubyte offset 0 enum TriggerScoreAction default TRIGGER_SCORE_ACTION_ADD writedefault;
467 "count" alias scoreCount type ubyte offset 1 default 1 writedefault;
468 "team" alias scoreTeam type ubyte offset 2 enum TriggerScoreTeam writedefault;
469 "console" alias scoreCon type bool offset 3 default false writedefault;
470 "message" alias scoreMsg type bool offset 4 default true writedefault;
473 TriggerData for TRIGGER_MESSAGE {
474 "kind" type ubyte offset 0 enum TriggerMessageKind default TRIGGER_MESSAGE_KIND_GAME writedefault;
475 "dest" alias msgDest type ubyte enum TriggerMessageDest offset 1;
476 "text" type char[100] offset 2 writedefault;
477 "time" alias msgTime type ushort offset 102 writedefault;
480 TriggerData for TRIGGER_DAMAGE {
481 "amount" type ushort offset 0 writedefault;
482 "interval" type ushort offset 2 writedefault;
485 TriggerData for TRIGGER_HEALTH {
486 "amount" type ushort offset 0 writedefault;
487 "interval" type ushort offset 2 writedefault;
488 "max" alias healMax type bool offset 4 writedefault;
489 "silent" type bool offset 5 writedefault;
492 TriggerData for TRIGGER_SHOT {
493 "position" type point offset 0 as txy writedefault;
494 "type" alias shotType type ubyte offset 8 enum TriggerShot writedefault;
495 "target" alias shotTarget type ubyte offset 9 enum TriggerShotTarget writedefault;
496 "quiet" type negbool offset 10; // negbool!
497 "aim" type byte offset 11 enum TriggerShotAim default TRIGGER_SHOT_AIM_DEFAULT;
498 "panelid" type int offset 12 panel default null writedefault;
499 "sight" type ushort offset 16;
500 "angle" type ushort offset 18;
501 "wait" type ushort offset 20;
502 "accuracy" type ushort offset 22;
503 "ammo" type ushort offset 24;
504 "reload" type ushort offset 26;
507 TriggerData for TRIGGER_EFFECT {
508 "count" alias FXCount type ubyte offset 0 writedefault;
509 "type" alias FXType type ubyte offset 1 enum TriggerEffect default TRIGGER_EFFECT_PARTICLE writedefault;
510 "subtype" alias FXSubType type ubyte offset 2 enum TriggerEffectType default TRIGGER_EFFECT_SPARK writedefault;
511 "red" alias FXRed type ubyte offset 3 writedefault;
512 "green" alias FXGreen type ubyte offset 4 writedefault;
513 "blue" alias FXBlue type ubyte offset 5 writedefault;
514 "pos" alias FXPos type ubyte offset 6 enum TriggerEffectPos default TRIGGER_EFFECT_POS_CENTER writedefault;
515 "wait" type ushort offset 8 writedefault;
516 "vel_x" type byte offset 10 writedefault;
517 "vel_y" type byte offset 11 writedefault;
518 "spread_l" type ubyte offset 12 writedefault;
519 "spread_r" type ubyte offset 13 writedefault;
520 "spread_u" type ubyte offset 14 writedefault;
521 "spread_d" type ubyte offset 15 writedefault;