rnd-20050122-2-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_TOWARDS_PLAYER       (1 << MV_BIT_TOWARDS_PLAYER)
271 #define MV_AWAY_FROM_PLAYER     (1 << MV_BIT_AWAY_FROM_PLAYER)
272 #define MV_ALONG_LEFT_SIDE      (1 << MV_BIT_ALONG_LEFT_SIDE)
273 #define MV_ALONG_RIGHT_SIDE     (1 << MV_BIT_ALONG_RIGHT_SIDE)
274 #define MV_TURNING_LEFT         (1 << MV_BIT_TURNING_LEFT)
275 #define MV_TURNING_RIGHT        (1 << MV_BIT_TURNING_RIGHT)
276 #define MV_WHEN_PUSHED          (1 << MV_BIT_WHEN_PUSHED)
277 #define MV_MAZE_RUNNER          (1 << MV_BIT_MAZE_RUNNER)
278 #define MV_MAZE_HUNTER          (1 << MV_BIT_MAZE_HUNTER)
279 #define MV_MAZE_RUNNER_STYLE    (MV_MAZE_RUNNER | MV_MAZE_HUNTER)
280 #define MV_WHEN_DROPPED         (1 << MV_BIT_WHEN_DROPPED)
281 #define MV_TURNING_LEFT_RIGHT   (1 << MV_BIT_TURNING_LEFT_RIGHT)
282 #define MV_TURNING_RIGHT_LEFT   (1 << MV_BIT_TURNING_RIGHT_LEFT)
283 #define MV_TURNING_RANDOM       (1 << MV_BIT_TURNING_RANDOM)
284
285 /* values for initial move direction (bits 0 - 3: basic move directions) */
286 #define MV_START_BIT_PREVIOUS   4
287
288 /* values for initial move direction */
289 #define MV_START_AUTOMATIC      (MV_NO_MOVING)
290 #define MV_START_LEFT           (MV_LEFT)
291 #define MV_START_RIGHT          (MV_RIGHT)
292 #define MV_START_UP             (MV_UP)
293 #define MV_START_DOWN           (MV_DOWN)
294 #define MV_START_RANDOM         (MV_ALL_DIRECTIONS)
295 #define MV_START_PREVIOUS       (1 << MV_START_BIT_PREVIOUS)
296
297 /* values for elements left behind by custom elements */
298 #define LEAVE_TYPE_UNLIMITED    0
299 #define LEAVE_TYPE_LIMITED      1
300
301 /* values for slippery property for custom elements */
302 #define SLIPPERY_ANY_RANDOM     0
303 #define SLIPPERY_ANY_LEFT_RIGHT 1
304 #define SLIPPERY_ANY_RIGHT_LEFT 2
305 #define SLIPPERY_ONLY_LEFT      3
306 #define SLIPPERY_ONLY_RIGHT     4
307
308 /* values for explosion type for custom elements */
309 #define EXPLODES_3X3            0
310 #define EXPLODES_1X1            1
311 #define EXPLODES_CROSS          2
312
313 /* macros for configurable properties */
314 #define IS_DIGGABLE(e)          HAS_PROPERTY(e, EP_DIGGABLE)
315 #define IS_COLLECTIBLE_ONLY(e)  HAS_PROPERTY(e, EP_COLLECTIBLE_ONLY)
316 #define DONT_RUN_INTO(e)        HAS_PROPERTY(e, EP_DONT_RUN_INTO)
317 #define DONT_COLLIDE_WITH(e)    HAS_PROPERTY(e, EP_DONT_COLLIDE_WITH)
318 #define DONT_TOUCH(e)           HAS_PROPERTY(e, EP_DONT_TOUCH)
319 #define IS_INDESTRUCTIBLE(e)    HAS_PROPERTY(e, EP_INDESTRUCTIBLE)
320 #define IS_SLIPPERY(e)          HAS_PROPERTY(e, EP_SLIPPERY)
321 #define CAN_CHANGE(e)           HAS_PROPERTY(e, EP_CAN_CHANGE)
322 #define CAN_MOVE(e)             HAS_PROPERTY(e, EP_CAN_MOVE)
323 #define CAN_FALL(e)             HAS_PROPERTY(e, EP_CAN_FALL)
324 #define CAN_SMASH_PLAYER(e)     HAS_PROPERTY(e, EP_CAN_SMASH_PLAYER)
325 #define CAN_SMASH_ENEMIES(e)    HAS_PROPERTY(e, EP_CAN_SMASH_ENEMIES)
326 #define CAN_SMASH_EVERYTHING(e) HAS_PROPERTY(e, EP_CAN_SMASH_EVERYTHING)
327 #define EXPLODES_BY_FIRE(e)     HAS_PROPERTY(e, EP_EXPLODES_BY_FIRE)
328 #define EXPLODES_SMASHED(e)     HAS_PROPERTY(e, EP_EXPLODES_SMASHED)
329 #define EXPLODES_IMPACT(e)      HAS_PROPERTY(e, EP_EXPLODES_IMPACT)
330 #define IS_WALKABLE_OVER(e)     HAS_PROPERTY(e, EP_WALKABLE_OVER)
331 #define IS_WALKABLE_INSIDE(e)   HAS_PROPERTY(e, EP_WALKABLE_INSIDE)
332 #define IS_WALKABLE_UNDER(e)    HAS_PROPERTY(e, EP_WALKABLE_UNDER)
333 #define IS_PASSABLE_OVER(e)     HAS_PROPERTY(e, EP_PASSABLE_OVER)
334 #define IS_PASSABLE_INSIDE(e)   HAS_PROPERTY(e, EP_PASSABLE_INSIDE)
335 #define IS_PASSABLE_UNDER(e)    HAS_PROPERTY(e, EP_PASSABLE_UNDER)
336 #define IS_DROPPABLE(e)         HAS_PROPERTY(e, EP_DROPPABLE)
337 #define EXPLODES_1X1_OLD(e)     HAS_PROPERTY(e, EP_EXPLODES_1X1_OLD)
338 #define IS_PUSHABLE(e)          HAS_PROPERTY(e, EP_PUSHABLE)
339 #define EXPLODES_CROSS_OLD(e)   HAS_PROPERTY(e, EP_EXPLODES_CROSS_OLD)
340 #define IS_PROTECTED(e)         HAS_PROPERTY(e, EP_PROTECTED)
341 #define CAN_MOVE_INTO_ACID(e)   HAS_PROPERTY(e, EP_CAN_MOVE_INTO_ACID)
342 #define IS_THROWABLE(e)         HAS_PROPERTY(e, EP_THROWABLE)
343 #define CAN_EXPLODE(e)          HAS_PROPERTY(e, EP_CAN_EXPLODE)
344 #define IS_GRAVITY_REACHABLE(e) HAS_PROPERTY(e, EP_GRAVITY_REACHABLE)
345
346 /* macros for special configurable properties */
347 #define IS_EM_SLIPPERY_WALL(e)  HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL)
348
349 /* macros for special graphics properties */
350 #define GFX_CRUMBLED(e)         HAS_PROPERTY(GFX_ELEMENT(e), EP_GFX_CRUMBLED)
351
352 /* macros for pre-defined properties */
353 #define ELEM_IS_PLAYER(e)       HAS_PROPERTY(e, EP_PLAYER)
354 #define CAN_PASS_MAGIC_WALL(e)  HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL)
355 #define IS_SWITCHABLE(e)        HAS_PROPERTY(e, EP_SWITCHABLE)
356 #define IS_BD_ELEMENT(e)        HAS_PROPERTY(e, EP_BD_ELEMENT)
357 #define IS_SP_ELEMENT(e)        HAS_PROPERTY(e, EP_SP_ELEMENT)
358 #define IS_SB_ELEMENT(e)        HAS_PROPERTY(e, EP_SB_ELEMENT)
359 #define IS_GEM(e)               HAS_PROPERTY(e, EP_GEM)
360 #define IS_FOOD_DARK_YAMYAM(e)  HAS_PROPERTY(e, EP_FOOD_DARK_YAMYAM)
361 #define IS_FOOD_PENGUIN(e)      HAS_PROPERTY(e, EP_FOOD_PENGUIN)
362 #define IS_FOOD_PIG(e)          HAS_PROPERTY(e, EP_FOOD_PIG)
363 #define IS_HISTORIC_WALL(e)     HAS_PROPERTY(e, EP_HISTORIC_WALL)
364 #define IS_HISTORIC_SOLID(e)    HAS_PROPERTY(e, EP_HISTORIC_SOLID)
365 #define IS_CLASSIC_ENEMY(e)     HAS_PROPERTY(e, EP_CLASSIC_ENEMY)
366 #define IS_BELT(e)              HAS_PROPERTY(e, EP_BELT)
367 #define IS_BELT_ACTIVE(e)       HAS_PROPERTY(e, EP_BELT_ACTIVE)
368 #define IS_BELT_SWITCH(e)       HAS_PROPERTY(e, EP_BELT_SWITCH)
369 #define IS_TUBE(e)              HAS_PROPERTY(e, EP_TUBE)
370 #define IS_KEYGATE(e)           HAS_PROPERTY(e, EP_KEYGATE)
371 #define IS_AMOEBOID(e)          HAS_PROPERTY(e, EP_AMOEBOID)
372 #define IS_AMOEBALIVE(e)        HAS_PROPERTY(e, EP_AMOEBALIVE)
373 #define HAS_CONTENT(e)          HAS_PROPERTY(e, EP_HAS_CONTENT)
374 #define CAN_TURN_EACH_MOVE(e)   HAS_PROPERTY(e, EP_CAN_TURN_EACH_MOVE)
375 #define CAN_GROW(e)             HAS_PROPERTY(e, EP_CAN_GROW)
376 #define IS_ACTIVE_BOMB(e)       HAS_PROPERTY(e, EP_ACTIVE_BOMB)
377 #define IS_INACTIVE(e)          HAS_PROPERTY(e, EP_INACTIVE)
378
379 /* macros for derived properties */
380 #define IS_ACCESSIBLE_OVER(e)   HAS_PROPERTY(e, EP_ACCESSIBLE_OVER)
381 #define IS_ACCESSIBLE_INSIDE(e) HAS_PROPERTY(e, EP_ACCESSIBLE_INSIDE)
382 #define IS_ACCESSIBLE_UNDER(e)  HAS_PROPERTY(e, EP_ACCESSIBLE_UNDER)
383 #define IS_WALKABLE(e)          HAS_PROPERTY(e, EP_WALKABLE)
384 #define IS_PASSABLE(e)          HAS_PROPERTY(e, EP_PASSABLE)
385 #define IS_ACCESSIBLE(e)        HAS_PROPERTY(e, EP_ACCESSIBLE)
386 #define IS_COLLECTIBLE(e)       HAS_PROPERTY(e, EP_COLLECTIBLE)
387 #define IS_SNAPPABLE(e)         HAS_PROPERTY(e, EP_SNAPPABLE)
388 #define IS_WALL(e)              HAS_PROPERTY(e, EP_WALL)
389 #define IS_SOLID_FOR_PUSHING(e) HAS_PROPERTY(e, EP_SOLID_FOR_PUSHING)
390 #define IS_DRAGONFIRE_PROOF(e)  HAS_PROPERTY(e, EP_DRAGONFIRE_PROOF)
391 #define IS_EXPLOSION_PROOF(e)   HAS_PROPERTY(e, EP_EXPLOSION_PROOF)
392 #define CAN_SMASH(e)            HAS_PROPERTY(e, EP_CAN_SMASH)
393 #define EXPLODES_3X3_OLD(e)     HAS_PROPERTY(e, EP_EXPLODES_3X3_OLD)
394 #define CAN_EXPLODE_BY_FIRE(e)  HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE)
395 #define CAN_EXPLODE_SMASHED(e)  HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED)
396 #define CAN_EXPLODE_IMPACT(e)   HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT)
397 #define IS_SP_PORT(e)           HAS_PROPERTY(e, EP_SP_PORT)
398 #define CAN_EXPLODE_BY_DRAGONFIRE(e)    \
399                                 HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_DRAGONFIRE)
400 #define CAN_EXPLODE_BY_EXPLOSION(e)     \
401                                 HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_EXPLOSION)
402 #define COULD_MOVE_INTO_ACID(e) HAS_PROPERTY(e, EP_COULD_MOVE_INTO_ACID)
403 #define MAYBE_DONT_COLLIDE_WITH(e) HAS_PROPERTY(e, EP_MAYBE_DONT_COLLIDE_WITH)
404
405 /* special macros used in game engine */
406 #define IS_CUSTOM_ELEMENT(e)    ((e) >= EL_CUSTOM_START &&              \
407                                  (e) <= EL_CUSTOM_END)
408
409 #define IS_GROUP_ELEMENT(e)     ((e) >= EL_GROUP_START &&               \
410                                  (e) <= EL_GROUP_END)
411
412 #define IS_CLIPBOARD_ELEMENT(e) ((e) >= EL_INTERNAL_CLIPBOARD_START &&  \
413                                  (e) <= EL_INTERNAL_CLIPBOARD_END)
414
415 #define IS_INTERNAL_ELEMENT(e)  ((e) >= EL_INTERNAL_START &&            \
416                                  (e) <= EL_INTERNAL_END)
417
418 #define IS_ENVELOPE(e)          ((e) >= EL_ENVELOPE_1 &&                \
419                                  (e) <= EL_ENVELOPE_4)
420
421 #define IS_GATE(e)              ((e) >= EL_GATE_1 &&                    \
422                                  (e) <= EL_GATE_4)
423
424 #define IS_GATE_GRAY(e)         ((e) >= EL_GATE_1_GRAY &&               \
425                                  (e) <= EL_GATE_4_GRAY)
426
427 #define IS_EM_GATE(e)           ((e) >= EL_EM_GATE_1 &&                 \
428                                  (e) <= EL_EM_GATE_4)
429
430 #define IS_EM_GATE_GRAY(e)      ((e) >= EL_EM_GATE_1_GRAY &&            \
431                                  (e) <= EL_EM_GATE_4_GRAY)
432
433 #define GFX_ELEMENT(e)          (element_info[e].use_gfx_element ?      \
434                                  element_info[e].gfx_element : e)
435
436 /* !!! "use sound" deactivated due to problems with level "bug machine" !!! */
437 /* (solution: add separate "use sound of element" to level file and editor) */
438 #if 0
439 #define SND_ELEMENT(e)          GFX_ELEMENT(e)
440 #else
441 #define SND_ELEMENT(e)          (e)
442 #endif
443
444 #define IS_PLAYER(x, y)         (ELEM_IS_PLAYER(StorePlayer[x][y]))
445
446 #define IS_FREE(x, y)           (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x, y))
447 #define IS_FREE_OR_PLAYER(x, y) (Feld[x][y] == EL_EMPTY)
448
449 #define IS_MOVING(x,y)          (MovPos[x][y] != 0)
450 #define IS_FALLING(x,y)         (MovPos[x][y] != 0 && MovDir[x][y] == MV_DOWN)
451 #define IS_BLOCKED(x,y)         (Feld[x][y] == EL_BLOCKED)
452
453 #define EL_CHANGED(e)           ((e) == EL_ROCK           ? EL_EMERALD :    \
454                                  (e) == EL_BD_ROCK        ? EL_BD_DIAMOND : \
455                                  (e) == EL_EMERALD        ? EL_DIAMOND :    \
456                                  (e) == EL_EMERALD_YELLOW ? EL_DIAMOND :    \
457                                  (e) == EL_EMERALD_RED    ? EL_DIAMOND :    \
458                                  (e) == EL_EMERALD_PURPLE ? EL_DIAMOND :    \
459                                  EL_ROCK)
460 #define EL_CHANGED2(e)          ((e) == EL_ROCK           ? EL_BD_DIAMOND : \
461                                  (e) == EL_BD_ROCK        ? EL_BD_DIAMOND : \
462                                  EL_BD_ROCK)
463 #define IS_DRAWABLE(e)          ((e) < EL_BLOCKED)
464 #define IS_NOT_DRAWABLE(e)      ((e) >= EL_BLOCKED)
465 #define TAPE_IS_EMPTY(x)        ((x).length == 0)
466 #define TAPE_IS_STOPPED(x)      (!(x).recording && !(x).playing)
467
468 #define PLAYERINFO(x,y)         (&stored_player[StorePlayer[x][y]-EL_PLAYER_1])
469 #define SHIELD_ON(p)            ((p)->shield_normal_time_left > 0)
470
471 #if 1
472
473 #define ENEMY_PROTECTED_FIELD(x,y)      (IS_PROTECTED(Feld[x][y]) ||       \
474                                          IS_PROTECTED(Back[x][y]))
475 #define EXPLOSION_PROTECTED_FIELD(x,y)  (IS_EXPLOSION_PROOF(Feld[x][y]))
476 #define PLAYER_ENEMY_PROTECTED(x,y)     (SHIELD_ON(PLAYERINFO(x, y)) ||    \
477                                          ENEMY_PROTECTED_FIELD(x, y))
478 #define PLAYER_EXPLOSION_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) ||    \
479                                          EXPLOSION_PROTECTED_FIELD(x, y))
480
481 #else
482
483 #define PROTECTED_FIELD(x,y)    (IS_ACCESSIBLE_INSIDE(Feld[x][y]) &&    \
484                                  IS_INDESTRUCTIBLE(Feld[x][y]))
485 #define PLAYER_ENEMY_PROTECTED(x,y)     (SHIELD_ON(PLAYERINFO(x, y)) || \
486                                  PROTECTED_FIELD(x, y))
487 #define PLAYER_EXPLOSION_PROTECTED(x,y) (SHIELD_ON(PLAYERINFO(x, y)) || \
488                                  PROTECTED_FIELD(x, y))
489 #endif
490
491 #define PLAYER_SWITCHING(p,x,y) ((p)->is_switching &&                   \
492                                  (p)->switch_x == (x) && (p)->switch_y == (y))
493
494 #define PLAYER_NR_GFX(g,i)      ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1))
495
496 #define ANIM_FRAMES(g)          (graphic_info[g].anim_frames)
497 #define ANIM_DELAY(g)           (graphic_info[g].anim_delay)
498 #define ANIM_MODE(g)            (graphic_info[g].anim_mode)
499
500 #define IS_ANIMATED(g)          (ANIM_FRAMES(g) > 1)
501 #define IS_NEW_DELAY(f, g)      ((f) % ANIM_DELAY(g) == 0)
502 #define IS_NEW_FRAME(f, g)      (IS_ANIMATED(g) && IS_NEW_DELAY(f, g))
503 #define IS_NEXT_FRAME(f, g)     (IS_NEW_FRAME(f, g) && (f) > 0)
504
505 #define IS_LOOP_SOUND(s)        (sound_info[s].loop)
506
507
508 /* fundamental game speed values */
509 #define ONE_SECOND_DELAY        1000    /* delay value for one second */
510 #define GAME_FRAME_DELAY        20      /* frame delay in milliseconds */
511 #define FFWD_FRAME_DELAY        10      /* 200% speed for fast forward */
512 #define FRAMES_PER_SECOND       (ONE_SECOND_DELAY / GAME_FRAME_DELAY)
513 #define MICROLEVEL_SCROLL_DELAY 50      /* delay for scrolling micro level */
514 #define MICROLEVEL_LABEL_DELAY  250     /* delay for micro level label */
515
516 /* boundaries of arrays etc. */
517 #define MAX_LEVEL_NAME_LEN      32
518 #define MAX_LEVEL_AUTHOR_LEN    32
519 #define MAX_ELEMENT_NAME_LEN    32
520 #define MAX_TAPELEN             (1000 * FRAMES_PER_SECOND) /* max.time x fps */
521 #define MAX_SCORE_ENTRIES       100
522 #define MAX_NUM_AMOEBA          100
523 #define MAX_INVENTORY_SIZE      1000
524 #define MAX_KEYS                4
525 #define NUM_BELTS               4
526 #define NUM_BELT_PARTS          3
527 #define MIN_ENVELOPE_XSIZE      1
528 #define MIN_ENVELOPE_YSIZE      1
529 #define MAX_ENVELOPE_XSIZE      30
530 #define MAX_ENVELOPE_YSIZE      20
531 #define MAX_ENVELOPE_TEXT_LEN   (MAX_ENVELOPE_XSIZE * MAX_ENVELOPE_YSIZE)
532 #define MIN_CHANGE_PAGES        1
533 #define MAX_CHANGE_PAGES        32
534 #define MIN_ELEMENTS_IN_GROUP   1
535 #define MAX_ELEMENTS_IN_GROUP   16
536
537 /* values for elements with content */
538 #define MIN_ELEMENT_CONTENTS    1
539 #define STD_ELEMENT_CONTENTS    4
540 #define MAX_ELEMENT_CONTENTS    8
541 #define NUM_MAGIC_BALL_CONTENTS 8
542
543 #define LEVEL_SCORE_ELEMENTS    16      /* level elements with score */
544
545 /* often used screen positions */
546 #define SX                      8
547 #define SY                      8
548 #define REAL_SX                 (SX - 2)
549 #define REAL_SY                 (SY - 2)
550 #define DX                      566
551 #define DY                      60
552 #define VX                      DX
553 #define VY                      400
554 #define EX                      DX
555 #define EY                      (VY - 44)
556 #define TILESIZE                32
557 #define TILEX                   TILESIZE
558 #define TILEY                   TILESIZE
559 #define MINI_TILESIZE           (TILESIZE / 2)
560 #define MINI_TILEX              MINI_TILESIZE
561 #define MINI_TILEY              MINI_TILESIZE
562 #define MICRO_TILESIZE          (TILESIZE / 8)
563 #define MICRO_TILEX             MICRO_TILESIZE
564 #define MICRO_TILEY             MICRO_TILESIZE
565 #define MIDPOSX                 (SCR_FIELDX / 2)
566 #define MIDPOSY                 (SCR_FIELDY / 2)
567 #define SXSIZE                  (SCR_FIELDX * TILEX)
568 #define SYSIZE                  (SCR_FIELDY * TILEY)
569 #define FXSIZE                  ((SCR_FIELDX + 2) * TILEX)
570 #define FYSIZE                  ((SCR_FIELDY + 2) * TILEY)
571 #define DXSIZE                  100
572 #define DYSIZE                  280
573 #define VXSIZE                  DXSIZE
574 #define VYSIZE                  100
575 #define EXSIZE                  DXSIZE
576 #define EYSIZE                  (VYSIZE + 44)
577 #define FULL_SXSIZE             (2 + SXSIZE + 2)
578 #define FULL_SYSIZE             (2 + SYSIZE + 2)
579 #define MICROLEV_XSIZE          ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
580 #define MICROLEV_YSIZE          ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
581 #define MICROLEV_XPOS           (SX + (SXSIZE - MICROLEV_XSIZE) / 2)
582 #define MICROLEV_YPOS           (SX + 12 * TILEY - MICRO_TILEY)
583 #define MICROLABEL_YPOS         (MICROLEV_YPOS + MICROLEV_YSIZE + 7)
584
585
586 /* score for elements */
587 #define SC_EMERALD              0
588 #define SC_DIAMOND              1
589 #define SC_BUG                  2
590 #define SC_SPACESHIP            3
591 #define SC_YAMYAM               4
592 #define SC_ROBOT                5
593 #define SC_PACMAN               6
594 #define SC_NUT                  7
595 #define SC_DYNAMITE             8
596 #define SC_KEY                  9
597 #define SC_TIME_BONUS           10
598 #define SC_CRYSTAL              11
599 #define SC_PEARL                12
600 #define SC_SHIELD               13
601
602
603 /* "real" level file elements */
604 #define EL_UNDEFINED                    -1
605
606 #define EL_EMPTY_SPACE                  0
607 #define EL_EMPTY                        EL_EMPTY_SPACE
608 #define EL_SAND                         1
609 #define EL_WALL                         2
610 #define EL_WALL_SLIPPERY                3
611 #define EL_ROCK                         4
612 #define EL_KEY_OBSOLETE                 5       /* obsolete; now EL_KEY_1 */
613 #define EL_EMERALD                      6
614 #define EL_EXIT_CLOSED                  7
615 #define EL_PLAYER_OBSOLETE              8       /* obsolete; now EL_PLAYER_1 */
616 #define EL_BUG                          9
617 #define EL_SPACESHIP                    10
618 #define EL_YAMYAM                       11
619 #define EL_ROBOT                        12
620 #define EL_STEELWALL                    13
621 #define EL_DIAMOND                      14
622 #define EL_AMOEBA_DEAD                  15
623 #define EL_QUICKSAND_EMPTY              16
624 #define EL_QUICKSAND_FULL               17
625 #define EL_AMOEBA_DROP                  18
626 #define EL_BOMB                         19
627 #define EL_MAGIC_WALL                   20
628 #define EL_SPEED_PILL                   21
629 #define EL_ACID                         22
630 #define EL_AMOEBA_WET                   23
631 #define EL_AMOEBA_DRY                   24
632 #define EL_NUT                          25
633 #define EL_GAME_OF_LIFE                 26
634 #define EL_BIOMAZE                      27
635 #define EL_DYNAMITE_ACTIVE              28
636 #define EL_STONEBLOCK                   29
637 #define EL_ROBOT_WHEEL                  30
638 #define EL_ROBOT_WHEEL_ACTIVE           31
639 #define EL_KEY_1                        32
640 #define EL_KEY_2                        33
641 #define EL_KEY_3                        34
642 #define EL_KEY_4                        35
643 #define EL_GATE_1                       36
644 #define EL_GATE_2                       37
645 #define EL_GATE_3                       38
646 #define EL_GATE_4                       39
647 #define EL_GATE_1_GRAY                  40
648 #define EL_GATE_2_GRAY                  41
649 #define EL_GATE_3_GRAY                  42
650 #define EL_GATE_4_GRAY                  43
651 #define EL_DYNAMITE                     44
652 #define EL_PACMAN                       45
653 #define EL_INVISIBLE_WALL               46
654 #define EL_LAMP                         47
655 #define EL_LAMP_ACTIVE                  48
656 #define EL_WALL_EMERALD                 49
657 #define EL_WALL_DIAMOND                 50
658 #define EL_AMOEBA_FULL                  51
659 #define EL_BD_AMOEBA                    52
660 #define EL_TIME_ORB_FULL                53
661 #define EL_TIME_ORB_EMPTY               54
662 #define EL_EXPANDABLE_WALL              55
663 #define EL_BD_DIAMOND                   56
664 #define EL_EMERALD_YELLOW               57
665 #define EL_WALL_BD_DIAMOND              58
666 #define EL_WALL_EMERALD_YELLOW          59
667 #define EL_DARK_YAMYAM                  60
668 #define EL_BD_MAGIC_WALL                61
669 #define EL_INVISIBLE_STEELWALL          62
670 #define EL_SOKOBAN_FIELD_PLAYER         63
671 #define EL_DYNABOMB_INCREASE_NUMBER     64
672 #define EL_DYNABOMB_INCREASE_SIZE       65
673 #define EL_DYNABOMB_INCREASE_POWER      66
674 #define EL_SOKOBAN_OBJECT               67
675 #define EL_SOKOBAN_FIELD_EMPTY          68
676 #define EL_SOKOBAN_FIELD_FULL           69
677 #define EL_BD_BUTTERFLY_RIGHT           70
678 #define EL_BD_BUTTERFLY_UP              71
679 #define EL_BD_BUTTERFLY_LEFT            72
680 #define EL_BD_BUTTERFLY_DOWN            73
681 #define EL_BD_FIREFLY_RIGHT             74
682 #define EL_BD_FIREFLY_UP                75
683 #define EL_BD_FIREFLY_LEFT              76
684 #define EL_BD_FIREFLY_DOWN              77
685 #define EL_BD_BUTTERFLY_1               EL_BD_BUTTERFLY_DOWN
686 #define EL_BD_BUTTERFLY_2               EL_BD_BUTTERFLY_LEFT
687 #define EL_BD_BUTTERFLY_3               EL_BD_BUTTERFLY_UP
688 #define EL_BD_BUTTERFLY_4               EL_BD_BUTTERFLY_RIGHT
689 #define EL_BD_FIREFLY_1                 EL_BD_FIREFLY_LEFT
690 #define EL_BD_FIREFLY_2                 EL_BD_FIREFLY_DOWN
691 #define EL_BD_FIREFLY_3                 EL_BD_FIREFLY_RIGHT
692 #define EL_BD_FIREFLY_4                 EL_BD_FIREFLY_UP
693 #define EL_BD_BUTTERFLY                 78
694 #define EL_BD_FIREFLY                   79
695 #define EL_PLAYER_1                     80
696 #define EL_PLAYER_2                     81
697 #define EL_PLAYER_3                     82
698 #define EL_PLAYER_4                     83
699 #define EL_BUG_RIGHT                    84
700 #define EL_BUG_UP                       85
701 #define EL_BUG_LEFT                     86
702 #define EL_BUG_DOWN                     87
703 #define EL_SPACESHIP_RIGHT              88
704 #define EL_SPACESHIP_UP                 89
705 #define EL_SPACESHIP_LEFT               90
706 #define EL_SPACESHIP_DOWN               91
707 #define EL_PACMAN_RIGHT                 92
708 #define EL_PACMAN_UP                    93
709 #define EL_PACMAN_LEFT                  94
710 #define EL_PACMAN_DOWN                  95
711 #define EL_EMERALD_RED                  96
712 #define EL_EMERALD_PURPLE               97
713 #define EL_WALL_EMERALD_RED             98
714 #define EL_WALL_EMERALD_PURPLE          99
715 #define EL_ACID_POOL_TOPLEFT            100
716 #define EL_ACID_POOL_TOPRIGHT           101
717 #define EL_ACID_POOL_BOTTOMLEFT         102
718 #define EL_ACID_POOL_BOTTOM             103
719 #define EL_ACID_POOL_BOTTOMRIGHT        104
720 #define EL_BD_WALL                      105
721 #define EL_BD_ROCK                      106
722 #define EL_EXIT_OPEN                    107
723 #define EL_BLACK_ORB                    108
724 #define EL_AMOEBA_TO_DIAMOND            109
725 #define EL_MOLE                         110
726 #define EL_PENGUIN                      111
727 #define EL_SATELLITE                    112
728 #define EL_ARROW_LEFT                   113
729 #define EL_ARROW_RIGHT                  114
730 #define EL_ARROW_UP                     115
731 #define EL_ARROW_DOWN                   116
732 #define EL_PIG                          117
733 #define EL_DRAGON                       118
734
735 #define EL_EM_KEY_1_FILE_OBSOLETE       119     /* obsolete; now EL_EM_KEY_1 */
736
737 #define EL_CHAR_START                   120
738 #define EL_CHAR_ASCII0                  (EL_CHAR_START  - 32)
739 #define EL_CHAR_ASCII0_START            (EL_CHAR_ASCII0 + 32)
740
741 #include "conf_chr.h"   /* include auto-generated data structure definitions */
742
743 #define EL_CHAR_ASCII0_END              (EL_CHAR_ASCII0 + 111)
744 #define EL_CHAR_END                     (EL_CHAR_START  + 79)
745
746 #define EL_CHAR(c)                      (EL_CHAR_ASCII0 + MAP_FONT_ASCII(c))
747
748 #define EL_EXPANDABLE_WALL_HORIZONTAL   200
749 #define EL_EXPANDABLE_WALL_VERTICAL     201
750 #define EL_EXPANDABLE_WALL_ANY          202
751
752 #define EL_EM_GATE_1                    203
753 #define EL_EM_GATE_2                    204
754 #define EL_EM_GATE_3                    205
755 #define EL_EM_GATE_4                    206
756
757 #define EL_EM_KEY_2_FILE_OBSOLETE       207     /* obsolete; now EL_EM_KEY_2 */
758 #define EL_EM_KEY_3_FILE_OBSOLETE       208     /* obsolete; now EL_EM_KEY_3 */
759 #define EL_EM_KEY_4_FILE_OBSOLETE       209     /* obsolete; now EL_EM_KEY_4 */
760
761 #define EL_SP_START                     210
762 #define EL_SP_EMPTY_SPACE               (EL_SP_START + 0)
763 #define EL_SP_EMPTY                     EL_SP_EMPTY_SPACE
764 #define EL_SP_ZONK                      (EL_SP_START + 1)
765 #define EL_SP_BASE                      (EL_SP_START + 2)
766 #define EL_SP_MURPHY                    (EL_SP_START + 3)
767 #define EL_SP_INFOTRON                  (EL_SP_START + 4)
768 #define EL_SP_CHIP_SINGLE               (EL_SP_START + 5)
769 #define EL_SP_HARDWARE_GRAY             (EL_SP_START + 6)
770 #define EL_SP_EXIT_CLOSED               (EL_SP_START + 7)
771 #define EL_SP_DISK_ORANGE               (EL_SP_START + 8)
772 #define EL_SP_PORT_RIGHT                (EL_SP_START + 9)
773 #define EL_SP_PORT_DOWN                 (EL_SP_START + 10)
774 #define EL_SP_PORT_LEFT                 (EL_SP_START + 11)
775 #define EL_SP_PORT_UP                   (EL_SP_START + 12)
776 #define EL_SP_GRAVITY_PORT_RIGHT        (EL_SP_START + 13)
777 #define EL_SP_GRAVITY_PORT_DOWN         (EL_SP_START + 14)
778 #define EL_SP_GRAVITY_PORT_LEFT         (EL_SP_START + 15)
779 #define EL_SP_GRAVITY_PORT_UP           (EL_SP_START + 16)
780 #define EL_SP_SNIKSNAK                  (EL_SP_START + 17)
781 #define EL_SP_DISK_YELLOW               (EL_SP_START + 18)
782 #define EL_SP_TERMINAL                  (EL_SP_START + 19)
783 #define EL_SP_DISK_RED                  (EL_SP_START + 20)
784 #define EL_SP_PORT_VERTICAL             (EL_SP_START + 21)
785 #define EL_SP_PORT_HORIZONTAL           (EL_SP_START + 22)
786 #define EL_SP_PORT_ANY                  (EL_SP_START + 23)
787 #define EL_SP_ELECTRON                  (EL_SP_START + 24)
788 #define EL_SP_BUGGY_BASE                (EL_SP_START + 25)
789 #define EL_SP_CHIP_LEFT                 (EL_SP_START + 26)
790 #define EL_SP_CHIP_RIGHT                (EL_SP_START + 27)
791 #define EL_SP_HARDWARE_BASE_1           (EL_SP_START + 28)
792 #define EL_SP_HARDWARE_GREEN            (EL_SP_START + 29)
793 #define EL_SP_HARDWARE_BLUE             (EL_SP_START + 30)
794 #define EL_SP_HARDWARE_RED              (EL_SP_START + 31)
795 #define EL_SP_HARDWARE_YELLOW           (EL_SP_START + 32)
796 #define EL_SP_HARDWARE_BASE_2           (EL_SP_START + 33)
797 #define EL_SP_HARDWARE_BASE_3           (EL_SP_START + 34)
798 #define EL_SP_HARDWARE_BASE_4           (EL_SP_START + 35)
799 #define EL_SP_HARDWARE_BASE_5           (EL_SP_START + 36)
800 #define EL_SP_HARDWARE_BASE_6           (EL_SP_START + 37)
801 #define EL_SP_CHIP_TOP                  (EL_SP_START + 38)
802 #define EL_SP_CHIP_BOTTOM               (EL_SP_START + 39)
803 #define EL_SP_END                       (EL_SP_START + 39)
804
805 #define EL_EM_GATE_1_GRAY               250
806 #define EL_EM_GATE_2_GRAY               251
807 #define EL_EM_GATE_3_GRAY               252
808 #define EL_EM_GATE_4_GRAY               253
809
810 #define EL_UNUSED_254                   254
811 #define EL_UNUSED_255                   255
812
813 #define EL_PEARL                        256
814 #define EL_CRYSTAL                      257
815 #define EL_WALL_PEARL                   258
816 #define EL_WALL_CRYSTAL                 259
817 #define EL_DOOR_WHITE                   260
818 #define EL_DOOR_WHITE_GRAY              261
819 #define EL_KEY_WHITE                    262
820 #define EL_SHIELD_NORMAL                263
821 #define EL_EXTRA_TIME                   264
822 #define EL_SWITCHGATE_OPEN              265
823 #define EL_SWITCHGATE_CLOSED            266
824 #define EL_SWITCHGATE_SWITCH_UP         267
825 #define EL_SWITCHGATE_SWITCH_DOWN       268
826
827 #define EL_UNUSED_269                   269
828 #define EL_UNUSED_270                   270
829
830 #define EL_CONVEYOR_BELT_1_LEFT          271
831 #define EL_CONVEYOR_BELT_1_MIDDLE        272
832 #define EL_CONVEYOR_BELT_1_RIGHT         273
833 #define EL_CONVEYOR_BELT_1_SWITCH_LEFT   274
834 #define EL_CONVEYOR_BELT_1_SWITCH_MIDDLE 275
835 #define EL_CONVEYOR_BELT_1_SWITCH_RIGHT  276
836 #define EL_CONVEYOR_BELT_2_LEFT          277
837 #define EL_CONVEYOR_BELT_2_MIDDLE        278
838 #define EL_CONVEYOR_BELT_2_RIGHT         279
839 #define EL_CONVEYOR_BELT_2_SWITCH_LEFT   280
840 #define EL_CONVEYOR_BELT_2_SWITCH_MIDDLE 281
841 #define EL_CONVEYOR_BELT_2_SWITCH_RIGHT  282
842 #define EL_CONVEYOR_BELT_3_LEFT          283
843 #define EL_CONVEYOR_BELT_3_MIDDLE        284
844 #define EL_CONVEYOR_BELT_3_RIGHT         285
845 #define EL_CONVEYOR_BELT_3_SWITCH_LEFT   286
846 #define EL_CONVEYOR_BELT_3_SWITCH_MIDDLE 287
847 #define EL_CONVEYOR_BELT_3_SWITCH_RIGHT  288
848 #define EL_CONVEYOR_BELT_4_LEFT          289
849 #define EL_CONVEYOR_BELT_4_MIDDLE        290
850 #define EL_CONVEYOR_BELT_4_RIGHT         291
851 #define EL_CONVEYOR_BELT_4_SWITCH_LEFT   292
852 #define EL_CONVEYOR_BELT_4_SWITCH_MIDDLE 293
853 #define EL_CONVEYOR_BELT_4_SWITCH_RIGHT  294
854 #define EL_LANDMINE                     295
855 #define EL_ENVELOPE_OBSOLETE            296   /* obsolete; now EL_ENVELOPE_1 */
856 #define EL_LIGHT_SWITCH                 297
857 #define EL_LIGHT_SWITCH_ACTIVE          298
858 #define EL_SIGN_EXCLAMATION             299
859 #define EL_SIGN_RADIOACTIVITY           300
860 #define EL_SIGN_STOP                    301
861 #define EL_SIGN_WHEELCHAIR              302
862 #define EL_SIGN_PARKING                 303
863 #define EL_SIGN_ONEWAY                  304
864 #define EL_SIGN_HEART                   305
865 #define EL_SIGN_TRIANGLE                306
866 #define EL_SIGN_ROUND                   307
867 #define EL_SIGN_EXIT                    308
868 #define EL_SIGN_YINYANG                 309
869 #define EL_SIGN_OTHER                   310
870 #define EL_MOLE_LEFT                    311
871 #define EL_MOLE_RIGHT                   312
872 #define EL_MOLE_UP                      313
873 #define EL_MOLE_DOWN                    314
874 #define EL_STEELWALL_SLIPPERY           315
875 #define EL_INVISIBLE_SAND               316
876 #define EL_DX_UNKNOWN_15                317
877 #define EL_DX_UNKNOWN_42                318
878
879 #define EL_UNUSED_319                   319
880 #define EL_UNUSED_320                   320
881
882 #define EL_SHIELD_DEADLY                321
883 #define EL_TIMEGATE_OPEN                322
884 #define EL_TIMEGATE_CLOSED              323
885 #define EL_TIMEGATE_SWITCH_ACTIVE       324
886 #define EL_TIMEGATE_SWITCH              325
887
888 #define EL_BALLOON                      326
889 #define EL_BALLOON_SWITCH_LEFT          327
890 #define EL_BALLOON_SWITCH_RIGHT         328
891 #define EL_BALLOON_SWITCH_UP            329
892 #define EL_BALLOON_SWITCH_DOWN          330
893 #define EL_BALLOON_SWITCH_ANY           331
894
895 #define EL_EMC_STEELWALL_1              332
896 #define EL_EMC_STEELWALL_2              333
897 #define EL_EMC_STEELWALL_3              334
898 #define EL_EMC_STEELWALL_4              335
899 #define EL_EMC_WALL_1                   336
900 #define EL_EMC_WALL_2                   337
901 #define EL_EMC_WALL_3                   338
902 #define EL_EMC_WALL_4                   339
903 #define EL_EMC_WALL_5                   340
904 #define EL_EMC_WALL_6                   341
905 #define EL_EMC_WALL_7                   342
906 #define EL_EMC_WALL_8                   343
907
908 #define EL_TUBE_ANY                     344
909 #define EL_TUBE_VERTICAL                345
910 #define EL_TUBE_HORIZONTAL              346
911 #define EL_TUBE_VERTICAL_LEFT           347
912 #define EL_TUBE_VERTICAL_RIGHT          348
913 #define EL_TUBE_HORIZONTAL_UP           349
914 #define EL_TUBE_HORIZONTAL_DOWN         350
915 #define EL_TUBE_LEFT_UP                 351
916 #define EL_TUBE_LEFT_DOWN               352
917 #define EL_TUBE_RIGHT_UP                353
918 #define EL_TUBE_RIGHT_DOWN              354
919 #define EL_SPRING                       355
920 #define EL_TRAP                         356
921 #define EL_DX_SUPABOMB                  357
922
923 #define EL_UNUSED_358                   358
924 #define EL_UNUSED_359                   359
925
926 /* ---------- begin of custom elements section ----------------------------- */
927 #define EL_CUSTOM_START                 360
928
929 #include "conf_cus.h"   /* include auto-generated data structure definitions */
930
931 #define NUM_CUSTOM_ELEMENTS             256
932 #define EL_CUSTOM_END                   615
933 /* ---------- end of custom elements section ------------------------------- */
934
935 #define EL_EM_KEY_1                     616
936 #define EL_EM_KEY_2                     617
937 #define EL_EM_KEY_3                     618
938 #define EL_EM_KEY_4                     619
939 #define EL_ENVELOPE_1                   620
940 #define EL_ENVELOPE_2                   621
941 #define EL_ENVELOPE_3                   622
942 #define EL_ENVELOPE_4                   623
943
944 /* ---------- begin of group elements section ------------------------------ */
945 #define EL_GROUP_START                  624
946
947 #include "conf_grp.h"   /* include auto-generated data structure definitions */
948
949 #define NUM_GROUP_ELEMENTS              32
950 #define EL_GROUP_END                    655
951 /* ---------- end of custom elements section ------------------------------- */
952
953 #define EL_UNKNOWN                      656
954 #define EL_TRIGGER_ELEMENT              657
955 #define EL_TRIGGER_PLAYER               658
956
957 #define EL_SP_GRAVITY_ON_PORT_RIGHT     659
958 #define EL_SP_GRAVITY_ON_PORT_DOWN      660
959 #define EL_SP_GRAVITY_ON_PORT_LEFT      661
960 #define EL_SP_GRAVITY_ON_PORT_UP        662
961 #define EL_SP_GRAVITY_OFF_PORT_RIGHT    663
962 #define EL_SP_GRAVITY_OFF_PORT_DOWN     664
963 #define EL_SP_GRAVITY_OFF_PORT_LEFT     665
964 #define EL_SP_GRAVITY_OFF_PORT_UP       666
965
966
967 /* the following EMC style elements are currently not implemented in R'n'D */
968 #define EL_BALLOON_SWITCH_NONE          667
969 #define EL_EM_GATE_5                    668
970 #define EL_EM_GATE_6                    669
971 #define EL_EM_GATE_7                    670
972 #define EL_EM_GATE_8                    671
973 #define EL_EM_GATE_5_GRAY               672
974 #define EL_EM_GATE_6_GRAY               673
975 #define EL_EM_GATE_7_GRAY               674
976 #define EL_EM_GATE_8_GRAY               675
977 #define EL_EM_KEY_5                     676
978 #define EL_EM_KEY_6                     677
979 #define EL_EM_KEY_7                     678
980 #define EL_EM_KEY_8                     679
981 #define EL_EMC_ANDROID                  680
982 #define EL_EMC_GRASS                    681
983 #define EL_EMC_MAGIC_BALL               682
984 #define EL_EMC_MAGIC_BALL_ACTIVE        683
985 #define EL_EMC_MAGIC_BALL_SWITCH        684
986 #define EL_EMC_MAGIC_BALL_SWITCH_ACTIVE 685
987 #define EL_EMC_SPRING_BUMPER            686
988 #define EL_EMC_PLANT                    687
989 #define EL_EMC_LENSES                   688
990 #define EL_EMC_MAGNIFIER                689
991 #define EL_EMC_WALL_9                   690
992 #define EL_EMC_WALL_10                  691
993 #define EL_EMC_WALL_11                  692
994 #define EL_EMC_WALL_12                  693
995 #define EL_EMC_WALL_13                  694
996 #define EL_EMC_WALL_14                  695
997 #define EL_EMC_WALL_15                  696
998 #define EL_EMC_WALL_16                  697
999 #define EL_EMC_WALL_SLIPPERY_1          698
1000 #define EL_EMC_WALL_SLIPPERY_2          699
1001 #define EL_EMC_WALL_SLIPPERY_3          700
1002 #define EL_EMC_WALL_SLIPPERY_4          701
1003 #define EL_EMC_FAKE_GRASS               702
1004 #define EL_EMC_FAKE_ACID                703
1005 #define EL_EMC_DRIPPER                  704
1006
1007 #define NUM_FILE_ELEMENTS               705
1008
1009
1010 /* "real" (and therefore drawable) runtime elements */
1011 #define EL_FIRST_RUNTIME_REAL           NUM_FILE_ELEMENTS
1012
1013 #define EL_DYNABOMB_PLAYER_1_ACTIVE     (EL_FIRST_RUNTIME_REAL + 0)
1014 #define EL_DYNABOMB_PLAYER_2_ACTIVE     (EL_FIRST_RUNTIME_REAL + 1)
1015 #define EL_DYNABOMB_PLAYER_3_ACTIVE     (EL_FIRST_RUNTIME_REAL + 2)
1016 #define EL_DYNABOMB_PLAYER_4_ACTIVE     (EL_FIRST_RUNTIME_REAL + 3)
1017 #define EL_SP_DISK_RED_ACTIVE           (EL_FIRST_RUNTIME_REAL + 4)
1018 #define EL_SWITCHGATE_OPENING           (EL_FIRST_RUNTIME_REAL + 5)
1019 #define EL_SWITCHGATE_CLOSING           (EL_FIRST_RUNTIME_REAL + 6)
1020 #define EL_TIMEGATE_OPENING             (EL_FIRST_RUNTIME_REAL + 7)
1021 #define EL_TIMEGATE_CLOSING             (EL_FIRST_RUNTIME_REAL + 8)
1022 #define EL_PEARL_BREAKING               (EL_FIRST_RUNTIME_REAL + 9)
1023 #define EL_TRAP_ACTIVE                  (EL_FIRST_RUNTIME_REAL + 10)
1024 #define EL_INVISIBLE_STEELWALL_ACTIVE   (EL_FIRST_RUNTIME_REAL + 11)
1025 #define EL_INVISIBLE_WALL_ACTIVE        (EL_FIRST_RUNTIME_REAL + 12)
1026 #define EL_INVISIBLE_SAND_ACTIVE        (EL_FIRST_RUNTIME_REAL + 13)
1027 #define EL_CONVEYOR_BELT_1_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 14)
1028 #define EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 15)
1029 #define EL_CONVEYOR_BELT_1_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 16)
1030 #define EL_CONVEYOR_BELT_2_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 17)
1031 #define EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 18)
1032 #define EL_CONVEYOR_BELT_2_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 19)
1033 #define EL_CONVEYOR_BELT_3_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 20)
1034 #define EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 21)
1035 #define EL_CONVEYOR_BELT_3_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 22)
1036 #define EL_CONVEYOR_BELT_4_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 23)
1037 #define EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 24)
1038 #define EL_CONVEYOR_BELT_4_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 25)
1039 #define EL_EXIT_OPENING                 (EL_FIRST_RUNTIME_REAL + 26)
1040 #define EL_EXIT_CLOSING                 (EL_FIRST_RUNTIME_REAL + 27)
1041 #define EL_SP_EXIT_OPENING              (EL_FIRST_RUNTIME_REAL + 28)
1042 #define EL_SP_EXIT_CLOSING              (EL_FIRST_RUNTIME_REAL + 29)
1043 #define EL_SP_EXIT_OPEN                 (EL_FIRST_RUNTIME_REAL + 30)
1044 #define EL_SP_TERMINAL_ACTIVE           (EL_FIRST_RUNTIME_REAL + 31)
1045 #define EL_SP_BUGGY_BASE_ACTIVATING     (EL_FIRST_RUNTIME_REAL + 32)
1046 #define EL_SP_BUGGY_BASE_ACTIVE         (EL_FIRST_RUNTIME_REAL + 33)
1047 #define EL_SP_MURPHY_CLONE              (EL_FIRST_RUNTIME_REAL + 34)
1048 #define EL_AMOEBA_DROPPING              (EL_FIRST_RUNTIME_REAL + 35)
1049 #define EL_QUICKSAND_EMPTYING           (EL_FIRST_RUNTIME_REAL + 36)
1050 #define EL_MAGIC_WALL_ACTIVE            (EL_FIRST_RUNTIME_REAL + 37)
1051 #define EL_BD_MAGIC_WALL_ACTIVE         (EL_FIRST_RUNTIME_REAL + 38)
1052 #define EL_MAGIC_WALL_FULL              (EL_FIRST_RUNTIME_REAL + 39)
1053 #define EL_BD_MAGIC_WALL_FULL           (EL_FIRST_RUNTIME_REAL + 40)
1054 #define EL_MAGIC_WALL_EMPTYING          (EL_FIRST_RUNTIME_REAL + 41)
1055 #define EL_BD_MAGIC_WALL_EMPTYING       (EL_FIRST_RUNTIME_REAL + 42)
1056 #define EL_MAGIC_WALL_DEAD              (EL_FIRST_RUNTIME_REAL + 43)
1057 #define EL_BD_MAGIC_WALL_DEAD           (EL_FIRST_RUNTIME_REAL + 44)
1058
1059 /* "unreal" (and therefore not drawable) runtime elements */
1060 #define EL_FIRST_RUNTIME_UNREAL         (EL_FIRST_RUNTIME_REAL + 45)
1061
1062 #define EL_BLOCKED                      (EL_FIRST_RUNTIME_UNREAL + 0)
1063 #define EL_EXPLOSION                    (EL_FIRST_RUNTIME_UNREAL + 1)
1064 #define EL_NUT_BREAKING                 (EL_FIRST_RUNTIME_UNREAL + 2)
1065 #define EL_DIAMOND_BREAKING             (EL_FIRST_RUNTIME_UNREAL + 3)
1066 #define EL_ACID_SPLASH_LEFT             (EL_FIRST_RUNTIME_UNREAL + 4)
1067 #define EL_ACID_SPLASH_RIGHT            (EL_FIRST_RUNTIME_UNREAL + 5)
1068 #define EL_AMOEBA_GROWING               (EL_FIRST_RUNTIME_UNREAL + 6)
1069 #define EL_AMOEBA_SHRINKING             (EL_FIRST_RUNTIME_UNREAL + 7)
1070 #define EL_EXPANDABLE_WALL_GROWING      (EL_FIRST_RUNTIME_UNREAL + 8)
1071 #define EL_FLAMES                       (EL_FIRST_RUNTIME_UNREAL + 9)
1072 #define EL_PLAYER_IS_LEAVING            (EL_FIRST_RUNTIME_UNREAL + 10)
1073 #define EL_PLAYER_IS_EXPLODING_1        (EL_FIRST_RUNTIME_UNREAL + 11)
1074 #define EL_PLAYER_IS_EXPLODING_2        (EL_FIRST_RUNTIME_UNREAL + 12)
1075 #define EL_PLAYER_IS_EXPLODING_3        (EL_FIRST_RUNTIME_UNREAL + 13)
1076 #define EL_PLAYER_IS_EXPLODING_4        (EL_FIRST_RUNTIME_UNREAL + 14)
1077 #define EL_QUICKSAND_FILLING            (EL_FIRST_RUNTIME_UNREAL + 15)
1078 #define EL_MAGIC_WALL_FILLING           (EL_FIRST_RUNTIME_UNREAL + 16)
1079 #define EL_BD_MAGIC_WALL_FILLING        (EL_FIRST_RUNTIME_UNREAL + 17)
1080
1081 /* dummy elements (never used as game elements, only used as graphics) */
1082 #define EL_FIRST_DUMMY                  (EL_FIRST_RUNTIME_UNREAL + 18)
1083
1084 #define EL_STEELWALL_TOPLEFT            (EL_FIRST_DUMMY + 0)
1085 #define EL_STEELWALL_TOPRIGHT           (EL_FIRST_DUMMY + 1)
1086 #define EL_STEELWALL_BOTTOMLEFT         (EL_FIRST_DUMMY + 2)
1087 #define EL_STEELWALL_BOTTOMRIGHT        (EL_FIRST_DUMMY + 3)
1088 #define EL_STEELWALL_HORIZONTAL         (EL_FIRST_DUMMY + 4)
1089 #define EL_STEELWALL_VERTICAL           (EL_FIRST_DUMMY + 5)
1090 #define EL_INVISIBLE_STEELWALL_TOPLEFT     (EL_FIRST_DUMMY + 6)
1091 #define EL_INVISIBLE_STEELWALL_TOPRIGHT    (EL_FIRST_DUMMY + 7)
1092 #define EL_INVISIBLE_STEELWALL_BOTTOMLEFT  (EL_FIRST_DUMMY + 8)
1093 #define EL_INVISIBLE_STEELWALL_BOTTOMRIGHT (EL_FIRST_DUMMY + 9)
1094 #define EL_INVISIBLE_STEELWALL_HORIZONTAL  (EL_FIRST_DUMMY + 10)
1095 #define EL_INVISIBLE_STEELWALL_VERTICAL    (EL_FIRST_DUMMY + 11)
1096 #define EL_DYNABOMB                     (EL_FIRST_DUMMY + 12)
1097 #define EL_DYNABOMB_ACTIVE              (EL_FIRST_DUMMY + 13)
1098 #define EL_DYNABOMB_PLAYER_1            (EL_FIRST_DUMMY + 14)
1099 #define EL_DYNABOMB_PLAYER_2            (EL_FIRST_DUMMY + 15)
1100 #define EL_DYNABOMB_PLAYER_3            (EL_FIRST_DUMMY + 16)
1101 #define EL_DYNABOMB_PLAYER_4            (EL_FIRST_DUMMY + 17)
1102 #define EL_SHIELD_NORMAL_ACTIVE         (EL_FIRST_DUMMY + 18)
1103 #define EL_SHIELD_DEADLY_ACTIVE         (EL_FIRST_DUMMY + 19)
1104 #define EL_AMOEBA                       (EL_FIRST_DUMMY + 20)
1105 #define EL_DEFAULT                      (EL_FIRST_DUMMY + 21)
1106 #define EL_BD_DEFAULT                   (EL_FIRST_DUMMY + 22)
1107 #define EL_SP_DEFAULT                   (EL_FIRST_DUMMY + 23)
1108 #define EL_SB_DEFAULT                   (EL_FIRST_DUMMY + 24)
1109
1110 /* internal elements (only used for internal purposes like copying) */
1111 #define EL_FIRST_INTERNAL               (EL_FIRST_DUMMY + 25)
1112
1113 #define EL_INTERNAL_CLIPBOARD_CUSTOM    (EL_FIRST_INTERNAL + 0)
1114 #define EL_INTERNAL_CLIPBOARD_CHANGE    (EL_FIRST_INTERNAL + 1)
1115 #define EL_INTERNAL_CLIPBOARD_GROUP     (EL_FIRST_INTERNAL + 2)
1116 #define EL_INTERNAL_DUMMY               (EL_FIRST_INTERNAL + 3)
1117
1118 #define EL_INTERNAL_CLIPBOARD_START     (EL_FIRST_INTERNAL + 0)
1119 #define EL_INTERNAL_CLIPBOARD_END       (EL_FIRST_INTERNAL + 2)
1120 #define EL_INTERNAL_START               (EL_FIRST_INTERNAL + 0)
1121 #define EL_INTERNAL_END                 (EL_FIRST_INTERNAL + 3)
1122
1123 #define MAX_NUM_ELEMENTS                (EL_FIRST_INTERNAL + 4)
1124
1125
1126 /* values for graphics/sounds action types */
1127 #define ACTION_DEFAULT                  0
1128 #define ACTION_WAITING                  1
1129 #define ACTION_FALLING                  2
1130 #define ACTION_MOVING                   3
1131 #define ACTION_DIGGING                  4
1132 #define ACTION_SNAPPING                 5
1133 #define ACTION_COLLECTING               6
1134 #define ACTION_DROPPING                 7
1135 #define ACTION_PUSHING                  8
1136 #define ACTION_WALKING                  9
1137 #define ACTION_PASSING                  10
1138 #define ACTION_IMPACT                   11
1139 #define ACTION_BREAKING                 12
1140 #define ACTION_ACTIVATING               13
1141 #define ACTION_DEACTIVATING             14
1142 #define ACTION_OPENING                  15
1143 #define ACTION_CLOSING                  16
1144 #define ACTION_ATTACKING                17
1145 #define ACTION_GROWING                  18
1146 #define ACTION_SHRINKING                19
1147 #define ACTION_ACTIVE                   20
1148 #define ACTION_FILLING                  21
1149 #define ACTION_EMPTYING                 22
1150 #define ACTION_CHANGING                 23
1151 #define ACTION_EXPLODING                24
1152 #define ACTION_BORING                   25
1153 #define ACTION_BORING_1                 26
1154 #define ACTION_BORING_2                 27
1155 #define ACTION_BORING_3                 28
1156 #define ACTION_BORING_4                 29
1157 #define ACTION_BORING_5                 30
1158 #define ACTION_BORING_6                 31
1159 #define ACTION_BORING_7                 32
1160 #define ACTION_BORING_8                 33
1161 #define ACTION_BORING_9                 34
1162 #define ACTION_BORING_10                35
1163 #define ACTION_SLEEPING                 36
1164 #define ACTION_SLEEPING_1               37
1165 #define ACTION_SLEEPING_2               38
1166 #define ACTION_SLEEPING_3               39
1167 #define ACTION_AWAKENING                40
1168 #define ACTION_DYING                    41
1169 #define ACTION_TURNING                  42
1170 #define ACTION_TURNING_FROM_LEFT        43
1171 #define ACTION_TURNING_FROM_RIGHT       44
1172 #define ACTION_TURNING_FROM_UP          45
1173 #define ACTION_TURNING_FROM_DOWN        46
1174 #define ACTION_SMASHED_BY_ROCK          47
1175 #define ACTION_SMASHED_BY_SPRING        48
1176 #define ACTION_SLURPED_BY_SPRING        49
1177 #define ACTION_TWINKLING                50
1178 #define ACTION_OTHER                    51
1179
1180 #define NUM_ACTIONS                     52
1181
1182 #define ACTION_BORING_LAST              ACTION_BORING_10
1183 #define ACTION_SLEEPING_LAST            ACTION_SLEEPING_3
1184
1185
1186 /* values for special image configuration suffixes (must match game mode) */
1187 #define GFX_SPECIAL_ARG_DEFAULT         0
1188 #define GFX_SPECIAL_ARG_MAIN            1
1189 #define GFX_SPECIAL_ARG_LEVELS          2
1190 #define GFX_SPECIAL_ARG_SCORES          3
1191 #define GFX_SPECIAL_ARG_EDITOR          4
1192 #define GFX_SPECIAL_ARG_INFO            5
1193 #define GFX_SPECIAL_ARG_SETUP           6
1194 #define GFX_SPECIAL_ARG_PLAYING         7
1195 #define GFX_SPECIAL_ARG_DOOR            8
1196 #define GFX_SPECIAL_ARG_PREVIEW         9
1197 #define GFX_SPECIAL_ARG_CRUMBLED        10
1198
1199 #define NUM_SPECIAL_GFX_ARGS            11
1200
1201
1202 /* values for image configuration suffixes */
1203 #define GFX_ARG_X                       0
1204 #define GFX_ARG_Y                       1
1205 #define GFX_ARG_XPOS                    2
1206 #define GFX_ARG_YPOS                    3
1207 #define GFX_ARG_WIDTH                   4
1208 #define GFX_ARG_HEIGHT                  5
1209 #define GFX_ARG_VERTICAL                6
1210 #define GFX_ARG_OFFSET                  7
1211 #define GFX_ARG_XOFFSET                 8
1212 #define GFX_ARG_YOFFSET                 9
1213 #define GFX_ARG_2ND_MOVEMENT_TILE       10
1214 #define GFX_ARG_2ND_VERTICAL            11
1215 #define GFX_ARG_2ND_OFFSET              12
1216 #define GFX_ARG_2ND_XOFFSET             13
1217 #define GFX_ARG_2ND_YOFFSET             14
1218 #define GFX_ARG_2ND_SWAP_TILES          15      
1219 #define GFX_ARG_FRAMES                  16
1220 #define GFX_ARG_FRAMES_PER_LINE         17
1221 #define GFX_ARG_START_FRAME             18
1222 #define GFX_ARG_DELAY                   19
1223 #define GFX_ARG_ANIM_MODE               20
1224 #define GFX_ARG_GLOBAL_SYNC             21
1225 #define GFX_ARG_CRUMBLED_LIKE           22
1226 #define GFX_ARG_DIGGABLE_LIKE           23
1227 #define GFX_ARG_BORDER_SIZE             24
1228 #define GFX_ARG_STEP_OFFSET             25
1229 #define GFX_ARG_STEP_DELAY              26
1230 #define GFX_ARG_DIRECTION               27
1231 #define GFX_ARG_POSITION                28
1232 #define GFX_ARG_DRAW_XOFFSET            29
1233 #define GFX_ARG_DRAW_YOFFSET            30
1234 #define GFX_ARG_DRAW_MASKED             31
1235 #define GFX_ARG_ANIM_DELAY_FIXED        32
1236 #define GFX_ARG_ANIM_DELAY_RANDOM       33
1237 #define GFX_ARG_POST_DELAY_FIXED        34
1238 #define GFX_ARG_POST_DELAY_RANDOM       35
1239 #define GFX_ARG_NAME                    36
1240 #define GFX_ARG_SCALE_UP_FACTOR         37
1241
1242 #define NUM_GFX_ARGS                    38
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           2
1327 #define PROGRAM_VERSION_PATCH           0
1328 #define PROGRAM_VERSION_BUILD           2
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 swap_double_tiles;        /* explicitely force or forbid tile swapping */
1908   int anim_frames;
1909   int anim_frames_per_line;
1910   int anim_start_frame;
1911   int anim_delay;               /* important: delay of 1 means "no delay"! */
1912   int anim_mode;
1913   boolean anim_global_sync;
1914   int crumbled_like;            /* element for cloning crumble graphics */
1915   int diggable_like;            /* element for cloning digging graphics */
1916   int border_size;              /* border size for "crumbled" graphics */
1917   int scale_up_factor;          /* optional factor for scaling image up */
1918
1919   int anim_delay_fixed;         /* optional delay values for bored and   */
1920   int anim_delay_random;        /* sleeping player animations (animation */
1921   int post_delay_fixed;         /* intervall and following pause before  */
1922   int post_delay_random;        /* next intervall (bored animation only) */
1923
1924   int step_offset;              /* optional step offset of toon animations */
1925   int step_delay;               /* optional step delay of toon animations */
1926
1927   int draw_x, draw_y;           /* optional offset for drawing fonts chars */
1928
1929   int draw_masked;              /* optional setting for drawing envelope gfx */
1930
1931 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
1932   Pixmap clip_mask;             /* single-graphic-only clip mask for X11 */
1933   GC clip_gc;                   /* single-graphic-only clip gc for X11 */
1934 #endif
1935 };
1936
1937 struct SoundInfo
1938 {
1939   boolean loop;
1940   int volume;
1941   int priority;
1942 };
1943
1944 struct MusicInfo
1945 {
1946   boolean loop;
1947 };
1948
1949 struct MusicPrefixInfo
1950 {
1951   char *prefix;
1952   boolean is_loop_music;
1953 };
1954
1955 struct MusicFileInfo
1956 {
1957   char *basename;
1958
1959   char *title_header;
1960   char *artist_header;
1961   char *album_header;
1962   char *year_header;
1963
1964   char *title;
1965   char *artist;
1966   char *album;
1967   char *year;
1968
1969   int music;
1970
1971   boolean is_sound;
1972
1973   struct MusicFileInfo *next;
1974 };
1975
1976 struct ElementActionInfo
1977 {
1978   char *suffix;
1979   int value;
1980   boolean is_loop_sound;
1981 };
1982
1983 struct ElementDirectionInfo
1984 {
1985   char *suffix;
1986   int value;
1987 };
1988
1989 struct SpecialSuffixInfo
1990 {
1991   char *suffix;
1992   int value;
1993 };
1994
1995 struct HelpAnimInfo
1996 {
1997   int element;
1998   int action;
1999   int direction;
2000
2001   int delay;
2002 };
2003
2004
2005 #if 0
2006 extern GC                       tile_clip_gc;
2007 extern Bitmap                  *pix[];
2008 #endif
2009 extern Bitmap                  *bitmap_db_field, *bitmap_db_door;
2010 extern Pixmap                   tile_clipmask[];
2011 extern DrawBuffer             *fieldbuffer;
2012 extern DrawBuffer             *drawto_field;
2013
2014 extern int                      game_status;
2015 extern boolean                  level_editor_test_game;
2016 extern boolean                  network_playing;
2017
2018 #if defined(TARGET_SDL)
2019 extern boolean                  network_server;
2020 extern SDL_Thread              *server_thread;
2021 #endif
2022
2023 extern int                      key_joystick_mapping;
2024
2025 extern boolean                  redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
2026 extern int                      redraw_x1, redraw_y1;
2027
2028 extern short                    Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2029 extern short                    MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2030 extern short                    MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2031 extern short                    MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2032 extern short                    ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2033 extern short                    ChangePage[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2034 extern short                    Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2035 extern short                    Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2036 extern short                    StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2037 extern short                    Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2038 extern boolean                  Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2039 extern boolean                  Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2040 extern unsigned long            Changed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2041 extern unsigned long            ChangeEvent[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2042 extern short                    WasJustMoving[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2043 extern short                    WasJustFalling[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2044 extern short                    CheckCollision[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2045 extern short                    AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2046 extern short                    AmoebaCnt[MAX_NUM_AMOEBA];
2047 extern short                    AmoebaCnt2[MAX_NUM_AMOEBA];
2048 extern short                    ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2049 extern short                    ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2050 extern short                    ExplodeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2051 extern int                      RunnerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2052 extern int                      PlayerVisit[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2053
2054 extern unsigned long            Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
2055
2056 extern int                      GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2057 extern int                      GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2058 extern int                      GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2059 extern int                      GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2060 extern int                      GfxDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
2061
2062 extern int                      lev_fieldx, lev_fieldy;
2063 extern int                      scroll_x, scroll_y;
2064
2065 extern int                      FX, FY;
2066 extern int                      ScrollStepSize;
2067 extern int                      ScreenMovDir, ScreenMovPos, ScreenGfxPos;
2068 extern int                      BorderElement;
2069 extern int                      GameFrameDelay;
2070 extern int                      FfwdFrameDelay;
2071 extern int                      BX1, BY1;
2072 extern int                      BX2, BY2;
2073 extern int                      SBX_Left, SBX_Right;
2074 extern int                      SBY_Upper, SBY_Lower;
2075 extern int                      ZX, ZY;
2076 extern int                      ExitX, ExitY;
2077 extern int                      AllPlayersGone;
2078
2079 extern int                      TimeFrames, TimePlayed, TimeLeft, TapeTime;
2080 extern boolean                  SiebAktiv;
2081 extern int                      SiebCount;
2082
2083 extern boolean                  network_player_action_received;
2084
2085 extern int                      graphics_action_mapping[];
2086
2087 extern struct LevelSetInfo      levelset;
2088 extern struct LevelInfo         level, level_template;
2089 extern struct PlayerInfo        stored_player[], *local_player;
2090 extern struct HiScore           highscore[];
2091 extern struct TapeInfo          tape;
2092 extern struct GameInfo          game;
2093 extern struct GlobalInfo        global;
2094 extern struct MenuInfo          menu;
2095 extern struct DoorInfo          door_1, door_2;
2096 extern struct ElementInfo       element_info[];
2097 extern struct ElementNameInfo   element_name_info[];
2098 extern struct ElementActionInfo element_action_info[];
2099 extern struct ElementDirectionInfo element_direction_info[];
2100 extern struct SpecialSuffixInfo special_suffix_info[];
2101 extern struct TokenIntPtrInfo   image_config_vars[];
2102 extern struct FontInfo          font_info[];
2103 extern struct MusicPrefixInfo   music_prefix_info[];
2104 extern struct GraphicInfo      *graphic_info;
2105 extern struct SoundInfo        *sound_info;
2106 extern struct MusicInfo        *music_info;
2107 extern struct MusicFileInfo    *music_file_info;
2108 extern struct HelpAnimInfo     *helpanim_info;
2109 extern SetupFileHash           *helptext_info;
2110 extern struct ConfigTypeInfo    image_config_suffix[];
2111 extern struct ConfigTypeInfo    sound_config_suffix[];
2112 extern struct ConfigTypeInfo    music_config_suffix[];
2113 extern struct ConfigInfo        image_config[];
2114 extern struct ConfigInfo        sound_config[];
2115 extern struct ConfigInfo        music_config[];
2116 extern struct ConfigInfo        helpanim_config[];
2117 extern struct ConfigInfo        helptext_config[];
2118
2119 #endif  /* MAIN_H */