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