DEADSOFTWARE

mplat fixes
[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 `omitdefault` 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 TMapHeaderRec_1 is "map" size 452 bytes header binblock 7 {
24 //_ is "version" type uint minvalue 1 maxvalue 1;
25 MapName is "name" type char[32] offset 0;
26 MapAuthor is "author" type char[32] offset 32 default "" omitdefault;
27 MapDescription is "description" type char[256] offset 64 default "" omitdefault;
28 MusicName is "music" type char[64] offset 320 default 'Standart.wad:D2DMUS\ПРОСТОТА' omitdefault;
29 SkyName is "sky" type char[64] offset 384 default 'Standart.wad:D2DSKY\RSKY1' omitdefault;
30 //Width is "width" type ushort offset 448;
31 //Height is "height" type ushort offset 450;
32 Size is "size" type size offset 448 as wh;
33 // not in binary
34 Title is "title" type string default "" omitdefault;
35 }
37 TTextureRec_1 is "texture" size 65 bytes binblock 1 {
38 Resource is "path" type char[64] offset 0;
39 Anim is "animated" type bool offset 64 default false omitdefault;
40 // internals
41 TexIdx is "texidx" type uint internal;
42 }
44 TPanelRec_1 is "panel" size 18 bytes binblock 2 {
45 //X is "x" type int offset 0;
46 //Y is "y" type int offset 4;
47 Pos is "position" type point offset 0 as xy;
48 //Width is "width" type ushort offset 8;
49 //Height is "height" type ushort offset 10;
50 Size is "size" type size offset 8 as wh as wh;
51 TextureNum is "texture" type ushort offset 12 texture;
52 PanelType is "type" type ushort offset 14 bitset unique PanelType;
53 Alpha is "alpha" type ubyte offset 16 default 0 omitdefault;
54 Flags is "flags" type ubyte offset 17 bitset PanelFlag default PANEL_FLAG_NONE omitdefault;
55 // moving platform options, not in binary
56 MoveSpeed is "move_speed" type point default (0 0) omitdefault;
57 SizeSpeed is "size_speed" type point default (0 0) omitdefault; // alas, `size` cannot be negative
58 MoveStart is "move_start" type point default (0 0) omitdefault;
59 MoveEnd is "move_end" type point default (0 0) omitdefault;
60 SizeEnd is "size_end" type size default (0 0) omitdefault;
61 MoveActive is "move_active" type bool default false omitdefault;
62 MoveOnce is "move_once" type bool default false omitdefault;
63 EndPosTrigger is "end_pos_trigger" type int trigger default null omitdefault;
64 EndSizeTrigger is "end_size_trigger" type int trigger default null omitdefault;
65 // not in binary
66 //Id is "id" type string default "" omitdefault;
67 // internals
68 PanIdx is "panidx" type uint internal;
69 }
71 TItemRec_1 is "item" size 10 bytes binblock 3 {
72 //X is "x" type int offset 0;
73 //Y is "y" type int offset 4;
74 Pos is "position" type point offset 0 as xy;
75 ItemType is "type" type ubyte offset 8 enum Item;
76 Options is "options" type ubyte offset 9 bitset ItemOption default ITEM_OPTION_NONE omitdefault;
77 // not in binary
78 //Id is "id" type string default "" omitdefault;
79 // internals
80 ItemIdx is "itemidx" type uint internal;
81 }
83 TMonsterRec_1 is "monster" size 10 bytes binblock 5 {
84 //X is "x" type int offset 0;
85 //Y is "y" type int offset 4;
86 Pos is "position" type point offset 0 as xy;
87 MonsterType is "type" type ubyte offset 8 enum Monster;
88 Direction is "direction" type ubyte offset 9 enum DirType default DIR_LEFT omitdefault;
89 // not in binary
90 //Id is "id" type string default "" omitdefault;
91 // internals
92 MonsIdx is "monsidx" type uint internal;
93 }
95 TAreaRec_1 is "area" size 10 bytes binblock 4 {
96 //X is "x" type int offset 0;
97 //Y is "y" type int offset 4;
98 Pos is "position" type point offset 0 as xy;
99 AreaType is "type" type ubyte offset 8 enum AreaType;
100 Direction is "direction" type ubyte offset 9 enum DirType default DIR_LEFT omitdefault;
101 // not in binary
102 //Id is "id" type string default "" omitdefault;
103 // internals
104 AreaIdx is "areaidx" type uint internal;
107 TTriggerRec_1 is "trigger" size 148 bytes binblock 6 {
108 //X is "x" type int offset 0;
109 //Y is "y" type int offset 4;
110 Pos is "position" type point offset 0 as xy;
111 //Width is "width" type ushort offset 8;
112 //Height is "height" type ushort offset 10;
113 Size is "size" type size offset 8 as wh;
114 Enabled is "enabled" type bool offset 12 default true omitdefault;
115 TexturePanel is "texturepanel" type int offset 13 panel default null omitdefault;
116 TriggerType is "type" type ubyte offset 17 enum TriggerType;
117 ActivateType is "activatetype" type ubyte offset 18 bitset ActivateType;
118 Keys is "keys" type ubyte offset 19 bitset Key default KEY_NONE omitdefault;
119 //WARNING: "trigdata" MUST be defined before "type", and "type" MUST be named "type" (for now, can be changed later)
120 DATA is "triggerdata" type trigdata[128] offset 20; // the only special nested structure
121 // not in binary
122 //Id is "id" type string default "" omitdefault;
123 // internals
124 TrigIdx is "trigidx" type uint internal;
128 ////////////////////////////////////////////////////////////////////////////////
129 /*
130 enum {
131 TEXTURE_NAME_WATER = '_water_0',
132 TEXTURE_NAME_ACID1 = '_water_1',
133 TEXTURE_NAME_ACID2 = '_water_2',
135 */
137 enum TextureSpecial {
138 TEXTURE_SPECIAL_WATER = -1,
139 TEXTURE_SPECIAL_ACID1 = -2,
140 TEXTURE_SPECIAL_ACID2 = -3,
141 TEXTURE_NONE = -4,
144 // directions
145 enum DirType {
146 DIR_LEFT, // 0
147 DIR_RIGHT, // 1
148 DIR_SOMETHING2, // 2
151 // triggers
152 enum TriggerType {
153 TRIGGER_NONE, // 0
154 TRIGGER_EXIT, // 1
155 TRIGGER_TELEPORT, // 2
156 TRIGGER_OPENDOOR, // 3
157 TRIGGER_CLOSEDOOR, // 4
158 TRIGGER_DOOR, // 5
159 TRIGGER_DOOR5, // 6
160 TRIGGER_CLOSETRAP, // 7
161 TRIGGER_TRAP, // 8
162 TRIGGER_PRESS, // 9
163 TRIGGER_SECRET, // 10
164 TRIGGER_LIFTUP, // 11
165 TRIGGER_LIFTDOWN, // 12
166 TRIGGER_LIFT, // 13
167 TRIGGER_TEXTURE, // 14
168 TRIGGER_ON, // 15
169 TRIGGER_OFF, // 16
170 TRIGGER_ONOFF, // 17
171 TRIGGER_SOUND, // 18
172 TRIGGER_SPAWNMONSTER, // 19
173 TRIGGER_SPAWNITEM, // 20
174 TRIGGER_MUSIC, // 21
175 TRIGGER_PUSH, // 22
176 TRIGGER_SCORE, // 23
177 TRIGGER_MESSAGE, // 24
178 TRIGGER_DAMAGE, // 25
179 TRIGGER_HEALTH, // 26
180 TRIGGER_SHOT, // 27
181 TRIGGER_EFFECT, // 28
182 TRIGGER_SCRIPT, // 29
183 //
184 TRIGGER_MAX = MAX,
187 // "as XXX" means "generate this identifier for pascal sources
188 bitset PanelType {
189 PANEL_NONE = 0, // 0
190 PANEL_WALL, // 1
191 PANEL_BACK, // 2
192 PANEL_FORE, // 4
193 PANEL_WATER, // 8
194 PANEL_ACID1, // 16
195 PANEL_ACID2, // 32
196 PANEL_STEP, // 64
197 PANEL_LIFTUP, // 128
198 PANEL_LIFTDOWN, // 256
199 PANEL_OPENDOOR, // 512
200 PANEL_CLOSEDOOR, // 1024
201 PANEL_BLOCKMON, // 2048
202 PANEL_LIFTLEFT, // 4096
203 PANEL_LIFTRIGHT, // 8192
206 bitset PanelFlag {
207 PANEL_FLAG_NONE = 0, // 0
208 PANEL_FLAG_BLENDING, // 1
209 PANEL_FLAG_HIDE, // 2
210 PANEL_FLAG_WATERTEXTURES, // 4
213 enum EffectAction {
214 EFFECT_NONE, // 0
215 EFFECT_TELEPORT, // 1
216 EFFECT_RESPAWN, // 2
217 EFFECT_FIRE, // 3
220 enum Item {
221 ITEM_NONE, // 0
222 ITEM_MEDKIT_SMALL, // 1
223 ITEM_MEDKIT_LARGE, // 2
224 ITEM_MEDKIT_BLACK, // 3
225 ITEM_ARMOR_GREEN, // 4
226 ITEM_ARMOR_BLUE, // 5
227 ITEM_SPHERE_BLUE, // 6
228 ITEM_SPHERE_WHITE, // 7
229 ITEM_SUIT, // 8
230 ITEM_OXYGEN, // 9
231 ITEM_INVUL, // 10
232 ITEM_WEAPON_SAW, // 11
233 ITEM_WEAPON_SHOTGUN1, // 12
234 ITEM_WEAPON_SHOTGUN2, // 13
235 ITEM_WEAPON_CHAINGUN, // 14
236 ITEM_WEAPON_ROCKETLAUNCHER, // 15
237 ITEM_WEAPON_PLASMA, // 16
238 ITEM_WEAPON_BFG, // 17
239 ITEM_WEAPON_SUPERPULEMET, // 18
240 ITEM_AMMO_BULLETS, // 19
241 ITEM_AMMO_BULLETS_BOX, // 20
242 ITEM_AMMO_SHELLS, // 21
243 ITEM_AMMO_SHELLS_BOX, // 22
244 ITEM_AMMO_ROCKET, // 23
245 ITEM_AMMO_ROCKET_BOX, // 24
246 ITEM_AMMO_CELL, // 25
247 ITEM_AMMO_CELL_BIG, // 26
248 ITEM_AMMO_BACKPACK, // 27
249 ITEM_KEY_RED, // 28
250 ITEM_KEY_GREEN, // 29
251 ITEM_KEY_BLUE, // 30
252 ITEM_WEAPON_KASTET, // 31
253 ITEM_WEAPON_PISTOL, // 32
254 ITEM_BOTTLE, // 33
255 ITEM_HELMET, // 34
256 ITEM_JETPACK, // 35
257 ITEM_INVIS, // 36
258 ITEM_WEAPON_FLAMETHROWER, // 37
259 ITEM_AMMO_FUELCAN, // 38
260 //
261 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
264 bitset ItemOption {
265 ITEM_OPTION_NONE = 0, // 0
266 ITEM_OPTION_ONLYDM, // 1
267 ITEM_OPTION_FALL, // 2
270 enum AreaType {
271 AREA_NONE, // 0
272 AREA_PLAYERPOINT1, // 1
273 AREA_PLAYERPOINT2, // 2
274 AREA_DMPOINT, // 3
275 AREA_REDFLAG, // 4
276 AREA_BLUEFLAG, // 5
277 AREA_DOMFLAG, // 6
278 AREA_REDTEAMPOINT, // 7
279 AREA_BLUETEAMPOINT, // 8
282 enum Monster {
283 MONSTER_NONE, // 0
284 MONSTER_DEMON, // 1
285 MONSTER_IMP, // 2
286 MONSTER_ZOMBY, // 3
287 MONSTER_SERG, // 4
288 MONSTER_CYBER, // 5
289 MONSTER_CGUN, // 6
290 MONSTER_BARON, // 7
291 MONSTER_KNIGHT, // 8
292 MONSTER_CACO, // 9
293 MONSTER_SOUL, // 10
294 MONSTER_PAIN, // 11
295 MONSTER_SPIDER, // 12
296 MONSTER_BSP, // 13
297 MONSTER_MANCUB, // 14
298 MONSTER_SKEL, // 15
299 MONSTER_VILE, // 16
300 MONSTER_FISH, // 17
301 MONSTER_BARREL, // 18
302 MONSTER_ROBO, // 19
303 MONSTER_MAN, // 20
306 enum TriggerShot {
307 TRIGGER_SHOT_PISTOL, // 0
308 TRIGGER_SHOT_BULLET, // 1
309 TRIGGER_SHOT_SHOTGUN, // 2
310 TRIGGER_SHOT_SSG, // 3
311 TRIGGER_SHOT_IMP, // 4
312 TRIGGER_SHOT_PLASMA, // 5
313 TRIGGER_SHOT_SPIDER, // 6
314 TRIGGER_SHOT_CACO, // 7
315 TRIGGER_SHOT_BARON, // 8
316 TRIGGER_SHOT_MANCUB, // 9
317 TRIGGER_SHOT_REV, // 10
318 TRIGGER_SHOT_ROCKET, // 11
319 TRIGGER_SHOT_BFG, // 12
320 TRIGGER_SHOT_EXPL, // 13
321 TRIGGER_SHOT_BFGEXPL, // 14
322 //
323 TRIGGER_SHOT_MAX = MAX,
326 enum TriggerShotTarget {
327 TRIGGER_SHOT_TARGET_NONE, // 0
328 TRIGGER_SHOT_TARGET_MON, // 1
329 TRIGGER_SHOT_TARGET_PLR, // 2
330 TRIGGER_SHOT_TARGET_RED, // 3
331 TRIGGER_SHOT_TARGET_BLUE, // 4
332 TRIGGER_SHOT_TARGET_MONPLR, // 5
333 TRIGGER_SHOT_TARGET_PLRMON, // 6
336 enum TriggerShotAim {
337 TRIGGER_SHOT_AIM_DEFAULT, // 0
338 TRIGGER_SHOT_AIM_ALLMAP, // 1
339 TRIGGER_SHOT_AIM_TRACE, // 2
340 TRIGGER_SHOT_AIM_TRACEALL, // 3
343 enum TriggerEffect {
344 TRIGGER_EFFECT_PARTICLE, // 0
345 TRIGGER_EFFECT_ANIMATION, // 1
348 enum TriggerEffectType {
349 TRIGGER_EFFECT_SLIQUID, // 0
350 TRIGGER_EFFECT_LLIQUID, // 1
351 TRIGGER_EFFECT_DLIQUID, // 2
352 TRIGGER_EFFECT_BLOOD, // 3
353 TRIGGER_EFFECT_SPARK, // 4
354 TRIGGER_EFFECT_BUBBLE, // 5
355 TRIGGER_EFFECT_MAX = MAX,
358 enum TriggerEffectPos {
359 TRIGGER_EFFECT_POS_CENTER, // 0
360 TRIGGER_EFFECT_POS_AREA, // 1
363 bitset ActivateType {
364 ACTIVATE_NONE = 0, // 0
365 ACTIVATE_PLAYERCOLLIDE, // 1
366 ACTIVATE_MONSTERCOLLIDE, // 2
367 ACTIVATE_PLAYERPRESS, // 4
368 ACTIVATE_MONSTERPRESS, // 8
369 ACTIVATE_SHOT, // 16
370 ACTIVATE_NOMONSTER, // 32
371 ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
374 bitset Key {
375 KEY_NONE = 0, // 0
376 KEY_RED, // 1
377 KEY_GREEN, // 2
378 KEY_BLUE, // 4
379 KEY_REDTEAM, // 8
380 KEY_BLUETEAM, // 16
384 ////////////////////////////////////////////////////////////////////////////////
385 // various triggers
386 TriggerData for TRIGGER_EXIT {
387 MapName is "map" type char[16] offset 0;
390 TriggerData for TRIGGER_TELEPORT {
391 TargetPoint is "target" type point offset 0;
392 d2d_teleport is "d2d" type bool offset 8 default false omitdefault;
393 silent_teleport is "silent" type bool offset 9 default false omitdefault;
394 TlpDir is "direction" type ubyte offset 10 enum DirType default DIR_LEFT omitdefault;
397 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
398 PanelID is "panelid" type int offset 0 panel;
399 NoSound is "silent" type bool offset 4 default false omitdefault;
400 d2d_doors is "d2d" type bool offset 5 default false omitdefault;
403 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
404 //tX is "tx" type int offset 0;
405 //tY is "ty" type int offset 4;
406 Pos is "position" type point offset 0 as txy default (0 0);
407 //tWidth is "width" type ushort offset 8;
408 //tHeight is "height" type ushort offset 10;
409 Size is "size" type size offset 8 as twh default (0 0);
410 Wait is "wait" type ushort offset 12 default 0;
411 Count is "count" type ushort offset 14 default 0;
412 MonsterID is "monsterid" type int offset 16 monster as monsterid default null;
413 ExtRandom is "extrandom" type bool offset 20 default false;
414 // this one is for moving platforms
415 PanelId is "panelid" type int panel default null omitdefault;
418 TriggerData for TRIGGER_SECRET {
421 TriggerData for TRIGGER_TEXTURE {
422 ActivateOnce is "activateonce" type bool offset 0;
423 AnimOnce is "animateonce" type bool offset 1;
426 TriggerData for TRIGGER_SOUND {
427 SoundName is "soundname" type char[64] offset 0;
428 Volume is "volume" type ubyte offset 64;
429 Pan is "pan" type ubyte offset 65;
430 Local is "local" type bool offset 66;
431 PlayCount is "playcount" type ubyte offset 67;
432 SoundSwitch is "soundswitch" type bool offset 68;
435 TriggerData for TRIGGER_SPAWNMONSTER {
436 MonPos is "position" type point offset 0;
437 MonType is "type" type ubyte offset 8;
438 MonHealth is "health" type int offset 12;
439 MonDir is "direction" type ubyte offset 16 enum DirType;
440 MonActive is "active" type bool offset 17;
441 MonCount is "count" type int offset 20;
442 MonEffect is "effect" type ubyte offset 24;
443 MonMax is "max" type ushort offset 26;
444 MonDelay is "delay" type ushort offset 28;
445 MonBehav is "behaviour" type ubyte offset 30;
448 TriggerData for TRIGGER_SPAWNITEM {
449 ItemPos is "position" type point offset 0;
450 ItemType is "type" type ubyte offset 8;
451 ItemFalls is "gravity" type bool offset 9;
452 ItemOnlyDM is "dmonly" type bool offset 10;
453 ItemCount is "count" type int offset 12;
454 ItemEffect is "effect" type ubyte offset 16;
455 ItemMax is "max" type ushort offset 18;
456 ItemDelay is "delay" type ushort offset 20;
459 TriggerData for TRIGGER_MUSIC {
460 MusicName is "name" type char[64] offset 0;
461 MusicAction is "action" type ubyte offset 64;
464 TriggerData for TRIGGER_PUSH {
465 PushAngle is "angle" type ushort offset 0;
466 PushForce is "force" type ubyte offset 2;
467 ResetVel is "resetvelocity" type bool offset 3;
470 TriggerData for TRIGGER_SCORE {
471 ScoreAction is "action" type ubyte offset 0;
472 ScoreCount is "count" type ubyte offset 1;
473 ScoreTeam is "team" type ubyte offset 2;
474 ScoreCon is "console" type bool offset 3;
475 ScoreMsg is "message" type bool offset 4;
478 TriggerData for TRIGGER_MESSAGE {
479 MessageKind is "kind" type ubyte offset 0;
480 MessageSendTo is "sendto" type ubyte offset 1;
481 MessageText is "text" type char[100] offset 2;
482 MessageTime is "time" type ushort offset 102;
485 TriggerData for TRIGGER_DAMAGE {
486 DamageValue is "amount" type ushort offset 0;
487 DamageInterval is "interval" type ushort offset 2;
490 TriggerData for TRIGGER_HEALTH {
491 HealValue is "amount" type ushort offset 0;
492 HealInterval is "interval" type ushort offset 2;
493 HealMax is "max" type bool offset 4;
494 HealSilent is "silent" type bool offset 5;
497 TriggerData for TRIGGER_SHOT {
498 ShotPos is "position" type point offset 0;
499 ShotType is "type" type ubyte offset 8 enum TriggerShot;
500 ShotTarget is "target" type ubyte offset 9 enum TriggerShotTarget;
501 ShotSound is "silent" type negbool offset 10; // negbool!
502 ShotAim is "aim" type byte offset 11;
503 ShotPanelID is "panelid" type int offset 12;
504 ShotIntSight is "sight" type ushort offset 16;
505 ShotAngle is "angle" type ushort offset 18;
506 ShotWait is "wait" type ushort offset 20;
507 ShotAccuracy is "accuracy" type ushort offset 22;
508 ShotAmmo is "ammo" type ushort offset 24;
509 ShotIntReload is "reload" type ushort offset 26;
512 TriggerData for TRIGGER_EFFECT {
513 FXCount is "count" type ubyte offset 0;
514 FXType is "type" type ubyte offset 1;
515 FXSubType is "subtype" type ubyte offset 2;
516 FXColorR is "colorr" type ubyte offset 3;
517 FXColorG is "colorg" type ubyte offset 4;
518 FXColorB is "colorb" type ubyte offset 5;
519 FXPos is "position" type ubyte offset 6;
520 FXWait is "wait" type ushort offset 8;
521 FXVelX is "velx" type byte offset 10;
522 FXVelY is "vely" type byte offset 11;
523 FXSpreadL is "spreadl" type ubyte offset 12;
524 FXSpreadR is "spreadr" type ubyte offset 13;
525 FXSpreadU is "spreadu" type ubyte offset 14;
526 FXSpreadD is "spreadd" type ubyte offset 15;