rnd-20030807-1-src
[rocksndiamonds.git] / src / main.h
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * main.h                                                   *
12 ***********************************************************/
13
14 #ifndef MAIN_H
15 #define MAIN_H
16
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <string.h>
20 #include <time.h>
21 #include <sys/time.h>
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 #include <errno.h>
25 #include <unistd.h>
26 #include <fcntl.h>
27
28 #include "libgame/libgame.h"
29
30 #include "conf_gfx.h"   /* include auto-generated data structure definitions */
31 #include "conf_snd.h"   /* include auto-generated data structure definitions */
32
33 #define IMG_UNDEFINED           (-1)
34 #define IMG_EMPTY               IMG_EMPTY_SPACE
35 #define IMG_SP_EMPTY            IMG_SP_EMPTY_SPACE
36 #define IMG_EXPLOSION           IMG_DEFAULT_EXPLODING
37 #define IMG_CHAR_START          IMG_CHAR_SPACE
38 #define IMG_CUSTOM_START        IMG_CUSTOM_1
39
40 #define SND_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          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_CAN_EXPLODE_BY_FIRE  13
79 #define EP_CAN_EXPLODE_SMASHED  14
80 #define EP_CAN_EXPLODE_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_UNUSED_22            22
88 #define EP_UNUSED_23            23
89 #define EP_PUSHABLE             24
90
91 /* values for special configurable properties (depending on level settings) */
92 #define EP_EM_SLIPPERY_WALL     32
93
94 /* values for special graphics properties (no effect on game engine) */
95 #define EP_CAN_BE_CRUMBLED      33
96
97 /* values for pre-defined properties */
98 #define EP_PLAYER               34
99 #define EP_CAN_PASS_MAGIC_WALL  35
100 #define EP_SWITCHABLE           36
101 #define EP_BD_ELEMENT           37
102 #define EP_SP_ELEMENT           38
103 #define EP_SB_ELEMENT           39
104 #define EP_GEM                  40
105 #define EP_FOOD_DARK_YAMYAM     41
106 #define EP_FOOD_PENGUIN         42
107 #define EP_FOOD_PIG             43
108 #define EP_HISTORIC_WALL        44
109 #define EP_HISTORIC_SOLID       45
110 #define EP_CLASSIC_ENEMY        46
111 #define EP_BELT                 47
112 #define EP_BELT_ACTIVE          48
113 #define EP_BELT_SWITCH          49
114 #define EP_TUBE                 50
115 #define EP_KEYGATE              51
116 #define EP_AMOEBOID             52
117 #define EP_AMOEBALIVE           53
118 #define EP_HAS_CONTENT          54
119 #define EP_ACTIVE_BOMB          55
120 #define EP_INACTIVE             56
121
122 /* values for derived properties (determined from properties above) */
123 #define EP_ACCESSIBLE_OVER      57
124 #define EP_ACCESSIBLE_INSIDE    58
125 #define EP_ACCESSIBLE_UNDER     59
126 #define EP_WALKABLE             60
127 #define EP_PASSABLE             61
128 #define EP_ACCESSIBLE           62
129 #define EP_SNAPPABLE            63
130 #define EP_WALL                 64
131 #define EP_SOLID_FOR_PUSHING    65
132 #define EP_DRAGONFIRE_PROOF     66
133 #define EP_EXPLOSION_PROOF      67
134 #define EP_CAN_SMASH            68
135 #define EP_CAN_EXPLODE          69
136
137 /* values for internal purpose only (level editor) */
138 #define EP_EXPLODE_RESULT       70
139 #define EP_WALK_TO_OBJECT       71
140 #define EP_DEADLY               72
141
142 #define NUM_ELEMENT_PROPERTIES  73
143
144 #define NUM_EP_BITFIELDS        ((NUM_ELEMENT_PROPERTIES + 31) / 32)
145 #define EP_BITFIELD_BASE        0
146
147 #define EP_BITMASK_DEFAULT      0
148
149 #define PROPERTY_BIT(p)         (1 << ((p) % 32))
150 #define PROPERTY_VAR(e,p)       (Properties[e][(p) / 32])
151 #define HAS_PROPERTY(e,p)       ((PROPERTY_VAR(e, p) & PROPERTY_BIT(p)) != 0)
152 #define SET_PROPERTY(e,p,v)     ((v) ?                                     \
153                                  (PROPERTY_VAR(e,p) |=  PROPERTY_BIT(p)) : \
154                                  (PROPERTY_VAR(e,p) &= ~PROPERTY_BIT(p)))
155
156
157 /* values for change events for custom elements */
158 #define CE_DELAY                0
159 #define CE_TOUCHED_BY_PLAYER    1
160 #define CE_PRESSED_BY_PLAYER    2
161 #define CE_PUSHED_BY_PLAYER     3
162 #define CE_COLLISION            4
163 #define CE_IMPACT               5
164 #define CE_SMASHED              6
165 #define CE_OTHER_IS_TOUCHING    7
166 #define CE_OTHER_IS_CHANGING    8
167 #define CE_OTHER_IS_EXPLODING   9
168 #define CE_OTHER_GETS_TOUCHED   10
169 #define CE_OTHER_GETS_PRESSED   11
170 #define CE_OTHER_GETS_PUSHED    12
171 #define CE_OTHER_GETS_COLLECTED 13
172
173 /* values for internal purpose only (level editor) */
174 #define CE_BY_PLAYER            14
175 #define CE_BY_COLLISION         15
176 #define CE_BY_OTHER             16
177
178 #define NUM_CHANGE_EVENTS       17
179
180 #define CE_BITMASK_DEFAULT      0
181
182 #define CH_EVENT_BIT(c)         (1 << (c))
183 #define CH_EVENT_VAR(e)         (element_info[e].change.events)
184
185 #define HAS_CHANGE_EVENT(e,c)   (IS_CUSTOM_ELEMENT(e) &&                  \
186                                  (CH_EVENT_VAR(e) & CH_EVENT_BIT(c)) != 0)
187 #define SET_CHANGE_EVENT(e,c,v) (IS_CUSTOM_ELEMENT(e) ?                   \
188                                  ((v) ?                                   \
189                                   (CH_EVENT_VAR(e) |=  CH_EVENT_BIT(c)) : \
190                                   (CH_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0)
191
192 /* values for change power for custom elements */
193 #define CP_NON_DESTRUCTIVE      0
194 #define CP_HALF_DESTRUCTIVE     1
195 #define CP_FULL_DESTRUCTIVE     2
196
197 /* values for special move patterns (bits 0-3: basic move directions) */
198 #define MV_BIT_TOWARDS_PLAYER   4
199 #define MV_BIT_AWAY_FROM_PLAYER 5
200 #define MV_BIT_ALONG_LEFT_SIDE  6
201 #define MV_BIT_ALONG_RIGHT_SIDE 7
202 #define MV_BIT_TURNING_LEFT     8
203 #define MV_BIT_TURNING_RIGHT    9
204
205 /* values for special move patterns for custom elements */
206 #define MV_HORIZONTAL           (MV_LEFT | MV_RIGHT)
207 #define MV_VERTICAL             (MV_UP | MV_DOWN)
208 #define MV_ALL_DIRECTIONS       (MV_HORIZONTAL | MV_VERTICAL)
209 #define MV_ANY_DIRECTION        (MV_ALL_DIRECTIONS)
210 #define MV_TOWARDS_PLAYER       (1 << MV_BIT_TOWARDS_PLAYER)
211 #define MV_AWAY_FROM_PLAYER     (1 << MV_BIT_AWAY_FROM_PLAYER)
212 #define MV_ALONG_LEFT_SIDE      (1 << MV_BIT_ALONG_LEFT_SIDE)
213 #define MV_ALONG_RIGHT_SIDE     (1 << MV_BIT_ALONG_RIGHT_SIDE)
214 #define MV_TURNING_LEFT         (1 << MV_BIT_TURNING_LEFT)
215 #define MV_TURNING_RIGHT        (1 << MV_BIT_TURNING_RIGHT)
216
217 /* values for slippery property for custom elements */
218 #define SLIPPERY_ANY_RANDOM     0
219 #define SLIPPERY_ANY_LEFT_RIGHT 1
220 #define SLIPPERY_ANY_RIGHT_LEFT 2
221 #define SLIPPERY_ONLY_LEFT      3
222 #define SLIPPERY_ONLY_RIGHT     4
223
224 /* macros for configurable properties */
225 #define IS_DIGGABLE(e)          HAS_PROPERTY(e, EP_DIGGABLE)
226 #define IS_COLLECTIBLE(e)       HAS_PROPERTY(e, EP_COLLECTIBLE)
227 #define DONT_RUN_INTO(e)        HAS_PROPERTY(e, EP_DONT_RUN_INTO)
228 #define DONT_COLLIDE_WITH(e)    HAS_PROPERTY(e, EP_DONT_COLLIDE_WITH)
229 #define DONT_TOUCH(e)           HAS_PROPERTY(e, EP_DONT_TOUCH)
230 #define IS_INDESTRUCTIBLE(e)    HAS_PROPERTY(e, EP_INDESTRUCTIBLE)
231 #define IS_SLIPPERY(e)          HAS_PROPERTY(e, EP_SLIPPERY)
232 #define CAN_CHANGE(e)           HAS_PROPERTY(e, EP_CAN_CHANGE)
233 #define CAN_MOVE(e)             HAS_PROPERTY(e, EP_CAN_MOVE)
234 #define CAN_FALL(e)             HAS_PROPERTY(e, EP_CAN_FALL)
235 #define CAN_SMASH_PLAYER(e)     HAS_PROPERTY(e, EP_CAN_SMASH_PLAYER)
236 #define CAN_SMASH_ENEMIES(e)    HAS_PROPERTY(e, EP_CAN_SMASH_ENEMIES)
237 #define CAN_SMASH_EVERYTHING(e) HAS_PROPERTY(e, EP_CAN_SMASH_EVERYTHING)
238 #define CAN_EXPLODE_BY_FIRE(e)  HAS_PROPERTY(e, EP_CAN_EXPLODE_BY_FIRE)
239 #define CAN_EXPLODE_SMASHED(e)  HAS_PROPERTY(e, EP_CAN_EXPLODE_SMASHED)
240 #define CAN_EXPLODE_IMPACT(e)   HAS_PROPERTY(e, EP_CAN_EXPLODE_IMPACT)
241 #define IS_WALKABLE_OVER(e)     HAS_PROPERTY(e, EP_WALKABLE_OVER)
242 #define IS_WALKABLE_INSIDE(e)   HAS_PROPERTY(e, EP_WALKABLE_INSIDE)
243 #define IS_WALKABLE_UNDER(e)    HAS_PROPERTY(e, EP_WALKABLE_UNDER)
244 #define IS_PASSABLE_OVER(e)     HAS_PROPERTY(e, EP_PASSABLE_OVER)
245 #define IS_PASSABLE_INSIDE(e)   HAS_PROPERTY(e, EP_PASSABLE_INSIDE)
246 #define IS_PASSABLE_UNDER(e)    HAS_PROPERTY(e, EP_PASSABLE_UNDER)
247 #define IS_PUSHABLE(e)          HAS_PROPERTY(e, EP_PUSHABLE)
248
249 /* macros for special configurable properties */
250 #define IS_EM_SLIPPERY_WALL(e)  HAS_PROPERTY(e, EP_EM_SLIPPERY_WALL)
251
252 /* macros for special graphics properties */
253 #define CAN_BE_CRUMBLED(e)      HAS_PROPERTY(GFX_ELEMENT(e),EP_CAN_BE_CRUMBLED)
254
255 /* macros for pre-defined properties */
256 #define ELEM_IS_PLAYER(e)       HAS_PROPERTY(e, EP_PLAYER)
257 #define CAN_PASS_MAGIC_WALL(e)  HAS_PROPERTY(e, EP_CAN_PASS_MAGIC_WALL)
258 #define IS_SWITCHABLE(e)        HAS_PROPERTY(e, EP_SWITCHABLE)
259 #define IS_BD_ELEMENT(e)        HAS_PROPERTY(e, EP_BD_ELEMENT)
260 #define IS_SP_ELEMENT(e)        HAS_PROPERTY(e, EP_SP_ELEMENT)
261 #define IS_SB_ELEMENT(e)        HAS_PROPERTY(e, EP_SB_ELEMENT)
262 #define IS_GEM(e)               HAS_PROPERTY(e, EP_GEM)
263 #define IS_FOOD_DARK_YAMYAM(e)  HAS_PROPERTY(e, EP_FOOD_DARK_YAMYAM)
264 #define IS_FOOD_PENGUIN(e)      HAS_PROPERTY(e, EP_FOOD_PENGUIN)
265 #define IS_FOOD_PIG(e)          HAS_PROPERTY(e, EP_FOOD_PIG)
266 #define IS_HISTORIC_WALL(e)     HAS_PROPERTY(e, EP_HISTORIC_WALL)
267 #define IS_HISTORIC_SOLID(e)    HAS_PROPERTY(e, EP_HISTORIC_SOLID)
268 #define IS_CLASSIC_ENEMY(e)     HAS_PROPERTY(e, EP_CLASSIC_ENEMY)
269 #define IS_BELT(e)              HAS_PROPERTY(e, EP_BELT)
270 #define IS_BELT_ACTIVE(e)       HAS_PROPERTY(e, EP_BELT_ACTIVE)
271 #define IS_BELT_SWITCH(e)       HAS_PROPERTY(e, EP_BELT_SWITCH)
272 #define IS_TUBE(e)              HAS_PROPERTY(e, EP_TUBE)
273 #define IS_KEYGATE(e)           HAS_PROPERTY(e, EP_KEYGATE)
274 #define IS_AMOEBOID(e)          HAS_PROPERTY(e, EP_AMOEBOID)
275 #define IS_AMOEBALIVE(e)        HAS_PROPERTY(e, EP_AMOEBALIVE)
276 #define HAS_CONTENT(e)          HAS_PROPERTY(e, EP_HAS_CONTENT)
277 #define IS_ACTIVE_BOMB(e)       HAS_PROPERTY(e, EP_ACTIVE_BOMB)
278 #define IS_INACTIVE(e)          HAS_PROPERTY(e, EP_INACTIVE)
279
280 /* macros for derived properties */
281 #define IS_ACCESSIBLE_OVER(e)   HAS_PROPERTY(e, EP_ACCESSIBLE_OVER)
282 #define IS_ACCESSIBLE_INSIDE(e) HAS_PROPERTY(e, EP_ACCESSIBLE_INSIDE)
283 #define IS_ACCESSIBLE_UNDER(e)  HAS_PROPERTY(e, EP_ACCESSIBLE_UNDER)
284 #define IS_SNAPPABLE(e)         HAS_PROPERTY(e, EP_SNAPPABLE)
285 #define IS_WALKABLE(e)          HAS_PROPERTY(e, EP_WALKABLE)
286 #define IS_PASSABLE(e)          HAS_PROPERTY(e, EP_PASSABLE)
287 #define IS_ACCESSIBLE(e)        HAS_PROPERTY(e, EP_ACCESSIBLE)
288 #define IS_WALL(e)              HAS_PROPERTY(e, EP_WALL)
289 #define IS_SOLID_FOR_PUSHING(e) HAS_PROPERTY(e, EP_SOLID_FOR_PUSHING)
290 #define IS_DRAGONFIRE_PROOF(e)  HAS_PROPERTY(e, EP_DRAGONFIRE_PROOF)
291 #define IS_EXPLOSION_PROOF(e)   HAS_PROPERTY(e, EP_EXPLOSION_PROOF)
292 #define CAN_SMASH(e)            HAS_PROPERTY(e, EP_CAN_SMASH)
293 #define CAN_EXPLODE(e)          HAS_PROPERTY(e, EP_CAN_EXPLODE)
294
295 /* special macros used in game engine */
296 #define IS_CUSTOM_ELEMENT(e)    ((e) >= EL_CUSTOM_START &&              \
297                                  (e) <= EL_CUSTOM_END)
298
299 #define GFX_ELEMENT(e)          (element_info[e].use_gfx_element ?      \
300                                  element_info[e].gfx_element : e)
301
302 #define IS_PLAYER(x,y)          (ELEM_IS_PLAYER(StorePlayer[x][y]))
303
304 #define IS_FREE(x,y)            (Feld[x][y] == EL_EMPTY && !IS_PLAYER(x,y))
305 #define IS_FREE_OR_PLAYER(x,y)  (Feld[x][y] == EL_EMPTY)
306
307 #define IS_MOVING(x,y)          (MovPos[x][y] != 0)
308 #define IS_FALLING(x,y)         (MovPos[x][y] != 0 && MovDir[x][y] == MV_DOWN)
309 #define IS_BLOCKED(x,y)         (Feld[x][y] == EL_BLOCKED)
310
311 #define EL_CHANGED(e)           ((e) == EL_ROCK           ? EL_EMERALD :    \
312                                  (e) == EL_BD_ROCK        ? EL_BD_DIAMOND : \
313                                  (e) == EL_EMERALD        ? EL_DIAMOND :    \
314                                  (e) == EL_EMERALD_YELLOW ? EL_DIAMOND :    \
315                                  (e) == EL_EMERALD_RED    ? EL_DIAMOND :    \
316                                  (e) == EL_EMERALD_PURPLE ? EL_DIAMOND :    \
317                                  EL_ROCK)
318 #define EL_CHANGED2(e)          ((e) == EL_ROCK           ? EL_BD_DIAMOND : \
319                                  (e) == EL_BD_ROCK        ? EL_BD_DIAMOND : \
320                                  EL_BD_ROCK)
321 #define IS_DRAWABLE(e)          ((e) < EL_BLOCKED)
322 #define IS_NOT_DRAWABLE(e)      ((e) >= EL_BLOCKED)
323 #define TAPE_IS_EMPTY(x)        ((x).length == 0)
324 #define TAPE_IS_STOPPED(x)      (!(x).recording && !(x).playing)
325
326 #define PLAYERINFO(x,y)         (&stored_player[StorePlayer[x][y]-EL_PLAYER_1])
327 #define SHIELD_ON(p)            ((p)->shield_normal_time_left > 0)
328 #define PROTECTED_FIELD(x,y)    (IS_ACCESSIBLE_INSIDE(Feld[x][y]) &&    \
329                                  IS_INDESTRUCTIBLE(Feld[x][y]))
330 #define PLAYER_PROTECTED(x,y)   (SHIELD_ON(PLAYERINFO(x, y)) ||         \
331                                  PROTECTED_FIELD(x, y))
332
333 #define PLAYER_NR_GFX(g,i)      ((g) + i * (IMG_PLAYER_2 - IMG_PLAYER_1))
334
335 #define ANIM_FRAMES(g)          (graphic_info[g].anim_frames)
336 #define ANIM_DELAY(g)           (graphic_info[g].anim_delay)
337 #define ANIM_MODE(g)            (graphic_info[g].anim_mode)
338
339 #define IS_ANIMATED(g)          (ANIM_FRAMES(g) > 1)
340 #define IS_NEW_DELAY(f, g)      ((f) % ANIM_DELAY(g) == 0)
341 #define IS_NEW_FRAME(f, g)      (IS_ANIMATED(g) && IS_NEW_DELAY(f, g))
342 #define IS_NEXT_FRAME(f, g)     (IS_NEW_FRAME(f, g) && (f) > 0)
343
344 #define IS_LOOP_SOUND(s)        (sound_info[s].loop)
345
346
347 /* boundaries of arrays etc. */
348 #define MAX_LEVEL_NAME_LEN      32
349 #define MAX_LEVEL_AUTHOR_LEN    32
350 #define MAX_ELEMENT_NAME_LEN    32
351 #define MAX_TAPELEN             (1000 * 50)     /* max. time * framerate */
352 #define MAX_SCORE_ENTRIES       100
353 #define MAX_NUM_AMOEBA          100
354
355 /* values for elements with content */
356 #define MIN_ELEMENT_CONTENTS    1
357 #define STD_ELEMENT_CONTENTS    4
358 #define MAX_ELEMENT_CONTENTS    8
359
360 #define LEVEL_SCORE_ELEMENTS    16      /* level elements with score */
361
362 /* fundamental game speed values */
363 #define GAME_FRAME_DELAY        20      /* frame delay in milliseconds */
364 #define FFWD_FRAME_DELAY        10      /* 200% speed for fast forward */
365 #define FRAMES_PER_SECOND       (1000 / GAME_FRAME_DELAY)
366 #define MICROLEVEL_SCROLL_DELAY 50      /* delay for scrolling micro level */
367 #define MICROLEVEL_LABEL_DELAY  250     /* delay for micro level label */
368
369 /* often used screen positions */
370 #define SX                      8
371 #define SY                      8
372 #define REAL_SX                 (SX - 2)
373 #define REAL_SY                 (SY - 2)
374 #define DX                      566
375 #define DY                      60
376 #define VX                      DX
377 #define VY                      400
378 #define EX                      DX
379 #define EY                      (VY - 44)
380 #define TILEX                   32
381 #define TILEY                   32
382 #define MINI_TILEX              (TILEX / 2)
383 #define MINI_TILEY              (TILEY / 2)
384 #define MICRO_TILEX             (TILEX / 8)
385 #define MICRO_TILEY             (TILEY / 8)
386 #define MIDPOSX                 (SCR_FIELDX / 2)
387 #define MIDPOSY                 (SCR_FIELDY / 2)
388 #define SXSIZE                  (SCR_FIELDX * TILEX)
389 #define SYSIZE                  (SCR_FIELDY * TILEY)
390 #define FXSIZE                  ((SCR_FIELDX + 2) * TILEX)
391 #define FYSIZE                  ((SCR_FIELDY + 2) * TILEY)
392 #define DXSIZE                  100
393 #define DYSIZE                  280
394 #define VXSIZE                  DXSIZE
395 #define VYSIZE                  100
396 #define EXSIZE                  DXSIZE
397 #define EYSIZE                  (VYSIZE + 44)
398 #define FULL_SXSIZE             (2 + SXSIZE + 2)
399 #define FULL_SYSIZE             (2 + SYSIZE + 2)
400 #define MICROLEV_XSIZE          ((STD_LEV_FIELDX + 2) * MICRO_TILEX)
401 #define MICROLEV_YSIZE          ((STD_LEV_FIELDY + 2) * MICRO_TILEY)
402 #define MICROLEV_XPOS           (SX + (SXSIZE - MICROLEV_XSIZE) / 2)
403 #define MICROLEV_YPOS           (SX + 12 * TILEY - MICRO_TILEY)
404 #define MICROLABEL_YPOS         (MICROLEV_YPOS + MICROLEV_YSIZE + 7)
405
406
407 /* "real" level file elements */
408 #define EL_UNDEFINED                    -1
409
410 #define EL_EMPTY_SPACE                  0
411 #define EL_EMPTY                        EL_EMPTY_SPACE
412 #define EL_SAND                         1
413 #define EL_WALL                         2
414 #define EL_WALL_SLIPPERY                3
415 #define EL_ROCK                         4
416 #define EL_KEY_OBSOLETE                 5 /* obsolete; mapped to EL_KEY_1 */
417 #define EL_EMERALD                      6
418 #define EL_EXIT_CLOSED                  7
419 #define EL_PLAYER_OBSOLETE              8 /* obsolete; mapped to EL_PLAYER_1 */
420 #define EL_BUG                          9
421 #define EL_SPACESHIP                    10
422 #define EL_YAMYAM                       11
423 #define EL_ROBOT                        12
424 #define EL_STEELWALL                    13
425 #define EL_DIAMOND                      14
426 #define EL_AMOEBA_DEAD                  15
427 #define EL_QUICKSAND_EMPTY              16
428 #define EL_QUICKSAND_FULL               17
429 #define EL_AMOEBA_DROP                  18
430 #define EL_BOMB                         19
431 #define EL_MAGIC_WALL                   20
432 #define EL_SPEED_PILL                   21
433 #define EL_ACID                         22
434 #define EL_AMOEBA_WET                   23
435 #define EL_AMOEBA_DRY                   24
436 #define EL_NUT                          25
437 #define EL_GAME_OF_LIFE                 26
438 #define EL_BIOMAZE                      27
439 #define EL_DYNAMITE_ACTIVE              28
440 #define EL_STONEBLOCK                   29
441 #define EL_ROBOT_WHEEL                  30
442 #define EL_ROBOT_WHEEL_ACTIVE           31
443 #define EL_KEY_1                        32
444 #define EL_KEY_2                        33
445 #define EL_KEY_3                        34
446 #define EL_KEY_4                        35
447 #define EL_GATE_1                       36
448 #define EL_GATE_2                       37
449 #define EL_GATE_3                       38
450 #define EL_GATE_4                       39
451 #define EL_GATE_1_GRAY                  40
452 #define EL_GATE_2_GRAY                  41
453 #define EL_GATE_3_GRAY                  42
454 #define EL_GATE_4_GRAY                  43
455 #define EL_DYNAMITE                     44
456 #define EL_PACMAN                       45
457 #define EL_INVISIBLE_WALL               46
458 #define EL_LAMP                         47
459 #define EL_LAMP_ACTIVE                  48
460 #define EL_WALL_EMERALD                 49
461 #define EL_WALL_DIAMOND                 50
462 #define EL_AMOEBA_FULL                  51
463 #define EL_BD_AMOEBA                    52
464 #define EL_TIME_ORB_FULL                53
465 #define EL_TIME_ORB_EMPTY               54
466 #define EL_EXPANDABLE_WALL              55
467 #define EL_BD_DIAMOND                   56
468 #define EL_EMERALD_YELLOW               57
469 #define EL_WALL_BD_DIAMOND              58
470 #define EL_WALL_EMERALD_YELLOW          59
471 #define EL_DARK_YAMYAM                  60
472 #define EL_BD_MAGIC_WALL                61
473 #define EL_INVISIBLE_STEELWALL          62
474
475 #define EL_UNUSED_63                    63
476
477 #define EL_DYNABOMB_INCREASE_NUMBER     64
478 #define EL_DYNABOMB_INCREASE_SIZE       65
479 #define EL_DYNABOMB_INCREASE_POWER      66
480 #define EL_SOKOBAN_OBJECT               67
481 #define EL_SOKOBAN_FIELD_EMPTY          68
482 #define EL_SOKOBAN_FIELD_FULL           69
483 #define EL_BD_BUTTERFLY_RIGHT           70
484 #define EL_BD_BUTTERFLY_UP              71
485 #define EL_BD_BUTTERFLY_LEFT            72
486 #define EL_BD_BUTTERFLY_DOWN            73
487 #define EL_BD_FIREFLY_RIGHT             74
488 #define EL_BD_FIREFLY_UP                75
489 #define EL_BD_FIREFLY_LEFT              76
490 #define EL_BD_FIREFLY_DOWN              77
491 #define EL_BD_BUTTERFLY_1               EL_BD_BUTTERFLY_DOWN
492 #define EL_BD_BUTTERFLY_2               EL_BD_BUTTERFLY_LEFT
493 #define EL_BD_BUTTERFLY_3               EL_BD_BUTTERFLY_UP
494 #define EL_BD_BUTTERFLY_4               EL_BD_BUTTERFLY_RIGHT
495 #define EL_BD_FIREFLY_1                 EL_BD_FIREFLY_LEFT
496 #define EL_BD_FIREFLY_2                 EL_BD_FIREFLY_DOWN
497 #define EL_BD_FIREFLY_3                 EL_BD_FIREFLY_RIGHT
498 #define EL_BD_FIREFLY_4                 EL_BD_FIREFLY_UP
499 #define EL_BD_BUTTERFLY                 78
500 #define EL_BD_FIREFLY                   79
501 #define EL_PLAYER_1                     80
502 #define EL_PLAYER_2                     81
503 #define EL_PLAYER_3                     82
504 #define EL_PLAYER_4                     83
505 #define EL_BUG_RIGHT                    84
506 #define EL_BUG_UP                       85
507 #define EL_BUG_LEFT                     86
508 #define EL_BUG_DOWN                     87
509 #define EL_SPACESHIP_RIGHT              88
510 #define EL_SPACESHIP_UP                 89
511 #define EL_SPACESHIP_LEFT               90
512 #define EL_SPACESHIP_DOWN               91
513 #define EL_PACMAN_RIGHT                 92
514 #define EL_PACMAN_UP                    93
515 #define EL_PACMAN_LEFT                  94
516 #define EL_PACMAN_DOWN                  95
517 #define EL_EMERALD_RED                  96
518 #define EL_EMERALD_PURPLE               97
519 #define EL_WALL_EMERALD_RED             98
520 #define EL_WALL_EMERALD_PURPLE          99
521 #define EL_ACID_POOL_TOPLEFT            100
522 #define EL_ACID_POOL_TOPRIGHT           101
523 #define EL_ACID_POOL_BOTTOMLEFT         102
524 #define EL_ACID_POOL_BOTTOM             103
525 #define EL_ACID_POOL_BOTTOMRIGHT        104
526 #define EL_BD_WALL                      105
527 #define EL_BD_ROCK                      106
528 #define EL_EXIT_OPEN                    107
529 #define EL_BLACK_ORB                    108
530 #define EL_AMOEBA_TO_DIAMOND            109
531 #define EL_MOLE                         110
532 #define EL_PENGUIN                      111
533 #define EL_SATELLITE                    112
534 #define EL_ARROW_LEFT                   113
535 #define EL_ARROW_RIGHT                  114
536 #define EL_ARROW_UP                     115
537 #define EL_ARROW_DOWN                   116
538 #define EL_PIG                          117
539 #define EL_DRAGON                       118
540
541 #define EL_EM_KEY_1_FILE                119
542
543 #define EL_CHAR_START                   120
544 #define EL_CHAR_ASCII0                  (EL_CHAR_START  - 32)
545 #define EL_CHAR_ASCII0_START            (EL_CHAR_ASCII0 + 32)
546
547 #include "conf_chr.h"   /* include auto-generated data structure definitions */
548
549 #define EL_CHAR_ASCII0_END              (EL_CHAR_ASCII0 + 111)
550 #define EL_CHAR_END                     (EL_CHAR_START  + 79)
551
552 #define EL_CHAR(c)                      (EL_CHAR_ASCII0 + MAP_FONT_ASCII(c))
553
554 #define EL_EXPANDABLE_WALL_HORIZONTAL   200
555 #define EL_EXPANDABLE_WALL_VERTICAL     201
556 #define EL_EXPANDABLE_WALL_ANY          202
557
558 #define EL_EM_GATE_1                    203
559 #define EL_EM_GATE_2                    204
560 #define EL_EM_GATE_3                    205
561 #define EL_EM_GATE_4                    206
562
563 #define EL_EM_KEY_2_FILE                        207
564 #define EL_EM_KEY_3_FILE                        208
565 #define EL_EM_KEY_4_FILE                        209
566
567 #define EL_SP_START                     210
568 #define EL_SP_EMPTY_SPACE               (EL_SP_START + 0)
569 #define EL_SP_EMPTY                     EL_SP_EMPTY_SPACE
570 #define EL_SP_ZONK                      (EL_SP_START + 1)
571 #define EL_SP_BASE                      (EL_SP_START + 2)
572 #define EL_SP_MURPHY                    (EL_SP_START + 3)
573 #define EL_SP_INFOTRON                  (EL_SP_START + 4)
574 #define EL_SP_CHIP_SINGLE               (EL_SP_START + 5)
575 #define EL_SP_HARDWARE_GRAY             (EL_SP_START + 6)
576 #define EL_SP_EXIT_CLOSED               (EL_SP_START + 7)
577 #define EL_SP_DISK_ORANGE               (EL_SP_START + 8)
578 #define EL_SP_PORT_RIGHT                (EL_SP_START + 9)
579 #define EL_SP_PORT_DOWN                 (EL_SP_START + 10)
580 #define EL_SP_PORT_LEFT                 (EL_SP_START + 11)
581 #define EL_SP_PORT_UP                   (EL_SP_START + 12)
582 #define EL_SP_GRAVITY_PORT_RIGHT        (EL_SP_START + 13)
583 #define EL_SP_GRAVITY_PORT_DOWN         (EL_SP_START + 14)
584 #define EL_SP_GRAVITY_PORT_LEFT         (EL_SP_START + 15)
585 #define EL_SP_GRAVITY_PORT_UP           (EL_SP_START + 16)
586 #define EL_SP_SNIKSNAK                  (EL_SP_START + 17)
587 #define EL_SP_DISK_YELLOW               (EL_SP_START + 18)
588 #define EL_SP_TERMINAL                  (EL_SP_START + 19)
589 #define EL_SP_DISK_RED                  (EL_SP_START + 20)
590 #define EL_SP_PORT_VERTICAL             (EL_SP_START + 21)
591 #define EL_SP_PORT_HORIZONTAL           (EL_SP_START + 22)
592 #define EL_SP_PORT_ANY                  (EL_SP_START + 23)
593 #define EL_SP_ELECTRON                  (EL_SP_START + 24)
594 #define EL_SP_BUGGY_BASE                (EL_SP_START + 25)
595 #define EL_SP_CHIP_LEFT                 (EL_SP_START + 26)
596 #define EL_SP_CHIP_RIGHT                (EL_SP_START + 27)
597 #define EL_SP_HARDWARE_BASE_1           (EL_SP_START + 28)
598 #define EL_SP_HARDWARE_GREEN            (EL_SP_START + 29)
599 #define EL_SP_HARDWARE_BLUE             (EL_SP_START + 30)
600 #define EL_SP_HARDWARE_RED              (EL_SP_START + 31)
601 #define EL_SP_HARDWARE_YELLOW           (EL_SP_START + 32)
602 #define EL_SP_HARDWARE_BASE_2           (EL_SP_START + 33)
603 #define EL_SP_HARDWARE_BASE_3           (EL_SP_START + 34)
604 #define EL_SP_HARDWARE_BASE_4           (EL_SP_START + 35)
605 #define EL_SP_HARDWARE_BASE_5           (EL_SP_START + 36)
606 #define EL_SP_HARDWARE_BASE_6           (EL_SP_START + 37)
607 #define EL_SP_CHIP_TOP                  (EL_SP_START + 38)
608 #define EL_SP_CHIP_BOTTOM               (EL_SP_START + 39)
609 #define EL_SP_END                       (EL_SP_START + 39)
610
611 #define EL_EM_GATE_1_GRAY               250
612 #define EL_EM_GATE_2_GRAY               251
613 #define EL_EM_GATE_3_GRAY               252
614 #define EL_EM_GATE_4_GRAY               253
615
616 #define EL_UNUSED_254                   254
617 #define EL_UNUSED_255                   255
618
619 #define EL_PEARL                        256
620 #define EL_CRYSTAL                      257
621 #define EL_WALL_PEARL                   258
622 #define EL_WALL_CRYSTAL                 259
623 #define EL_DOOR_WHITE                   260
624 #define EL_DOOR_WHITE_GRAY              261
625 #define EL_KEY_WHITE                    262
626 #define EL_SHIELD_NORMAL                263
627 #define EL_EXTRA_TIME                   264
628 #define EL_SWITCHGATE_OPEN              265
629 #define EL_SWITCHGATE_CLOSED            266
630 #define EL_SWITCHGATE_SWITCH_UP         267
631 #define EL_SWITCHGATE_SWITCH_DOWN       268
632
633 #define EL_UNUSED_269                   269
634 #define EL_UNUSED_270                   270
635
636 #define EL_CONVEYOR_BELT_1_LEFT          271
637 #define EL_CONVEYOR_BELT_1_MIDDLE        272
638 #define EL_CONVEYOR_BELT_1_RIGHT         273
639 #define EL_CONVEYOR_BELT_1_SWITCH_LEFT   274
640 #define EL_CONVEYOR_BELT_1_SWITCH_MIDDLE 275
641 #define EL_CONVEYOR_BELT_1_SWITCH_RIGHT  276
642 #define EL_CONVEYOR_BELT_2_LEFT          277
643 #define EL_CONVEYOR_BELT_2_MIDDLE        278
644 #define EL_CONVEYOR_BELT_2_RIGHT         279
645 #define EL_CONVEYOR_BELT_2_SWITCH_LEFT   280
646 #define EL_CONVEYOR_BELT_2_SWITCH_MIDDLE 281
647 #define EL_CONVEYOR_BELT_2_SWITCH_RIGHT  282
648 #define EL_CONVEYOR_BELT_3_LEFT          283
649 #define EL_CONVEYOR_BELT_3_MIDDLE        284
650 #define EL_CONVEYOR_BELT_3_RIGHT         285
651 #define EL_CONVEYOR_BELT_3_SWITCH_LEFT   286
652 #define EL_CONVEYOR_BELT_3_SWITCH_MIDDLE 287
653 #define EL_CONVEYOR_BELT_3_SWITCH_RIGHT  288
654 #define EL_CONVEYOR_BELT_4_LEFT          289
655 #define EL_CONVEYOR_BELT_4_MIDDLE        290
656 #define EL_CONVEYOR_BELT_4_RIGHT         291
657 #define EL_CONVEYOR_BELT_4_SWITCH_LEFT   292
658 #define EL_CONVEYOR_BELT_4_SWITCH_MIDDLE 293
659 #define EL_CONVEYOR_BELT_4_SWITCH_RIGHT  294
660 #define EL_LANDMINE                     295
661 #define EL_ENVELOPE                     296
662 #define EL_LIGHT_SWITCH                 297
663 #define EL_LIGHT_SWITCH_ACTIVE          298
664 #define EL_SIGN_EXCLAMATION             299
665 #define EL_SIGN_RADIOACTIVITY           300
666 #define EL_SIGN_STOP                    301
667 #define EL_SIGN_WHEELCHAIR              302
668 #define EL_SIGN_PARKING                 303
669 #define EL_SIGN_ONEWAY                  304
670 #define EL_SIGN_HEART                   305
671 #define EL_SIGN_TRIANGLE                306
672 #define EL_SIGN_ROUND                   307
673 #define EL_SIGN_EXIT                    308
674 #define EL_SIGN_YINYANG                 309
675 #define EL_SIGN_OTHER                   310
676 #define EL_MOLE_LEFT                    311
677 #define EL_MOLE_RIGHT                   312
678 #define EL_MOLE_UP                      313
679 #define EL_MOLE_DOWN                    314
680 #define EL_STEELWALL_SLIPPERY           315
681 #define EL_INVISIBLE_SAND               316
682 #define EL_DX_UNKNOWN_15                317
683 #define EL_DX_UNKNOWN_42                318
684
685 #define EL_UNUSED_319                   319
686 #define EL_UNUSED_320                   320
687
688 #define EL_SHIELD_DEADLY                321
689 #define EL_TIMEGATE_OPEN                322
690 #define EL_TIMEGATE_CLOSED              323
691 #define EL_TIMEGATE_SWITCH_ACTIVE       324
692 #define EL_TIMEGATE_SWITCH              325
693
694 #define EL_BALLOON                      326
695 #define EL_BALLOON_SWITCH_LEFT          327
696 #define EL_BALLOON_SWITCH_RIGHT         328
697 #define EL_BALLOON_SWITCH_UP            329
698 #define EL_BALLOON_SWITCH_DOWN          330
699 #define EL_BALLOON_SWITCH_ANY           331
700
701 #define EL_EMC_STEELWALL_1              332
702 #define EL_EMC_STEELWALL_2              333
703 #define EL_EMC_STEELWALL_3              334
704 #define EL_EMC_STEELWALL_4              335
705 #define EL_EMC_WALL_1                   336
706 #define EL_EMC_WALL_2                   337
707 #define EL_EMC_WALL_3                   338
708 #define EL_EMC_WALL_4                   339
709 #define EL_EMC_WALL_5                   340
710 #define EL_EMC_WALL_6                   341
711 #define EL_EMC_WALL_7                   342
712 #define EL_EMC_WALL_8                   343
713
714 #define EL_TUBE_ANY                     344
715 #define EL_TUBE_VERTICAL                345
716 #define EL_TUBE_HORIZONTAL              346
717 #define EL_TUBE_VERTICAL_LEFT           347
718 #define EL_TUBE_VERTICAL_RIGHT          348
719 #define EL_TUBE_HORIZONTAL_UP           349
720 #define EL_TUBE_HORIZONTAL_DOWN         350
721 #define EL_TUBE_LEFT_UP                 351
722 #define EL_TUBE_LEFT_DOWN               352
723 #define EL_TUBE_RIGHT_UP                353
724 #define EL_TUBE_RIGHT_DOWN              354
725 #define EL_SPRING                       355
726 #define EL_TRAP                         356
727 #define EL_DX_SUPABOMB                  357
728
729 #define EL_UNUSED_358                   358
730 #define EL_UNUSED_359                   359
731
732 #define EL_CUSTOM_START                 360
733
734 #include "conf_cus.h"   /* include auto-generated data structure definitions */
735
736 #define EL_CUSTOM_END                   (EL_CUSTOM_START + 127)
737
738 #define NUM_CUSTOM_ELEMENTS             128
739 #define NUM_FILE_ELEMENTS               488
740
741
742 /* "real" (and therefore drawable) runtime elements */
743 #define EL_FIRST_RUNTIME_REAL           NUM_FILE_ELEMENTS
744
745 #define EL_EM_KEY_1                     (EL_FIRST_RUNTIME_REAL + 0)
746 #define EL_EM_KEY_2                     (EL_FIRST_RUNTIME_REAL + 1)
747 #define EL_EM_KEY_3                     (EL_FIRST_RUNTIME_REAL + 2)
748 #define EL_EM_KEY_4                     (EL_FIRST_RUNTIME_REAL + 3)
749 #define EL_DYNABOMB_PLAYER_1_ACTIVE     (EL_FIRST_RUNTIME_REAL + 4)
750 #define EL_DYNABOMB_PLAYER_2_ACTIVE     (EL_FIRST_RUNTIME_REAL + 5)
751 #define EL_DYNABOMB_PLAYER_3_ACTIVE     (EL_FIRST_RUNTIME_REAL + 6)
752 #define EL_DYNABOMB_PLAYER_4_ACTIVE     (EL_FIRST_RUNTIME_REAL + 7)
753 #define EL_SP_DISK_RED_ACTIVE           (EL_FIRST_RUNTIME_REAL + 8)
754 #define EL_SWITCHGATE_OPENING           (EL_FIRST_RUNTIME_REAL + 9)
755 #define EL_SWITCHGATE_CLOSING           (EL_FIRST_RUNTIME_REAL + 10)
756 #define EL_TIMEGATE_OPENING             (EL_FIRST_RUNTIME_REAL + 11)
757 #define EL_TIMEGATE_CLOSING             (EL_FIRST_RUNTIME_REAL + 12)
758 #define EL_PEARL_BREAKING               (EL_FIRST_RUNTIME_REAL + 13)
759 #define EL_TRAP_ACTIVE                  (EL_FIRST_RUNTIME_REAL + 14)
760 #define EL_INVISIBLE_STEELWALL_ACTIVE   (EL_FIRST_RUNTIME_REAL + 15)
761 #define EL_INVISIBLE_WALL_ACTIVE        (EL_FIRST_RUNTIME_REAL + 16)
762 #define EL_INVISIBLE_SAND_ACTIVE        (EL_FIRST_RUNTIME_REAL + 17)
763 #define EL_CONVEYOR_BELT_1_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 18)
764 #define EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 19)
765 #define EL_CONVEYOR_BELT_1_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 20)
766 #define EL_CONVEYOR_BELT_2_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 21)
767 #define EL_CONVEYOR_BELT_2_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 22)
768 #define EL_CONVEYOR_BELT_2_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 23)
769 #define EL_CONVEYOR_BELT_3_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 24)
770 #define EL_CONVEYOR_BELT_3_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 25)
771 #define EL_CONVEYOR_BELT_3_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 26)
772 #define EL_CONVEYOR_BELT_4_LEFT_ACTIVE   (EL_FIRST_RUNTIME_REAL + 27)
773 #define EL_CONVEYOR_BELT_4_MIDDLE_ACTIVE (EL_FIRST_RUNTIME_REAL + 28)
774 #define EL_CONVEYOR_BELT_4_RIGHT_ACTIVE  (EL_FIRST_RUNTIME_REAL + 29)
775 #define EL_EXIT_OPENING                 (EL_FIRST_RUNTIME_REAL + 30)
776 #define EL_SP_EXIT_OPEN                 (EL_FIRST_RUNTIME_REAL + 31)
777 #define EL_SP_TERMINAL_ACTIVE           (EL_FIRST_RUNTIME_REAL + 32)
778 #define EL_SP_BUGGY_BASE_ACTIVATING     (EL_FIRST_RUNTIME_REAL + 33)
779 #define EL_SP_BUGGY_BASE_ACTIVE         (EL_FIRST_RUNTIME_REAL + 34)
780 #define EL_SP_MURPHY_CLONE              (EL_FIRST_RUNTIME_REAL + 35)
781 #define EL_AMOEBA_DROPPING              (EL_FIRST_RUNTIME_REAL + 36)
782 #define EL_QUICKSAND_EMPTYING           (EL_FIRST_RUNTIME_REAL + 37)
783 #define EL_MAGIC_WALL_ACTIVE            (EL_FIRST_RUNTIME_REAL + 38)
784 #define EL_BD_MAGIC_WALL_ACTIVE         (EL_FIRST_RUNTIME_REAL + 39)
785 #define EL_MAGIC_WALL_FULL              (EL_FIRST_RUNTIME_REAL + 40)
786 #define EL_BD_MAGIC_WALL_FULL           (EL_FIRST_RUNTIME_REAL + 41)
787 #define EL_MAGIC_WALL_EMPTYING          (EL_FIRST_RUNTIME_REAL + 42)
788 #define EL_BD_MAGIC_WALL_EMPTYING       (EL_FIRST_RUNTIME_REAL + 43)
789 #define EL_MAGIC_WALL_DEAD              (EL_FIRST_RUNTIME_REAL + 44)
790 #define EL_BD_MAGIC_WALL_DEAD           (EL_FIRST_RUNTIME_REAL + 45)
791
792 /* "unreal" (and therefore not drawable) runtime elements */
793 #define EL_FIRST_RUNTIME_UNREAL         (EL_FIRST_RUNTIME_REAL + 46)
794
795 #define EL_BLOCKED                      (EL_FIRST_RUNTIME_UNREAL + 0)
796 #define EL_EXPLOSION                    (EL_FIRST_RUNTIME_UNREAL + 1)
797 #define EL_NUT_BREAKING                 (EL_FIRST_RUNTIME_UNREAL + 2)
798 #define EL_DIAMOND_BREAKING             (EL_FIRST_RUNTIME_UNREAL + 3)
799 #define EL_ACID_SPLASH_LEFT             (EL_FIRST_RUNTIME_UNREAL + 4)
800 #define EL_ACID_SPLASH_RIGHT            (EL_FIRST_RUNTIME_UNREAL + 5)
801 #define EL_AMOEBA_GROWING               (EL_FIRST_RUNTIME_UNREAL + 6)
802 #define EL_AMOEBA_SHRINKING             (EL_FIRST_RUNTIME_UNREAL + 7)
803 #define EL_EXPANDABLE_WALL_GROWING      (EL_FIRST_RUNTIME_UNREAL + 8)
804 #define EL_FLAMES                       (EL_FIRST_RUNTIME_UNREAL + 9)
805 #define EL_PLAYER_IS_LEAVING            (EL_FIRST_RUNTIME_UNREAL + 10)
806 #define EL_QUICKSAND_FILLING            (EL_FIRST_RUNTIME_UNREAL + 11)
807 #define EL_MAGIC_WALL_FILLING           (EL_FIRST_RUNTIME_UNREAL + 12)
808 #define EL_BD_MAGIC_WALL_FILLING        (EL_FIRST_RUNTIME_UNREAL + 13)
809
810 /* dummy elements (never used as game elements, only used as graphics) */
811 #define EL_FIRST_DUMMY                  (EL_FIRST_RUNTIME_UNREAL + 14)
812
813 #define EL_STEELWALL_TOPLEFT                    (EL_FIRST_DUMMY + 0)
814 #define EL_STEELWALL_TOPRIGHT                   (EL_FIRST_DUMMY + 1)
815 #define EL_STEELWALL_BOTTOMLEFT                 (EL_FIRST_DUMMY + 2)
816 #define EL_STEELWALL_BOTTOMRIGHT                (EL_FIRST_DUMMY + 3)
817 #define EL_STEELWALL_HORIZONTAL                 (EL_FIRST_DUMMY + 4)
818 #define EL_STEELWALL_VERTICAL                   (EL_FIRST_DUMMY + 5)
819 #define EL_INVISIBLE_STEELWALL_TOPLEFT          (EL_FIRST_DUMMY + 6)
820 #define EL_INVISIBLE_STEELWALL_TOPRIGHT         (EL_FIRST_DUMMY + 7)
821 #define EL_INVISIBLE_STEELWALL_BOTTOMLEFT       (EL_FIRST_DUMMY + 8)
822 #define EL_INVISIBLE_STEELWALL_BOTTOMRIGHT      (EL_FIRST_DUMMY + 9)
823 #define EL_INVISIBLE_STEELWALL_HORIZONTAL       (EL_FIRST_DUMMY + 10)
824 #define EL_INVISIBLE_STEELWALL_VERTICAL         (EL_FIRST_DUMMY + 11)
825 #define EL_DYNABOMB                             (EL_FIRST_DUMMY + 12)
826 #define EL_DYNABOMB_ACTIVE                      (EL_FIRST_DUMMY + 13)
827 #define EL_DYNABOMB_PLAYER_1                    (EL_FIRST_DUMMY + 14)
828 #define EL_DYNABOMB_PLAYER_2                    (EL_FIRST_DUMMY + 15)
829 #define EL_DYNABOMB_PLAYER_3                    (EL_FIRST_DUMMY + 16)
830 #define EL_DYNABOMB_PLAYER_4                    (EL_FIRST_DUMMY + 17)
831 #define EL_SHIELD_NORMAL_ACTIVE                 (EL_FIRST_DUMMY + 18)
832 #define EL_SHIELD_DEADLY_ACTIVE                 (EL_FIRST_DUMMY + 19)
833 #define EL_DEFAULT                              (EL_FIRST_DUMMY + 20)
834 #define EL_BD_DEFAULT                           (EL_FIRST_DUMMY + 21)
835 #define EL_SP_DEFAULT                           (EL_FIRST_DUMMY + 22)
836 #define EL_SB_DEFAULT                           (EL_FIRST_DUMMY + 23)
837
838 #define MAX_NUM_ELEMENTS                        (EL_FIRST_DUMMY + 24)
839
840
841 /* values for graphics/sounds action types */
842 #define ACTION_DEFAULT                          0
843 #define ACTION_WAITING                          1
844 #define ACTION_FALLING                          2
845 #define ACTION_MOVING                           3
846 #define ACTION_DIGGING                          4
847 #define ACTION_SNAPPING                         5
848 #define ACTION_COLLECTING                       6
849 #define ACTION_DROPPING                         7
850 #define ACTION_PUSHING                          8
851 #define ACTION_WALKING                          9
852 #define ACTION_PASSING                          10
853 #define ACTION_IMPACT                           11
854 #define ACTION_BREAKING                         12
855 #define ACTION_ACTIVATING                       13
856 #define ACTION_DEACTIVATING                     14
857 #define ACTION_OPENING                          15
858 #define ACTION_CLOSING                          16
859 #define ACTION_ATTACKING                        17
860 #define ACTION_GROWING                          18
861 #define ACTION_SHRINKING                        19
862 #define ACTION_ACTIVE                           20
863 #define ACTION_FILLING                          21
864 #define ACTION_EMPTYING                         22
865 #define ACTION_CHANGING                         23
866 #define ACTION_EXPLODING                        24
867 #define ACTION_DYING                            25
868 #define ACTION_OTHER                            26
869
870 #define NUM_ACTIONS                             27
871
872 /* values for special image configuration suffixes (must match game mode) */
873 #define GFX_SPECIAL_ARG_MAIN                    0
874 #define GFX_SPECIAL_ARG_LEVELS                  1
875 #define GFX_SPECIAL_ARG_SCORES                  2
876 #define GFX_SPECIAL_ARG_EDITOR                  3
877 #define GFX_SPECIAL_ARG_INFO                    4
878 #define GFX_SPECIAL_ARG_SETUP                   5
879 #define GFX_SPECIAL_ARG_DOOR                    6
880 #define GFX_SPECIAL_ARG_PREVIEW                 7
881 #define GFX_SPECIAL_ARG_CRUMBLED                8
882
883 #define NUM_SPECIAL_GFX_ARGS                    9
884
885
886 /* values for image configuration suffixes */
887 #define GFX_ARG_X                               0
888 #define GFX_ARG_Y                               1
889 #define GFX_ARG_XPOS                            2
890 #define GFX_ARG_YPOS                            3
891 #define GFX_ARG_WIDTH                           4
892 #define GFX_ARG_HEIGHT                          5
893 #define GFX_ARG_OFFSET                          6
894 #define GFX_ARG_VERTICAL                        7
895 #define GFX_ARG_XOFFSET                         8
896 #define GFX_ARG_YOFFSET                         9
897 #define GFX_ARG_FRAMES                          10
898 #define GFX_ARG_FRAMES_PER_LINE                 11
899 #define GFX_ARG_START_FRAME                     12
900 #define GFX_ARG_DELAY                           13
901 #define GFX_ARG_ANIM_MODE                       14
902 #define GFX_ARG_GLOBAL_SYNC                     15
903 #define GFX_ARG_CRUMBLED_LIKE                   16
904 #define GFX_ARG_DIGGABLE_LIKE                   17
905 #define GFX_ARG_STEP_OFFSET                     18
906 #define GFX_ARG_STEP_DELAY                      19
907 #define GFX_ARG_DIRECTION                       20
908 #define GFX_ARG_POSITION                        21
909 #define GFX_ARG_DRAW_XOFFSET                    22
910 #define GFX_ARG_DRAW_YOFFSET                    23
911 #define GFX_ARG_NAME                            24
912
913 #define NUM_GFX_ARGS                            25
914
915
916 /* values for sound configuration suffixes */
917 #define SND_ARG_MODE_LOOP                       0
918
919 #define NUM_SND_ARGS                            1
920
921
922 /* values for font configuration */
923
924 #define FONT_INITIAL_1                          0
925 #define FONT_INITIAL_2                          1
926 #define FONT_INITIAL_3                          2
927 #define FONT_INITIAL_4                          3
928 #define FONT_TITLE_1                            4
929 #define FONT_TITLE_2                            5
930 #define FONT_MENU_1                             6
931 #define FONT_MENU_2                             7
932 #define FONT_TEXT_1_ACTIVE                      8
933 #define FONT_TEXT_2_ACTIVE                      9
934 #define FONT_TEXT_3_ACTIVE                      10
935 #define FONT_TEXT_4_ACTIVE                      11
936 #define FONT_TEXT_1                             12
937 #define FONT_TEXT_2                             13
938 #define FONT_TEXT_3                             14
939 #define FONT_TEXT_4                             15
940 #define FONT_INPUT_1_ACTIVE                     16
941 #define FONT_INPUT_2_ACTIVE                     17
942 #define FONT_INPUT_1                            18
943 #define FONT_INPUT_2                            19
944 #define FONT_OPTION_OFF                         20
945 #define FONT_OPTION_ON                          21
946 #define FONT_VALUE_1                            22
947 #define FONT_VALUE_2                            23
948 #define FONT_VALUE_OLD                          24
949 #define FONT_LEVEL_NUMBER                       25
950 #define FONT_TAPE_RECORDER                      26
951 #define FONT_GAME_INFO                          27
952
953 #define NUM_FONTS                               28
954 #define NUM_INITIAL_FONTS                       4
955
956 /* values for game_status (must match special image configuration suffixes) */
957 #define GAME_MODE_MAIN                          0
958 #define GAME_MODE_LEVELS                        1
959 #define GAME_MODE_SCORES                        2
960 #define GAME_MODE_EDITOR                        3
961 #define GAME_MODE_INFO                          4
962 #define GAME_MODE_SETUP                         5
963 #define GAME_MODE_PSEUDO_DOOR                   6
964 #define GAME_MODE_PSEUDO_PREVIEW                7
965 #define GAME_MODE_PSEUDO_CRUMBLED               8
966
967 /* there are no special config file suffixes for these modes */
968 #define GAME_MODE_PLAYING                       9
969 #define GAME_MODE_PSEUDO_TYPENAME               10
970 #define GAME_MODE_QUIT                          11
971
972 #define PROGRAM_VERSION_MAJOR   3
973 #define PROGRAM_VERSION_MINOR   0
974 #define PROGRAM_VERSION_PATCH   1
975 #define PROGRAM_VERSION_RELEASE 0
976 #define PROGRAM_VERSION_STRING  "3.0.1"
977
978 #define PROGRAM_TITLE_STRING    "Rocks'n'Diamonds"
979 #define PROGRAM_AUTHOR_STRING   "Holger Schemel"
980 #define PROGRAM_RIGHTS_STRING   "Copyright Â©1995-2003 by"
981 #define PROGRAM_DOS_PORT_STRING "DOS port done by Guido Schulz"
982 #define PROGRAM_IDENT_STRING    PROGRAM_VERSION_STRING " " TARGET_STRING
983 #define WINDOW_TITLE_STRING     PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING
984 #define WINDOW_SUBTITLE_STRING  PROGRAM_RIGHTS_STRING " " PROGRAM_AUTHOR_STRING
985 #define ICON_TITLE_STRING       PROGRAM_TITLE_STRING
986 #define COOKIE_PREFIX           "ROCKSNDIAMONDS"
987 #define FILENAME_PREFIX         "Rocks"
988
989 #if defined(PLATFORM_UNIX)
990 #define USERDATA_DIRECTORY      ".rocksndiamonds"
991 #elif defined(PLATFORM_WIN32)
992 #define USERDATA_DIRECTORY      PROGRAM_TITLE_STRING
993 #else
994 #define USERDATA_DIRECTORY      "userdata"
995 #endif
996
997 #define X11_ICON_FILENAME       "rocks_icon.xbm"
998 #define X11_ICONMASK_FILENAME   "rocks_iconmask.xbm"
999 #define MSDOS_POINTER_FILENAME  "mouse.pcx"
1000
1001 /* file version numbers for resource files (levels, tapes, score, setup, etc.)
1002 ** currently supported/known file version numbers:
1003 **      1.0 (old)
1004 **      1.2 (still in use)
1005 **      1.4 (still in use)
1006 **      2.0 (actual)
1007 */
1008 #define FILE_VERSION_1_0        VERSION_IDENT(1,0,0)
1009 #define FILE_VERSION_1_2        VERSION_IDENT(1,2,0)
1010 #define FILE_VERSION_1_4        VERSION_IDENT(1,4,0)
1011 #define FILE_VERSION_2_0        VERSION_IDENT(2,0,0)
1012
1013 /* file version does not change for every program version, but is changed
1014    when new features are introduced that are incompatible with older file
1015    versions, so that they can be treated accordingly */
1016 #define FILE_VERSION_ACTUAL     FILE_VERSION_2_0
1017
1018 #define GAME_VERSION_1_0        FILE_VERSION_1_0
1019 #define GAME_VERSION_1_2        FILE_VERSION_1_2
1020 #define GAME_VERSION_1_4        FILE_VERSION_1_4
1021 #define GAME_VERSION_2_0        FILE_VERSION_2_0
1022
1023 #define GAME_VERSION_ACTUAL     RELEASE_IDENT(PROGRAM_VERSION_MAJOR, \
1024                                               PROGRAM_VERSION_MINOR, \
1025                                               PROGRAM_VERSION_PATCH, \
1026                                               PROGRAM_VERSION_RELEASE)
1027
1028 /* values for game_emulation */
1029 #define EMU_NONE                0
1030 #define EMU_BOULDERDASH         1
1031 #define EMU_SOKOBAN             2
1032 #define EMU_SUPAPLEX            3
1033
1034 struct HiScore
1035 {
1036   char Name[MAX_PLAYER_NAME_LEN + 1];
1037   int Score;
1038 };
1039
1040 struct PlayerInfo
1041 {
1042   boolean present;              /* player present in level playfield */
1043   boolean connected;            /* player connected (locally or via network) */
1044   boolean active;               /* player (present && connected) */
1045
1046   int index_nr, client_nr, element_nr;
1047
1048   byte action;                  /* action from local input device */
1049   byte effective_action;        /* action acknowledged from network server
1050                                    or summarized over all configured input
1051                                    devices when in single player mode */
1052   byte programmed_action;       /* action forced by game itself (like moving
1053                                    through doors); overrides other actions */
1054
1055   int jx,jy, last_jx,last_jy;
1056   int MovDir, MovPos, GfxDir, GfxPos;
1057   int Frame, StepFrame;
1058
1059   int GfxAction;
1060
1061   boolean use_murphy_graphic;
1062   boolean use_disk_red_graphic;
1063
1064   boolean Pushing;
1065   boolean Switching;
1066   boolean LevelSolved, GameOver;
1067   boolean snapped;
1068
1069   int last_move_dir;
1070   boolean is_moving;
1071   boolean is_waiting;
1072   boolean is_digging;
1073   boolean is_collecting;
1074
1075   unsigned long move_delay;
1076   int move_delay_value;
1077
1078   unsigned long push_delay;
1079   unsigned long push_delay_value;
1080
1081   unsigned long actual_frame_counter;
1082
1083   int score;
1084   int gems_still_needed;
1085   int sokobanfields_still_needed;
1086   int lights_still_needed;
1087   int friends_still_needed;
1088   int key[4];
1089   int dynamite;
1090   int dynabomb_count, dynabomb_size, dynabombs_left, dynabomb_xl;
1091   int shield_normal_time_left;
1092   int shield_deadly_time_left;
1093 };
1094
1095 struct LevelInfo
1096 {
1097   int file_version;     /* file format version the level is stored with    */
1098   int game_version;     /* game release version the level was created with */
1099
1100   boolean encoding_16bit_field;         /* level contains 16-bit elements  */
1101   boolean encoding_16bit_yamyam;        /* yamyam contains 16-bit elements */
1102   boolean encoding_16bit_amoeba;        /* amoeba contains 16-bit elements */
1103
1104   int fieldx;
1105   int fieldy;
1106   int time;
1107   int gems_needed;
1108   char name[MAX_LEVEL_NAME_LEN + 1];
1109   char author[MAX_LEVEL_AUTHOR_LEN + 1];
1110   int score[LEVEL_SCORE_ELEMENTS];
1111   int yamyam_content[MAX_ELEMENT_CONTENTS][3][3];
1112   int num_yamyam_contents;
1113   int amoeba_speed;
1114   int amoeba_content;
1115   int time_magic_wall;
1116   int time_wheel;
1117   int time_light;
1118   int time_timegate;
1119   boolean double_speed;
1120   boolean initial_gravity;
1121   boolean em_slippery_gems;     /* EM style "gems slip from wall" behaviour */
1122
1123   short field[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1124
1125   boolean use_custom_template;  /* use custom properties from template file */
1126
1127   boolean no_level_file;
1128 };
1129
1130 struct TapeInfo
1131 {
1132   int file_version;     /* file format version the tape is stored with    */
1133   int game_version;     /* game release version the tape was created with */
1134   int engine_version;   /* game engine version the tape was recorded with */
1135
1136   char *level_identifier;
1137   int level_nr;
1138   unsigned long random_seed;
1139   unsigned long date;
1140   unsigned long counter;
1141   unsigned long length;
1142   unsigned long length_seconds;
1143   unsigned int delay_played;
1144   boolean pause_before_death;
1145   boolean recording, playing, pausing;
1146   boolean fast_forward;
1147   boolean index_search;
1148   boolean auto_play;
1149   boolean auto_play_level_solved;
1150   boolean quick_resume;
1151   boolean single_step;
1152   boolean changed;
1153   boolean player_participates[MAX_PLAYERS];
1154   int num_participating_players;
1155
1156   struct
1157   {
1158     byte action[MAX_PLAYERS];
1159     byte delay;
1160   } pos[MAX_TAPELEN];
1161 };
1162
1163 struct GameInfo
1164 {
1165   /* constant within running game */
1166   int engine_version;
1167   int emulation;
1168   int initial_move_delay;
1169   int initial_move_delay_value;
1170
1171   /* variable within running game */
1172   int yamyam_content_nr;
1173   boolean magic_wall_active;
1174   int magic_wall_time_left;
1175   int light_time_left;
1176   int timegate_time_left;
1177   int belt_dir[4];
1178   int belt_dir_nr[4];
1179   int switchgate_pos;
1180   int balloon_dir;
1181   boolean explosions_delayed;
1182   boolean current_gravity;
1183 };
1184
1185 struct GlobalInfo
1186 {
1187   char *autoplay_leveldir;
1188   int autoplay_level_nr;
1189
1190   int num_toons;
1191
1192   float frames_per_second;
1193   boolean fps_slowdown;
1194   int fps_slowdown_factor;
1195 };
1196
1197 struct MenuInfo
1198 {
1199   int draw_xoffset_default;
1200   int draw_yoffset_default;
1201   int draw_xoffset[NUM_SPECIAL_GFX_ARGS];
1202   int draw_yoffset[NUM_SPECIAL_GFX_ARGS];
1203
1204   int scrollbar_xoffset;
1205
1206   int list_size_default;
1207   int list_size[NUM_SPECIAL_GFX_ARGS];
1208 };
1209
1210 struct DoorInfo
1211 {
1212   int step_offset;
1213   int step_delay;
1214 };
1215
1216 struct ElementChangeInfo
1217 {
1218   unsigned long events;         /* bitfield for change events */
1219
1220   short target_element;         /* target element after change */
1221
1222   int delay_fixed;              /* added frame delay before changed (fixed) */
1223   int delay_random;             /* added frame delay before changed (random) */
1224   int delay_frames;             /* either 1 (frames) or 50 (seconds; 50 fps) */
1225
1226   short trigger_element;        /* custom element triggering change */
1227
1228   int content[3][3];            /* new elements after extended change */
1229   boolean use_content;          /* use extended change content */
1230   boolean only_complete;        /* only use complete content */
1231   boolean use_random_change;    /* use random value for setting content */
1232   int random;                   /* random value for setting content */
1233   int power;                    /* power of extended change */
1234
1235   boolean explode;              /* explode instead of change */
1236
1237   /* functions that are called before, while and after the change of an
1238      element -- currently only used for non-custom elements */
1239   void (*pre_change_function)(int x, int y);
1240   void (*change_function)(int x, int y);
1241   void (*post_change_function)(int x, int y);
1242 };
1243
1244 struct ElementInfo
1245 {
1246   /* ---------- token and description strings ---------- */
1247
1248   char *token_name;             /* element token used in config files */
1249   char *class_name;             /* element class used in config files */
1250   char *editor_description;     /* pre-defined description for level editor */
1251   char *custom_description;     /* alternative description from config file */
1252   char description[MAX_ELEMENT_NAME_LEN + 1];   /* for custom elements */
1253
1254   /* ---------- graphic and sound definitions ---------- */
1255
1256   int graphic[NUM_ACTIONS];     /* default graphics for several actions */
1257   int direction_graphic[NUM_ACTIONS][NUM_DIRECTIONS];
1258                                 /* special graphics for left/right/up/down */
1259
1260   int crumbled[NUM_ACTIONS];    /* crumbled graphics for several actions */
1261   int direction_crumbled[NUM_ACTIONS][NUM_DIRECTIONS];
1262                                 /* crumbled graphics for left/right/up/down */
1263
1264   int special_graphic[NUM_SPECIAL_GFX_ARGS];
1265                                 /* special graphics for certain screens */
1266
1267   int sound[NUM_ACTIONS];       /* default sounds for several actions */
1268
1269   /* ---------- special element property values ---------- */
1270
1271   boolean use_gfx_element;      /* use custom graphic element */
1272   short gfx_element;            /* optional custom graphic element */
1273
1274   int score;                    /* score value for collecting */
1275   int gem_count;                /* gem count value for collecting */
1276
1277   int push_delay_fixed;         /* constant frame delay for pushing */
1278   int push_delay_random;        /* additional random frame delay for pushing */
1279   int move_delay_fixed;         /* constant frame delay for moving */
1280   int move_delay_random;        /* additional random frame delay for moving */
1281
1282   int move_pattern;             /* direction movable element moves to */
1283   int move_direction_initial;   /* initial direction element moves to */
1284   int move_stepsize;            /* step size element moves with */
1285
1286   int slippery_type;            /* how/where other elements slip away */
1287
1288   int content[3][3];            /* new elements after explosion */
1289
1290   struct ElementChangeInfo change;
1291
1292   /* ---------- internal values used in level editor ---------- */
1293
1294   int access_type;              /* walkable or passable */
1295   int access_layer;             /* accessible over/inside/under */
1296   int walk_to_action;           /* diggable/collectible/pushable */
1297   int smash_targets;            /* can smash player/enemies/everything */
1298   int deadliness;               /* deadly when running/colliding/touching */
1299   int consistency;              /* indestructible/can explode */
1300   int change_player_action;     /* touched/pressed/pushed by player */
1301   int change_collide_action;    /* collision/impact/smashed */
1302   int change_other_action;      /* various change actions */
1303
1304   boolean can_explode_by_fire;  /* element explodes by fire */
1305   boolean can_explode_smashed;  /* element explodes when smashed */
1306   boolean can_explode_impact;   /* element explodes on impact */
1307 };
1308
1309 struct FontInfo
1310 {
1311   char *token_name;             /* font token used in config files */
1312
1313   int graphic;                  /* default graphic for this font */
1314   int special_graphic[NUM_SPECIAL_GFX_ARGS];
1315                                 /* special graphics for certain screens */
1316   int special_bitmap_id[NUM_SPECIAL_GFX_ARGS];
1317                                 /* internal bitmap ID for special graphics */
1318 };
1319
1320 struct GraphicInfo
1321 {
1322   Bitmap *bitmap;
1323   int src_x, src_y;             /* start position of animation frames */
1324   int width, height;            /* width/height of each animation frame */
1325   int offset_x, offset_y;       /* x/y offset to next animation frame */
1326   int anim_frames;
1327   int anim_frames_per_line;
1328   int anim_start_frame;
1329   int anim_delay;               /* important: delay of 1 means "no delay"! */
1330   int anim_mode;
1331   boolean anim_global_sync;
1332   int crumbled_like;            /* element for cloning crumble graphics */
1333   int diggable_like;            /* element for cloning digging graphics */
1334
1335   int step_offset;              /* optional step offset of toon animations */
1336   int step_delay;               /* optional step delay of toon animations */
1337
1338   int draw_x, draw_y;           /* optional offset for drawing fonts chars */
1339
1340 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
1341   Pixmap clip_mask;             /* single-graphic-only clip mask for X11 */
1342   GC clip_gc;                   /* single-graphic-only clip gc for X11 */
1343 #endif
1344 };
1345
1346 struct SoundInfo
1347 {
1348   boolean loop;
1349 };
1350
1351 struct ElementActionInfo
1352 {
1353   char *suffix;
1354   int value;
1355   boolean is_loop_sound;
1356 };
1357
1358 struct ElementDirectionInfo
1359 {
1360   char *suffix;
1361   int value;
1362 };
1363
1364 struct SpecialSuffixInfo
1365 {
1366   char *suffix;
1367   int value;
1368 };
1369
1370
1371 #if 0
1372 extern GC                       tile_clip_gc;
1373 extern Bitmap                  *pix[];
1374 #endif
1375 extern Bitmap                  *bitmap_db_field, *bitmap_db_door;
1376 extern Pixmap                   tile_clipmask[];
1377 extern DrawBuffer             *fieldbuffer;
1378 extern DrawBuffer             *drawto_field;
1379
1380 extern int                      game_status;
1381 extern boolean                  level_editor_test_game;
1382 extern boolean                  network_playing;
1383
1384 extern int                      key_joystick_mapping;
1385
1386 extern boolean                  redraw[MAX_BUF_XSIZE][MAX_BUF_YSIZE];
1387 extern int                      redraw_x1, redraw_y1;
1388
1389 extern short                    Feld[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1390 extern short                    MovPos[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1391 extern short                    MovDir[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1392 extern short                    MovDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1393 extern short                    ChangeDelay[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1394 extern short                    Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1395 extern short                    Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1396 extern short                    StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1397 extern short                    Back[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1398 extern boolean                  Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1399 extern boolean                  Pushed[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1400 extern boolean                  Changing[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1401 extern short                    JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1402 extern short                    AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1403 extern short                    AmoebaCnt[MAX_NUM_AMOEBA];
1404 extern short                    AmoebaCnt2[MAX_NUM_AMOEBA];
1405 extern short                    ExplodePhase[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1406 extern short                    ExplodeField[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1407
1408 extern unsigned long            Properties[MAX_NUM_ELEMENTS][NUM_EP_BITFIELDS];
1409
1410 extern int                      GfxFrame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1411 extern int                      GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1412 extern int                      GfxRandom[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1413 extern int                      GfxElement[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
1414
1415 extern int                      lev_fieldx, lev_fieldy;
1416 extern int                      scroll_x, scroll_y;
1417
1418 extern int                      FX, FY;
1419 extern int                      ScrollStepSize;
1420 extern int                      ScreenMovDir, ScreenMovPos, ScreenGfxPos;
1421 extern int                      BorderElement;
1422 extern int                      GameFrameDelay;
1423 extern int                      FfwdFrameDelay;
1424 extern int                      BX1, BY1;
1425 extern int                      BX2, BY2;
1426 extern int                      SBX_Left, SBX_Right;
1427 extern int                      SBY_Upper, SBY_Lower;
1428 extern int                      ZX, ZY;
1429 extern int                      ExitX, ExitY;
1430 extern int                      AllPlayersGone;
1431
1432 extern int                      TimeFrames, TimePlayed, TimeLeft;
1433 extern boolean                  SiebAktiv;
1434 extern int                      SiebCount;
1435
1436 extern boolean                  network_player_action_received;
1437
1438 extern int                      graphics_action_mapping[];
1439
1440 extern struct LevelInfo         level, level_template;
1441 extern struct PlayerInfo        stored_player[], *local_player;
1442 extern struct HiScore           highscore[];
1443 extern struct TapeInfo          tape;
1444 extern struct GameInfo          game;
1445 extern struct GlobalInfo        global;
1446 extern struct MenuInfo          menu;
1447 extern struct DoorInfo          door;
1448 extern struct ElementInfo       element_info[];
1449 extern struct ElementActionInfo element_action_info[];
1450 extern struct ElementDirectionInfo element_direction_info[];
1451 extern struct SpecialSuffixInfo special_suffix_info[];
1452 extern struct TokenIntPtrInfo   image_config_vars[];
1453 extern struct FontInfo          font_info[];
1454 extern struct GraphicInfo      *graphic_info;
1455 extern struct SoundInfo        *sound_info;
1456 extern struct ConfigInfo        image_config[], sound_config[];
1457 extern struct ConfigInfo        image_config_suffix[], sound_config_suffix[];
1458
1459 #endif  /* MAIN_H */