DEADSOFTWARE

textmap: binary i/o seems to work!
[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
139 // triggers
140 enum TriggerType {
141 TRIGGER_NONE, // 0
142 TRIGGER_EXIT, // 1
143 TRIGGER_TELEPORT, // 2
144 TRIGGER_OPENDOOR, // 3
145 TRIGGER_CLOSEDOOR, // 4
146 TRIGGER_DOOR, // 5
147 TRIGGER_DOOR5, // 6
148 TRIGGER_CLOSETRAP, // 7
149 TRIGGER_TRAP, // 8
150 TRIGGER_PRESS, // 9
151 TRIGGER_SECRET, // 10
152 TRIGGER_LIFTUP, // 11
153 TRIGGER_LIFTDOWN, // 12
154 TRIGGER_LIFT, // 13
155 TRIGGER_TEXTURE, // 14
156 TRIGGER_ON, // 15
157 TRIGGER_OFF, // 16
158 TRIGGER_ONOFF, // 17
159 TRIGGER_SOUND, // 18
160 TRIGGER_SPAWNMONSTER, // 19
161 TRIGGER_SPAWNITEM, // 20
162 TRIGGER_MUSIC, // 21
163 TRIGGER_PUSH, // 22
164 TRIGGER_SCORE, // 23
165 TRIGGER_MESSAGE, // 24
166 TRIGGER_DAMAGE, // 25
167 TRIGGER_HEALTH, // 26
168 TRIGGER_SHOT, // 27
169 TRIGGER_EFFECT, // 28
170 TRIGGER_SCRIPT, // 29
171 //
172 TRIGGER_MAX = MAX,
175 // "as XXX" means "generate this identifier for pascal sources
176 bitset PanelType {
177 PANEL_NONE = 0, // 0
178 PANEL_WALL, // 1
179 PANEL_BACK, // 2
180 PANEL_FORE, // 4
181 PANEL_WATER, // 8
182 PANEL_ACID1, // 16
183 PANEL_ACID2, // 32
184 PANEL_STEP, // 64
185 PANEL_LIFTUP, // 128
186 PANEL_LIFTDOWN, // 256
187 PANEL_OPENDOOR, // 512
188 PANEL_CLOSEDOOR, // 1024
189 PANEL_BLOCKMON, // 2048
190 PANEL_LIFTLEFT, // 4096
191 PANEL_LIFTRIGHT, // 8192
194 bitset PanelFlag {
195 PANEL_FLAG_NONE = 0, // 0
196 PANEL_FLAG_BLENDING, // 1
197 PANEL_FLAG_HIDE, // 2
198 PANEL_FLAG_WATERTEXTURES, // 4
201 enum EffectAction {
202 EFFECT_NONE, // 0
203 EFFECT_TELEPORT, // 1
204 EFFECT_RESPAWN, // 2
205 EFFECT_FIRE, // 3
208 enum Item {
209 ITEM_NONE, // 0
210 ITEM_MEDKIT_SMALL, // 1
211 ITEM_MEDKIT_LARGE, // 2
212 ITEM_MEDKIT_BLACK, // 3
213 ITEM_ARMOR_GREEN, // 4
214 ITEM_ARMOR_BLUE, // 5
215 ITEM_SPHERE_BLUE, // 6
216 ITEM_SPHERE_WHITE, // 7
217 ITEM_SUIT, // 8
218 ITEM_OXYGEN, // 9
219 ITEM_INVUL, // 10
220 ITEM_WEAPON_SAW, // 11
221 ITEM_WEAPON_SHOTGUN1, // 12
222 ITEM_WEAPON_SHOTGUN2, // 13
223 ITEM_WEAPON_CHAINGUN, // 14
224 ITEM_WEAPON_ROCKETLAUNCHER, // 15
225 ITEM_WEAPON_PLASMA, // 16
226 ITEM_WEAPON_BFG, // 17
227 ITEM_WEAPON_SUPERPULEMET, // 18
228 ITEM_AMMO_BULLETS, // 19
229 ITEM_AMMO_BULLETS_BOX, // 20
230 ITEM_AMMO_SHELLS, // 21
231 ITEM_AMMO_SHELLS_BOX, // 22
232 ITEM_AMMO_ROCKET, // 23
233 ITEM_AMMO_ROCKET_BOX, // 24
234 ITEM_AMMO_CELL, // 25
235 ITEM_AMMO_CELL_BIG, // 26
236 ITEM_AMMO_BACKPACK, // 27
237 ITEM_KEY_RED, // 28
238 ITEM_KEY_GREEN, // 29
239 ITEM_KEY_BLUE, // 30
240 ITEM_WEAPON_KASTET, // 31
241 ITEM_WEAPON_PISTOL, // 32
242 ITEM_BOTTLE, // 33
243 ITEM_HELMET, // 34
244 ITEM_JETPACK, // 35
245 ITEM_INVIS, // 36
246 ITEM_WEAPON_FLAMETHROWER, // 37
247 ITEM_AMMO_FUELCAN, // 38
248 //
249 ITEM_MAX = MAX, // store the last item's id in here use this in for loops
252 bitset ItemOption {
253 ITEM_OPTION_NONE = 0, // 0
254 ITEM_OPTION_ONLYDM, // 1
255 ITEM_OPTION_FALL, // 2
258 enum AreaType {
259 AREA_NONE, // 0
260 AREA_PLAYERPOINT1, // 1
261 AREA_PLAYERPOINT2, // 2
262 AREA_DMPOINT, // 3
263 AREA_REDFLAG, // 4
264 AREA_BLUEFLAG, // 5
265 AREA_DOMFLAG, // 6
266 AREA_REDTEAMPOINT, // 7
267 AREA_BLUETEAMPOINT, // 8
270 enum Monster {
271 MONSTER_NONE, // 0
272 MONSTER_DEMON, // 1
273 MONSTER_IMP, // 2
274 MONSTER_ZOMBY, // 3
275 MONSTER_SERG, // 4
276 MONSTER_CYBER, // 5
277 MONSTER_CGUN, // 6
278 MONSTER_BARON, // 7
279 MONSTER_KNIGHT, // 8
280 MONSTER_CACO, // 9
281 MONSTER_SOUL, // 10
282 MONSTER_PAIN, // 11
283 MONSTER_SPIDER, // 12
284 MONSTER_BSP, // 13
285 MONSTER_MANCUB, // 14
286 MONSTER_SKEL, // 15
287 MONSTER_VILE, // 16
288 MONSTER_FISH, // 17
289 MONSTER_BARREL, // 18
290 MONSTER_ROBO, // 19
291 MONSTER_MAN, // 20
294 enum TriggerShot {
295 TRIGGER_SHOT_PISTOL, // 0
296 TRIGGER_SHOT_BULLET, // 1
297 TRIGGER_SHOT_SHOTGUN, // 2
298 TRIGGER_SHOT_SSG, // 3
299 TRIGGER_SHOT_IMP, // 4
300 TRIGGER_SHOT_PLASMA, // 5
301 TRIGGER_SHOT_SPIDER, // 6
302 TRIGGER_SHOT_CACO, // 7
303 TRIGGER_SHOT_BARON, // 8
304 TRIGGER_SHOT_MANCUB, // 9
305 TRIGGER_SHOT_REV, // 10
306 TRIGGER_SHOT_ROCKET, // 11
307 TRIGGER_SHOT_BFG, // 12
308 TRIGGER_SHOT_EXPL, // 13
309 TRIGGER_SHOT_BFGEXPL, // 14
310 //
311 TRIGGER_SHOT_MAX = MAX,
314 enum TriggerShotTarget {
315 TRIGGER_SHOT_TARGET_NONE, // 0
316 TRIGGER_SHOT_TARGET_MON, // 1
317 TRIGGER_SHOT_TARGET_PLR, // 2
318 TRIGGER_SHOT_TARGET_RED, // 3
319 TRIGGER_SHOT_TARGET_BLUE, // 4
320 TRIGGER_SHOT_TARGET_MONPLR, // 5
321 TRIGGER_SHOT_TARGET_PLRMON, // 6
324 enum TriggerShotAim {
325 TRIGGER_SHOT_AIM_DEFAULT, // 0
326 TRIGGER_SHOT_AIM_ALLMAP, // 1
327 TRIGGER_SHOT_AIM_TRACE, // 2
328 TRIGGER_SHOT_AIM_TRACEALL, // 3
331 enum TriggerEffect {
332 TRIGGER_EFFECT_PARTICLE, // 0
333 TRIGGER_EFFECT_ANIMATION, // 1
336 enum TriggerEffectType {
337 TRIGGER_EFFECT_SLIQUID, // 0
338 TRIGGER_EFFECT_LLIQUID, // 1
339 TRIGGER_EFFECT_DLIQUID, // 2
340 TRIGGER_EFFECT_BLOOD, // 3
341 TRIGGER_EFFECT_SPARK, // 4
342 TRIGGER_EFFECT_BUBBLE, // 5
343 TRIGGER_EFFECT_MAX = MAX,
346 enum TriggerEffectPos {
347 TRIGGER_EFFECT_POS_CENTER, // 0
348 TRIGGER_EFFECT_POS_AREA, // 1
351 bitset ActivateType {
352 ACTIVATE_NONE = 0, // 0
353 ACTIVATE_PLAYERCOLLIDE, // 1
354 ACTIVATE_MONSTERCOLLIDE, // 2
355 ACTIVATE_PLAYERPRESS, // 4
356 ACTIVATE_MONSTERPRESS, // 8
357 ACTIVATE_SHOT, // 16
358 ACTIVATE_NOMONSTER, // 32
359 ACTIVATE_CUSTOM = 255, // note that "direct assign" field doesn't affect bit counter
362 bitset Key {
363 KEY_NONE = 0, // 0
364 KEY_RED, // 1
365 KEY_GREEN, // 2
366 KEY_BLUE, // 4
367 KEY_REDTEAM, // 8
368 KEY_BLUETEAM, // 16
372 ////////////////////////////////////////////////////////////////////////////////
373 // various triggers
374 TriggerData for TRIGGER_EXIT {
375 MapName is "map" type char[16] offset 0;
378 TriggerData for TRIGGER_TELEPORT {
379 TargetPoint is "target" type point offset 0;
380 d2d_teleport is "d2d" type bool offset 8 default false omitdefault;
381 silent_teleport is "silent" type bool offset 9 default false omitdefault;
382 TlpDir is "direction" type ubyte offset 10 enum DirType default DIR_LEFT omitdefault;
385 TriggerData for (TRIGGER_OPENDOOR, TRIGGER_CLOSEDOOR, TRIGGER_DOOR, TRIGGER_DOOR5, TRIGGER_CLOSETRAP, TRIGGER_TRAP, TRIGGER_LIFTUP, TRIGGER_LIFTDOWN, TRIGGER_LIFT) {
386 PanelID is "panelid" type int offset 0 panel;
387 NoSound is "silent" type bool offset 4 default false omitdefault;
388 d2d_doors is "d2d" type bool offset 5 default false omitdefault;
391 TriggerData for (TRIGGER_PRESS, TRIGGER_ON, TRIGGER_OFF, TRIGGER_ONOFF) {
392 //tX is "tx" type int offset 0;
393 //tY is "ty" type int offset 4;
394 Pos is "position" type point offset 0 as txy;
395 //tWidth is "width" type ushort offset 8;
396 //tHeight is "height" type ushort offset 10;
397 Size is "size" type size offset 8 as twh;
398 Wait is "wait" type ushort offset 12;
399 Count is "count" type ushort offset 14;
400 MonsterID is "monsterid" type int offset 16 monster;
401 ExtRandom is "extrandom" type bool offset 20;
404 TriggerData for TRIGGER_SECRET {
407 TriggerData for TRIGGER_TEXTURE {
408 ActivateOnce is "activateonce" type bool offset 0;
409 AnimOnce is "animateonce" type bool offset 1;
412 TriggerData for TRIGGER_SOUND {
413 SoundName is "soundname" type char[64] offset 0;
414 Volume is "volume" type ubyte offset 64;
415 Pan is "pan" type ubyte offset 65;
416 Local is "local" type bool offset 66;
417 PlayCount is "playcount" type ubyte offset 67;
418 SoundSwitch is "soundswitch" type bool offset 68;
421 TriggerData for TRIGGER_SPAWNMONSTER {
422 MonPos is "position" type point offset 0;
423 MonType is "type" type ubyte offset 8;
424 MonHealth is "health" type int offset 12;
425 MonDir is "direction" type ubyte offset 16 enum DirType;
426 MonActive is "active" type bool offset 17;
427 MonCount is "count" type int offset 20;
428 MonEffect is "effect" type ubyte offset 24;
429 MonMax is "max" type ushort offset 26;
430 MonDelay is "delay" type ushort offset 28;
431 MonBehav is "behaviour" type ubyte offset 30;
434 TriggerData for TRIGGER_SPAWNITEM {
435 ItemPos is "position" type point offset 0;
436 ItemType is "type" type ubyte offset 8;
437 ItemFalls is "gravity" type bool offset 9;
438 ItemOnlyDM is "dmonly" type bool offset 10;
439 ItemCount is "count" type int offset 12;
440 ItemEffect is "effect" type ubyte offset 16;
441 ItemMax is "max" type ushort offset 18;
442 ItemDelay is "delay" type ushort offset 20;
445 TriggerData for TRIGGER_MUSIC {
446 MusicName is "name" type char[64] offset 0;
447 MusicAction is "action" type ubyte offset 64;
450 TriggerData for TRIGGER_PUSH {
451 PushAngle is "angle" type ushort offset 0;
452 PushForce is "force" type ubyte offset 2;
453 ResetVel is "resetvelocity" type bool offset 3;
456 TriggerData for TRIGGER_SCORE {
457 ScoreAction is "action" type ubyte offset 0;
458 ScoreCount is "count" type ubyte offset 1;
459 ScoreTeam is "team" type ubyte offset 2;
460 ScoreCon is "console" type bool offset 3;
461 ScoreMsg is "message" type bool offset 4;
464 TriggerData for TRIGGER_MESSAGE {
465 MessageKind is "kind" type ubyte offset 0;
466 MessageSendTo is "sendto" type ubyte offset 1;
467 MessageText is "text" type char[100] offset 2;
468 MessageTime is "time" type ushort offset 102;
471 TriggerData for TRIGGER_DAMAGE {
472 DamageValue is "amount" type ushort offset 0;
473 DamageInterval is "interval" type ushort offset 2;
476 TriggerData for TRIGGER_HEALTH {
477 HealValue is "amount" type ushort offset 0;
478 HealInterval is "interval" type ushort offset 2;
479 HealMax is "max" type bool offset 4;
480 HealSilent is "silent" type bool offset 5;
483 TriggerData for TRIGGER_SHOT {
484 ShotPos is "position" type point offset 0;
485 ShotType is "type" type ubyte offset 8 enum TriggerShot;
486 ShotTarget is "target" type ubyte offset 9 enum TriggerShotTarget;
487 ShotSound is "silent" type negbool offset 10; // negbool!
488 ShotAllMap is "allmap" type bool offset 11;
489 ShotPanelID is "panelid" type int offset 12;
490 ShotIntSight is "sight" type ushort offset 16;
491 ShotAngle is "angle" type ushort offset 18;
492 ShotWait is "wait" type ushort offset 20;
493 ShotAccuracy is "accuracy" type ushort offset 22;
494 ShotAmmo is "ammo" type ushort offset 24;
495 ShotIntReload is "reload" type ushort offset 26;
498 TriggerData for TRIGGER_EFFECT {
499 FXCount is "count" type ubyte offset 0;
500 FXType is "type" type ubyte offset 1;
501 FXSubType is "subtype" type ubyte offset 2;
502 FXColorR is "colorr" type ubyte offset 3;
503 FXColorG is "colorg" type ubyte offset 4;
504 FXColorB is "colorb" type ubyte offset 5;
505 FXPos is "position" type ubyte offset 6;
506 FXWait is "wait" type ushort offset 8;
507 FXVelX is "velx" type byte offset 10;
508 FXVelY is "vely" type byte offset 11;
509 FXSpreadL is "spreadl" type ubyte offset 12;
510 FXSpreadR is "spreadr" type ubyte offset 13;
511 FXSpreadU is "spreadu" type ubyte offset 14;
512 FXSpreadD is "spreadd" type ubyte offset 15;