682f8b5312e57edac23a16155a4c405c67446e3e
[rocksndiamonds.git] / src / main.h
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * main.h                                                   *
12 ***********************************************************/
13
14 #ifndef MAIN_H
15 #define MAIN_H
16
17 #include <time.h>
18 #include <sys/time.h>
19 #include <sys/types.h>
20 #include <sys/stat.h>
21 #include <errno.h>
22 #include <unistd.h>
23 #include <fcntl.h>
24
25 #include "libgame/libgame.h"
26 #include "game_em/game_em.h"
27
28 #include "conf_gfx.h"   /* include auto-generated data structure definitions */
29 #include "conf_snd.h"   /* include auto-generated data structure definitions */
30 #include "conf_mus.h"   /* include auto-generated data structure definitions */
31
32 #define IMG_UNDEFINED                   (-1)
33 #define IMG_EMPTY                       IMG_EMPTY_SPACE
34 #define IMG_SP_EMPTY                    IMG_SP_EMPTY_SPACE
35 #define IMG_EXPLOSION                   IMG_DEFAULT_EXPLODING
36 #define IMG_CHAR_START                  IMG_CHAR_SPACE
37 #define IMG_CUSTOM_START                IMG_CUSTOM_1
38
39 #define SND_UNDEFINED                   (-1)
40 #define MUS_UNDEFINED                   (-1)
41
42 #define WIN_XSIZE                       672
43 #define WIN_YSIZE                       560
44
45 #define SCR_FIELDX                      17
46 #define SCR_FIELDY                      17
47 #define MAX_BUF_XSIZE                   (SCR_FIELDX + 2)
48 #define MAX_BUF_YSIZE                   (SCR_FIELDY + 2)
49 #define MIN_LEV_FIELDX                  3
50 #define MIN_LEV_FIELDY                  3
51 #define STD_LEV_FIELDX                  64
52 #define STD_LEV_FIELDY                  32
53 #define MAX_LEV_FIELDX                  MAX_PLAYFIELD_WIDTH
54 #define MAX_LEV_FIELDY                  MAX_PLAYFIELD_HEIGHT
55
56 #define SCREENX(a)                      ((a) - scroll_x)
57 #define SCREENY(a)                      ((a) - scroll_y)
58 #define LEVELX(a)                       ((a) + scroll_x)
59 #define LEVELY(a)                       ((a) + scroll_y)
60 #define IN_VIS_FIELD(x,y) ((x)>=0 && (x)<SCR_FIELDX && (y)>=0 &&(y)<SCR_FIELDY)
61 #define IN_SCR_FIELD(x,y) ((x)>=BX1 && (x)<=BX2 && (y)>=BY1 &&(y)<=BY2)
62 #define IN_LEV_FIELD(x,y) ((x)>=0 && (x)<lev_fieldx && (y)>=0 &&(y)<lev_fieldy)
63
64 /* values for configurable properties (custom elem's only, else pre-defined) */
65 #define EP_DIGGABLE                     0
66 #define EP_COLLECTIBLE_ONLY             1
67 #define EP_DONT_RUN_INTO                2
68 #define EP_DONT_COLLIDE_WITH            3
69 #define EP_DONT_TOUCH                   4
70 #define EP_INDESTRUCTIBLE               5
71 #define EP_SLIPPERY                     6
72 #define EP_CAN_CHANGE                   7
73 #define EP_CAN_MOVE                     8
74 #define EP_CAN_FALL                     9
75 #define EP_CAN_SMASH_PLAYER             10
76 #define EP_CAN_SMASH_ENEMIES            11
77 #define EP_CAN_SMASH_EVERYTHING         12
78 #define EP_EXPLODES_BY_FIRE             13
79 #define EP_EXPLODES_SMASHED             14
80 #define EP_EXPLODES_IMPACT              15
81 #define EP_WALKABLE_OVER                16
82 #define EP_WALKABLE_INSIDE              17
83 #define EP_WALKABLE_UNDER               18
84 #define EP_PASSABLE_OVER                19
85 #define EP_PASSABLE_INSIDE              20
86 #define EP_PASSABLE_UNDER               21
87 #define EP_DROPPABLE                    22
88 #define EP_EXPLODES_1X1_OLD             23
89 #define EP_PUSHABLE                     24
90 #define EP_EXPLODES_CROSS_OLD           25
91 #define EP_PROTECTED                    26
92 #define EP_CAN_MOVE_INTO_ACID           27
93 #define EP_THROWABLE                    28
94 #define EP_CAN_EXPLODE                  29
95 #define EP_GRAVITY_REACHABLE            30
96
97 /* values for pre-defined properties */
98 #define EP_PLAYER                       32
99 #define EP_CAN_PASS_MAGIC_WALL          33
100 #define EP_SWITCHABLE                   34
101 #define EP_BD_ELEMENT                   35
102 #define EP_SP_ELEMENT                   36
103 #define EP_SB_ELEMENT                   37
104 #define EP_GEM                          38
105 #define EP_FOOD_DARK_YAMYAM             39
106 #define EP_FOOD_PENGUIN                 40
107 #define EP_FOOD_PIG                     41
108 #define EP_HISTORIC_WALL                42
109 #define EP_HISTORIC_SOLID               43
110 #define EP_CLASSIC_ENEMY                44
111 #define EP_BELT                         45
112 #define EP_BELT_ACTIVE                  46
113 #define EP_BELT_SWITCH                  47
114 #define EP_TUBE                         48
115 #define EP_KEYGATE                      49
116 #define EP_AMOEBOID                     50
117 #define EP_AMOEBALIVE                   51
118 #define EP_HAS_EDITOR_CONTENT           52
119 #define EP_CAN_TURN_EACH_MOVE           53
120 #define EP_CAN_GROW                     54
121 #define EP_ACTIVE_BOMB                  55
122 #define EP_INACTIVE                     56
123
124 /* values for special configurable properties (depending on level settings) */
125 #define EP_EM_SLIPPERY_WALL             57
126
127 /* values for special graphics properties (no effect on game engine) */
128 #define EP_GFX_CRUMBLED                 58
129
130 /* values for derived properties (determined from properties above) */
131 #define EP_ACCESSIBLE_OVER              59
132 #define EP_ACCESSIBLE_INSIDE            60
133 #define EP_ACCESSIBLE_UNDER             61
134 #define EP_WALKABLE                     62
135 #define EP_PASSABLE                     63
136 #define EP_ACCESSIBLE                   64
137 #define EP_COLLECTIBLE                  65
138 #define EP_SNAPPABLE                    66
139 #define EP_WALL                         67
140 #define EP_SOLID_FOR_PUSHING            68
141 #define EP_DRAGONFIRE_PROOF             69
142 #define EP_EXPLOSION_PROOF              70
143 #define EP_CAN_SMASH                    71
144 #define EP_EXPLODES_3X3_OLD             72
145 #define EP_CAN_EXPLODE_BY_FIRE          73
146 #define EP_CAN_EXPLODE_SMASHED          74
147 #define EP_CAN_EXPLODE_IMPACT           75
148 #define EP_SP_PORT                      76
149 #define EP_CAN_EXPLODE_BY_DRAGONFIRE    77
150 #define EP_CAN_EXPLODE_BY_EXPLOSION     78
151 #define EP_COULD_MOVE_INTO_ACID         79
152 #define EP_MAYBE_DONT_COLLIDE_WITH      80
153 #define EP_CAN_BE_CLONED_BY_ANDROID     81
154
155 /* values for internal purpose only (level editor) */
156 #define EP_WALK_TO_OBJECT               82
157 #define EP_DEADLY                       83
158 #define EP_EDITOR_CASCADE               84
159 #define EP_EDITOR_CASCADE_ACTIVE        85
160 #define EP_EDITOR_CASCADE_INACTIVE      86
161
162 /* values for internal purpose only (game engine) */
163 #define EP_HAS_ACTION                   87
164 #define EP_CAN_CHANGE_OR_HAS_ACTION     88
165
166 #define NUM_ELEMENT_PROPERTIES          89
167
168 #define NUM_EP_BITFIELDS                ((NUM_ELEMENT_PROPERTIES + 31) / 32)
169 #define EP_BITFIELD_BASE                0
170
171 #define EP_BITMASK_DEFAULT              0
172
173 #define PROPERTY_BIT(p)                 (1 << ((p) % 32))
174 #if 1
175 #define PROPERTY_VAR(e,p)               (element_info[e].properties[(p) / 32])
176 #else
177 #define PROPERTY_VAR(e,p)               (Properties[e][(p) / 32])
178 #endif
179 #define HAS_PROPERTY(e,p)       ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
180 #define SET_PROPERTY(e,p,v)     ((v) ?                                     \
181                                  (PROPERTY_VAR(e,p) |=  PROPERTY_BIT(p)) : \
182                                  (PROPERTY_VAR(e,p) &= ~PROPERTY_BIT(p)))
183
184
185 /* values for change events for custom elements (stored in level file) */
186 #define CE_DELAY                        0
187 #define CE_TOUCHED_BY_PLAYER            1
188 #define CE_PRESSED_BY_PLAYER            2
189 #define CE_PUSHED_BY_PLAYER             3
190 #define CE_DROPPED_BY_PLAYER            4
191 #define CE_HITTING_SOMETHING            5
192 #define CE_IMPACT                       6
193 #define CE_SMASHED                      7
194 #define CE_TOUCHING_X                   8
195 #define CE_CHANGE_OF_X                  9
196 #define CE_EXPLOSION_OF_X               10
197 #define CE_PLAYER_TOUCHES_X             11
198 #define CE_PLAYER_PRESSES_X             12
199 #define CE_PLAYER_PUSHES_X              13
200 #define CE_PLAYER_COLLECTS_X            14
201 #define CE_PLAYER_DROPS_X               15
202 #define CE_VALUE_GETS_ZERO              16
203 #define CE_VALUE_GETS_ZERO_OF_X         17
204 #define CE_BY_OTHER_ACTION              18
205 #define CE_BY_DIRECT_ACTION             19
206 #define CE_PLAYER_DIGS_X                20
207 #define CE_ENTERED_BY_PLAYER            21
208 #define CE_LEFT_BY_PLAYER               22
209 #define CE_PLAYER_ENTERS_X              23
210 #define CE_PLAYER_LEAVES_X              24
211 #define CE_SWITCHED                     25
212 #define CE_SWITCH_OF_X                  26
213 #define CE_HIT_BY_SOMETHING             27
214 #define CE_HITTING_X                    28
215 #define CE_HIT_BY_X                     29
216 #define CE_BLOCKED                      30
217 #define CE_SWITCHED_BY_PLAYER           31
218 #define CE_PLAYER_SWITCHES_X            32
219 #define CE_SNAPPED_BY_PLAYER            33
220 #define CE_PLAYER_SNAPS_X               34
221 #define CE_MOVE_OF_X                    35
222 #define CE_DIGGING_X                    36
223 #define CE_CREATION_OF_X                37
224
225 #define NUM_CHANGE_EVENTS               38
226
227 #define CE_BITMASK_DEFAULT              0
228
229 #define CH_EVENT_VAR(e,c)               (element_info[e].change->has_event[c])
230 #define CH_ANY_EVENT_VAR(e,c)           (element_info[e].has_change_event[c])
231
232 #define PAGE_HAS_CHANGE_EVENT(p,c)      ((p)->has_event[c])
233 #define HAS_CHANGE_EVENT(e,c)           (IS_CUSTOM_ELEMENT(e) &&        \
234                                          CH_EVENT_VAR(e,c))
235 #define HAS_ANY_CHANGE_EVENT(e,c)       (IS_CUSTOM_ELEMENT(e) &&        \
236                                          CH_ANY_EVENT_VAR(e,c))
237
238 #define SET_CHANGE_EVENT(e,c,v)         (IS_CUSTOM_ELEMENT(e) ?         \
239                                          CH_EVENT_VAR(e,c) = (v) : 0)
240 #define SET_ANY_CHANGE_EVENT(e,c,v)     (IS_CUSTOM_ELEMENT(e) ?         \
241                                          CH_ANY_EVENT_VAR(e,c) = (v) : 0)
242
243 /* values for player bitmasks */
244 #define PLAYER_BITS_NONE                0
245 #define PLAYER_BITS_1                   (1 << 0)
246 #define PLAYER_BITS_2                   (1 << 1)
247 #define PLAYER_BITS_3                   (1 << 2)
248 #define PLAYER_BITS_4                   (1 << 3)
249 #define PLAYER_BITS_ANY                 (PLAYER_BITS_1 | \
250                                          PLAYER_BITS_2 | \
251                                          PLAYER_BITS_3 | \
252                                          PLAYER_BITS_4)
253 #define PLAYER_BITS_TRIGGER             (1 << 4)
254
255 /* values for move directions (bits 0 - 3: basic move directions) */
256 #define MV_BIT_PREVIOUS                 4
257 #define MV_BIT_TRIGGER                  5
258 #define MV_BIT_TRIGGER_BACK             6
259 #define MV_BIT_NORMAL                   MV_BIT_TRIGGER
260 #define MV_BIT_REVERSE                  MV_BIT_TRIGGER_BACK
261
262 #define MV_PREVIOUS                     (1 << MV_BIT_PREVIOUS)
263 #define MV_TRIGGER                      (1 << MV_BIT_TRIGGER)
264 #define MV_TRIGGER_BACK                 (1 << MV_BIT_TRIGGER_BACK)
265 #define MV_NORMAL                       (1 << MV_BIT_NORMAL)
266 #define MV_REVERSE                      (1 << MV_BIT_REVERSE)
267
268 /* values for move stepsize */
269 #define STEPSIZE_NOT_MOVING             0
270 #define STEPSIZE_VERY_SLOW              1
271 #define STEPSIZE_SLOW                   2
272 #define STEPSIZE_NORMAL                 4
273 #define STEPSIZE_FAST                   8
274 #define STEPSIZE_VERY_FAST              16
275 #define STEPSIZE_EVEN_FASTER            32
276 #define STEPSIZE_SLOWER                 50      /* (symbolic value only) */
277 #define STEPSIZE_FASTER                 200     /* (symbolic value only) */
278 #define STEPSIZE_RESET                  100     /* (symbolic value only) */
279
280 /* values for change side for custom elements */
281 #define CH_SIDE_NONE                    MV_NONE
282 #define CH_SIDE_LEFT                    MV_LEFT
283 #define CH_SIDE_RIGHT                   MV_RIGHT
284 #define CH_SIDE_TOP                     MV_UP
285 #define CH_SIDE_BOTTOM                  MV_DOWN
286 #define CH_SIDE_LEFT_RIGHT              MV_HORIZONTAL
287 #define CH_SIDE_TOP_BOTTOM              MV_VERTICAL
288 #define CH_SIDE_ANY                     MV_ANY_DIRECTION
289
290 /* values for change player for custom elements */
291 #define CH_PLAYER_NONE                  PLAYER_BITS_NONE
292 #define CH_PLAYER_1                     PLAYER_BITS_1
293 #define CH_PLAYER_2                     PLAYER_BITS_2
294 #define CH_PLAYER_3                     PLAYER_BITS_3
295 #define CH_PLAYER_4                     PLAYER_BITS_4
296 #define CH_PLAYER_ANY                   PLAYER_BITS_ANY
297
298 /* values for change page for custom elements */
299 #define CH_PAGE_ANY_FILE                (0xff)
300 #define CH_PAGE_ANY                     (0xffffffff)
301
302 /* values for change power for custom elements */
303 #define CP_WHEN_EMPTY                   0
304 #define CP_WHEN_DIGGABLE                1
305 #define CP_WHEN_DESTRUCTIBLE            2
306 #define CP_WHEN_COLLECTIBLE             3
307 #define CP_WHEN_REMOVABLE               4
308 #define CP_WHEN_WALKABLE                5
309
310 /* values for change actions for custom elements */
311 #define CA_NO_ACTION                    0
312 #define CA_EXIT_PLAYER                  1
313 #define CA_KILL_PLAYER                  2
314 #define CA_MOVE_PLAYER                  3
315 #define CA_RESTART_LEVEL                4
316 #define CA_SHOW_ENVELOPE                5
317 #define CA_SET_LEVEL_TIME               6
318 #define CA_SET_LEVEL_GEMS               7
319 #define CA_SET_LEVEL_SCORE              8
320 #define CA_SET_LEVEL_WIND               9
321 #define CA_SET_LEVEL_GRAVITY            10
322 #define CA_SET_PLAYER_KEYS              11
323 #define CA_SET_PLAYER_SPEED             12
324 #define CA_SET_PLAYER_SHIELD            13
325 #define CA_SET_PLAYER_ARTWORK           14
326 #define CA_SET_CE_SCORE                 15
327 #define CA_SET_CE_VALUE                 16
328 #define CA_SET_ENGINE_SCAN_MODE         17
329
330 #define CA_HEADLINE_LEVEL_ACTIONS       250
331 #define CA_HEADLINE_PLAYER_ACTIONS      251
332 #define CA_HEADLINE_CE_ACTIONS          252
333 #define CA_HEADLINE_ENGINE_ACTIONS      253
334 #define CA_UNDEFINED                    255
335
336 /* values for change action mode for custom elements */
337 #define CA_MODE_UNDEFINED               0
338 #define CA_MODE_SET                     1
339 #define CA_MODE_ADD                     2
340 #define CA_MODE_SUBTRACT                3
341 #define CA_MODE_MULTIPLY                4
342 #define CA_MODE_DIVIDE                  5
343 #define CA_MODE_MODULO                  6
344
345 /* values for change action parameters for custom elements */
346 #define CA_ARG_MIN                      0
347 #define CA_ARG_0                        0
348 #define CA_ARG_1                        1
349 #define CA_ARG_2                        2
350 #define CA_ARG_3                        3
351 #define CA_ARG_4                        4
352 #define CA_ARG_5                        5
353 #define CA_ARG_6                        6
354 #define CA_ARG_7                        7
355 #define CA_ARG_8                        8
356 #define CA_ARG_9                        9
357 #define CA_ARG_10                       10
358 #define CA_ARG_100                      100
359 #define CA_ARG_1000                     1000
360 #define CA_ARG_MAX                      9999
361 #define CA_ARG_PLAYER                   10000
362 #define CA_ARG_PLAYER_1                 (CA_ARG_PLAYER + PLAYER_BITS_1)
363 #define CA_ARG_PLAYER_2                 (CA_ARG_PLAYER + PLAYER_BITS_2)
364 #define CA_ARG_PLAYER_3                 (CA_ARG_PLAYER + PLAYER_BITS_3)
365 #define CA_ARG_PLAYER_4                 (CA_ARG_PLAYER + PLAYER_BITS_4)
366 #define CA_ARG_PLAYER_ANY               (CA_ARG_PLAYER + PLAYER_BITS_ANY)
367 #define CA_ARG_PLAYER_TRIGGER           (CA_ARG_PLAYER + PLAYER_BITS_TRIGGER)
368 #define CA_ARG_PLAYER_HEADLINE          (CA_ARG_PLAYER + 999)
369 #define CA_ARG_NUMBER                   11000
370 #define CA_ARG_NUMBER_MIN               (CA_ARG_NUMBER + 0)
371 #define CA_ARG_NUMBER_MAX               (CA_ARG_NUMBER + 1)
372 #define CA_ARG_NUMBER_RESET             (CA_ARG_NUMBER + 2)
373 #define CA_ARG_NUMBER_CE_SCORE          (CA_ARG_NUMBER + 3)
374 #define CA_ARG_NUMBER_CE_VALUE          (CA_ARG_NUMBER + 4)
375 #define CA_ARG_NUMBER_CE_DELAY          (CA_ARG_NUMBER + 5)
376 #define CA_ARG_NUMBER_LEVEL_TIME        (CA_ARG_NUMBER + 6)
377 #define CA_ARG_NUMBER_LEVEL_GEMS        (CA_ARG_NUMBER + 7)
378 #define CA_ARG_NUMBER_LEVEL_SCORE       (CA_ARG_NUMBER + 8)
379 #define CA_ARG_NUMBER_HEADLINE          (CA_ARG_NUMBER + 999)
380 #define CA_ARG_ELEMENT                  12000
381 #define CA_ARG_ELEMENT_RESET            (CA_ARG_ELEMENT + 0)
382 #define CA_ARG_ELEMENT_TARGET           (CA_ARG_ELEMENT + 1)
383 #define CA_ARG_ELEMENT_TRIGGER          (CA_ARG_ELEMENT + 2)
384 #define CA_ARG_ELEMENT_HEADLINE         (CA_ARG_ELEMENT + 997)
385 #define CA_ARG_ELEMENT_CV_TARGET        (CA_ARG_ELEMENT_TARGET)
386 #define CA_ARG_ELEMENT_CV_TRIGGER       (CA_ARG_ELEMENT_TRIGGER)
387 #define CA_ARG_ELEMENT_CV_HEADLINE      (CA_ARG_ELEMENT_HEADLINE)
388 #define CA_ARG_ELEMENT_NR_TARGET        (CA_ARG_ELEMENT + 3)
389 #define CA_ARG_ELEMENT_NR_TRIGGER       (CA_ARG_ELEMENT + 4)
390 #define CA_ARG_ELEMENT_NR_HEADLINE      (CA_ARG_ELEMENT + 998)
391 #define CA_ARG_ELEMENT_CS_TARGET        (CA_ARG_ELEMENT + 5)
392 #define CA_ARG_ELEMENT_CS_TRIGGER       (CA_ARG_ELEMENT + 6)
393 #define CA_ARG_ELEMENT_CS_HEADLINE      (CA_ARG_ELEMENT + 999)
394 #define CA_ARG_SPEED                    13000
395 #define CA_ARG_SPEED_NOT_MOVING         (CA_ARG_SPEED + STEPSIZE_NOT_MOVING)
396 #define CA_ARG_SPEED_VERY_SLOW          (CA_ARG_SPEED + STEPSIZE_VERY_SLOW)
397 #define CA_ARG_SPEED_SLOW               (CA_ARG_SPEED + STEPSIZE_SLOW)
398 #define CA_ARG_SPEED_NORMAL             (CA_ARG_SPEED + STEPSIZE_NORMAL)
399 #define CA_ARG_SPEED_FAST               (CA_ARG_SPEED + STEPSIZE_FAST)
400 #define CA_ARG_SPEED_VERY_FAST          (CA_ARG_SPEED + STEPSIZE_VERY_FAST)
401 #define CA_ARG_SPEED_EVEN_FASTER        (CA_ARG_SPEED + STEPSIZE_EVEN_FASTER)
402 #define CA_ARG_SPEED_SLOWER             (CA_ARG_SPEED + STEPSIZE_SLOWER)
403 #define CA_ARG_SPEED_FASTER             (CA_ARG_SPEED + STEPSIZE_FASTER)
404 #define CA_ARG_SPEED_RESET              (CA_ARG_SPEED + STEPSIZE_RESET)
405 #define CA_ARG_SPEED_HEADLINE           (CA_ARG_SPEED + 999)
406 #define CA_ARG_GRAVITY                  14000
407 #define CA_ARG_GRAVITY_OFF              (CA_ARG_GRAVITY + 0)
408 #define CA_ARG_GRAVITY_ON               (CA_ARG_GRAVITY + 1)
409 #define CA_ARG_GRAVITY_TOGGLE           (CA_ARG_GRAVITY + 2)
410 #define CA_ARG_GRAVITY_HEADLINE         (CA_ARG_GRAVITY + 999)
411 #define CA_ARG_DIRECTION                15000
412 #define CA_ARG_DIRECTION_NONE           (CA_ARG_DIRECTION + MV_NONE)
413 #define CA_ARG_DIRECTION_LEFT           (CA_ARG_DIRECTION + MV_LEFT)
414 #define CA_ARG_DIRECTION_RIGHT          (CA_ARG_DIRECTION + MV_RIGHT)
415 #define CA_ARG_DIRECTION_UP             (CA_ARG_DIRECTION + MV_UP)
416 #define CA_ARG_DIRECTION_DOWN           (CA_ARG_DIRECTION + MV_DOWN)
417 #define CA_ARG_DIRECTION_TRIGGER        (CA_ARG_DIRECTION + MV_TRIGGER)
418 #define CA_ARG_DIRECTION_TRIGGER_BACK   (CA_ARG_DIRECTION + MV_TRIGGER_BACK)
419 #define CA_ARG_DIRECTION_HEADLINE       (CA_ARG_DIRECTION + 999)
420 #define CA_ARG_SHIELD                   16000
421 #define CA_ARG_SHIELD_OFF               (CA_ARG_SHIELD + 0)
422 #define CA_ARG_SHIELD_NORMAL            (CA_ARG_SHIELD + 1)
423 #define CA_ARG_SHIELD_DEADLY            (CA_ARG_SHIELD + 2)
424 #define CA_ARG_SHIELD_HEADLINE          (CA_ARG_SHIELD + 999)
425 #define CA_ARG_SCAN_MODE                17000
426 #define CA_ARG_SCAN_MODE_NORMAL         (CA_ARG_SCAN_MODE + MV_NORMAL)
427 #define CA_ARG_SCAN_MODE_REVERSE        (CA_ARG_SCAN_MODE + MV_REVERSE)
428 #define CA_ARG_SCAN_MODE_HEADLINE       (CA_ARG_SCAN_MODE + 999)
429 #define CA_ARG_UNDEFINED                65535
430
431 /* values for custom move patterns (bits 0 - 3: basic move directions) */
432 #define MV_BIT_TOWARDS_PLAYER           4
433 #define MV_BIT_AWAY_FROM_PLAYER         5
434 #define MV_BIT_ALONG_LEFT_SIDE          6
435 #define MV_BIT_ALONG_RIGHT_SIDE         7
436 #define MV_BIT_TURNING_LEFT             8
437 #define MV_BIT_TURNING_RIGHT            9
438 #define MV_BIT_WHEN_PUSHED              10
439 #define MV_BIT_MAZE_RUNNER              11
440 #define MV_BIT_MAZE_HUNTER              12
441 #define MV_BIT_WHEN_DROPPED             13
442 #define MV_BIT_TURNING_LEFT_RIGHT       14
443 #define MV_BIT_TURNING_RIGHT_LEFT       15
444 #define MV_BIT_TURNING_RANDOM           16
445 #define MV_BIT_WIND_DIRECTION           17
446
447 /* values for custom move patterns */
448 #define MV_TOWARDS_PLAYER               (1 << MV_BIT_TOWARDS_PLAYER)
449 #define MV_AWAY_FROM_PLAYER             (1 << MV_BIT_AWAY_FROM_PLAYER)
450 #define MV_ALONG_LEFT_SIDE              (1 << MV_BIT_ALONG_LEFT_SIDE)
451 #define MV_ALONG_RIGHT_SIDE             (1 << MV_BIT_ALONG_RIGHT_SIDE)
452 #define MV_TURNING_LEFT                 (1 << MV_BIT_TURNING_LEFT)
453 #define MV_TURNING_RIGHT                (1 << MV_BIT_TURNING_RIGHT)
454 #define MV_WHEN_PUSHED                  (1 << MV_BIT_WHEN_PUSHED)
455 #define MV_MAZE_RUNNER                  (1 << MV_BIT_MAZE_RUNNER)
456 #define MV_MAZE_HUNTER                  (1 << MV_BIT_MAZE_HUNTER)
457 #define MV_MAZE_RUNNER_STYLE            (MV_MAZE_RUNNER | MV_MAZE_HUNTER)
458 #define MV_WHEN_DROPPED                 (1 << MV_BIT_WHEN_DROPPED)
459 #define MV_TURNING_LEFT_RIGHT           (1 << MV_BIT_TURNING_LEFT_RIGHT)
460 #define MV_TURNING_RIGHT_LEFT           (1 << MV_BIT_TURNING_RIGHT_LEFT)
461 #define MV_TURNING_RANDOM               (1 << MV_BIT_TURNING_RANDOM)
462 #define MV_WIND_DIRECTION               (1 << MV_BIT_WIND_DIRECTION)
463
464 /* values for initial move direction */
465 #define MV_START_NONE                   (MV_NONE)
466 #define MV_START_AUTOMATIC              (MV_NONE)
467 #define MV_START_LEFT                   (MV_LEFT)
468 #define MV_START_RIGHT                  (MV_RIGHT)
469 #define MV_START_UP                     (MV_UP)
470 #define MV_START_DOWN                   (MV_DOWN)
471 #define MV_START_RANDOM                 (MV_ALL_DIRECTIONS)
472 #define MV_START_PREVIOUS               (MV_PREVIOUS)
473
474 /* values for elements left behind by custom elements */
475 #define LEAVE_TYPE_UNLIMITED            0
476 #define LEAVE_TYPE_LIMITED              1
477
478 /* values for slippery property for custom elements */
479 #define SLIPPERY_ANY_RANDOM             0
480 #define SLIPPERY_ANY_LEFT_RIGHT         1
481 #define SLIPPERY_ANY_RIGHT_LEFT         2
482 #define SLIPPERY_ONLY_LEFT              3
483 #define SLIPPERY_ONLY_RIGHT             4
484
485 /* values for explosion type for custom elements */
486 #define EXPLODES_3X3                    0
487 #define EXPLODES_1X1                    1
488 #define EXPLODES_CROSS                  2
489
490 /* macros for configurable properties */
491 #define IS_DIGGABLE(e)          HAS_PROPERTY(e, EP_DIGGABLE)
492 #define IS_COLLECTIBLE_ONLY(e)  HAS_PROPERTY(e, EP_COLLECTIBLE_ONLY)
493 #define DONT_RUN_INTO(e)        HAS_PROPERTY(e, EP_DONT_RUN_INTO)
494 #define DONT_COLLIDE_WITH(e)    HAS_PROPERTY(e, EP_DONT_COLLIDE_WITH)
495 #define DONT_TOUCH(e)           HAS_PROPERTY(e, EP_DONT_TOUCH)
496 #define IS_INDESTRUCTIBLE(e)    HAS_PROPERTY(e, EP_INDESTRUCTIBLE)
497 #define IS_SLIPPERY(e)          HAS_PROPERTY(e, EP_SLIPPERY)
498 #define CAN_CHANGE(e)           HAS_PROPERTY(e, EP_CAN_CHANGE)
499 #define CAN_MOVE(e)             HAS_PROPERTY(e, EP_CAN_MOVE)
500 #define CAN_FALL(e)             HAS_PROPERTY(e, EP_CAN_FALL)
501 #define CAN_SMASH_PLAYER(e)     HAS_PROPERTY(e, EP_CAN_SMASH_PLAYER)
502 #define CAN_SMASH_ENEMIES(e)    HAS_PROPERTY(e, EP_CAN_SMASH_ENEMIES)
503 #define CAN_SMASH_EVERYTHING(e) HAS_PROPERTY(e, EP_CAN_SMASH_EVERYTHING)
504 #define EXPLODES_BY_FIRE(e)     HAS_PROPERTY(e, EP_EXPLODES_BY_FIRE)
505 #define EXPLODES_SMASHED(e)     HAS_PROPERTY(e, EP_EXPLODES_SMASHED)
506 #define EXPLODES_IMPACT(e)      HAS_PROPERTY(e, EP_EXPLODES_IMPACT)
507 #define IS_WALKABLE_OVER(e)     HAS_PROPERTY(e, EP_WALKABLE_OVER)
508 #define IS_WALKABLE_INSIDE(e)   HAS_PROPERTY(e, EP_WALKABLE_INSIDE)
509 #define IS_WALKABLE_UNDER(e)    HAS_PROPERTY(e, EP_WALKABLE_UNDER)
510 #define IS_PASSABLE_OVER(e)     HAS_PROPERTY(e, EP_PASSABLE_OVER)
511 #define IS_PASSABLE_INSIDE(e)   HAS_PROPERTY(e, EP_PASSABLE_INSIDE)
512 #define IS_PASSABLE_UNDER(e)    HAS_PROPERTY(e, EP_PASSABLE_UNDER)
513 #define IS_DROPPABLE(e)         HAS_PROPERTY(e, EP_DROPPABLE)
514 #define EXPLODES_1X1_OLD(e)     HAS_PROPERTY(e, EP_EXPLODES_1X1_OLD)
515 #define IS_PUSHABLE(e)          HAS_PROPERTY(e, EP_PUSHABLE)
516 #define EXPLODES_CROSS_OLD(e)   HAS_PROPERTY(e, EP_EXPLODES_CROSS_OLD)
517 #define IS_PROTECTED(e)         HAS_PROPERTY(e, EP_PROTECTED)
518 #define CAN_MOVE_INTO_ACID(e)   HAS_PROPERTY(e, EP_CAN_MOVE_INTO_ACID)
519 #define IS_THROWABLE(e)         HAS_PROPERTY(e, EP_THROWABLE)
520 #define CAN_EXPLODE(e)          HAS_PROPERTY(e, EP_CAN_EXPLODE)
521 #define IS_GRAVITY_REACHABLE(e) HAS_PROPERTY(e, EP_GRAVITY_REACHABLE)
522
523 /* macros for special configurable properties */
524 #define IS_EM_SLIPPERY_WALL(e)  HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL)
525
526 /* macros for special graphics properties */
527 #define GFX_CRUMBLED(e)         HAS_PROPERTY(GFX_ELEMENT(e), EP_GFX_CRUMBLED)
528
529 /* macros for pre-defined properties */
530 #define ELEM_IS_PLAYER(e)       HAS_PROPERTY(e, EP_PLAYER)
531 #define CAN_PASS_MAGIC_WALL(e)  HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL)
532 #define IS_SWITCHABLE(e)        HAS_PROPERTY(e, EP_SWITCHABLE)
533 #define IS_BD_ELEMENT(e)        HAS_PROPERTY(e, EP_BD_ELEMENT)
534 #define IS_SP_ELEMENT(e)        HAS_PROPERTY(e, EP_SP_ELEMENT)
535 #define IS_SB_ELEMENT(e)        HAS_PROPERTY(e, EP_SB_ELEMENT)
536 #define IS_GEM(e)               HAS_PROPERTY(e, EP_GEM)
537 #define IS_FOOD_DARK_YAMYAM(e)  HAS_PROPERTY(e, EP_FOOD_DARK_YAMYAM)
538 #define IS_FOOD_PENGUIN(e)      HAS_PROPERTY(e, EP_FOOD_PENGUIN)
539 #define IS_FOOD_PIG(e)          HAS_PROPERTY(e, EP_FOOD_PIG)
540 #define IS_HISTORIC_WALL(e)     HAS_PROPERTY(e, EP_HISTORIC_WALL)
541 #define IS_HISTORIC_SOLID(e)    HAS_PROPERTY(e, EP_HISTORIC_SOLID)
542 #define IS_CLASSIC_ENEMY(e)     HAS_PROPERTY(e, EP_CLASSIC_ENEMY)
543 #define IS_BELT(e)              HAS_PROPERTY(e, EP_BELT)
544 #define IS_BELT_ACTIVE(e)       HAS_PROPERTY(e, EP_BELT_ACTIVE)
545 #define IS_BELT_SWITCH(e)       HAS_PROPERTY(e, EP_BELT_SWITCH)
546 #define IS_TUBE(e)              HAS_PROPERTY(e, EP_TUBE)
547 #define IS_KEYGATE(e)           HAS_PROPERTY(e, EP_KEYGATE)
548 #define IS_AMOEBOID(e)          HAS_PROPERTY(e, EP_AMOEBOID)
549 #define IS_AMOEBALIVE(e)        HAS_PROPERTY(e, EP_AMOEBALIVE)
550 #define HAS_EDITOR_CONTENT(e)   HAS_PROPERTY(e, EP_HAS_EDITOR_CONTENT)
551 #define CAN_TURN_EACH_MOVE(e)   HAS_PROPERTY(e, EP_CAN_TURN_EACH_MOVE)
552 #define CAN_GROW(e)             HAS_PROPERTY(e, EP_CAN_GROW)
553 #define IS_ACTIVE_BOMB(e)       HAS_PROPERTY(e, EP_ACTIVE_BOMB)
554 #define IS_INACTIVE(e)          HAS_PROPERTY(e, EP_INACTIVE)
555
556 /* macros for derived properties */
557 #define IS_ACCESSIBLE_OVER(e)   HAS_PROPERTY(e, EP_ACCESSIBLE_OVER)
558 #define IS_ACCESSIBLE_INSIDE(e) HAS_PROPERTY(e, EP_ACCESSIBLE_INSIDE)
559 #define IS_ACCESSIBLE_UNDER(e)  HAS_PROPERTY(e, EP_ACCESSIBLE_UNDER)
560 #define IS_WALKABLE(e)          HAS_PROPERTY(e, EP_WALKABLE)
561 #define IS_PASSABLE(e)          HAS_PROPERTY(e, EP_PASSABLE)
562 #define IS_ACCESSIBLE(e)        HAS_PROPERTY(e, EP_ACCESSIBLE)
563 #define IS_COLLECTIBLE(e)       HAS_PROPERTY(e, EP_COLLECTIBLE)
564 #define IS_SNAPPABLE(e)         HAS_PROPERTY(e, EP_SNAPPABLE)
565 #define IS_WALL(e)              HAS_PROPERTY(e, EP_WALL)
566 #define IS_SOLID_FOR_PUSHING(e) HAS_PROPERTY(e, EP_SOLID_FOR_PUSHING)
567 #define IS_DRAGONFIRE_PROOF(e)  HAS_PROPERTY(e, EP_DRAGONFIRE_PROOF)
568 #define IS_EXPLOSION_PROOF(e)   HAS_PROPERTY(e, EP_EXPLOSION_PROOF)
569 #define CAN_SMASH(e)            HAS_PROPERTY(e, EP_CAN_SMASH)
570 #define EXPLODES_3X3_OLD(e)     HAS_PROPERTY(e, EP_EXPLODES_3X3_OLD)
571 #define CAN_EXPLODE_BY_FIRE(e)  HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE)
572 #define CAN_EXPLODE_SMASHED(e)  HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED)
573 #define CAN_EXPLODE_IMPACT(e)   HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT)
574 #define IS_SP_PORT(e)           HAS_PROPERTY(e, EP_SP_PORT)
575 #define CAN_EXPLODE_BY_DRAGONFIRE(e)    \
576                                 HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_DRAGONFIRE)
577 #define CAN_EXPLODE_BY_EXPLOSION(e)     \
578                                 HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_EXPLOSION)
579 #define COULD_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_COULD_MOVE_INTO_ACID)
580 #define MAYBE_DONT_COLLIDE_WITH(e) HAS_PROPERTY(e, EP_MAYBE_DONT_COLLIDE_WITH)
581 #define CAN_BE_CLONED_BY_ANDROID(e)     \
582                                 HAS_PROPERTY(e, EP_CAN_BE_CLONED_BY_ANDROID)
583
584 #define IS_EDITOR_CASCADE(e)    HAS_PROPERTY(e, EP_EDITOR_CASCADE)
585 #define IS_EDITOR_CASCADE_ACTIVE(e)     \
586                                 HAS_PROPERTY(e, EP_EDITOR_CASCADE_ACTIVE)
587 #define IS_EDITOR_CASCADE_INACTIVE(e)   \
588                                 HAS_PROPERTY(e, EP_EDITOR_CASCADE_INACTIVE)
589
590 #define HAS_ACTION(e)           HAS_PROPERTY(e, EP_HAS_ACTION)
591 #define CAN_CHANGE_OR_HAS_ACTION(e)     \
592                                 HAS_PROPERTY(e, EP_CAN_CHANGE_OR_HAS_ACTION)
593
594 /* special macros used in game engine */
595 #define IS_CUSTOM_ELEMENT(e)    ((e) >= EL_CUSTOM_START &&              \
596                                  (e) <= EL_CUSTOM_END)
597
598 #define IS_GROUP_ELEMENT(e)     ((e) >= EL_GROUP_START &&               \
599                                  (e) <= EL_GROUP_END)
600
601 #define IS_CLIPBOARD_ELEMENT(e) ((e) >= EL_INTERNAL_CLIPBOARD_START &&  \
602                                  (e) <= EL_INTERNAL_CLIPBOARD_END)
603
604 #define IS_INTERNAL_ELEMENT(e)  ((e) >= EL_INTERNAL_START &&            \
605                                  (e) <= EL_INTERNAL_END)
606
607 #define IS_ENVELOPE(e)          ((e) >= EL_ENVELOPE_1 &&                \
608                                  (e) <= EL_ENVELOPE_4)
609
610 #define IS_RND_KEY(e)           ((e) >= EL_KEY_1 &&                     \
611                                  (e) <= EL_KEY_4)
612 #define IS_EM_KEY(e)            ((e) >= EL_EM_KEY_1 &&                  \
613                                  (e) <= EL_EM_KEY_4)
614 #define IS_EMC_KEY(e)           ((e) >= EL_EMC_KEY_5 &&                 \
615                                  (e) <= EL_EMC_KEY_8)
616 #define IS_KEY(e)               (IS_RND_KEY(e) ||                       \
617                                  IS_EM_KEY(e) ||                        \
618                                  IS_EMC_KEY(e))
619 #define RND_KEY_NR(e)           ((e) - EL_KEY_1)
620 #define EM_KEY_NR(e)            ((e) - EL_EM_KEY_1)
621 #define EMC_KEY_NR(e)           ((e) - EL_EMC_KEY_5 + 4)
622 #define KEY_NR(e)               (IS_RND_KEY(e) ? RND_KEY_NR(e) :        \
623                                  IS_EM_KEY(e) ?  EM_KEY_NR(e) :         \
624                                  IS_EMC_KEY(e) ? EMC_KEY_NR(e) : 0)
625
626 #define IS_RND_GATE(e)          ((e) >= EL_GATE_1 &&                    \
627                                  (e) <= EL_GATE_4)
628 #define IS_EM_GATE(e)           ((e) >= EL_EM_GATE_1 &&                 \
629                                  (e) <= EL_EM_GATE_4)
630 #define IS_EMC_GATE(e)          ((e) >= EL_EMC_GATE_5 &&                \
631                                  (e) <= EL_EMC_GATE_8)
632 #define IS_GATE(e)              (IS_RND_GATE(e) ||                      \
633                                  IS_EM_GATE(e) ||                       \
634                                  IS_EMC_GATE(e))
635 #define RND_GATE_NR(e)          ((e) - EL_GATE_1)
636 #define EM_GATE_NR(e)           ((e) - EL_EM_GATE_1)
637 #define EMC_GATE_NR(e)          ((e) - EL_EMC_GATE_5 + 4)
638 #define GATE_NR(e)              (IS_RND_GATE(e) ? RND_GATE_NR(e) :      \
639                                  IS_EM_GATE(e) ?  EM_GATE_NR(e) :       \
640                                  IS_EMC_GATE(e) ? EMC_GATE_NR(e) : 0)
641
642 #define IS_RND_GATE_GRAY(e)     ((e) >= EL_GATE_1_GRAY &&               \
643                                  (e) <= EL_GATE_4_GRAY)
644 #define IS_RND_GATE_GRAY_ACTIVE(e) ((e) >= EL_GATE_1_GRAY_ACTIVE &&     \
645                                  (e) <= EL_GATE_4_GRAY_ACTIVE)
646 #define IS_EM_GATE_GRAY(e)      ((e) >= EL_EM_GATE_1_GRAY &&            \
647                                  (e) <= EL_EM_GATE_4_GRAY)
648 #define IS_EM_GATE_GRAY_ACTIVE(e) ((e) >= EL_EM_GATE_1_GRAY_ACTIVE &&   \
649                                  (e) <= EL_EM_GATE_4_GRAY_ACTIVE)
650 #define IS_EMC_GATE_GRAY(e)     ((e) >= EL_EMC_GATE_5_GRAY &&           \
651                                  (e) <= EL_EMC_GATE_8_GRAY)
652 #define IS_EMC_GATE_GRAY_ACTIVE(e) ((e) >= EL_EMC_GATE_5_GRAY_ACTIVE && \
653                                  (e) <= EL_EMC_GATE_8_GRAY_ACTIVE)
654 #define IS_GATE_GRAY(e)         (IS_RND_GATE_GRAY(e) ||                 \
655                                  IS_EM_GATE_GRAY(e) ||                  \
656                                  IS_EMC_GATE_GRAY(e))
657 #define IS_GATE_GRAY_ACTIVE(e)  (IS_RND_GATE_GRAY_ACTIVE(e) ||          \
658                                  IS_EM_GATE_GRAY_ACTIVE(e) ||           \
659                                  IS_EMC_GATE_GRAY_ACTIVE(e))
660 #define RND_GATE_GRAY_NR(e)     ((e) - EL_GATE_1_GRAY)
661 #define RND_GATE_GRAY_ACTIVE_NR(e) ((e) - EL_GATE_1_GRAY_ACTIVE)
662 #define EM_GATE_GRAY_NR(e)      ((e) - EL_EM_GATE_1_GRAY)
663 #define EM_GATE_GRAY_ACTIVE_NR(e) ((e) - EL_EM_GATE_1_GRAY_ACTIVE)
664 #define EMC_GATE_GRAY_NR(e)     ((e) - EL_EMC_GATE_5_GRAY + 4)
665 #define EMC_GATE_GRAY_ACTIVE_NR(e) ((e) - EL_EMC_GATE_5_GRAY_ACTIVE + 4)
666 #define GATE_GRAY_NR(e)         (IS_RND_GATE_GRAY(e) ? RND_GATE_GRAY_NR(e) :  \
667                                  IS_EM_GATE_GRAY(e) ?  EM_GATE_GRAY_NR(e) :   \
668                                  IS_EMC_GATE_GRAY(e) ? EMC_GATE_GRAY_NR(e) : 0)
669
670 #define GFX_ELEMENT(e)          (element_info[e].use_gfx_element ?      \
671                                  element_info[e].gfx_element : e)
672
673 /* !!! CHECK THIS !!! */
674 #if 1
675 #define TILE_GFX_ELEMENT(x, y)                                          \
676                    (GfxElement[x][y] != EL_UNDEFINED &&                 \
677                     Feld[x][y] != EL_EXPLOSION ?                        \
678                     GfxElement[x][y] : Feld[x][y])
679 #else
680 #define TILE_GFX_ELEMENT(x, y)                                          \
681         GFX_ELEMENT(GfxElement[x][y] != EL_UNDEFINED &&                 \
682                     Feld[x][y] != EL_EXPLOSION ?                        \
683                     GfxElement[x][y] : Feld[x][y])
684 #endif
685
686 /* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
687 /* (solution: add separate "use sound of element" to level file and editor) */
688 #if 0
689 #define SND_ELEMENT(e)          GFX_ELEMENT(e)
690 #else
691 #define SND_ELEMENT(e)          (e)
692 #endif
693
694 #if 1
695 #define GROUP_NR(e)             ((e) - EL_GROUP_START)
696 #define IS_IN_GROUP(e, nr)      (element_info[e].in_group[nr] == TRUE)
697 #define IS_IN_GROUP_EL(e, ge)   (IS_IN_GROUP(e, (ge) - EL_GROUP_START))
698
699 #define IS_EQUAL_OR_IN_GROUP(e, ge)                                     \
700         (IS_GROUP_ELEMENT(ge) ? IS_IN_GROUP(e, GROUP_NR(ge)) : (e) == (ge))
701 #endif
702
703 #define IS_PLAYER(x, y)         (ELEM_IS_PLAYER(StorePlayer[x][y]))
704
705 #define IS_FREE(x, y)           (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x, y))
706 #define IS_FREE_OR_PLAYER(x, y) (Feld[x][y] == EL_EMPTY)
707
708 #define IS_MOVING(x,y)          (MovPos[x][y] != 0)
709 #define IS_FALLING(x,y)         (MovPos[x][y] != 0 && MovDir[x][y] == MV_DOWN)
710 #define IS_BLOCKED(x,y)         (Feld[x][y] == EL_BLOCKED)
711
712 #define IS_MV_DIAGONAL(x)       ((x) & MV_HORIZONTAL && (x) & MV_VERTICAL)
713
714 #define EL_CHANGED(e)           ((e) == EL_ROCK           ? EL_EMERALD :    \
715                                  (e) == EL_BD_ROCK        ? EL_BD_DIAMOND : \
716                                  (e) == EL_EMERALD        ? EL_DIAMOND :    \
717                                  (e) == EL_EMERALD_YELLOW ? EL_DIAMOND :    \
718                                  (e) == EL_EMERALD_RED    ? EL_DIAMOND :    \
719                                  (e) == EL_EMERALD_PURPLE ? EL_DIAMOND :    \
720                                  EL_ROCK)
721 #define EL_CHANGED2(e)          ((e) == EL_ROCK           ? EL_BD_DIAMOND : \
722                                  (e) == EL_BD_ROCK        ? EL_BD_DIAMOND : \
723                                  EL_BD_ROCK)
724 #define IS_DRAWABLE(e)          ((e) < EL_BLOCKED)
725 #define IS_NOT_DRAWABLE(e)      ((e) >= EL_BLOCKED)
726 #define TAPE_IS_EMPTY(x)        ((x).length == 0)
727 #define TAPE_IS_STOPPED(x)      (!(x).recording && !(x).playing)
728
729 #define PLAYERINFO(x,y)         (&stored_player[StorePlayer[x][y]-EL_PLAYER_1])
730 #define SHIELD_ON(p)            ((p)->shield_normal_time_left > 0)
731
732 #define ENEMY_PROTECTED_FIELD(x,y)      (IS_PROTECTED(Feld[x][y]) ||       \
733                                          IS_PROTECTED(Back[x][y]))
734 #define EXPLOSION_PROTECTED_FIELD(x,y)  (IS_EXPLOSION_PROOF(Feld[x][y]))
735 #define PLAYER_ENEMY_PROTECTED(x,y)     (SHIELD_ON(PLAYERINFO(x, y)) ||    \
736                                          ENEMY_PROTECTED_FIELD(x, y))
737 #define PLAYER_EXPLOSION_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) ||    \
738                                          EXPLOSION_PROTECTED_FIELD(x, y))
739
740 #define PLAYER_SWITCHING(p,x,y) ((p)->is_switching &&                   \
741                                  (p)->switch_x == (x) && (p)->switch_y == (y))
742
743 #define PLAYER_DROPPING(p,x,y)  ((p)->is_dropping &&                    \
744                                  (p)->drop_x == (x) && (p)->drop_y == (y))
745
746 #define PLAYER_NR_GFX(g,i)      ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1))
747
748 #define GET_PLAYER_ELEMENT(e)   ((e) >= EL_PLAYER_1 && (e) <= EL_PLAYER_4 ? \
749                                  (e) : EL_PLAYER_1)
750
751 #define GET_PLAYER_NR(e)        (GET_PLAYER_ELEMENT(e) - EL_PLAYER_1)
752
753 #define ANIM_FRAMES(g)          (graphic_info[g].anim_frames)
754 #define ANIM_DELAY(g)           (graphic_info[g].anim_delay)
755 #define ANIM_MODE(g)            (graphic_info[g].anim_mode)
756
757 #define IS_ANIMATED(g)          (ANIM_FRAMES(g) > 1)
758 #define IS_NEW_DELAY(f, g)      ((f) % ANIM_DELAY(g) == 0)
759 #define IS_NEW_FRAME(f, g)      (IS_ANIMATED(g) && IS_NEW_DELAY(f, g))
760 #define IS_NEXT_FRAME(f, g)     (IS_NEW_FRAME(f, g) && (f) > 0)
761
762 #define IS_LOOP_SOUND(s)        (sound_info[s].loop)
763
764 #define EL_CASCADE_ACTIVE(e)    (IS_EDITOR_CASCADE_INACTIVE(e) ? (e) + 1 : (e))
765 #define EL_CASCADE_INACTIVE(e)  (IS_EDITOR_CASCADE_ACTIVE(e)   ? (e) - 1 : (e))
766 #define EL_CASCADE_TOGGLE(e)    (IS_EDITOR_CASCADE_INACTIVE(e) ? (e) + 1 :    \
767                                  IS_EDITOR_CASCADE_ACTIVE(e)   ? (e) - 1 : (e))
768
769 #define EL_NAME(e)              ((e) >= 0 ? element_info[e].token_name : "(?)")
770
771 /* fundamental game speed values */
772 #define MICROLEVEL_SCROLL_DELAY 50      /* delay for scrolling micro level */
773 #define MICROLEVEL_LABEL_DELAY  250     /* delay for micro level label */
774
775 /* boundaries of arrays etc. */
776 #define MAX_LEVEL_NAME_LEN      32
777 #define MAX_LEVEL_AUTHOR_LEN    32
778 #define MAX_ELEMENT_NAME_LEN    32
779 #define MAX_TAPES_PER_SET       1024
780 #define MAX_SCORE_ENTRIES       100
781 #define MAX_NUM_AMOEBA          100
782 #if 0   /* game.h */
783 #define MAX_INVENTORY_SIZE      1000
784 #define STD_NUM_KEYS            4
785 #define MAX_NUM_KEYS            8
786 #endif
787 #define NUM_BELTS               4
788 #define NUM_BELT_PARTS          3
789 #define MIN_ENVELOPE_XSIZE      1
790 #define MIN_ENVELOPE_YSIZE      1
791 #define MAX_ENVELOPE_XSIZE      30
792 #define MAX_ENVELOPE_YSIZE      20
793 #define MAX_ENVELOPE_TEXT_LEN   (MAX_ENVELOPE_XSIZE * MAX_ENVELOPE_YSIZE)
794 #define MIN_CHANGE_PAGES        1
795 #define MAX_CHANGE_PAGES        32
796 #define MIN_ELEMENTS_IN_GROUP   1
797 #define MAX_ELEMENTS_IN_GROUP   16
798 #define MIN_ANDROID_ELEMENTS    1
799 #define MAX_ANDROID_ELEMENTS    16
800
801 /* values for elements with content */
802 #define MIN_ELEMENT_CONTENTS    1
803 #define STD_ELEMENT_CONTENTS    4
804 #define MAX_ELEMENT_CONTENTS    8
805
806 #define LEVEL_SCORE_ELEMENTS    16      /* level elements with score */
807
808 /* often used screen positions */
809 #define SX                      8
810 #define SY                      8
811 #define REAL_SX                 (SX - 2)
812 #define REAL_SY                 (SY - 2)
813 #define DX                      566
814 #define DY                      60
815 #define VX                      DX
816 #define VY                      400
817 #define EX                      DX
818 #define EY                      (VY - 44)
819 #define TILESIZE                32
820 #define TILEX                   TILESIZE
821 #define TILEY                   TILESIZE
822 #define MINI_TILESIZE           (TILESIZE / 2)
823 #define MINI_TILEX              MINI_TILESIZE
824 #define MINI_TILEY              MINI_TILESIZE
825 #define MICRO_TILESIZE          (TILESIZE / 8)
826 #define MICRO_TILEX             MICRO_TILESIZE
827 #define MICRO_TILEY             MICRO_TILESIZE
828 #define MIDPOSX                 (SCR_FIELDX / 2)
829 #define MIDPOSY                 (SCR_FIELDY / 2)
830 #define SXSIZE                  (SCR_FIELDX * TILEX)
831 #define SYSIZE                  (SCR_FIELDY * TILEY)
832 #define FXSIZE                  ((SCR_FIELDX + 2) * TILEX)
833 #define FYSIZE                  ((SCR_FIELDY + 2) * TILEY)
834 #define DXSIZE                  100
835 #define DYSIZE                  280
836 #define VXSIZE                  DXSIZE
837 #define VYSIZE                  100
838 #define EXSIZE                  DXSIZE
839 #define EYSIZE                  (VYSIZE + 44)
840 #define FULL_SXSIZE             (2 + SXSIZE + 2)
841 #define FULL_SYSIZE             (2 + SYSIZE + 2)
842 #define MICROLEVEL_XSIZE        ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
843 #define MICROLEVEL_YSIZE        ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
844 #define MICROLEVEL_XPOS         (SX + (SXSIZE - MICROLEVEL_XSIZE) / 2)
845 #define MICROLEVEL_YPOS         (SX + 12 * TILEY - MICRO_TILEY)
846 #define MICROLABEL1_YPOS        (MICROLEVEL_YPOS - 36)
847 #define MICROLABEL2_YPOS        (MICROLEVEL_YPOS + MICROLEVEL_YSIZE + 7)
848
849
850 /* score for elements */
851 #define SC_EMERALD              0
852 #define SC_DIAMOND              1
853 #define SC_BUG                  2
854 #define SC_SPACESHIP            3
855 #define SC_YAMYAM               4
856 #define SC_ROBOT                5
857 #define SC_PACMAN               6
858 #define SC_NUT                  7
859 #define SC_DYNAMITE             8
860 #define SC_KEY                  9
861 #define SC_TIME_BONUS           10
862 #define SC_CRYSTAL              11
863 #define SC_PEARL                12
864 #define SC_SHIELD               13
865
866
867 /* "real" level file elements */
868 #define EL_UNDEFINED                    -1
869
870 #define EL_EMPTY_SPACE                  0
871 #define EL_EMPTY                        EL_EMPTY_SPACE
872 #define EL_SAND                         1
873 #define EL_WALL                         2
874 #define EL_WALL_SLIPPERY                3
875 #define EL_ROCK                         4
876 #define EL_KEY_OBSOLETE                 5       /* obsolete; now EL_KEY_1 */
877 #define EL_EMERALD                      6
878 #define EL_EXIT_CLOSED                  7
879 #define EL_PLAYER_OBSOLETE              8       /* obsolete; now EL_PLAYER_1 */
880 #define EL_BUG                          9
881 #define EL_SPACESHIP                    10
882 #define EL_YAMYAM                       11
883 #define EL_ROBOT                        12
884 #define EL_STEELWALL                    13
885 #define EL_DIAMOND                      14
886 #define EL_AMOEBA_DEAD                  15
887 #define EL_QUICKSAND_EMPTY              16
888 #define EL_QUICKSAND_FULL               17
889 #define EL_AMOEBA_DROP                  18
890 #define EL_BOMB                         19
891 #define EL_MAGIC_WALL                   20
892 #define EL_SPEED_PILL                   21
893 #define EL_ACID                         22
894 #define EL_AMOEBA_WET                   23
895 #define EL_AMOEBA_DRY                   24
896 #define EL_NUT                          25
897 #define EL_GAME_OF_LIFE                 26
898 #define EL_BIOMAZE                      27
899 #define EL_DYNAMITE_ACTIVE              28
900 #define EL_STONEBLOCK                   29
901 #define EL_ROBOT_WHEEL                  30
902 #define EL_ROBOT_WHEEL_ACTIVE           31
903 #define EL_KEY_1                        32
904 #define EL_KEY_2                        33
905 #define EL_KEY_3                        34
906 #define EL_KEY_4                        35
907 #define EL_GATE_1                       36
908 #define EL_GATE_2                       37
909 #define EL_GATE_3                       38
910 #define EL_GATE_4                       39
911 #define EL_GATE_1_GRAY                  40
912 #define EL_GATE_2_GRAY                  41
913 #define EL_GATE_3_GRAY                  42
914 #define EL_GATE_4_GRAY                  43
915 #define EL_DYNAMITE                     44
916 #define EL_PACMAN                       45
917 #define EL_INVISIBLE_WALL               46
918 #define EL_LAMP                         47
919 #define EL_LAMP_ACTIVE                  48
920 #define EL_WALL_EMERALD                 49
921 #define EL_WALL_DIAMOND                 50
922 #define EL_AMOEBA_FULL                  51
923 #define EL_BD_AMOEBA                    52
924 #define EL_TIME_ORB_FULL                53
925 #define EL_TIME_ORB_EMPTY               54
926 #define EL_EXPANDABLE_WALL              55
927 #define EL_BD_DIAMOND                   56
928 #define EL_EMERALD_YELLOW               57
929 #define EL_WALL_BD_DIAMOND              58
930 #define EL_WALL_EMERALD_YELLOW          59
931 #define EL_DARK_YAMYAM                  60
932 #define EL_BD_MAGIC_WALL                61
933 #define EL_INVISIBLE_STEELWALL          62
934 #define EL_SOKOBAN_FIELD_PLAYER         63
935 #define EL_DYNABOMB_INCREASE_NUMBER     64
936 #define EL_DYNABOMB_INCREASE_SIZE       65
937 #define EL_DYNABOMB_INCREASE_POWER      66
938 #define EL_SOKOBAN_OBJECT               67
939 #define EL_SOKOBAN_FIELD_EMPTY          68
940 #define EL_SOKOBAN_FIELD_FULL           69
941 #define EL_BD_BUTTERFLY_RIGHT           70
942 #define EL_BD_BUTTERFLY_UP              71
943 #define EL_BD_BUTTERFLY_LEFT            72
944 #define EL_BD_BUTTERFLY_DOWN            73
945 #define EL_BD_FIREFLY_RIGHT             74
946 #define EL_BD_FIREFLY_UP                75
947 #define EL_BD_FIREFLY_LEFT              76
948 #define EL_BD_FIREFLY_DOWN              77
949 #define EL_BD_BUTTERFLY_1               EL_BD_BUTTERFLY_DOWN
950 #define EL_BD_BUTTERFLY_2               EL_BD_BUTTERFLY_LEFT
951 #define EL_BD_BUTTERFLY_3               EL_BD_BUTTERFLY_UP
952 #define EL_BD_BUTTERFLY_4               EL_BD_BUTTERFLY_RIGHT
953 #define EL_BD_FIREFLY_1                 EL_BD_FIREFLY_LEFT
954 #define EL_BD_FIREFLY_2                 EL_BD_FIREFLY_DOWN
955 #define EL_BD_FIREFLY_3                 EL_BD_FIREFLY_RIGHT
956 #define EL_BD_FIREFLY_4                 EL_BD_FIREFLY_UP
957 #define EL_BD_BUTTERFLY                 78
958 #define EL_BD_FIREFLY                   79
959 #define EL_PLAYER_1                     80
960 #define EL_PLAYER_2                     81
961 #define EL_PLAYER_3                     82
962 #define EL_PLAYER_4                     83
963 #define EL_BUG_RIGHT                    84
964 #define EL_BUG_UP                       85
965 #define EL_BUG_LEFT                     86
966 #define EL_BUG_DOWN                     87
967 #define EL_SPACESHIP_RIGHT              88
968 #define EL_SPACESHIP_UP                 89
969 #define EL_SPACESHIP_LEFT               90
970 #define EL_SPACESHIP_DOWN               91
971 #define EL_PACMAN_RIGHT                 92
972 #define EL_PACMAN_UP                    93
973 #define EL_PACMAN_LEFT                  94
974 #define EL_PACMAN_DOWN                  95
975 #define EL_EMERALD_RED                  96
976 #define EL_EMERALD_PURPLE               97
977 #define EL_WALL_EMERALD_RED             98
978 #define EL_WALL_EMERALD_PURPLE          99
979 #define EL_ACID_POOL_TOPLEFT            100
980 #define EL_ACID_POOL_TOPRIGHT           101
981 #define EL_ACID_POOL_BOTTOMLEFT         102
982 #define EL_ACID_POOL_BOTTOM             103
983 #define EL_ACID_POOL_BOTTOMRIGHT        104
984 #define EL_BD_WALL                      105
985 #define EL_BD_ROCK                      106
986 #define EL_EXIT_OPEN                    107
987 #define EL_BLACK_ORB                    108
988 #define EL_AMOEBA_TO_DIAMOND            109
989 #define EL_MOLE                         110
990 #define EL_PENGUIN                      111
991 #define EL_SATELLITE                    112
992 #define EL_ARROW_LEFT                   113
993 #define EL_ARROW_RIGHT                  114
994 #define EL_ARROW_UP                     115
995 #define EL_ARROW_DOWN                   116
996 #define EL_PIG                          117
997 #define EL_DRAGON                       118
998
999 #define EL_EM_KEY_1_FILE_OBSOLETE       119     /* obsolete; now EL_EM_KEY_1 */
1000
1001 #define EL_CHAR_START                   120
1002 #define EL_CHAR_ASCII0                  (EL_CHAR_START  - 32)
1003 #define EL_CHAR_ASCII0_START            (EL_CHAR_ASCII0 + 32)
1004
1005 #include "conf_chr.h"   /* include auto-generated data structure definitions */
1006
1007 #define EL_CHAR_ASCII0_END              (EL_CHAR_ASCII0 + 111)
1008 #define EL_CHAR_END                     (EL_CHAR_START  + 79)
1009
1010 #define EL_CHAR(c)                      (EL_CHAR_ASCII0 + MAP_FONT_ASCII(c))
1011
1012 #define EL_EXPANDABLE_WALL_HORIZONTAL   200
1013 #define EL_EXPANDABLE_WALL_VERTICAL     201
1014 #define EL_EXPANDABLE_WALL_ANY          202
1015
1016 #define EL_EM_GATE_1                    203
1017 #define EL_EM_GATE_2                    204
1018 #define EL_EM_GATE_3                    205
1019 #define EL_EM_GATE_4                    206
1020
1021 #define EL_EM_KEY_2_FILE_OBSOLETE       207     /* obsolete; now EL_EM_KEY_2 */
1022 #define EL_EM_KEY_3_FILE_OBSOLETE       208     /* obsolete; now EL_EM_KEY_3 */
1023 #define EL_EM_KEY_4_FILE_OBSOLETE       209     /* obsolete; now EL_EM_KEY_4 */
1024
1025 #define EL_SP_START                     210
1026 #define EL_SP_EMPTY_SPACE               (EL_SP_START + 0)
1027 #define EL_SP_EMPTY                     EL_SP_EMPTY_SPACE
1028 #define EL_SP_ZONK                      (EL_SP_START + 1)
1029 #define EL_SP_BASE                      (EL_SP_START + 2)
1030 #define EL_SP_MURPHY                    (EL_SP_START + 3)
1031 #define EL_SP_INFOTRON                  (EL_SP_START + 4)
1032 #define EL_SP_CHIP_SINGLE               (EL_SP_START + 5)
1033 #define EL_SP_HARDWARE_GRAY             (EL_SP_START + 6)
1034 #define EL_SP_EXIT_CLOSED               (EL_SP_START + 7)
1035 #define EL_SP_DISK_ORANGE               (EL_SP_START + 8)
1036 #define EL_SP_PORT_RIGHT                (EL_SP_START + 9)
1037 #define EL_SP_PORT_DOWN                 (EL_SP_START + 10)
1038 #define EL_SP_PORT_LEFT                 (EL_SP_START + 11)
1039 #define EL_SP_PORT_UP                   (EL_SP_START + 12)
1040 #define EL_SP_GRAVITY_PORT_RIGHT        (EL_SP_START + 13)
1041 #define EL_SP_GRAVITY_PORT_DOWN         (EL_SP_START + 14)
1042 #define EL_SP_GRAVITY_PORT_LEFT         (EL_SP_START + 15)
1043 #define EL_SP_GRAVITY_PORT_UP           (EL_SP_START + 16)
1044 #define EL_SP_SNIKSNAK                  (EL_SP_START + 17)
1045 #define EL_SP_DISK_YELLOW               (EL_SP_START + 18)
1046 #define EL_SP_TERMINAL                  (EL_SP_START + 19)
1047 #define EL_SP_DISK_RED                  (EL_SP_START + 20)
1048 #define EL_SP_PORT_VERTICAL             (EL_SP_START + 21)
1049 #define EL_SP_PORT_HORIZONTAL           (EL_SP_START + 22)
1050 #define EL_SP_PORT_ANY                  (EL_SP_START + 23)
1051 #define EL_SP_ELECTRON                  (EL_SP_START + 24)
1052 #define EL_SP_BUGGY_BASE                (EL_SP_START + 25)
1053 #define EL_SP_CHIP_LEFT                 (EL_SP_START + 26)
1054 #define EL_SP_CHIP_RIGHT                (EL_SP_START + 27)
1055 #define EL_SP_HARDWARE_BASE_1           (EL_SP_START + 28)
1056 #define EL_SP_HARDWARE_GREEN            (EL_SP_START + 29)
1057 #define EL_SP_HARDWARE_BLUE             (EL_SP_START + 30)
1058 #define EL_SP_HARDWARE_RED              (EL_SP_START + 31)
1059 #define EL_SP_HARDWARE_YELLOW           (EL_SP_START + 32)
1060 #define EL_SP_HARDWARE_BASE_2           (EL_SP_START + 33)
1061 #define EL_SP_HARDWARE_BASE_3           (EL_SP_START + 34)
1062 #define EL_SP_HARDWARE_BASE_4           (EL_SP_START + 35)
1063 #define EL_SP_HARDWARE_BASE_5           (EL_SP_START + 36)
1064 #define EL_SP_HARDWARE_BASE_6           (EL_SP_START + 37)
1065 #define EL_SP_CHIP_TOP                  (EL_SP_START + 38)
1066 #define EL_SP_CHIP_BOTTOM               (EL_SP_START + 39)
1067 #define EL_SP_END                       (EL_SP_START + 39)
1068
1069 #define EL_EM_GATE_1_GRAY               250
1070 #define EL_EM_GATE_2_GRAY               251
1071 #define EL_EM_GATE_3_GRAY               252
1072 #define EL_EM_GATE_4_GRAY               253
1073
1074 #define EL_EM_DYNAMITE                  254
1075 #define EL_EM_DYNAMITE_ACTIVE           255
1076
1077 #define EL_PEARL                        256
1078 #define EL_CRYSTAL                      257
1079 #define EL_WALL_PEARL                   258
1080 #define EL_WALL_CRYSTAL                 259
1081 #define EL_DOOR_WHITE                   260
1082 #define EL_DOOR_WHITE_GRAY              261
1083 #define EL_KEY_WHITE                    262
1084 #define EL_SHIELD_NORMAL                263
1085 #define EL_EXTRA_TIME                   264
1086 #define EL_SWITCHGATE_OPEN              265
1087 #define EL_SWITCHGATE_CLOSED            266
1088 #define EL_SWITCHGATE_SWITCH_UP         267
1089 #define EL_SWITCHGATE_SWITCH_DOWN       268
1090
1091 #define EL_UNUSED_269                   269
1092 #define EL_UNUSED_270                   270
1093
1094 #define EL_CONVEYOR_BELT_1_LEFT          271
1095 #define EL_CONVEYOR_BELT_1_MIDDLE        272
1096 #define EL_CONVEYOR_BELT_1_RIGHT         273
1097 #define EL_CONVEYOR_BELT_1_SWITCH_LEFT   274
1098 #define EL_CONVEYOR_BELT_1_SWITCH_MIDDLE 275
1099 #define EL_CONVEYOR_BELT_1_SWITCH_RIGHT  276
1100 #define EL_CONVEYOR_BELT_2_LEFT          277
1101 #define EL_CONVEYOR_BELT_2_MIDDLE        278
1102 #define EL_CONVEYOR_BELT_2_RIGHT         279
1103 #define EL_CONVEYOR_BELT_2_SWITCH_LEFT   280
1104 #define EL_CONVEYOR_BELT_2_SWITCH_MIDDLE 281
1105 #define EL_CONVEYOR_BELT_2_SWITCH_RIGHT  282
1106 #define EL_CONVEYOR_BELT_3_LEFT          283
1107 #define EL_CONVEYOR_BELT_3_MIDDLE        284
1108 #define EL_CONVEYOR_BELT_3_RIGHT         285
1109 #define EL_CONVEYOR_BELT_3_SWITCH_LEFT   286
1110 #define EL_CONVEYOR_BELT_3_SWITCH_MIDDLE 287
1111 #define EL_CONVEYOR_BELT_3_SWITCH_RIGHT  288
1112 #define EL_CONVEYOR_BELT_4_LEFT          289
1113 #define EL_CONVEYOR_BELT_4_MIDDLE        290
1114 #define EL_CONVEYOR_BELT_4_RIGHT         291
1115 #define EL_CONVEYOR_BELT_4_SWITCH_LEFT   292
1116 #define EL_CONVEYOR_BELT_4_SWITCH_MIDDLE 293
1117 #define EL_CONVEYOR_BELT_4_SWITCH_RIGHT  294
1118 #define EL_LANDMINE                     295
1119 #define EL_ENVELOPE_OBSOLETE            296   /* obsolete; now EL_ENVELOPE_1 */
1120 #define EL_LIGHT_SWITCH                 297
1121 #define EL_LIGHT_SWITCH_ACTIVE          298
1122 #define EL_SIGN_EXCLAMATION             299
1123 #define EL_SIGN_RADIOACTIVITY           300
1124 #define EL_SIGN_STOP                    301
1125 #define EL_SIGN_WHEELCHAIR              302
1126 #define EL_SIGN_PARKING                 303
1127 #define EL_SIGN_ONEWAY                  304
1128 #define EL_SIGN_HEART                   305
1129 #define EL_SIGN_TRIANGLE                306
1130 #define EL_SIGN_ROUND                   307
1131 #define EL_SIGN_EXIT                    308
1132 #define EL_SIGN_YINYANG                 309
1133 #define EL_SIGN_OTHER                   310
1134 #define EL_MOLE_LEFT                    311
1135 #define EL_MOLE_RIGHT                   312
1136 #define EL_MOLE_UP                      313
1137 #define EL_MOLE_DOWN                    314
1138 #define EL_STEELWALL_SLIPPERY           315
1139 #define EL_INVISIBLE_SAND               316
1140 #define EL_DX_UNKNOWN_15                317
1141 #define EL_DX_UNKNOWN_42                318
1142
1143 #define EL_UNUSED_319                   319
1144 #define EL_UNUSED_320                   320
1145
1146 #define EL_SHIELD_DEADLY                321
1147 #define EL_TIMEGATE_OPEN                322
1148 #define EL_TIMEGATE_CLOSED              323
1149 #define EL_TIMEGATE_SWITCH_ACTIVE       324
1150 #define EL_TIMEGATE_SWITCH              325
1151
1152 #define EL_BALLOON                      326
1153 #define EL_BALLOON_SWITCH_LEFT          327
1154 #define EL_BALLOON_SWITCH_RIGHT         328
1155 #define EL_BALLOON_SWITCH_UP            329
1156 #define EL_BALLOON_SWITCH_DOWN          330
1157 #define EL_BALLOON_SWITCH_ANY           331
1158
1159 #define EL_EMC_STEELWALL_1              332
1160 #define EL_EMC_STEELWALL_2              333
1161 #define EL_EMC_STEELWALL_3              334
1162 #define EL_EMC_STEELWALL_4              335
1163 #define EL_EMC_WALL_1                   336
1164 #define EL_EMC_WALL_2                   337
1165 #define EL_EMC_WALL_3                   338
1166 #define EL_EMC_WALL_4                   339
1167 #define EL_EMC_WALL_5                   340
1168 #define EL_EMC_WALL_6                   341
1169 #define EL_EMC_WALL_7                   342
1170 #define EL_EMC_WALL_8                   343
1171
1172 #define EL_TUBE_ANY                     344
1173 #define EL_TUBE_VERTICAL                345
1174 #define EL_TUBE_HORIZONTAL              346
1175 #define EL_TUBE_VERTICAL_LEFT           347
1176 #define EL_TUBE_VERTICAL_RIGHT          348
1177 #define EL_TUBE_HORIZONTAL_UP           349
1178 #define EL_TUBE_HORIZONTAL_DOWN         350
1179 #define EL_TUBE_LEFT_UP                 351
1180 #define EL_TUBE_LEFT_DOWN               352
1181 #define EL_TUBE_RIGHT_UP                353
1182 #define EL_TUBE_RIGHT_DOWN              354
1183 #define EL_SPRING                       355
1184 #define EL_TRAP                         356
1185 #define EL_DX_SUPABOMB                  357
1186
1187 #define EL_UNUSED_358                   358
1188 #define EL_UNUSED_359                   359
1189
1190 /* ---------- begin of custom elements section ----------------------------- */
1191 #define EL_CUSTOM_START                 360
1192
1193 #include "conf_cus.h"   /* include auto-generated data structure definitions */
1194
1195 #define NUM_CUSTOM_ELEMENTS             256
1196 #define EL_CUSTOM_END                   615
1197 /* ---------- end of custom elements section ------------------------------- */
1198
1199 #define EL_EM_KEY_1                     616
1200 #define EL_EM_KEY_2                     617
1201 #define EL_EM_KEY_3                     618
1202 #define EL_EM_KEY_4                     619
1203 #define EL_ENVELOPE_1                   620
1204 #define EL_ENVELOPE_2                   621
1205 #define EL_ENVELOPE_3                   622
1206 #define EL_ENVELOPE_4                   623
1207
1208 /* ---------- begin of group elements section ------------------------------ */
1209 #define EL_GROUP_START                  624
1210
1211 #include "conf_grp.h"   /* include auto-generated data structure definitions */
1212
1213 #define NUM_GROUP_ELEMENTS              32
1214 #define EL_GROUP_END                    655
1215 /* ---------- end of custom elements section ------------------------------- */
1216
1217 #define EL_UNKNOWN                      656
1218 #define EL_TRIGGER_ELEMENT              657
1219 #define EL_TRIGGER_PLAYER               658
1220
1221 /* SP style elements */
1222 #define EL_SP_GRAVITY_ON_PORT_RIGHT     659
1223 #define EL_SP_GRAVITY_ON_PORT_DOWN      660
1224 #define EL_SP_GRAVITY_ON_PORT_LEFT      661
1225 #define EL_SP_GRAVITY_ON_PORT_UP        662
1226 #define EL_SP_GRAVITY_OFF_PORT_RIGHT    663
1227 #define EL_SP_GRAVITY_OFF_PORT_DOWN     664
1228 #define EL_SP_GRAVITY_OFF_PORT_LEFT     665
1229 #define EL_SP_GRAVITY_OFF_PORT_UP       666
1230
1231 /* EMC style elements */
1232 #define EL_BALLOON_SWITCH_NONE          667
1233 #define EL_EMC_GATE_5                   668
1234 #define EL_EMC_GATE_6                   669
1235 #define EL_EMC_GATE_7                   670
1236 #define EL_EMC_GATE_8                   671
1237 #define EL_EMC_GATE_5_GRAY              672
1238 #define EL_EMC_GATE_6_GRAY              673
1239 #define EL_EMC_GATE_7_GRAY              674
1240 #define EL_EMC_GATE_8_GRAY              675
1241 #define EL_EMC_KEY_5                    676
1242 #define EL_EMC_KEY_6                    677
1243 #define EL_EMC_KEY_7                    678
1244 #define EL_EMC_KEY_8                    679
1245 #define EL_EMC_ANDROID                  680
1246 #define EL_EMC_GRASS                    681
1247 #define EL_EMC_MAGIC_BALL               682
1248 #define EL_EMC_MAGIC_BALL_ACTIVE        683
1249 #define EL_EMC_MAGIC_BALL_SWITCH        684
1250 #define EL_EMC_MAGIC_BALL_SWITCH_ACTIVE 685
1251 #define EL_EMC_SPRING_BUMPER            686
1252 #define EL_EMC_PLANT                    687
1253 #define EL_EMC_LENSES                   688
1254 #define EL_EMC_MAGNIFIER                689
1255 #define EL_EMC_WALL_9                   690
1256 #define EL_EMC_WALL_10                  691
1257 #define EL_EMC_WALL_11                  692
1258 #define EL_EMC_WALL_12                  693
1259 #define EL_EMC_WALL_13                  694
1260 #define EL_EMC_WALL_14                  695
1261 #define EL_EMC_WALL_15                  696
1262 #define EL_EMC_WALL_16                  697
1263 #define EL_EMC_WALL_SLIPPERY_1          698
1264 #define EL_EMC_WALL_SLIPPERY_2          699
1265 #define EL_EMC_WALL_SLIPPERY_3          700
1266 #define EL_EMC_WALL_SLIPPERY_4          701
1267 #define EL_EMC_FAKE_GRASS               702
1268 #define EL_EMC_FAKE_ACID                703
1269 #define EL_EMC_DRIPPER                  704
1270
1271 #define EL_TRIGGER_CE_VALUE             705
1272 #define EL_TRIGGER_CE_SCORE             706
1273 #define EL_CURRENT_CE_VALUE             707
1274 #define EL_CURRENT_CE_SCORE             708
1275
1276 #define EL_YAMYAM_LEFT                  709
1277 #define EL_YAMYAM_RIGHT                 710
1278 #define EL_YAMYAM_UP                    711
1279 #define EL_YAMYAM_DOWN                  712
1280
1281 #define NUM_FILE_ELEMENTS               713
1282
1283
1284 /* "real" (and therefore drawable) runtime elements */
1285 #define EL_FIRST_RUNTIME_REAL           NUM_FILE_ELEMENTS
1286
1287 #define EL_DYNABOMB_PLAYER_1_ACTIVE     (EL_FIRST_RUNTIME_REAL + 0)
1288 #define EL_DYNABOMB_PLAYER_2_ACTIVE     (EL_FIRST_RUNTIME_REAL + 1)
1289 #define EL_DYNABOMB_PLAYER_3_ACTIVE     (EL_FIRST_RUNTIME_REAL + 2)
1290 #define EL_DYNABOMB_PLAYER_4_ACTIVE     (EL_FIRST_RUNTIME_REAL + 3)
1291 #define EL_SP_DISK_RED_ACTIVE           (EL_FIRST_RUNTIME_REAL + 4)
1292 #define EL_SWITCHGATE_OPENING           (EL_FIRST_RUNTIME_REAL + 5)
1293 #define EL_SWITCHGATE_CLOSING           (EL_FIRST_RUNTIME_REAL + 6)
1294 #define EL_TIMEGATE_OPENING             (EL_FIRST_RUNTIME_REAL + 7)
1295 #define EL_TIMEGATE_CLOSING             (EL_FIRST_RUNTIME_REAL + 8)
1296 #define EL_PEARL_BREAKING               (EL_FIRST_RUNTIME_REAL + 9)
1297 #define EL_TRAP_ACTIVE                  (EL_FIRST_RUNTIME_REAL + 10)
1298 #define EL_INVISIBLE_STEELWALL_ACTIVE   (EL_FIRST_RUNTIME_REAL + 11)
1299 #define EL_INVISIBLE_WALL_ACTIVE        (EL_FIRST_RUNTIME_REAL + 12)
1300 #define EL_INVISIBLE_SAND_ACTIVE        (EL_FIRST_RUNTIME_REAL + 13)
1301 #define EL_CONVEYOR_BELT_1_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 14)
1302 #define EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 15)
1303 #define EL_CONVEYOR_BELT_1_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 16)
1304 #define EL_CONVEYOR_BELT_2_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 17)
1305 #define EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 18)
1306 #define EL_CONVEYOR_BELT_2_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 19)
1307 #define EL_CONVEYOR_BELT_3_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 20)
1308 #define EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 21)
1309 #define EL_CONVEYOR_BELT_3_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 22)
1310 #define EL_CONVEYOR_BELT_4_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 23)
1311 #define EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 24)
1312 #define EL_CONVEYOR_BELT_4_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 25)
1313 #define EL_EXIT_OPENING                 (EL_FIRST_RUNTIME_REAL + 26)
1314 #define EL_EXIT_CLOSING                 (EL_FIRST_RUNTIME_REAL + 27)
1315 #define EL_SP_EXIT_OPENING              (EL_FIRST_RUNTIME_REAL + 28)
1316 #define EL_SP_EXIT_CLOSING              (EL_FIRST_RUNTIME_REAL + 29)
1317 #define EL_SP_EXIT_OPEN                 (EL_FIRST_RUNTIME_REAL + 30)
1318 #define EL_SP_TERMINAL_ACTIVE           (EL_FIRST_RUNTIME_REAL + 31)
1319 #define EL_SP_BUGGY_BASE_ACTIVATING     (EL_FIRST_RUNTIME_REAL + 32)
1320 #define EL_SP_BUGGY_BASE_ACTIVE         (EL_FIRST_RUNTIME_REAL + 33)
1321 #define EL_SP_MURPHY_CLONE              (EL_FIRST_RUNTIME_REAL + 34)
1322 #define EL_AMOEBA_DROPPING              (EL_FIRST_RUNTIME_REAL + 35)
1323 #define EL_QUICKSAND_EMPTYING           (EL_FIRST_RUNTIME_REAL + 36)
1324 #define EL_MAGIC_WALL_ACTIVE            (EL_FIRST_RUNTIME_REAL + 37)
1325 #define EL_BD_MAGIC_WALL_ACTIVE         (EL_FIRST_RUNTIME_REAL + 38)
1326 #define EL_MAGIC_WALL_FULL              (EL_FIRST_RUNTIME_REAL + 39)
1327 #define EL_BD_MAGIC_WALL_FULL           (EL_FIRST_RUNTIME_REAL + 40)
1328 #define EL_MAGIC_WALL_EMPTYING          (EL_FIRST_RUNTIME_REAL + 41)
1329 #define EL_BD_MAGIC_WALL_EMPTYING       (EL_FIRST_RUNTIME_REAL + 42)
1330 #define EL_MAGIC_WALL_DEAD              (EL_FIRST_RUNTIME_REAL + 43)
1331 #define EL_BD_MAGIC_WALL_DEAD           (EL_FIRST_RUNTIME_REAL + 44)
1332 #define EL_EMC_FAKE_GRASS_ACTIVE        (EL_FIRST_RUNTIME_REAL + 45)
1333 #define EL_GATE_1_GRAY_ACTIVE           (EL_FIRST_RUNTIME_REAL + 46)
1334 #define EL_GATE_2_GRAY_ACTIVE           (EL_FIRST_RUNTIME_REAL + 47)
1335 #define EL_GATE_3_GRAY_ACTIVE           (EL_FIRST_RUNTIME_REAL + 48)
1336 #define EL_GATE_4_GRAY_ACTIVE           (EL_FIRST_RUNTIME_REAL + 49)
1337 #define EL_EM_GATE_1_GRAY_ACTIVE        (EL_FIRST_RUNTIME_REAL + 50)
1338 #define EL_EM_GATE_2_GRAY_ACTIVE        (EL_FIRST_RUNTIME_REAL + 51)
1339 #define EL_EM_GATE_3_GRAY_ACTIVE        (EL_FIRST_RUNTIME_REAL + 52)
1340 #define EL_EM_GATE_4_GRAY_ACTIVE        (EL_FIRST_RUNTIME_REAL + 53)
1341 #define EL_EMC_GATE_5_GRAY_ACTIVE       (EL_FIRST_RUNTIME_REAL + 54)
1342 #define EL_EMC_GATE_6_GRAY_ACTIVE       (EL_FIRST_RUNTIME_REAL + 55)
1343 #define EL_EMC_GATE_7_GRAY_ACTIVE       (EL_FIRST_RUNTIME_REAL + 56)
1344 #define EL_EMC_GATE_8_GRAY_ACTIVE       (EL_FIRST_RUNTIME_REAL + 57)
1345 #define EL_EMC_DRIPPER_ACTIVE           (EL_FIRST_RUNTIME_REAL + 58)
1346 #define EL_EMC_SPRING_BUMPER_ACTIVE     (EL_FIRST_RUNTIME_REAL + 59)
1347
1348 /* "unreal" (and therefore not drawable) runtime elements */
1349 #define EL_FIRST_RUNTIME_UNREAL         (EL_FIRST_RUNTIME_REAL + 60)
1350
1351 #define EL_BLOCKED                      (EL_FIRST_RUNTIME_UNREAL + 0)
1352 #define EL_EXPLOSION                    (EL_FIRST_RUNTIME_UNREAL + 1)
1353 #define EL_NUT_BREAKING                 (EL_FIRST_RUNTIME_UNREAL + 2)
1354 #define EL_DIAMOND_BREAKING             (EL_FIRST_RUNTIME_UNREAL + 3)
1355 #define EL_ACID_SPLASH_LEFT             (EL_FIRST_RUNTIME_UNREAL + 4)
1356 #define EL_ACID_SPLASH_RIGHT            (EL_FIRST_RUNTIME_UNREAL + 5)
1357 #define EL_AMOEBA_GROWING               (EL_FIRST_RUNTIME_UNREAL + 6)
1358 #define EL_AMOEBA_SHRINKING             (EL_FIRST_RUNTIME_UNREAL + 7)
1359 #define EL_EXPANDABLE_WALL_GROWING      (EL_FIRST_RUNTIME_UNREAL + 8)
1360 #define EL_FLAMES                       (EL_FIRST_RUNTIME_UNREAL + 9)
1361 #define EL_PLAYER_IS_LEAVING            (EL_FIRST_RUNTIME_UNREAL + 10)
1362 #define EL_PLAYER_IS_EXPLODING_1        (EL_FIRST_RUNTIME_UNREAL + 11)
1363 #define EL_PLAYER_IS_EXPLODING_2        (EL_FIRST_RUNTIME_UNREAL + 12)
1364 #define EL_PLAYER_IS_EXPLODING_3        (EL_FIRST_RUNTIME_UNREAL + 13)
1365 #define EL_PLAYER_IS_EXPLODING_4        (EL_FIRST_RUNTIME_UNREAL + 14)
1366 #define EL_QUICKSAND_FILLING            (EL_FIRST_RUNTIME_UNREAL + 15)
1367 #define EL_MAGIC_WALL_FILLING           (EL_FIRST_RUNTIME_UNREAL + 16)
1368 #define EL_BD_MAGIC_WALL_FILLING        (EL_FIRST_RUNTIME_UNREAL + 17)
1369 #define EL_ELEMENT_SNAPPING             (EL_FIRST_RUNTIME_UNREAL + 18)
1370 #define EL_DIAGONAL_SHRINKING           (EL_FIRST_RUNTIME_UNREAL + 19)
1371 #define EL_DIAGONAL_GROWING             (EL_FIRST_RUNTIME_UNREAL + 20)
1372
1373 #define NUM_RUNTIME_ELEMENTS            (EL_FIRST_RUNTIME_UNREAL + 21)
1374
1375 /* dummy elements (never used as game elements, only used as graphics) */
1376 #define EL_FIRST_DUMMY                  NUM_RUNTIME_ELEMENTS
1377
1378 #define EL_STEELWALL_TOPLEFT            (EL_FIRST_DUMMY + 0)
1379 #define EL_STEELWALL_TOPRIGHT           (EL_FIRST_DUMMY + 1)
1380 #define EL_STEELWALL_BOTTOMLEFT         (EL_FIRST_DUMMY + 2)
1381 #define EL_STEELWALL_BOTTOMRIGHT        (EL_FIRST_DUMMY + 3)
1382 #define EL_STEELWALL_HORIZONTAL         (EL_FIRST_DUMMY + 4)
1383 #define EL_STEELWALL_VERTICAL           (EL_FIRST_DUMMY + 5)
1384 #define EL_INVISIBLE_STEELWALL_TOPLEFT     (EL_FIRST_DUMMY + 6)
1385 #define EL_INVISIBLE_STEELWALL_TOPRIGHT    (EL_FIRST_DUMMY + 7)
1386 #define EL_INVISIBLE_STEELWALL_BOTTOMLEFT  (EL_FIRST_DUMMY + 8)
1387 #define EL_INVISIBLE_STEELWALL_BOTTOMRIGHT (EL_FIRST_DUMMY + 9)
1388 #define EL_INVISIBLE_STEELWALL_HORIZONTAL  (EL_FIRST_DUMMY + 10)
1389 #define EL_INVISIBLE_STEELWALL_VERTICAL    (EL_FIRST_DUMMY + 11)
1390 #define EL_DYNABOMB                     (EL_FIRST_DUMMY + 12)
1391 #define EL_DYNABOMB_ACTIVE              (EL_FIRST_DUMMY + 13)
1392 #define EL_DYNABOMB_PLAYER_1            (EL_FIRST_DUMMY + 14)
1393 #define EL_DYNABOMB_PLAYER_2            (EL_FIRST_DUMMY + 15)
1394 #define EL_DYNABOMB_PLAYER_3            (EL_FIRST_DUMMY + 16)
1395 #define EL_DYNABOMB_PLAYER_4            (EL_FIRST_DUMMY + 17)
1396 #define EL_SHIELD_NORMAL_ACTIVE         (EL_FIRST_DUMMY + 18)
1397 #define EL_SHIELD_DEADLY_ACTIVE         (EL_FIRST_DUMMY + 19)
1398 #define EL_AMOEBA                       (EL_FIRST_DUMMY + 20)
1399 #define EL_DEFAULT                      (EL_FIRST_DUMMY + 21)
1400 #define EL_BD_DEFAULT                   (EL_FIRST_DUMMY + 22)
1401 #define EL_SP_DEFAULT                   (EL_FIRST_DUMMY + 23)
1402 #define EL_SB_DEFAULT                   (EL_FIRST_DUMMY + 24)
1403
1404 /* internal elements (only used for internal purposes like copying) */
1405 #define EL_FIRST_INTERNAL               (EL_FIRST_DUMMY + 25)
1406
1407 #define EL_INTERNAL_CLIPBOARD_CUSTOM    (EL_FIRST_INTERNAL + 0)
1408 #define EL_INTERNAL_CLIPBOARD_CHANGE    (EL_FIRST_INTERNAL + 1)
1409 #define EL_INTERNAL_CLIPBOARD_GROUP     (EL_FIRST_INTERNAL + 2)
1410 #define EL_INTERNAL_DUMMY               (EL_FIRST_INTERNAL + 3)
1411
1412 #define EL_INTERNAL_CASCADE_BD                  (EL_FIRST_INTERNAL + 4)
1413 #define EL_INTERNAL_CASCADE_BD_ACTIVE           (EL_FIRST_INTERNAL + 5)
1414 #define EL_INTERNAL_CASCADE_EM                  (EL_FIRST_INTERNAL + 6)
1415 #define EL_INTERNAL_CASCADE_EM_ACTIVE           (EL_FIRST_INTERNAL + 7)
1416 #define EL_INTERNAL_CASCADE_EMC                 (EL_FIRST_INTERNAL + 8)
1417 #define EL_INTERNAL_CASCADE_EMC_ACTIVE          (EL_FIRST_INTERNAL + 9)
1418 #define EL_INTERNAL_CASCADE_RND                 (EL_FIRST_INTERNAL + 10)
1419 #define EL_INTERNAL_CASCADE_RND_ACTIVE          (EL_FIRST_INTERNAL + 11)
1420 #define EL_INTERNAL_CASCADE_SB                  (EL_FIRST_INTERNAL + 12)
1421 #define EL_INTERNAL_CASCADE_SB_ACTIVE           (EL_FIRST_INTERNAL + 13)
1422 #define EL_INTERNAL_CASCADE_SP                  (EL_FIRST_INTERNAL + 14)
1423 #define EL_INTERNAL_CASCADE_SP_ACTIVE           (EL_FIRST_INTERNAL + 15)
1424 #define EL_INTERNAL_CASCADE_DC                  (EL_FIRST_INTERNAL + 16)
1425 #define EL_INTERNAL_CASCADE_DC_ACTIVE           (EL_FIRST_INTERNAL + 17)
1426 #define EL_INTERNAL_CASCADE_DX                  (EL_FIRST_INTERNAL + 18)
1427 #define EL_INTERNAL_CASCADE_DX_ACTIVE           (EL_FIRST_INTERNAL + 19)
1428 #define EL_INTERNAL_CASCADE_CHARS               (EL_FIRST_INTERNAL + 20)
1429 #define EL_INTERNAL_CASCADE_CHARS_ACTIVE        (EL_FIRST_INTERNAL + 21)
1430 #define EL_INTERNAL_CASCADE_CE                  (EL_FIRST_INTERNAL + 22)
1431 #define EL_INTERNAL_CASCADE_CE_ACTIVE           (EL_FIRST_INTERNAL + 23)
1432 #define EL_INTERNAL_CASCADE_GE                  (EL_FIRST_INTERNAL + 24)
1433 #define EL_INTERNAL_CASCADE_GE_ACTIVE           (EL_FIRST_INTERNAL + 25)
1434 #define EL_INTERNAL_CASCADE_USER                (EL_FIRST_INTERNAL + 26)
1435 #define EL_INTERNAL_CASCADE_USER_ACTIVE         (EL_FIRST_INTERNAL + 27)
1436 #define EL_INTERNAL_CASCADE_GENERIC             (EL_FIRST_INTERNAL + 28)
1437 #define EL_INTERNAL_CASCADE_GENERIC_ACTIVE      (EL_FIRST_INTERNAL + 29)
1438 #define EL_INTERNAL_CASCADE_DYNAMIC             (EL_FIRST_INTERNAL + 30)
1439 #define EL_INTERNAL_CASCADE_DYNAMIC_ACTIVE      (EL_FIRST_INTERNAL + 31)
1440
1441 #define EL_INTERNAL_CLIPBOARD_START     (EL_FIRST_INTERNAL + 0)
1442 #define EL_INTERNAL_CLIPBOARD_END       (EL_FIRST_INTERNAL + 2)
1443 #define EL_INTERNAL_START               (EL_FIRST_INTERNAL + 0)
1444 #define EL_INTERNAL_END                 (EL_FIRST_INTERNAL + 31)
1445
1446 #define MAX_NUM_ELEMENTS                (EL_FIRST_INTERNAL + 32)
1447
1448
1449 /* values for graphics/sounds action types */
1450 #define ACTION_DEFAULT                  0
1451 #define ACTION_WAITING                  1
1452 #define ACTION_FALLING                  2
1453 #define ACTION_MOVING                   3
1454 #define ACTION_DIGGING                  4
1455 #define ACTION_SNAPPING                 5
1456 #define ACTION_COLLECTING               6
1457 #define ACTION_DROPPING                 7
1458 #define ACTION_PUSHING                  8
1459 #define ACTION_WALKING                  9
1460 #define ACTION_PASSING                  10
1461 #define ACTION_IMPACT                   11
1462 #define ACTION_BREAKING                 12
1463 #define ACTION_ACTIVATING               13
1464 #define ACTION_DEACTIVATING             14
1465 #define ACTION_OPENING                  15
1466 #define ACTION_CLOSING                  16
1467 #define ACTION_ATTACKING                17
1468 #define ACTION_GROWING                  18
1469 #define ACTION_SHRINKING                19
1470 #define ACTION_ACTIVE                   20
1471 #define ACTION_FILLING                  21
1472 #define ACTION_EMPTYING                 22
1473 #define ACTION_CHANGING                 23
1474 #define ACTION_EXPLODING                24
1475 #define ACTION_BORING                   25
1476 #define ACTION_BORING_1                 26
1477 #define ACTION_BORING_2                 27
1478 #define ACTION_BORING_3                 28
1479 #define ACTION_BORING_4                 29
1480 #define ACTION_BORING_5                 30
1481 #define ACTION_BORING_6                 31
1482 #define ACTION_BORING_7                 32
1483 #define ACTION_BORING_8                 33
1484 #define ACTION_BORING_9                 34
1485 #define ACTION_BORING_10                35
1486 #define ACTION_SLEEPING                 36
1487 #define ACTION_SLEEPING_1               37
1488 #define ACTION_SLEEPING_2               38
1489 #define ACTION_SLEEPING_3               39
1490 #define ACTION_AWAKENING                40
1491 #define ACTION_DYING                    41
1492 #define ACTION_TURNING                  42
1493 #define ACTION_TURNING_FROM_LEFT        43
1494 #define ACTION_TURNING_FROM_RIGHT       44
1495 #define ACTION_TURNING_FROM_UP          45
1496 #define ACTION_TURNING_FROM_DOWN        46
1497 #define ACTION_SMASHED_BY_ROCK          47
1498 #define ACTION_SMASHED_BY_SPRING        48
1499 #define ACTION_EATING                   49
1500 #define ACTION_TWINKLING                50
1501 #define ACTION_SPLASHING                51
1502 #define ACTION_PAGE_1                   52
1503 #define ACTION_PAGE_2                   53
1504 #define ACTION_PAGE_3                   54
1505 #define ACTION_PAGE_4                   55
1506 #define ACTION_PAGE_5                   56
1507 #define ACTION_PAGE_6                   57
1508 #define ACTION_PAGE_7                   58
1509 #define ACTION_PAGE_8                   59
1510 #define ACTION_PAGE_9                   60
1511 #define ACTION_PAGE_10                  61
1512 #define ACTION_PAGE_11                  62
1513 #define ACTION_PAGE_12                  63
1514 #define ACTION_PAGE_13                  64
1515 #define ACTION_PAGE_14                  65
1516 #define ACTION_PAGE_15                  66
1517 #define ACTION_PAGE_16                  67
1518 #define ACTION_PAGE_17                  68
1519 #define ACTION_PAGE_18                  69
1520 #define ACTION_PAGE_19                  70
1521 #define ACTION_PAGE_20                  71
1522 #define ACTION_PAGE_21                  72
1523 #define ACTION_PAGE_22                  73
1524 #define ACTION_PAGE_23                  74
1525 #define ACTION_PAGE_24                  75
1526 #define ACTION_PAGE_25                  76
1527 #define ACTION_PAGE_26                  77
1528 #define ACTION_PAGE_27                  78
1529 #define ACTION_PAGE_28                  79
1530 #define ACTION_PAGE_29                  80
1531 #define ACTION_PAGE_30                  81
1532 #define ACTION_PAGE_31                  82
1533 #define ACTION_PAGE_32                  83
1534 #define ACTION_OTHER                    84
1535
1536 #define NUM_ACTIONS                     85
1537
1538 #define ACTION_BORING_LAST              ACTION_BORING_10
1539 #define ACTION_SLEEPING_LAST            ACTION_SLEEPING_3
1540
1541
1542 /* values for special image configuration suffixes (must match game mode) */
1543 #define GFX_SPECIAL_ARG_DEFAULT         0
1544 #define GFX_SPECIAL_ARG_MAIN            1
1545 #define GFX_SPECIAL_ARG_LEVELS          2
1546 #define GFX_SPECIAL_ARG_SCORES          3
1547 #define GFX_SPECIAL_ARG_EDITOR          4
1548 #define GFX_SPECIAL_ARG_INFO            5
1549 #define GFX_SPECIAL_ARG_SETUP           6
1550 #define GFX_SPECIAL_ARG_PLAYING         7
1551 #define GFX_SPECIAL_ARG_DOOR            8
1552 #define GFX_SPECIAL_ARG_PREVIEW         9
1553 #define GFX_SPECIAL_ARG_CRUMBLED        10
1554
1555 #define NUM_SPECIAL_GFX_ARGS            11
1556
1557
1558 /* values for image configuration suffixes */
1559 #define GFX_ARG_X                       0
1560 #define GFX_ARG_Y                       1
1561 #define GFX_ARG_XPOS                    2
1562 #define GFX_ARG_YPOS                    3
1563 #define GFX_ARG_WIDTH                   4
1564 #define GFX_ARG_HEIGHT                  5
1565 #define GFX_ARG_VERTICAL                6
1566 #define GFX_ARG_OFFSET                  7
1567 #define GFX_ARG_XOFFSET                 8
1568 #define GFX_ARG_YOFFSET                 9
1569 #define GFX_ARG_2ND_MOVEMENT_TILE       10
1570 #define GFX_ARG_2ND_VERTICAL            11
1571 #define GFX_ARG_2ND_OFFSET              12
1572 #define GFX_ARG_2ND_XOFFSET             13
1573 #define GFX_ARG_2ND_YOFFSET             14
1574 #define GFX_ARG_2ND_SWAP_TILES          15      
1575 #define GFX_ARG_FRAMES                  16
1576 #define GFX_ARG_FRAMES_PER_LINE         17
1577 #define GFX_ARG_START_FRAME             18
1578 #define GFX_ARG_DELAY                   19
1579 #define GFX_ARG_ANIM_MODE               20
1580 #define GFX_ARG_GLOBAL_SYNC             21
1581 #define GFX_ARG_CRUMBLED_LIKE           22
1582 #define GFX_ARG_DIGGABLE_LIKE           23
1583 #define GFX_ARG_BORDER_SIZE             24
1584 #define GFX_ARG_STEP_OFFSET             25
1585 #define GFX_ARG_STEP_DELAY              26
1586 #define GFX_ARG_DIRECTION               27
1587 #define GFX_ARG_POSITION                28
1588 #define GFX_ARG_DRAW_XOFFSET            29
1589 #define GFX_ARG_DRAW_YOFFSET            30
1590 #define GFX_ARG_DRAW_MASKED             31
1591 #define GFX_ARG_ANIM_DELAY_FIXED        32
1592 #define GFX_ARG_ANIM_DELAY_RANDOM       33
1593 #define GFX_ARG_POST_DELAY_FIXED        34
1594 #define GFX_ARG_POST_DELAY_RANDOM       35
1595 #define GFX_ARG_NAME                    36
1596 #define GFX_ARG_SCALE_UP_FACTOR         37
1597 #define GFX_ARG_CLONE_FROM              38
1598
1599 #define NUM_GFX_ARGS                    39
1600
1601
1602 /* values for sound configuration suffixes */
1603 #define SND_ARG_MODE_LOOP               0
1604 #define SND_ARG_VOLUME                  1
1605 #define SND_ARG_PRIORITY                2
1606
1607 #define NUM_SND_ARGS                    3
1608
1609
1610 /* values for music configuration suffixes */
1611 #define MUS_ARG_MODE_LOOP               0
1612
1613 #define NUM_MUS_ARGS                    1
1614
1615
1616 /* values for font configuration */
1617 #define FONT_INITIAL_1                  0
1618 #define FONT_INITIAL_2                  1
1619 #define FONT_INITIAL_3                  2
1620 #define FONT_INITIAL_4                  3
1621 #define FONT_TITLE_1                    4
1622 #define FONT_TITLE_2                    5
1623 #define FONT_MENU_1                     6
1624 #define FONT_MENU_2                     7
1625 #define FONT_TEXT_1_ACTIVE              8
1626 #define FONT_TEXT_2_ACTIVE              9
1627 #define FONT_TEXT_3_ACTIVE              10
1628 #define FONT_TEXT_4_ACTIVE              11
1629 #define FONT_TEXT_1                     12
1630 #define FONT_TEXT_2                     13
1631 #define FONT_TEXT_3                     14
1632 #define FONT_TEXT_4                     15
1633 #define FONT_ENVELOPE_1                 16
1634 #define FONT_ENVELOPE_2                 17
1635 #define FONT_ENVELOPE_3                 18
1636 #define FONT_ENVELOPE_4                 19
1637 #define FONT_INPUT_1_ACTIVE             20
1638 #define FONT_INPUT_2_ACTIVE             21
1639 #define FONT_INPUT_1                    22
1640 #define FONT_INPUT_2                    23
1641 #define FONT_OPTION_OFF                 24
1642 #define FONT_OPTION_ON                  25
1643 #define FONT_VALUE_1                    26
1644 #define FONT_VALUE_2                    27
1645 #define FONT_VALUE_OLD                  28
1646 #define FONT_LEVEL_NUMBER               29
1647 #define FONT_TAPE_RECORDER              30
1648 #define FONT_GAME_INFO                  31
1649
1650 #define NUM_FONTS                       32
1651 #define NUM_INITIAL_FONTS               4
1652
1653 /* values for game_status (must match special image configuration suffixes) */
1654 #define GAME_MODE_DEFAULT               0
1655 #define GAME_MODE_MAIN                  1
1656 #define GAME_MODE_LEVELS                2
1657 #define GAME_MODE_SCORES                3
1658 #define GAME_MODE_EDITOR                4
1659 #define GAME_MODE_INFO                  5
1660 #define GAME_MODE_SETUP                 6
1661 #define GAME_MODE_PLAYING               7
1662 #define GAME_MODE_PSEUDO_DOOR           8
1663 #define GAME_MODE_PSEUDO_PREVIEW        9
1664 #define GAME_MODE_PSEUDO_CRUMBLED       10
1665
1666 /* there are no special config file suffixes for these modes */
1667 #define GAME_MODE_PSEUDO_TYPENAME       11
1668 #define GAME_MODE_QUIT                  12
1669
1670 /* special definitions currently only used for custom artwork configuration */
1671 #define MUSIC_PREFIX_BACKGROUND         0
1672 #define NUM_MUSIC_PREFIXES              1
1673 #define MAX_LEVELS                      1000
1674
1675 /* definitions for demo animation lists */
1676 #define HELPANIM_LIST_NEXT              -1
1677 #define HELPANIM_LIST_END               -999
1678
1679
1680 /* program information and versioning definitions */
1681 #define PROGRAM_VERSION_MAJOR           3
1682 #define PROGRAM_VERSION_MINOR           2
1683 #define PROGRAM_VERSION_PATCH           0
1684 #define PROGRAM_VERSION_BUILD           8
1685
1686 #define PROGRAM_TITLE_STRING            "Rocks'n'Diamonds"
1687 #define PROGRAM_AUTHOR_STRING           "Holger Schemel"
1688 #define PROGRAM_COPYRIGHT_STRING       "Copyright Â©1995-2006 by Holger Schemel"
1689
1690 #define ICON_TITLE_STRING               PROGRAM_TITLE_STRING
1691 #define COOKIE_PREFIX                   "ROCKSNDIAMONDS"
1692 #define FILENAME_PREFIX                 "Rocks"
1693
1694 #if defined(PLATFORM_UNIX)
1695 #define USERDATA_DIRECTORY              ".rocksndiamonds"
1696 #elif defined(PLATFORM_WIN32)
1697 #define USERDATA_DIRECTORY              PROGRAM_TITLE_STRING
1698 #else
1699 #define USERDATA_DIRECTORY              "userdata"
1700 #endif
1701
1702 #define X11_ICON_FILENAME               "rocks_icon.xbm"
1703 #define X11_ICONMASK_FILENAME           "rocks_iconmask.xbm"
1704 #define MSDOS_POINTER_FILENAME          "mouse.pcx"
1705
1706 /* file version numbers for resource files (levels, tapes, score, setup, etc.)
1707 ** currently supported/known file version numbers:
1708 **      1.0 (old)
1709 **      1.2 (still in use)
1710 **      1.4 (still in use)
1711 **      2.0 (actual)
1712 */
1713 #define FILE_VERSION_1_0                VERSION_IDENT(1,0,0,0)
1714 #define FILE_VERSION_1_2                VERSION_IDENT(1,2,0,0)
1715 #define FILE_VERSION_1_4                VERSION_IDENT(1,4,0,0)
1716 #define FILE_VERSION_2_0                VERSION_IDENT(2,0,0,0)
1717
1718 /* file version does not change for every program version, but is changed
1719    when new features are introduced that are incompatible with older file
1720    versions, so that they can be treated accordingly */
1721 #define FILE_VERSION_ACTUAL             FILE_VERSION_2_0
1722
1723 #define GAME_VERSION_1_0                FILE_VERSION_1_0
1724 #define GAME_VERSION_1_2                FILE_VERSION_1_2
1725 #define GAME_VERSION_1_4                FILE_VERSION_1_4
1726 #define GAME_VERSION_2_0                FILE_VERSION_2_0
1727
1728 #define GAME_VERSION_ACTUAL             VERSION_IDENT(PROGRAM_VERSION_MAJOR, \
1729                                                       PROGRAM_VERSION_MINOR, \
1730                                                       PROGRAM_VERSION_PATCH, \
1731                                                       PROGRAM_VERSION_BUILD)
1732
1733 /* values for game_emulation */
1734 #define EMU_NONE                        0
1735 #define EMU_BOULDERDASH                 1
1736 #define EMU_SOKOBAN                     2
1737 #define EMU_SUPAPLEX                    3
1738
1739 /* values for level file type identifier */
1740 #define LEVEL_FILE_TYPE_UNKNOWN         0
1741 #define LEVEL_FILE_TYPE_RND             1
1742 #define LEVEL_FILE_TYPE_BD              2
1743 #define LEVEL_FILE_TYPE_EM              3
1744 #define LEVEL_FILE_TYPE_SP              4
1745 #define LEVEL_FILE_TYPE_DX              5
1746 #define LEVEL_FILE_TYPE_SB              6
1747 #define LEVEL_FILE_TYPE_DC              7
1748
1749 #define NUM_LEVEL_FILE_TYPES            8
1750
1751 /* values for game engine type identifier */
1752 #define GAME_ENGINE_TYPE_UNKNOWN        LEVEL_FILE_TYPE_UNKNOWN
1753 #define GAME_ENGINE_TYPE_RND            LEVEL_FILE_TYPE_RND
1754 #define GAME_ENGINE_TYPE_EM             LEVEL_FILE_TYPE_EM
1755
1756 #define NUM_ENGINE_TYPES                3
1757
1758
1759 struct MenuInfo
1760 {
1761   int draw_xoffset[NUM_SPECIAL_GFX_ARGS];
1762   int draw_yoffset[NUM_SPECIAL_GFX_ARGS];
1763
1764   int scrollbar_xoffset;
1765
1766   int list_size[NUM_SPECIAL_GFX_ARGS];
1767
1768   int sound[NUM_SPECIAL_GFX_ARGS];
1769   int music[NUM_SPECIAL_GFX_ARGS];
1770 };
1771
1772 struct DoorInfo
1773 {
1774   int width;
1775   int height;
1776   int step_offset;
1777   int step_delay;
1778   int anim_mode;
1779 };
1780
1781 struct HiScore
1782 {
1783   char Name[MAX_PLAYER_NAME_LEN + 1];
1784   int Score;
1785 };
1786
1787 struct Content
1788 {
1789   int e[3][3];
1790 };
1791
1792 struct LevelSetInfo
1793 {
1794   int music[MAX_LEVELS];
1795 };
1796
1797 struct LevelFileInfo
1798 {
1799   int nr;
1800   int type;
1801   boolean packed;
1802   char *basename;
1803   char *filename;
1804 };
1805
1806 struct LevelInfo
1807 {
1808   struct LevelFileInfo file_info;
1809
1810   int game_engine_type;
1811
1812   /* level stored in native format for the alternative native game engines */
1813   struct LevelInfo_EM *native_em_level;
1814
1815   int file_version;     /* file format version the level is stored with    */
1816   int game_version;     /* game release version the level was created with */
1817
1818   boolean encoding_16bit_field;         /* level contains 16-bit elements  */
1819   boolean encoding_16bit_yamyam;        /* yamyam contains 16-bit elements */
1820   boolean encoding_16bit_amoeba;        /* amoeba contains 16-bit elements */
1821
1822   int fieldx, fieldy;
1823
1824   int time;                             /* available time (seconds) */
1825   int gems_needed;
1826
1827   char name[MAX_LEVEL_NAME_LEN + 1];
1828   char author[MAX_LEVEL_AUTHOR_LEN + 1];
1829
1830   char envelope_text[4][MAX_ENVELOPE_TEXT_LEN + 1];
1831   int envelope_xsize[4], envelope_ysize[4];
1832
1833   int score[LEVEL_SCORE_ELEMENTS];
1834
1835   struct Content yamyam_content[MAX_ELEMENT_CONTENTS];
1836   int num_yamyam_contents;
1837
1838   int amoeba_speed;
1839   int amoeba_content;
1840
1841   int game_of_life[4];
1842   int biomaze[4];
1843
1844   int time_magic_wall;
1845   int time_wheel;
1846   int time_light;
1847   int time_timegate;
1848
1849   int shield_normal_time;
1850   int shield_deadly_time;
1851
1852   int extra_time;
1853   int time_orb_time;
1854
1855   int extra_time_score;
1856
1857   int start_element[MAX_PLAYERS];
1858   boolean use_start_element[MAX_PLAYERS];
1859
1860   int artwork_element[MAX_PLAYERS];
1861   boolean use_artwork_element[MAX_PLAYERS];
1862
1863   int explosion_element[MAX_PLAYERS];
1864   boolean use_explosion_element[MAX_PLAYERS];
1865
1866 #if 1
1867   /* values for the new EMC elements */
1868   int android_move_time;
1869   int android_clone_time;
1870   boolean ball_random;
1871   boolean ball_state_initial;
1872   int ball_time;
1873   int lenses_score;
1874   int magnify_score;
1875   int slurp_score;
1876   int lenses_time;
1877   int magnify_time;
1878   int wind_direction_initial;
1879
1880   struct Content ball_content[MAX_ELEMENT_CONTENTS];
1881   int num_ball_contents;
1882
1883 #if 0
1884   boolean android_array[16];
1885 #endif
1886   int num_android_clone_elements;
1887   int android_clone_element[MAX_ANDROID_ELEMENTS];
1888 #endif
1889
1890   int can_move_into_acid_bits;  /* bitfield to store property for elements */
1891   int dont_collide_with_bits;   /* bitfield to store property for elements */
1892
1893   int initial_player_stepsize;  /* initial player speed */
1894
1895   boolean initial_gravity;
1896   boolean em_slippery_gems;     /* EM style "gems slip from wall" behaviour */
1897   boolean use_spring_bug;       /* for compatibility with old levels */
1898   boolean use_time_orb_bug;     /* for compatibility with old levels */
1899   boolean instant_relocation;   /* no visual delay when relocating player */
1900   boolean can_pass_to_walkable; /* player can pass to empty or walkable tile */
1901   boolean grow_into_diggable;   /* amoeba can grow into anything diggable */
1902
1903   boolean continuous_snapping;  /* repeated snapping without releasing key */
1904   boolean block_snap_field;     /* snapping blocks field to show animation */
1905   boolean block_last_field;     /* player blocks previous field while moving */
1906   boolean sp_block_last_field;  /* player blocks previous field while moving */
1907
1908   /* ('int' instead of 'boolean' because used as selectbox value in editor) */
1909   int use_step_counter;         /* count steps instead of seconds for level */
1910
1911   short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1912
1913   boolean use_custom_template;  /* use custom properties from template file */
1914
1915   boolean no_valid_file;        /* set when level file missing or invalid */
1916
1917   boolean changed;              /* set when level was changed in the editor */
1918 };
1919
1920 struct GlobalInfo
1921 {
1922   char *autoplay_leveldir;
1923   int autoplay_level[MAX_TAPES_PER_SET];
1924   boolean autoplay_all;
1925
1926   char *convert_leveldir;
1927   int convert_level_nr;
1928
1929   int num_toons;
1930
1931   float frames_per_second;
1932   boolean fps_slowdown;
1933   int fps_slowdown_factor;
1934 };
1935
1936 struct ElementChangeInfo
1937 {
1938   boolean can_change;           /* use or ignore this change info */
1939
1940   boolean has_event[NUM_CHANGE_EVENTS];         /* change events */
1941
1942   int trigger_player;           /* player triggering change */
1943   int trigger_side;             /* side triggering change */
1944   int trigger_page;             /* page triggering change */
1945
1946   int target_element;           /* target element after change */
1947
1948   int delay_fixed;              /* added frame delay before changed (fixed) */
1949   int delay_random;             /* added frame delay before changed (random) */
1950   int delay_frames;             /* either 1 (frames) or 50 (seconds; 50 fps) */
1951
1952   int trigger_element;          /* element triggering change */
1953
1954   struct Content target_content;/* elements for extended change target */
1955   boolean use_target_content;   /* use extended change target */
1956   boolean only_if_complete;     /* only use complete target content */
1957   boolean use_random_replace;   /* use random value for replacing elements */
1958   int random_percentage;        /* random value for replacing elements */
1959   int replace_when;             /* type of elements that can be replaced */
1960
1961   boolean explode;              /* explode instead of change */
1962
1963   boolean has_action;           /* execute action on specified condition */
1964   int action_type;              /* type of action */
1965   int action_mode;              /* mode of action */
1966   int action_arg;               /* parameter of action */
1967
1968   /* ---------- internal values used at runtime when playing ---------- */
1969
1970   /* functions that are called before, while and after the change of an
1971      element -- currently only used for non-custom elements */
1972   void (*pre_change_function)(int x, int y);
1973   void (*change_function)(int x, int y);
1974   void (*post_change_function)(int x, int y);
1975
1976   short actual_trigger_element; /* element that actually triggered change */
1977   int actual_trigger_side;      /* element side that triggered the change */
1978   int actual_trigger_player;    /* player which actually triggered change */
1979   int actual_trigger_ce_value;  /* CE value of element that triggered change */
1980   int actual_trigger_ce_score;  /* CE score of element that triggered change */
1981
1982   boolean can_change_or_has_action;     /* can_change | has_action */
1983
1984   /* ---------- internal values used in level editor ---------- */
1985
1986   int direct_action;            /* change triggered by actions on element */
1987   int other_action;             /* change triggered by other element actions */
1988 };
1989
1990 struct ElementGroupInfo
1991 {
1992   int num_elements;                     /* number of elements in this group */
1993   int element[MAX_ELEMENTS_IN_GROUP];   /* list of elements in this group */
1994
1995   int choice_mode;              /* how to choose element from group */
1996
1997   /* ---------- internal values used at runtime when playing ---------- */
1998
1999   /* the following is the same as above, but with recursively resolved group
2000      elements (group elements may also contain further group elements!) */
2001   int num_elements_resolved;
2002   short element_resolved[NUM_FILE_ELEMENTS];
2003
2004   int choice_pos;               /* current element choice position */
2005 };
2006
2007 struct ElementNameInfo
2008 {
2009   /* ---------- token and description strings ---------- */
2010
2011   char *token_name;             /* element token used in config files */
2012   char *class_name;             /* element class used in config files */
2013   char *editor_description;     /* pre-defined description for level editor */
2014 };
2015
2016 struct ElementInfo
2017 {
2018   /* ---------- token and description strings ---------- */
2019
2020   char *token_name;             /* element token used in config files */
2021   char *class_name;             /* element class used in config files */
2022   char *editor_description;     /* pre-defined description for level editor */
2023   char *custom_description;     /* alternative description from config file */
2024   char description[MAX_ELEMENT_NAME_LEN + 1];   /* for custom/group elements */
2025
2026   /* ---------- graphic and sound definitions ---------- */
2027
2028   int graphic[NUM_ACTIONS];     /* default graphics for several actions */
2029   int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS_FULL];
2030                                 /* special graphics for left/right/up/down */
2031
2032   int crumbled[NUM_ACTIONS];    /* crumbled graphics for several actions */
2033   int direction_crumbled[NUM_ACTIONS][NUM_DIRECTIONS_FULL];
2034                                 /* crumbled graphics for left/right/up/down */
2035
2036   int special_graphic[NUM_SPECIAL_GFX_ARGS];
2037                                 /* special graphics for certain screens */
2038
2039   int sound[NUM_ACTIONS];       /* default sounds for several actions */
2040
2041   /* ---------- special element property values ---------- */
2042
2043   unsigned long properties[NUM_EP_BITFIELDS];   /* element base properties */
2044
2045   boolean use_gfx_element;      /* use custom graphic element */
2046   int gfx_element;              /* optional custom graphic element */
2047
2048   int access_direction;         /* accessible from which direction */
2049
2050   int collect_score_initial;    /* initial score value for collecting */
2051   int collect_count_initial;    /* initial count value for collecting */
2052
2053   int ce_value_fixed_initial;   /* initial value for custom variable (fix) */
2054   int ce_value_random_initial;  /* initial value for custom variable (rnd) */
2055   boolean use_last_ce_value;    /* use value from element before change */
2056
2057   int push_delay_fixed;         /* constant delay before pushing */
2058   int push_delay_random;        /* additional random delay before pushing */
2059   int drop_delay_fixed;         /* constant delay after dropping */
2060   int drop_delay_random;        /* additional random delay after dropping */
2061   int move_delay_fixed;         /* constant delay after moving */
2062   int move_delay_random;        /* additional random delay after moving */
2063
2064   int move_pattern;             /* direction movable element moves to */
2065   int move_direction_initial;   /* initial direction element moves to */
2066   int move_stepsize;            /* step size element moves with */
2067
2068   int move_enter_element;       /* element that can be entered (and removed) */
2069   int move_leave_element;       /* element that can be left behind */
2070   int move_leave_type;          /* change (limited) or leave (unlimited) */
2071
2072   int slippery_type;            /* how/where other elements slip away */
2073
2074   struct Content content;       /* new elements after explosion */
2075
2076   int explosion_type;           /* type of explosion, like 3x3, 3+3 or 1x1 */
2077   int explosion_delay;          /* duration of explosion of this element */
2078   int ignition_delay;           /* delay for explosion by other explosion */
2079
2080   struct ElementChangeInfo *change_page; /* actual list of change pages */
2081   struct ElementChangeInfo *change;      /* pointer to current change page */
2082
2083   int num_change_pages;         /* actual number of change pages */
2084   int current_change_page;      /* currently edited change page */
2085
2086   struct ElementGroupInfo *group;       /* pointer to element group info */
2087
2088   /* ---------- internal values used at runtime when playing ---------- */
2089
2090   boolean has_change_event[NUM_CHANGE_EVENTS];
2091
2092   int event_page_nr[NUM_CHANGE_EVENTS]; /* page number for each event */
2093   struct ElementChangeInfo *event_page[NUM_CHANGE_EVENTS]; /* page for event */
2094
2095   boolean in_group[NUM_GROUP_ELEMENTS];
2096
2097   int collect_score;            /* runtime score value for collecting */
2098
2099   /* ---------- internal values used in level editor ---------- */
2100
2101   int access_type;              /* walkable or passable */
2102   int access_layer;             /* accessible over/inside/under */
2103   int access_protected;         /* protection against deadly elements */
2104   int walk_to_action;           /* diggable/collectible/pushable */
2105   int smash_targets;            /* can smash player/enemies/everything */
2106   int deadliness;               /* deadly when running/colliding/touching */
2107
2108   boolean can_explode_by_fire;  /* element explodes by fire */
2109   boolean can_explode_smashed;  /* element explodes when smashed */
2110   boolean can_explode_impact;   /* element explodes on impact */
2111
2112   boolean modified_settings;    /* set for all modified custom elements */
2113 };
2114
2115 struct FontInfo
2116 {
2117   char *token_name;             /* font token used in config files */
2118
2119   int graphic;                  /* default graphic for this font */
2120   int special_graphic[NUM_SPECIAL_GFX_ARGS];
2121                                 /* special graphics for certain screens */
2122   int special_bitmap_id[NUM_SPECIAL_GFX_ARGS];
2123                                 /* internal bitmap ID for special graphics */
2124 };
2125
2126 struct GraphicInfo
2127 {
2128   Bitmap *bitmap;
2129   int src_image_width;          /* scaled bitmap size, but w/o small images */
2130   int src_image_height;         /* scaled bitmap size, but w/o small images */
2131
2132   int src_x, src_y;             /* start position of animation frames */
2133   int width, height;            /* width/height of each animation frame */
2134   int offset_x, offset_y;       /* x/y offset to next animation frame */
2135   int offset2_x, offset2_y;     /* x/y offset to second movement tile */
2136   boolean double_movement;      /* animation has second movement tile */
2137   int swap_double_tiles;        /* explicitely force or forbid tile swapping */
2138   int anim_frames;
2139   int anim_frames_per_line;
2140   int anim_start_frame;
2141   int anim_delay;               /* important: delay of 1 means "no delay"! */
2142   int anim_mode;
2143   boolean anim_global_sync;
2144   int crumbled_like;            /* element for cloning crumble graphics */
2145   int diggable_like;            /* element for cloning digging graphics */
2146   int border_size;              /* border size for "crumbled" graphics */
2147   int scale_up_factor;          /* optional factor for scaling image up */
2148   int clone_from;               /* graphic for cloning *all* settings */
2149
2150   int anim_delay_fixed;         /* optional delay values for bored and   */
2151   int anim_delay_random;        /* sleeping player animations (animation */
2152   int post_delay_fixed;         /* intervall and following pause before  */
2153   int post_delay_random;        /* next intervall (bored animation only) */
2154
2155   int step_offset;              /* optional step offset of toon animations */
2156   int step_delay;               /* optional step delay of toon animations */
2157
2158   int draw_x, draw_y;           /* optional offset for drawing fonts chars */
2159
2160   int draw_masked;              /* optional setting for drawing envelope gfx */
2161
2162 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
2163   Pixmap clip_mask;             /* single-graphic-only clip mask for X11 */
2164   GC clip_gc;                   /* single-graphic-only clip gc for X11 */
2165 #endif
2166 };
2167
2168 struct SoundInfo
2169 {
2170   boolean loop;
2171   int volume;
2172   int priority;
2173 };
2174
2175 struct MusicInfo
2176 {
2177   boolean loop;
2178 };
2179
2180 struct MusicPrefixInfo
2181 {
2182   char *prefix;
2183   boolean is_loop_music;
2184 };
2185
2186 struct MusicFileInfo
2187 {
2188   char *basename;
2189
2190   char *title_header;
2191   char *artist_header;
2192   char *album_header;
2193   char *year_header;
2194
2195   char *title;
2196   char *artist;
2197   char *album;
2198   char *year;
2199
2200   int music;
2201
2202   boolean is_sound;
2203
2204   struct MusicFileInfo *next;
2205 };
2206
2207 struct ElementActionInfo
2208 {
2209   char *suffix;
2210   int value;
2211   boolean is_loop_sound;
2212 };
2213
2214 struct ElementDirectionInfo
2215 {
2216   char *suffix;
2217   int value;
2218 };
2219
2220 struct SpecialSuffixInfo
2221 {
2222   char *suffix;
2223   int value;
2224 };
2225
2226 struct HelpAnimInfo
2227 {
2228   int element;
2229   int action;
2230   int direction;
2231
2232   int delay;
2233 };
2234
2235
2236 extern Bitmap                  *bitmap_db_field, *bitmap_db_door;
2237 extern Pixmap                   tile_clipmask[];
2238 extern DrawBuffer             *fieldbuffer;
2239 extern DrawBuffer             *drawto_field;
2240
2241 extern int                      game_status;
2242 extern boolean                  level_editor_test_game;
2243 extern boolean                  network_playing;
2244
2245 #if defined(TARGET_SDL)
2246 extern boolean                  network_server;
2247 extern SDL_Thread              *server_thread;
2248 #endif
2249
2250 extern int                      key_joystick_mapping;
2251
2252 extern boolean                  redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
2253 extern int                      redraw_x1, redraw_y1;
2254
2255 extern short                    Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2256 extern short                    MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2257 extern short                    MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2258 extern short                    MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2259 extern short                    ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2260 extern short                    ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2261 extern short                    CustomValue[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2262 extern short                    Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2263 extern short                    Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2264 extern short                    StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2265 extern short                    Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2266 extern boolean                  Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2267 extern boolean                  Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2268 extern short                    ChangeCount[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2269 extern short                    ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2270 extern short                    WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2271 extern short                    WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2272 extern short                    CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2273 extern short                    AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2274 extern short                    AmoebaCnt[MAX_NUM_AMOEBA];
2275 extern short                    AmoebaCnt2[MAX_NUM_AMOEBA];
2276 extern short                    ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2277 extern short                    ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2278 extern short                    ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2279 extern int                      RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2280 extern int                      PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2281
2282 #if 0
2283 extern unsigned long            Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
2284 #endif
2285
2286 extern int                      GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2287 extern int                      GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2288 extern int                      GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2289 extern int                      GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2290 extern int                      GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2291
2292 extern int                      lev_fieldx, lev_fieldy;
2293 extern int                      scroll_x, scroll_y;
2294
2295 extern int                      FX, FY;
2296 extern int                      ScrollStepSize;
2297 extern int                      ScreenMovDir, ScreenMovPos, ScreenGfxPos;
2298 extern int                      BorderElement;
2299 extern int                      GameFrameDelay;
2300 extern int                      FfwdFrameDelay;
2301 extern int                      BX1, BY1;
2302 extern int                      BX2, BY2;
2303 extern int                      SBX_Left, SBX_Right;
2304 extern int                      SBY_Upper, SBY_Lower;
2305 extern int                      ZX, ZY;
2306 extern int                      ExitX, ExitY;
2307 extern int                      AllPlayersGone;
2308
2309 extern int                      TimeFrames, TimePlayed, TimeLeft, TapeTime;
2310 extern boolean                  SiebAktiv;
2311 extern int                      SiebCount;
2312
2313 extern boolean                  network_player_action_received;
2314
2315 extern int                      graphics_action_mapping[];
2316
2317 extern struct LevelSetInfo      levelset;
2318 extern struct LevelInfo         level, level_template;
2319 extern struct HiScore           highscore[];
2320 extern struct TapeInfo          tape;
2321 extern struct GlobalInfo        global;
2322 extern struct MenuInfo          menu;
2323 extern struct DoorInfo          door_1, door_2;
2324 extern struct ElementInfo       element_info[];
2325 extern struct ElementNameInfo   element_name_info[];
2326 extern struct ElementActionInfo element_action_info[];
2327 extern struct ElementDirectionInfo element_direction_info[];
2328 extern struct SpecialSuffixInfo special_suffix_info[];
2329 extern struct TokenIntPtrInfo   image_config_vars[];
2330 extern struct FontInfo          font_info[];
2331 extern struct MusicPrefixInfo   music_prefix_info[];
2332 extern struct GraphicInfo      *graphic_info;
2333 extern struct SoundInfo        *sound_info;
2334 extern struct MusicInfo        *music_info;
2335 extern struct MusicFileInfo    *music_file_info;
2336 extern struct HelpAnimInfo     *helpanim_info;
2337 extern SetupFileHash           *helptext_info;
2338 extern struct ConfigTypeInfo    image_config_suffix[];
2339 extern struct ConfigTypeInfo    sound_config_suffix[];
2340 extern struct ConfigTypeInfo    music_config_suffix[];
2341 extern struct ConfigInfo        image_config[];
2342 extern struct ConfigInfo        sound_config[];
2343 extern struct ConfigInfo        music_config[];
2344 extern struct ConfigInfo        helpanim_config[];
2345 extern struct ConfigInfo        helptext_config[];
2346
2347 #endif  /* MAIN_H */