DEADSOFTWARE

textmap: mosnterid in triggers is fuckin' special (i HAET special fields!); workarounded
[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 // not in binary
56 //Id is "id" type string default "" omitdefault;
57 // internals
58 PanIdx is "panidx" type uint internal;
59 }
61 TItemRec_1 is "item" size 10 bytes binblock 3 {
62 //X is "x" type int offset 0;
63 //Y is "y" type int offset 4;
64 Pos is "position" type point offset 0 as xy;
65 ItemType is "type" type ubyte offset 8 enum Item;
66 Options is "options" type ubyte offset 9 bitset ItemOption default ITEM_OPTION_NONE omitdefault;
67 // not in binary
68 //Id is "id" type string default "" omitdefault;
69 // internals
70 ItemIdx is "itemidx" type uint internal;
71 }
73 TMonsterRec_1 is "monster" size 10 bytes binblock 5 {
74 //X is "x" type int offset 0;
75 //Y is "y" type int offset 4;
76 Pos is "position" type point offset 0 as xy;
77 MonsterType is "type" type ubyte offset 8 enum Monster;
78 Direction is "direction" type ubyte offset 9 enum DirType default DIR_LEFT omitdefault;
79 // not in binary
80 //Id is "id" type string default "" omitdefault;
81 // internals
82 MonsIdx is "monsidx" type uint internal;
83 }
85 TAreaRec_1 is "area" size 10 bytes binblock 4 {
86 //X is "x" type int offset 0;
87 //Y is "y" type int offset 4;
88 Pos is "position" type point offset 0 as xy;
89 AreaType is "type" type ubyte offset 8 enum AreaType;
90 Direction is "direction" type ubyte offset 9 enum DirType default DIR_LEFT omitdefault;
91 // not in binary
92 //Id is "id" type string default "" omitdefault;
93 // internals
94 AreaIdx is "areaidx" type uint internal;
95 }
97 TTriggerRec_1 is "trigger" size 148 bytes binblock 6 {
98 //X is "x" type int offset 0;
99 //Y is "y" type int offset 4;
100 Pos is "position" type point offset 0 as xy;
101 //Width is "width" type ushort offset 8;
102 //Height is "height" type ushort offset 10;
103 Size is "size" type size offset 8 as wh;
104 Enabled is "enabled" type bool offset 12 default true omitdefault;
105 TexturePanel is "texturepanel" type int offset 13 panel default null omitdefault;
106 TriggerType is "type" type ubyte offset 17 enum TriggerType;
107 ActivateType is "activatetype" type ubyte offset 18 bitset ActivateType;
108 Keys is "keys" type ubyte offset 19 bitset Key default KEY_NONE omitdefault;
109 //WARNING: "trigdata" MUST be defined before "type", and "type" MUST be named "type" (for now, can be changed later)
110 DATA is "triggerdata" type trigdata[128] offset 20; // the only special nested structure
111 // not in binary
112 //Id is "id" type string default "" omitdefault;
113 // internals
114 TrigIdx is "trigidx" type uint internal;
118 ////////////////////////////////////////////////////////////////////////////////
119 /*
120 enum {
121 TEXTURE_NAME_WATER = '_water_0',
122 TEXTURE_NAME_ACID1 = '_water_1',
123 TEXTURE_NAME_ACID2 = '_water_2',
125 */
127 enum TextureSpecial {
128 TEXTURE_SPECIAL_WATER = -1,
129 TEXTURE_SPECIAL_ACID1 = -2,
130 TEXTURE_SPECIAL_ACID2 = -3,
131 TEXTURE_NONE = -4,
134 // directions
135 enum DirType {
136 DIR_LEFT, // 0
137 DIR_RIGHT, // 1
138 DIR_SOMETHING2, // 2
141 // triggers
142 enum TriggerType {
143 TRIGGER_NONE, // 0
144 TRIGGER_EXIT, // 1
145 TRIGGER_TELEPORT, // 2
146 TRIGGER_OPENDOOR, // 3
147 TRIGGER_CLOSEDOOR, // 4
148 TRIGGER_DOOR, // 5
149 TRIGGER_DOOR5, // 6
150 TRIGGER_CLOSETRAP, // 7
151 TRIGGER_TRAP, // 8
152 TRIGGER_PRESS, // 9
153 TRIGGER_SECRET, // 10
154 TRIGGER_LIFTUP, // 11
155 TRIGGER_LIFTDOWN, // 12
156 TRIGGER_LIFT, // 13
157 TRIGGER_TEXTURE, // 14
158 TRIGGER_ON, // 15
159 TRIGGER_OFF, // 16
160 TRIGGER_ONOFF, // 17
161 TRIGGER_SOUND, // 18
162 TRIGGER_SPAWNMONSTER, // 19
163 TRIGGER_SPAWNITEM, // 20
164 TRIGGER_MUSIC, // 21
165 TRIGGER_PUSH, // 22
166 TRIGGER_SCORE, // 23
167 TRIGGER_MESSAGE, // 24
168 TRIGGER_DAMAGE, // 25
169 TRIGGER_HEALTH, // 26
170 TRIGGER_SHOT, // 27
171 TRIGGER_EFFECT, // 28
172 TRIGGER_SCRIPT, // 29
173 //
174 TRIGGER_MAX = MAX,
177 // "as XXX" means "generate this identifier for pascal sources
178 bitset PanelType {
179 PANEL_NONE = 0, // 0
180 PANEL_WALL, // 1
181 PANEL_BACK, // 2
182 PANEL_FORE, // 4
183 PANEL_WATER, // 8
184 PANEL_ACID1, // 16
185 PANEL_ACID2, // 32
186 PANEL_STEP, // 64
187 PANEL_LIFTUP, // 128
188 PANEL_LIFTDOWN, // 256
189 PANEL_OPENDOOR, // 512
190 PANEL_CLOSEDOOR, // 1024
191 PANEL_BLOCKMON, // 2048
192 PANEL_LIFTLEFT, // 4096
193 PANEL_LIFTRIGHT, // 8192
196 bitset PanelFlag {
197 PANEL_FLAG_NONE = 0, // 0
198 PANEL_FLAG_BLENDING, // 1
199 PANEL_FLAG_HIDE, // 2
200 PANEL_FLAG_WATERTEXTURES, // 4
203 enum EffectAction {
204 EFFECT_NONE, // 0
205 EFFECT_TELEPORT, // 1
206 EFFECT_RESPAWN, // 2
207 EFFECT_FIRE, // 3
210 enum Item {
211 ITEM_NONE, // 0
212 ITEM_MEDKIT_SMALL, // 1
213 ITEM_MEDKIT_LARGE, // 2
214 ITEM_MEDKIT_BLACK, // 3
215 ITEM_ARMOR_GREEN, // 4
216 ITEM_ARMOR_BLUE, // 5
217 ITEM_SPHERE_BLUE, // 6
218 ITEM_SPHERE_WHITE, // 7
219 ITEM_SUIT, // 8
220 ITEM_OXYGEN, // 9
221 ITEM_INVUL, // 10
222 ITEM_WEAPON_SAW, // 11
223 ITEM_WEAPON_SHOTGUN1, // 12
224 ITEM_WEAPON_SHOTGUN2, // 13
225 ITEM_WEAPON_CHAINGUN, // 14
226 ITEM_WEAPON_ROCKETLAUNCHER, // 15
227 ITEM_WEAPON_PLASMA, // 16
228 ITEM_WEAPON_BFG, // 17
229 ITEM_WEAPON_SUPERPULEMET, // 18
230 ITEM_AMMO_BULLETS, // 19
231 ITEM_AMMO_BULLETS_BOX, // 20
232 ITEM_AMMO_SHELLS, // 21
233 ITEM_AMMO_SHELLS_BOX, // 22
234 ITEM_AMMO_ROCKET, // 23
235 ITEM_AMMO_ROCKET_BOX, // 24
236 ITEM_AMMO_CELL, // 25
237 ITEM_AMMO_CELL_BIG, // 26
238 ITEM_AMMO_BACKPACK, // 27
239 ITEM_KEY_RED, // 28
240 ITEM_KEY_GREEN, // 29
241 ITEM_KEY_BLUE, // 30
242 ITEM_WEAPON_KASTET, // 31
243 ITEM_WEAPON_PISTOL, // 32
244 ITEM_BOTTLE, // 33
245 ITEM_HELMET, // 34
246 ITEM_JETPACK, // 35
247 ITEM_INVIS, // 36
248 ITEM_WEAPON_FLAMETHROWER, // 37
249 ITEM_AMMO_FUELCAN, // 38
250 //
251 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
254 bitset ItemOption {
255 ITEM_OPTION_NONE = 0, // 0
256 ITEM_OPTION_ONLYDM, // 1
257 ITEM_OPTION_FALL, // 2
260 enum AreaType {
261 AREA_NONE, // 0
262 AREA_PLAYERPOINT1, // 1
263 AREA_PLAYERPOINT2, // 2
264 AREA_DMPOINT, // 3
265 AREA_REDFLAG, // 4
266 AREA_BLUEFLAG, // 5
267 AREA_DOMFLAG, // 6
268 AREA_REDTEAMPOINT, // 7
269 AREA_BLUETEAMPOINT, // 8
272 enum Monster {
273 MONSTER_NONE, // 0
274 MONSTER_DEMON, // 1
275 MONSTER_IMP, // 2
276 MONSTER_ZOMBY, // 3
277 MONSTER_SERG, // 4
278 MONSTER_CYBER, // 5
279 MONSTER_CGUN, // 6
280 MONSTER_BARON, // 7
281 MONSTER_KNIGHT, // 8
282 MONSTER_CACO, // 9
283 MONSTER_SOUL, // 10
284 MONSTER_PAIN, // 11
285 MONSTER_SPIDER, // 12
286 MONSTER_BSP, // 13
287 MONSTER_MANCUB, // 14
288 MONSTER_SKEL, // 15
289 MONSTER_VILE, // 16
290 MONSTER_FISH, // 17
291 MONSTER_BARREL, // 18
292 MONSTER_ROBO, // 19
293 MONSTER_MAN, // 20
296 enum TriggerShot {
297 TRIGGER_SHOT_PISTOL, // 0
298 TRIGGER_SHOT_BULLET, // 1
299 TRIGGER_SHOT_SHOTGUN, // 2
300 TRIGGER_SHOT_SSG, // 3
301 TRIGGER_SHOT_IMP, // 4
302 TRIGGER_SHOT_PLASMA, // 5
303 TRIGGER_SHOT_SPIDER, // 6
304 TRIGGER_SHOT_CACO, // 7
305 TRIGGER_SHOT_BARON, // 8
306 TRIGGER_SHOT_MANCUB, // 9
307 TRIGGER_SHOT_REV, // 10
308 TRIGGER_SHOT_ROCKET, // 11
309 TRIGGER_SHOT_BFG, // 12
310 TRIGGER_SHOT_EXPL, // 13
311 TRIGGER_SHOT_BFGEXPL, // 14
312 //
313 TRIGGER_SHOT_MAX = MAX,
316 enum TriggerShotTarget {
317 TRIGGER_SHOT_TARGET_NONE, // 0
318 TRIGGER_SHOT_TARGET_MON, // 1
319 TRIGGER_SHOT_TARGET_PLR, // 2
320 TRIGGER_SHOT_TARGET_RED, // 3
321 TRIGGER_SHOT_TARGET_BLUE, // 4
322 TRIGGER_SHOT_TARGET_MONPLR, // 5
323 TRIGGER_SHOT_TARGET_PLRMON, // 6
326 enum TriggerShotAim {
327 TRIGGER_SHOT_AIM_DEFAULT, // 0
328 TRIGGER_SHOT_AIM_ALLMAP, // 1
329 TRIGGER_SHOT_AIM_TRACE, // 2
330 TRIGGER_SHOT_AIM_TRACEALL, // 3
333 enum TriggerEffect {
334 TRIGGER_EFFECT_PARTICLE, // 0
335 TRIGGER_EFFECT_ANIMATION, // 1
338 enum TriggerEffectType {
339 TRIGGER_EFFECT_SLIQUID, // 0
340 TRIGGER_EFFECT_LLIQUID, // 1
341 TRIGGER_EFFECT_DLIQUID, // 2
342 TRIGGER_EFFECT_BLOOD, // 3
343 TRIGGER_EFFECT_SPARK, // 4
344 TRIGGER_EFFECT_BUBBLE, // 5
345 TRIGGER_EFFECT_MAX = MAX,
348 enum TriggerEffectPos {
349 TRIGGER_EFFECT_POS_CENTER, // 0
350 TRIGGER_EFFECT_POS_AREA, // 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 MapName is "map" type char[16] offset 0;
380 TriggerData for TRIGGER_TELEPORT {
381 TargetPoint is "target" type point offset 0;
382 d2d_teleport is "d2d" type bool offset 8 default false omitdefault;
383 silent_teleport is "silent" type bool offset 9 default false omitdefault;
384 TlpDir is "direction" type ubyte offset 10 enum DirType default DIR_LEFT omitdefault;
387 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
388 PanelID is "panelid" type int offset 0 panel;
389 NoSound is "silent" type bool offset 4 default false omitdefault;
390 d2d_doors is "d2d" type bool offset 5 default false omitdefault;
393 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
394 //tX is "tx" type int offset 0;
395 //tY is "ty" type int offset 4;
396 Pos is "position" type point offset 0 as txy;
397 //tWidth is "width" type ushort offset 8;
398 //tHeight is "height" type ushort offset 10;
399 Size is "size" type size offset 8 as twh;
400 Wait is "wait" type ushort offset 12;
401 Count is "count" type ushort offset 14;
402 MonsterID is "monsterid" type int offset 16 monster as monsterid;
403 ExtRandom is "extrandom" type bool offset 20;
406 TriggerData for TRIGGER_SECRET {
409 TriggerData for TRIGGER_TEXTURE {
410 ActivateOnce is "activateonce" type bool offset 0;
411 AnimOnce is "animateonce" type bool offset 1;
414 TriggerData for TRIGGER_SOUND {
415 SoundName is "soundname" type char[64] offset 0;
416 Volume is "volume" type ubyte offset 64;
417 Pan is "pan" type ubyte offset 65;
418 Local is "local" type bool offset 66;
419 PlayCount is "playcount" type ubyte offset 67;
420 SoundSwitch is "soundswitch" type bool offset 68;
423 TriggerData for TRIGGER_SPAWNMONSTER {
424 MonPos is "position" type point offset 0;
425 MonType is "type" type ubyte offset 8;
426 MonHealth is "health" type int offset 12;
427 MonDir is "direction" type ubyte offset 16 enum DirType;
428 MonActive is "active" type bool offset 17;
429 MonCount is "count" type int offset 20;
430 MonEffect is "effect" type ubyte offset 24;
431 MonMax is "max" type ushort offset 26;
432 MonDelay is "delay" type ushort offset 28;
433 MonBehav is "behaviour" type ubyte offset 30;
436 TriggerData for TRIGGER_SPAWNITEM {
437 ItemPos is "position" type point offset 0;
438 ItemType is "type" type ubyte offset 8;
439 ItemFalls is "gravity" type bool offset 9;
440 ItemOnlyDM is "dmonly" type bool offset 10;
441 ItemCount is "count" type int offset 12;
442 ItemEffect is "effect" type ubyte offset 16;
443 ItemMax is "max" type ushort offset 18;
444 ItemDelay is "delay" type ushort offset 20;
447 TriggerData for TRIGGER_MUSIC {
448 MusicName is "name" type char[64] offset 0;
449 MusicAction is "action" type ubyte offset 64;
452 TriggerData for TRIGGER_PUSH {
453 PushAngle is "angle" type ushort offset 0;
454 PushForce is "force" type ubyte offset 2;
455 ResetVel is "resetvelocity" type bool offset 3;
458 TriggerData for TRIGGER_SCORE {
459 ScoreAction is "action" type ubyte offset 0;
460 ScoreCount is "count" type ubyte offset 1;
461 ScoreTeam is "team" type ubyte offset 2;
462 ScoreCon is "console" type bool offset 3;
463 ScoreMsg is "message" type bool offset 4;
466 TriggerData for TRIGGER_MESSAGE {
467 MessageKind is "kind" type ubyte offset 0;
468 MessageSendTo is "sendto" type ubyte offset 1;
469 MessageText is "text" type char[100] offset 2;
470 MessageTime is "time" type ushort offset 102;
473 TriggerData for TRIGGER_DAMAGE {
474 DamageValue is "amount" type ushort offset 0;
475 DamageInterval is "interval" type ushort offset 2;
478 TriggerData for TRIGGER_HEALTH {
479 HealValue is "amount" type ushort offset 0;
480 HealInterval is "interval" type ushort offset 2;
481 HealMax is "max" type bool offset 4;
482 HealSilent is "silent" type bool offset 5;
485 TriggerData for TRIGGER_SHOT {
486 ShotPos is "position" type point offset 0;
487 ShotType is "type" type ubyte offset 8 enum TriggerShot;
488 ShotTarget is "target" type ubyte offset 9 enum TriggerShotTarget;
489 ShotSound is "silent" type negbool offset 10; // negbool!
490 ShotAim is "aim" type byte offset 11;
491 ShotPanelID is "panelid" type int offset 12;
492 ShotIntSight is "sight" type ushort offset 16;
493 ShotAngle is "angle" type ushort offset 18;
494 ShotWait is "wait" type ushort offset 20;
495 ShotAccuracy is "accuracy" type ushort offset 22;
496 ShotAmmo is "ammo" type ushort offset 24;
497 ShotIntReload is "reload" type ushort offset 26;
500 TriggerData for TRIGGER_EFFECT {
501 FXCount is "count" type ubyte offset 0;
502 FXType is "type" type ubyte offset 1;
503 FXSubType is "subtype" type ubyte offset 2;
504 FXColorR is "colorr" type ubyte offset 3;
505 FXColorG is "colorg" type ubyte offset 4;
506 FXColorB is "colorb" type ubyte offset 5;
507 FXPos is "position" type ubyte offset 6;
508 FXWait is "wait" type ushort offset 8;
509 FXVelX is "velx" type byte offset 10;
510 FXVelY is "vely" type byte offset 11;
511 FXSpreadL is "spreadl" type ubyte offset 12;
512 FXSpreadR is "spreadr" type ubyte offset 13;
513 FXSpreadU is "spreadu" type ubyte offset 14;
514 FXSpreadD is "spreadd" type ubyte offset 15;