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