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