DEADSOFTWARE

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