DEADSOFTWARE

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