rnd-20020424-1-src
[rocksndiamonds.git] / src / init.c
1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back!               *
3 *----------------------------------------------------------*
4 * (c) 1995-2001 Artsoft Entertainment                      *
5 *               Holger Schemel                             *
6 *               Detmolder Strasse 189                      *
7 *               33604 Bielefeld                            *
8 *               Germany                                    *
9 *               e-mail: info@artsoft.org                   *
10 *----------------------------------------------------------*
11 * init.c                                                   *
12 ***********************************************************/
13
14 #include "libgame/libgame.h"
15
16 #include "init.h"
17 #include "events.h"
18 #include "screens.h"
19 #include "editor.h"
20 #include "game.h"
21 #include "tape.h"
22 #include "tools.h"
23 #include "files.h"
24 #include "network.h"
25 #include "netserv.h"
26 #include "cartoons.h"
27 #include "config.h"
28
29 static char *image_filename[NUM_PICTURES] =
30 {
31   "RocksScreen.pcx",
32   "RocksDoor.pcx",
33   "RocksHeroes.pcx",
34   "RocksToons.pcx",
35   "RocksSP.pcx",
36   "RocksDC.pcx",
37   "RocksMore.pcx",
38   "RocksFont.pcx",
39   "RocksFont2.pcx",
40   "RocksFont3.pcx"
41 }; 
42
43 static void InitSetup(void);
44 static void InitPlayerInfo(void);
45 static void InitLevelInfo(void);
46 static void InitArtworkInfo(void);
47 static void InitNetworkServer(void);
48 static void InitSound(void);
49 static void InitGfx(void);
50 static void InitGfxBackground(void);
51 static void InitGadgets(void);
52 static void InitElementProperties(void);
53
54 void OpenAll(void)
55 {
56   if (options.serveronly)
57   {
58 #if defined(PLATFORM_UNIX)
59     NetworkServer(options.server_port, options.serveronly);
60 #else
61     Error(ERR_WARN, "networking only supported in Unix version");
62 #endif
63     exit(0);    /* never reached */
64   }
65
66   InitProgramInfo(UNIX_USERDATA_DIRECTORY,
67                   PROGRAM_TITLE_STRING, getWindowTitleString(),
68                   ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
69                   MSDOS_POINTER_FILENAME,
70                   COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
71
72   InitSetup();
73   InitPlayerInfo();
74   InitArtworkInfo();            /* needed before loading gfx, sound & music */
75
76   InitCounter();
77   InitSound();
78   InitJoysticks();
79   InitRND(NEW_RANDOMIZE);
80
81   InitVideoDisplay();
82   InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
83                   setup.fullscreen);
84
85   InitEventFilter(FilterMouseMotionEvents);
86
87   InitGfx();
88   InitElementProperties();      /* initializes IS_CHAR() for el2gfx() */
89
90   InitLevelInfo();
91   InitGadgets();                /* needs to know number of level series */
92
93   InitGfxBackground();
94   InitToons();
95
96   DrawMainMenu();
97
98   InitNetworkServer();
99 }
100
101 void InitSetup()
102 {
103   LoadSetup();                                  /* global setup info */
104 }
105
106 void InitPlayerInfo()
107 {
108   int i;
109
110   /* choose default local player */
111   local_player = &stored_player[0];
112
113   for (i=0; i<MAX_PLAYERS; i++)
114     stored_player[i].connected = FALSE;
115
116   local_player->connected = TRUE;
117 }
118
119 void InitLevelInfo()
120 {
121   LoadLevelInfo();                              /* global level info */
122   LoadLevelSetup_LastSeries();                  /* last played series info */
123   LoadLevelSetup_SeriesInfo();                  /* last played level info */
124 }
125
126 void InitArtworkInfo()
127 {
128   LoadArtworkInfo();
129 }
130
131 void InitNetworkServer()
132 {
133 #if defined(PLATFORM_UNIX)
134   int nr_wanted;
135 #endif
136
137   if (!options.network)
138     return;
139
140 #if defined(PLATFORM_UNIX)
141   nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
142
143   if (!ConnectToServer(options.server_host, options.server_port))
144     Error(ERR_EXIT, "cannot connect to network game server");
145
146   SendToServer_PlayerName(setup.player_name);
147   SendToServer_ProtocolVersion();
148
149   if (nr_wanted)
150     SendToServer_NrWanted(nr_wanted);
151 #endif
152 }
153
154 void InitSound()
155 {
156   int i;
157
158   OpenAudio();
159
160   InitSoundList(NUM_SOUNDS);
161
162   for(i=0; i<NUM_SOUNDS; i++)
163     LoadSoundToList(sound_name[i], i);
164
165   LoadCustomMusic();
166
167   StartSoundserver();
168 }
169
170 void InitTileClipmasks()
171 {
172 #if defined(TARGET_X11)
173   GC copy_clipmask_gc;
174   XGCValues clip_gc_values;
175   unsigned long clip_gc_valuemask;
176
177 #if defined(TARGET_X11_NATIVE)
178   static struct
179   {
180     int start;
181     int count;
182   }
183   tile_needs_clipping[] =
184   {
185     { GFX_SPIELER1_UP, 4 },
186     { GFX_SPIELER1_DOWN, 4 },
187     { GFX_SPIELER1_LEFT, 4 },
188     { GFX_SPIELER1_RIGHT, 4 },
189     { GFX_SPIELER1_PUSH_LEFT, 4 },
190     { GFX_SPIELER1_PUSH_RIGHT, 4 },
191     { GFX_SPIELER2_UP, 4 },
192     { GFX_SPIELER2_DOWN, 4 },
193     { GFX_SPIELER2_LEFT, 4 },
194     { GFX_SPIELER2_RIGHT, 4 },
195     { GFX_SPIELER2_PUSH_LEFT, 4 },
196     { GFX_SPIELER2_PUSH_RIGHT, 4 },
197     { GFX_SPIELER3_UP, 4 },
198     { GFX_SPIELER3_DOWN, 4 },
199     { GFX_SPIELER3_LEFT, 4 },
200     { GFX_SPIELER3_RIGHT, 4 },
201     { GFX_SPIELER3_PUSH_LEFT, 4 },
202     { GFX_SPIELER3_PUSH_RIGHT, 4 },
203     { GFX_SPIELER4_UP, 4 },
204     { GFX_SPIELER4_DOWN, 4 },
205     { GFX_SPIELER4_LEFT, 4 },
206     { GFX_SPIELER4_RIGHT, 4 },
207     { GFX_SPIELER4_PUSH_LEFT, 4 },
208     { GFX_SPIELER4_PUSH_RIGHT, 4 },
209     { GFX_SP_MURPHY, 1 },
210     { GFX_MURPHY_GO_LEFT, 3 },
211     { GFX_MURPHY_GO_RIGHT, 3 },
212     { GFX_MURPHY_SNAP_UP, 1 },
213     { GFX_MURPHY_SNAP_DOWN, 1 },
214     { GFX_MURPHY_SNAP_RIGHT, 1 },
215     { GFX_MURPHY_SNAP_LEFT, 1 },
216     { GFX_MURPHY_PUSH_RIGHT, 1 },
217     { GFX_MURPHY_PUSH_LEFT, 1 },
218     { GFX_GEBLUBBER, 4 },
219     { GFX_DYNAMIT, 7 },
220     { GFX_DYNABOMB, 4 },
221     { GFX_EXPLOSION, 8 },
222     { GFX_SOKOBAN_OBJEKT, 1 },
223     { GFX_FUNKELN_BLAU, 3 },
224     { GFX_FUNKELN_WEISS, 3 },
225     { GFX2_SHIELD_PASSIVE, 3 },
226     { GFX2_SHIELD_ACTIVE, 3 },
227     { -1, 0 }
228   };
229 #endif /* TARGET_X11_NATIVE */
230 #endif /* TARGET_X11 */
231
232   int i;
233
234   /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */
235   for(i=0; i<NUM_TILES; i++)
236     tile_clipmask[i] = None;
237
238 #if defined(TARGET_X11)
239   /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is
240      often very slow when preparing a masked XCopyArea() for big Pixmaps.
241      To prevent this, create small (tile-sized) mask Pixmaps which will then
242      be set much faster with XSetClipOrigin() and speed things up a lot. */
243
244   clip_gc_values.graphics_exposures = False;
245   clip_gc_valuemask = GCGraphicsExposures;
246   tile_clip_gc =
247     XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
248
249   for(i=0; i<NUM_BITMAPS; i++)
250   {
251     if (pix[i]->clip_mask)
252     {
253       clip_gc_values.graphics_exposures = False;
254       clip_gc_values.clip_mask = pix[i]->clip_mask;
255       clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
256       pix[i]->stored_clip_gc = XCreateGC(display, window->drawable,
257                                          clip_gc_valuemask, &clip_gc_values);
258     }
259   }
260
261 #if defined(TARGET_X11_NATIVE)
262
263   /* create graphic context structures needed for clipping */
264   clip_gc_values.graphics_exposures = False;
265   clip_gc_valuemask = GCGraphicsExposures;
266   copy_clipmask_gc =
267     XCreateGC(display, pix[PIX_BACK]->clip_mask,
268               clip_gc_valuemask, &clip_gc_values);
269
270   /* create only those clipping Pixmaps we really need */
271   for(i=0; tile_needs_clipping[i].start>=0; i++)
272   {
273     int j;
274
275     for(j=0; j<tile_needs_clipping[i].count; j++)
276     {
277       int tile = tile_needs_clipping[i].start + j;
278       int graphic = tile;
279       int src_x, src_y;
280       int pixmap_nr;
281       Pixmap src_pixmap;
282
283       getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
284       src_pixmap = pix[pixmap_nr]->clip_mask;
285
286       tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
287                                           TILEX, TILEY, 1);
288
289       XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc,
290                 src_x, src_y, TILEX, TILEY, 0, 0);
291     }
292   }
293
294   XFreeGC(display, copy_clipmask_gc);
295
296 #endif /* TARGET_X11_NATIVE */
297 #endif /* TARGET_X11 */
298 }
299
300 void FreeTileClipmasks()
301 {
302 #if defined(TARGET_X11)
303   int i;
304
305   for(i=0; i<NUM_TILES; i++)
306   {
307     if (tile_clipmask[i] != None)
308     {
309       XFreePixmap(display, tile_clipmask[i]);
310       tile_clipmask[i] = None;
311     }
312   }
313
314   if (tile_clip_gc)
315     XFreeGC(display, tile_clip_gc);
316   tile_clip_gc = None;
317
318   for(i=0; i<NUM_BITMAPS; i++)
319   {
320     if (pix[i]->stored_clip_gc)
321     {
322       XFreeGC(display, pix[i]->stored_clip_gc);
323       pix[i]->stored_clip_gc = None;
324     }
325   }
326 #endif /* TARGET_X11 */
327 }
328
329 void InitGfx()
330 {
331   int i;
332
333   /* initialize some global variables */
334   global.frames_per_second = 0;
335   global.fps_slowdown = FALSE;
336   global.fps_slowdown_factor = 1;
337
338   /* initialize screen properties */
339   InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
340                    REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
341   InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
342   InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
343   InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
344
345   /* create additional image buffers for double-buffering */
346   pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
347   pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
348
349   pix[PIX_SMALLFONT] = LoadCustomImage(image_filename[PIX_SMALLFONT]);
350
351   InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]);
352
353   DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
354   DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
355 #if defined(PLATFORM_MSDOS)
356   DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
357   rest(200);
358 #endif
359   DrawInitText("Loading graphics:",120,FC_GREEN);
360
361   for(i=0; i<NUM_PICTURES; i++)
362   {
363     if (i != PIX_SMALLFONT)
364     {
365       DrawInitText(image_filename[i], 150, FC_YELLOW);
366
367       pix[i] = LoadCustomImage(image_filename[i]);
368     }
369   }
370
371   InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
372
373   InitTileClipmasks();
374 }
375
376 void InitGfxBackground()
377 {
378   int x, y;
379
380   drawto = backbuffer;
381   fieldbuffer = pix[PIX_DB_FIELD];
382   SetDrawtoField(DRAW_BACKBUFFER);
383
384   BlitBitmap(pix[PIX_BACK], backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
385   ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
386   ClearRectangle(pix[PIX_DB_DOOR], 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
387
388   for(x=0; x<MAX_BUF_XSIZE; x++)
389     for(y=0; y<MAX_BUF_YSIZE; y++)
390       redraw[x][y] = 0;
391   redraw_tiles = 0;
392   redraw_mask = REDRAW_ALL;
393 }
394
395 void ReloadCustomArtwork()
396 {
397   if (artwork.graphics_set_current != artwork.gfx_current->name)
398   {
399     int i;
400
401     ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
402
403     for(i=0; i<NUM_PICTURES; i++)
404     {
405       DrawInitText(image_filename[i], 150, FC_YELLOW);
406       ReloadCustomImage(pix[i], image_filename[i]);
407     }
408
409     FreeTileClipmasks();
410     InitTileClipmasks();
411     InitGfxBackground();
412
413     SetDoorState(DOOR_OPEN_1 | DOOR_CLOSE_2);
414
415     artwork.graphics_set_current = artwork.gfx_current->name;
416   }
417
418   if (artwork.sounds_set_current != artwork.snd_current->name)
419   {
420     InitReloadSounds(artwork.snd_current->name);
421
422     artwork.sounds_set_current = artwork.snd_current->name;
423   }
424
425   if (artwork.music_set_current != artwork.mus_current->name)
426   {
427     InitReloadMusic(artwork.mus_current->name);
428
429     artwork.music_set_current = artwork.mus_current->name;
430   }
431 }
432
433 void InitGadgets()
434 {
435   CreateLevelEditorGadgets();
436   CreateGameButtons();
437   CreateTapeButtons();
438   CreateToolButtons();
439   CreateScreenGadgets();
440 }
441
442 void InitElementProperties()
443 {
444   int i,j;
445
446   static int ep_amoebalive[] =
447   {
448     EL_AMOEBE_NASS,
449     EL_AMOEBE_NORM,
450     EL_AMOEBE_VOLL,
451     EL_AMOEBE_BD
452   };
453   static int ep_amoebalive_num = SIZEOF_ARRAY_INT(ep_amoebalive);
454
455   static int ep_amoeboid[] =
456   {
457     EL_AMOEBE_TOT,
458     EL_AMOEBE_NASS,
459     EL_AMOEBE_NORM,
460     EL_AMOEBE_VOLL,
461     EL_AMOEBE_BD
462   };
463   static int ep_amoeboid_num = SIZEOF_ARRAY_INT(ep_amoeboid);
464
465   static int ep_schluessel[] =
466   {
467     EL_SCHLUESSEL1,
468     EL_SCHLUESSEL2,
469     EL_SCHLUESSEL3,
470     EL_SCHLUESSEL4,
471     EL_EM_KEY_1,
472     EL_EM_KEY_2,
473     EL_EM_KEY_3,
474     EL_EM_KEY_4
475   };
476   static int ep_schluessel_num = SIZEOF_ARRAY_INT(ep_schluessel);
477
478   static int ep_pforte[] =
479   {
480     EL_PFORTE1,
481     EL_PFORTE2,
482     EL_PFORTE3,
483     EL_PFORTE4,
484     EL_PFORTE1X,
485     EL_PFORTE2X,
486     EL_PFORTE3X,
487     EL_PFORTE4X,
488     EL_EM_GATE_1,
489     EL_EM_GATE_2,
490     EL_EM_GATE_3,
491     EL_EM_GATE_4,
492     EL_EM_GATE_1X,
493     EL_EM_GATE_2X,
494     EL_EM_GATE_3X,
495     EL_EM_GATE_4X,
496     EL_SWITCHGATE_OPEN,
497     EL_SWITCHGATE_CLOSED,
498     EL_TIMEGATE_OPEN,
499     EL_TIMEGATE_CLOSED,
500     EL_TUBE_CROSS,
501     EL_TUBE_VERTICAL,
502     EL_TUBE_HORIZONTAL,
503     EL_TUBE_VERT_LEFT,
504     EL_TUBE_VERT_RIGHT,
505     EL_TUBE_HORIZ_UP,
506     EL_TUBE_HORIZ_DOWN,
507     EL_TUBE_LEFT_UP,
508     EL_TUBE_LEFT_DOWN,
509     EL_TUBE_RIGHT_UP,
510     EL_TUBE_RIGHT_DOWN
511   };
512   static int ep_pforte_num = SIZEOF_ARRAY_INT(ep_pforte);
513
514   static int ep_solid[] =
515   {
516     EL_BETON,
517     EL_MAUERWERK,
518     EL_MAUER_LEBT,
519     EL_MAUER_X,
520     EL_MAUER_Y,
521     EL_MAUER_XY,
522     EL_BD_WALL,
523     EL_FELSBODEN,
524     EL_AUSGANG_ZU,
525     EL_AUSGANG_ACT,
526     EL_AUSGANG_AUF,
527     EL_AMOEBE_TOT,
528     EL_AMOEBE_NASS,
529     EL_AMOEBE_NORM,
530     EL_AMOEBE_VOLL,
531     EL_AMOEBE_BD,
532     EL_MORAST_VOLL,
533     EL_MORAST_LEER,
534     EL_QUICKSAND_FILLING,
535     EL_QUICKSAND_EMPTYING,
536     EL_MAGIC_WALL_OFF,
537     EL_MAGIC_WALL_EMPTY,
538     EL_MAGIC_WALL_FULL,
539     EL_MAGIC_WALL_DEAD,
540     EL_MAGIC_WALL_BD_OFF,
541     EL_MAGIC_WALL_BD_EMPTY,
542     EL_MAGIC_WALL_BD_FULL,
543     EL_MAGIC_WALL_BD_DEAD,
544     EL_LIFE,
545     EL_LIFE_ASYNC,
546     EL_BADEWANNE1,
547     EL_BADEWANNE2,
548     EL_BADEWANNE3,
549     EL_BADEWANNE4,
550     EL_BADEWANNE5,
551     EL_SP_CHIP_SINGLE,
552     EL_SP_CHIP_LEFT,
553     EL_SP_CHIP_RIGHT,
554     EL_SP_CHIP_UPPER,
555     EL_SP_CHIP_LOWER,
556     EL_SP_HARD_GRAY,
557     EL_SP_HARD_GREEN,
558     EL_SP_HARD_BLUE,
559     EL_SP_HARD_RED,
560     EL_SP_HARD_YELLOW,
561     EL_SP_HARD_BASE1,
562     EL_SP_HARD_BASE2,
563     EL_SP_HARD_BASE3,
564     EL_SP_HARD_BASE4,
565     EL_SP_HARD_BASE5,
566     EL_SP_HARD_BASE6,
567     EL_SP_TERMINAL,
568     EL_SP_EXIT,
569     EL_INVISIBLE_STEEL,
570     EL_BELT1_SWITCH_LEFT,
571     EL_BELT1_SWITCH_MIDDLE,
572     EL_BELT1_SWITCH_RIGHT,
573     EL_BELT2_SWITCH_LEFT,
574     EL_BELT2_SWITCH_MIDDLE,
575     EL_BELT2_SWITCH_RIGHT,
576     EL_BELT3_SWITCH_LEFT,
577     EL_BELT3_SWITCH_MIDDLE,
578     EL_BELT3_SWITCH_RIGHT,
579     EL_BELT4_SWITCH_LEFT,
580     EL_BELT4_SWITCH_MIDDLE,
581     EL_BELT4_SWITCH_RIGHT,
582     EL_SWITCHGATE_SWITCH_1,
583     EL_SWITCHGATE_SWITCH_2,
584     EL_LIGHT_SWITCH_OFF,
585     EL_LIGHT_SWITCH_ON,
586     EL_TIMEGATE_SWITCH_OFF,
587     EL_TIMEGATE_SWITCH_ON,
588     EL_SIGN_EXCLAMATION,
589     EL_SIGN_RADIOACTIVITY,
590     EL_SIGN_STOP,
591     EL_SIGN_WHEELCHAIR,
592     EL_SIGN_PARKING,
593     EL_SIGN_ONEWAY,
594     EL_SIGN_HEART,
595     EL_SIGN_TRIANGLE,
596     EL_SIGN_ROUND,
597     EL_SIGN_EXIT,
598     EL_SIGN_YINYANG,
599     EL_SIGN_OTHER,
600     EL_STEEL_SLANTED,
601     EL_EMC_STEEL_WALL_1,
602     EL_EMC_STEEL_WALL_2,
603     EL_EMC_STEEL_WALL_3,
604     EL_EMC_STEEL_WALL_4,
605     EL_EMC_WALL_1,
606     EL_EMC_WALL_2,
607     EL_EMC_WALL_3,
608     EL_EMC_WALL_4,
609     EL_EMC_WALL_5,
610     EL_EMC_WALL_6,
611     EL_EMC_WALL_7,
612     EL_EMC_WALL_8,
613     EL_CRYSTAL,
614     EL_WALL_PEARL,
615     EL_WALL_CRYSTAL,
616     EL_TUBE_CROSS,
617     EL_TUBE_VERTICAL,
618     EL_TUBE_HORIZONTAL,
619     EL_TUBE_VERT_LEFT,
620     EL_TUBE_VERT_RIGHT,
621     EL_TUBE_HORIZ_UP,
622     EL_TUBE_HORIZ_DOWN,
623     EL_TUBE_LEFT_UP,
624     EL_TUBE_LEFT_DOWN,
625     EL_TUBE_RIGHT_UP,
626     EL_TUBE_RIGHT_DOWN
627   };
628   static int ep_solid_num = SIZEOF_ARRAY_INT(ep_solid);
629
630   static int ep_massive[] =
631   {
632     EL_BETON,
633     EL_SALZSAEURE,
634     EL_BADEWANNE1,
635     EL_BADEWANNE2,
636     EL_BADEWANNE3,
637     EL_BADEWANNE4,
638     EL_BADEWANNE5,
639     EL_PFORTE1,
640     EL_PFORTE2,
641     EL_PFORTE3,
642     EL_PFORTE4,
643     EL_PFORTE1X,
644     EL_PFORTE2X,
645     EL_PFORTE3X,
646     EL_PFORTE4X,
647     EL_EM_GATE_1,
648     EL_EM_GATE_2,
649     EL_EM_GATE_3,
650     EL_EM_GATE_4,
651     EL_EM_GATE_1X,
652     EL_EM_GATE_2X,
653     EL_EM_GATE_3X,
654     EL_EM_GATE_4X,
655     EL_SWITCHGATE_OPEN,
656     EL_SWITCHGATE_CLOSED,
657     EL_TIMEGATE_OPEN,
658     EL_TIMEGATE_CLOSED,
659     EL_SP_HARD_GRAY,
660     EL_SP_HARD_GREEN,
661     EL_SP_HARD_BLUE,
662     EL_SP_HARD_RED,
663     EL_SP_HARD_YELLOW,
664     EL_SP_HARD_BASE1,
665     EL_SP_HARD_BASE2,
666     EL_SP_HARD_BASE3,
667     EL_SP_HARD_BASE4,
668     EL_SP_HARD_BASE5,
669     EL_SP_HARD_BASE6,
670     EL_INVISIBLE_STEEL,
671     EL_BELT1_SWITCH_LEFT,
672     EL_BELT1_SWITCH_MIDDLE,
673     EL_BELT1_SWITCH_RIGHT,
674     EL_BELT2_SWITCH_LEFT,
675     EL_BELT2_SWITCH_MIDDLE,
676     EL_BELT2_SWITCH_RIGHT,
677     EL_BELT3_SWITCH_LEFT,
678     EL_BELT3_SWITCH_MIDDLE,
679     EL_BELT3_SWITCH_RIGHT,
680     EL_BELT4_SWITCH_LEFT,
681     EL_BELT4_SWITCH_MIDDLE,
682     EL_BELT4_SWITCH_RIGHT,
683     EL_LIGHT_SWITCH_OFF,
684     EL_LIGHT_SWITCH_ON,
685     EL_SIGN_EXCLAMATION,
686     EL_SIGN_RADIOACTIVITY,
687     EL_SIGN_STOP,
688     EL_SIGN_WHEELCHAIR,
689     EL_SIGN_PARKING,
690     EL_SIGN_ONEWAY,
691     EL_SIGN_HEART,
692     EL_SIGN_TRIANGLE,
693     EL_SIGN_ROUND,
694     EL_SIGN_EXIT,
695     EL_SIGN_YINYANG,
696     EL_SIGN_OTHER,
697     EL_STEEL_SLANTED,
698     EL_EMC_STEEL_WALL_1,
699     EL_EMC_STEEL_WALL_2,
700     EL_EMC_STEEL_WALL_3,
701     EL_EMC_STEEL_WALL_4,
702     EL_CRYSTAL,
703     EL_TUBE_CROSS,
704     EL_TUBE_VERTICAL,
705     EL_TUBE_HORIZONTAL,
706     EL_TUBE_VERT_LEFT,
707     EL_TUBE_VERT_RIGHT,
708     EL_TUBE_HORIZ_UP,
709     EL_TUBE_HORIZ_DOWN,
710     EL_TUBE_LEFT_UP,
711     EL_TUBE_LEFT_DOWN,
712     EL_TUBE_RIGHT_UP,
713     EL_TUBE_RIGHT_DOWN
714   };
715   static int ep_massive_num = SIZEOF_ARRAY_INT(ep_massive);
716
717   static int ep_slippery[] =
718   {
719     EL_FELSBODEN,
720     EL_BD_WALL,
721     EL_FELSBROCKEN,
722     EL_BD_ROCK,
723     EL_EDELSTEIN,
724     EL_EDELSTEIN_BD,
725     EL_EDELSTEIN_GELB,
726     EL_EDELSTEIN_ROT,
727     EL_EDELSTEIN_LILA,
728     EL_DIAMANT,
729     EL_BOMBE,
730     EL_KOKOSNUSS,
731     EL_ABLENK_EIN,
732     EL_ABLENK_AUS,
733     EL_ZEIT_VOLL,
734     EL_ZEIT_LEER,
735     EL_BIRNE_EIN,
736     EL_BIRNE_AUS,
737     EL_BADEWANNE1,
738     EL_BADEWANNE2,
739     EL_SONDE,
740     EL_SP_ZONK,
741     EL_SP_INFOTRON,
742     EL_SP_CHIP_SINGLE,
743     EL_SP_CHIP_LEFT,
744     EL_SP_CHIP_RIGHT,
745     EL_SP_CHIP_UPPER,
746     EL_SP_CHIP_LOWER,
747     EL_SPEED_PILL,
748     EL_STEEL_SLANTED,
749     EL_PEARL,
750     EL_CRYSTAL
751   };
752   static int ep_slippery_num = SIZEOF_ARRAY_INT(ep_slippery);
753
754   static int ep_enemy[] =
755   {
756     EL_KAEFER,
757     EL_FLIEGER,
758     EL_BUTTERFLY,
759     EL_FIREFLY,
760     EL_MAMPFER,
761     EL_MAMPFER2,
762     EL_ROBOT,
763     EL_PACMAN,
764     EL_SP_SNIKSNAK,
765     EL_SP_ELECTRON
766   };
767   static int ep_enemy_num = SIZEOF_ARRAY_INT(ep_enemy);
768
769   static int ep_mauer[] =
770   {
771     EL_BETON,
772     EL_PFORTE1,
773     EL_PFORTE2,
774     EL_PFORTE3,
775     EL_PFORTE4,
776     EL_PFORTE1X,
777     EL_PFORTE2X,
778     EL_PFORTE3X,
779     EL_PFORTE4X,
780     EL_EM_GATE_1,
781     EL_EM_GATE_2,
782     EL_EM_GATE_3,
783     EL_EM_GATE_4,
784     EL_EM_GATE_1X,
785     EL_EM_GATE_2X,
786     EL_EM_GATE_3X,
787     EL_EM_GATE_4X,
788     EL_AUSGANG_ZU,
789     EL_AUSGANG_ACT,
790     EL_AUSGANG_AUF,
791     EL_MAUERWERK,
792     EL_FELSBODEN,
793     EL_MAUER_LEBT,
794     EL_MAUER_X,
795     EL_MAUER_Y,
796     EL_MAUER_XY,
797     EL_MAUERND,
798     EL_BD_WALL,
799     EL_SP_CHIP_SINGLE,
800     EL_SP_CHIP_LEFT,
801     EL_SP_CHIP_RIGHT,
802     EL_SP_CHIP_UPPER,
803     EL_SP_CHIP_LOWER,
804     EL_SP_HARD_GRAY,
805     EL_SP_HARD_GREEN,
806     EL_SP_HARD_BLUE,
807     EL_SP_HARD_RED,
808     EL_SP_HARD_YELLOW,
809     EL_SP_HARD_BASE1,
810     EL_SP_HARD_BASE2,
811     EL_SP_HARD_BASE3,
812     EL_SP_HARD_BASE4,
813     EL_SP_HARD_BASE5,
814     EL_SP_HARD_BASE6,
815     EL_SP_TERMINAL,
816     EL_SP_EXIT,
817     EL_INVISIBLE_STEEL,
818     EL_STEEL_SLANTED,
819     EL_EMC_STEEL_WALL_1,
820     EL_EMC_STEEL_WALL_2,
821     EL_EMC_STEEL_WALL_3,
822     EL_EMC_STEEL_WALL_4,
823     EL_EMC_WALL_1,
824     EL_EMC_WALL_2,
825     EL_EMC_WALL_3,
826     EL_EMC_WALL_4,
827     EL_EMC_WALL_5,
828     EL_EMC_WALL_6,
829     EL_EMC_WALL_7,
830     EL_EMC_WALL_8
831   };
832   static int ep_mauer_num = SIZEOF_ARRAY_INT(ep_mauer);
833
834   static int ep_can_fall[] =
835   {
836     EL_FELSBROCKEN,
837     EL_BD_ROCK,
838     EL_EDELSTEIN,
839     EL_EDELSTEIN_BD,
840     EL_EDELSTEIN_GELB,
841     EL_EDELSTEIN_ROT,
842     EL_EDELSTEIN_LILA,
843     EL_DIAMANT,
844     EL_BOMBE,
845     EL_KOKOSNUSS,
846     EL_TROPFEN,
847     EL_MORAST_VOLL,
848     EL_MAGIC_WALL_FULL,
849     EL_MAGIC_WALL_BD_FULL,
850     EL_ZEIT_VOLL,
851     EL_ZEIT_LEER,
852     EL_SP_ZONK,
853     EL_SP_INFOTRON,
854     EL_SP_DISK_ORANGE,
855     EL_PEARL,
856     EL_CRYSTAL,
857     EL_SPRING,
858     EL_DX_SUPABOMB
859   };
860   static int ep_can_fall_num = SIZEOF_ARRAY_INT(ep_can_fall);
861
862   static int ep_can_smash[] =
863   {
864     EL_FELSBROCKEN,
865     EL_BD_ROCK,
866     EL_EDELSTEIN,
867     EL_EDELSTEIN_BD,
868     EL_EDELSTEIN_GELB,
869     EL_EDELSTEIN_ROT,
870     EL_EDELSTEIN_LILA,
871     EL_DIAMANT,
872     EL_SCHLUESSEL1,
873     EL_SCHLUESSEL2,
874     EL_SCHLUESSEL3,
875     EL_SCHLUESSEL4,
876     EL_EM_KEY_1,
877     EL_EM_KEY_2,
878     EL_EM_KEY_3,
879     EL_EM_KEY_4,
880     EL_BOMBE,
881     EL_KOKOSNUSS,
882     EL_TROPFEN,
883     EL_ZEIT_VOLL,
884     EL_ZEIT_LEER,
885     EL_SP_ZONK,
886     EL_SP_INFOTRON,
887     EL_SP_DISK_ORANGE,
888     EL_PEARL,
889     EL_CRYSTAL,
890     EL_SPRING,
891     EL_DX_SUPABOMB
892   };
893   static int ep_can_smash_num = SIZEOF_ARRAY_INT(ep_can_smash);
894
895   static int ep_can_change[] =
896   {
897     EL_FELSBROCKEN,
898     EL_BD_ROCK,
899     EL_EDELSTEIN,
900     EL_EDELSTEIN_BD,
901     EL_EDELSTEIN_GELB,
902     EL_EDELSTEIN_ROT,
903     EL_EDELSTEIN_LILA,
904     EL_DIAMANT
905   };
906   static int ep_can_change_num = SIZEOF_ARRAY_INT(ep_can_change);
907
908   static int ep_can_move[] =
909   {
910     EL_KAEFER,
911     EL_FLIEGER,
912     EL_BUTTERFLY,
913     EL_FIREFLY,
914     EL_MAMPFER,
915     EL_MAMPFER2,
916     EL_ROBOT,
917     EL_PACMAN,
918     EL_MOLE,
919     EL_PINGUIN,
920     EL_SCHWEIN,
921     EL_DRACHE,
922     EL_SONDE,
923     EL_SP_SNIKSNAK,
924     EL_SP_ELECTRON,
925     EL_BALLOON,
926     EL_SPRING_MOVING
927   };
928   static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move);
929
930   static int ep_could_move[] =
931   {
932     EL_KAEFER_RIGHT,
933     EL_KAEFER_UP,
934     EL_KAEFER_LEFT,
935     EL_KAEFER_DOWN,
936     EL_FLIEGER_RIGHT,
937     EL_FLIEGER_UP,
938     EL_FLIEGER_LEFT,
939     EL_FLIEGER_DOWN,
940     EL_BUTTERFLY_RIGHT,
941     EL_BUTTERFLY_UP,
942     EL_BUTTERFLY_LEFT,
943     EL_BUTTERFLY_DOWN,
944     EL_FIREFLY_RIGHT,
945     EL_FIREFLY_UP,
946     EL_FIREFLY_LEFT,
947     EL_FIREFLY_DOWN,
948     EL_PACMAN_RIGHT,
949     EL_PACMAN_UP,
950     EL_PACMAN_LEFT,
951     EL_PACMAN_DOWN
952   };
953   static int ep_could_move_num = SIZEOF_ARRAY_INT(ep_could_move);
954
955   static int ep_dont_touch[] =
956   {
957     EL_KAEFER,
958     EL_FLIEGER,
959     EL_BUTTERFLY,
960     EL_FIREFLY
961   };
962   static int ep_dont_touch_num = SIZEOF_ARRAY_INT(ep_dont_touch);
963
964   static int ep_dont_go_to[] =
965   {
966     EL_KAEFER,
967     EL_FLIEGER,
968     EL_BUTTERFLY,
969     EL_FIREFLY,
970     EL_MAMPFER,
971     EL_MAMPFER2,
972     EL_ROBOT,
973     EL_PACMAN,
974     EL_TROPFEN,
975     EL_SALZSAEURE,
976     EL_SP_SNIKSNAK,
977     EL_SP_ELECTRON,
978     EL_SP_BUG_ACTIVE,
979     EL_TRAP_ACTIVE,
980     EL_LANDMINE
981   };
982   static int ep_dont_go_to_num = SIZEOF_ARRAY_INT(ep_dont_go_to);
983
984   static int ep_mampf2[] =
985   {
986     EL_ERDREICH,
987     EL_KAEFER,
988     EL_FLIEGER,
989     EL_BUTTERFLY,
990     EL_FIREFLY,
991     EL_MAMPFER,
992     EL_ROBOT,
993     EL_PACMAN,
994     EL_TROPFEN,
995     EL_AMOEBE_TOT,
996     EL_AMOEBE_NASS,
997     EL_AMOEBE_NORM,
998     EL_AMOEBE_VOLL,
999     EL_AMOEBE_BD,
1000     EL_EDELSTEIN,
1001     EL_EDELSTEIN_BD,
1002     EL_EDELSTEIN_GELB,
1003     EL_EDELSTEIN_ROT,
1004     EL_EDELSTEIN_LILA,
1005     EL_DIAMANT,
1006     EL_PEARL,
1007     EL_CRYSTAL
1008   };
1009   static int ep_mampf2_num = SIZEOF_ARRAY_INT(ep_mampf2);
1010
1011   static int ep_bd_element[] =
1012   {
1013     EL_LEERRAUM,
1014     EL_ERDREICH,
1015     EL_FELSBODEN,
1016     EL_BD_WALL,
1017     EL_FELSBROCKEN,
1018     EL_BD_ROCK,
1019     EL_EDELSTEIN_BD,
1020     EL_MAGIC_WALL_BD_OFF,
1021     EL_AUSGANG_ZU,
1022     EL_AUSGANG_AUF,
1023     EL_BETON,
1024     EL_SPIELFIGUR,
1025     EL_FIREFLY,
1026     EL_FIREFLY_1,
1027     EL_FIREFLY_2,
1028     EL_FIREFLY_3,
1029     EL_FIREFLY_4,
1030     EL_BUTTERFLY,
1031     EL_BUTTERFLY_1,
1032     EL_BUTTERFLY_2,
1033     EL_BUTTERFLY_3,
1034     EL_BUTTERFLY_4,
1035     EL_AMOEBE_BD,
1036     EL_CHAR_FRAGE
1037   };
1038   static int ep_bd_element_num = SIZEOF_ARRAY_INT(ep_bd_element);
1039
1040   static int ep_sb_element[] =
1041   {
1042     EL_LEERRAUM,
1043     EL_BETON,
1044     EL_SOKOBAN_OBJEKT,
1045     EL_SOKOBAN_FELD_LEER,
1046     EL_SOKOBAN_FELD_VOLL,
1047     EL_SPIELFIGUR,
1048     EL_INVISIBLE_STEEL
1049   };
1050   static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element);
1051
1052   static int ep_gem[] =
1053   {
1054     EL_EDELSTEIN,
1055     EL_EDELSTEIN_BD,
1056     EL_EDELSTEIN_GELB,
1057     EL_EDELSTEIN_ROT,
1058     EL_EDELSTEIN_LILA,
1059     EL_DIAMANT
1060   };
1061   static int ep_gem_num = SIZEOF_ARRAY_INT(ep_gem);
1062
1063   static int ep_inactive[] =
1064   {
1065     EL_LEERRAUM,
1066     EL_ERDREICH,
1067     EL_MAUERWERK,
1068     EL_BD_WALL,
1069     EL_FELSBODEN,
1070     EL_SCHLUESSEL,
1071     EL_BETON,
1072     EL_AMOEBE_TOT,
1073     EL_MORAST_LEER,
1074     EL_BADEWANNE,
1075     EL_ABLENK_AUS,
1076     EL_SCHLUESSEL1,
1077     EL_SCHLUESSEL2,
1078     EL_SCHLUESSEL3,
1079     EL_SCHLUESSEL4,
1080     EL_EM_KEY_1,
1081     EL_EM_KEY_2,
1082     EL_EM_KEY_3,
1083     EL_EM_KEY_4,
1084     EL_PFORTE1,
1085     EL_PFORTE2,
1086     EL_PFORTE3,
1087     EL_PFORTE4,
1088     EL_PFORTE1X,
1089     EL_PFORTE2X,
1090     EL_PFORTE3X,
1091     EL_PFORTE4X,
1092     EL_EM_GATE_1,
1093     EL_EM_GATE_2,
1094     EL_EM_GATE_3,
1095     EL_EM_GATE_4,
1096     EL_EM_GATE_1X,
1097     EL_EM_GATE_2X,
1098     EL_EM_GATE_3X,
1099     EL_EM_GATE_4X,
1100     EL_DYNAMITE_INACTIVE,
1101     EL_UNSICHTBAR,
1102     EL_BIRNE_AUS,
1103     EL_BIRNE_EIN,
1104     EL_ERZ_EDEL,
1105     EL_ERZ_DIAM,
1106     EL_ERZ_EDEL_BD,
1107     EL_ERZ_EDEL_GELB,
1108     EL_DYNABOMB_NR,
1109     EL_DYNABOMB_SZ,
1110     EL_DYNABOMB_XL,
1111     EL_SOKOBAN_OBJEKT,
1112     EL_SOKOBAN_FELD_LEER,
1113     EL_SOKOBAN_FELD_VOLL,
1114     EL_ERZ_EDEL_ROT,
1115     EL_ERZ_EDEL_LILA,
1116     EL_BADEWANNE1,
1117     EL_BADEWANNE2,
1118     EL_BADEWANNE3,
1119     EL_BADEWANNE4,
1120     EL_BADEWANNE5,
1121     EL_MAGIC_WALL_OFF,
1122     EL_MAGIC_WALL_DEAD,
1123     EL_MAGIC_WALL_BD_OFF,
1124     EL_MAGIC_WALL_BD_DEAD,
1125     EL_AMOEBA2DIAM,
1126     EL_BLOCKED,
1127     EL_SP_EMPTY,
1128     EL_SP_BASE,
1129     EL_SP_PORT1_RIGHT,
1130     EL_SP_PORT1_DOWN,
1131     EL_SP_PORT1_LEFT,
1132     EL_SP_PORT1_UP,
1133     EL_SP_PORT2_RIGHT,
1134     EL_SP_PORT2_DOWN,
1135     EL_SP_PORT2_LEFT,
1136     EL_SP_PORT2_UP,
1137     EL_SP_PORT_X,
1138     EL_SP_PORT_Y,
1139     EL_SP_PORT_XY,
1140     EL_SP_DISK_RED,
1141     EL_SP_DISK_YELLOW,
1142     EL_SP_CHIP_SINGLE,
1143     EL_SP_CHIP_LEFT,
1144     EL_SP_CHIP_RIGHT,
1145     EL_SP_CHIP_UPPER,
1146     EL_SP_CHIP_LOWER,
1147     EL_SP_HARD_GRAY,
1148     EL_SP_HARD_GREEN,
1149     EL_SP_HARD_BLUE,
1150     EL_SP_HARD_RED,
1151     EL_SP_HARD_YELLOW,
1152     EL_SP_HARD_BASE1,
1153     EL_SP_HARD_BASE2,
1154     EL_SP_HARD_BASE3,
1155     EL_SP_HARD_BASE4,
1156     EL_SP_HARD_BASE5,
1157     EL_SP_HARD_BASE6,
1158     EL_SP_EXIT,
1159     EL_INVISIBLE_STEEL,
1160     EL_BELT1_SWITCH_LEFT,
1161     EL_BELT1_SWITCH_MIDDLE,
1162     EL_BELT1_SWITCH_RIGHT,
1163     EL_BELT2_SWITCH_LEFT,
1164     EL_BELT2_SWITCH_MIDDLE,
1165     EL_BELT2_SWITCH_RIGHT,
1166     EL_BELT3_SWITCH_LEFT,
1167     EL_BELT3_SWITCH_MIDDLE,
1168     EL_BELT3_SWITCH_RIGHT,
1169     EL_BELT4_SWITCH_LEFT,
1170     EL_BELT4_SWITCH_MIDDLE,
1171     EL_BELT4_SWITCH_RIGHT,
1172     EL_SIGN_EXCLAMATION,
1173     EL_SIGN_RADIOACTIVITY,
1174     EL_SIGN_STOP,
1175     EL_SIGN_WHEELCHAIR,
1176     EL_SIGN_PARKING,
1177     EL_SIGN_ONEWAY,
1178     EL_SIGN_HEART,
1179     EL_SIGN_TRIANGLE,
1180     EL_SIGN_ROUND,
1181     EL_SIGN_EXIT,
1182     EL_SIGN_YINYANG,
1183     EL_SIGN_OTHER,
1184     EL_STEEL_SLANTED,
1185     EL_EMC_STEEL_WALL_1,
1186     EL_EMC_STEEL_WALL_2,
1187     EL_EMC_STEEL_WALL_3,
1188     EL_EMC_STEEL_WALL_4,
1189     EL_EMC_WALL_1,
1190     EL_EMC_WALL_2,
1191     EL_EMC_WALL_3,
1192     EL_EMC_WALL_4,
1193     EL_EMC_WALL_5,
1194     EL_EMC_WALL_6,
1195     EL_EMC_WALL_7,
1196     EL_EMC_WALL_8
1197   };
1198   static int ep_inactive_num = SIZEOF_ARRAY_INT(ep_inactive);
1199
1200   static int ep_explosive[] =
1201   {
1202     EL_BOMBE,
1203     EL_DYNAMITE_ACTIVE,
1204     EL_DYNAMITE_INACTIVE,
1205     EL_DYNABOMB_ACTIVE_1,
1206     EL_DYNABOMB_ACTIVE_2,
1207     EL_DYNABOMB_ACTIVE_3,
1208     EL_DYNABOMB_ACTIVE_4,
1209     EL_DYNABOMB_NR,
1210     EL_DYNABOMB_SZ,
1211     EL_DYNABOMB_XL,
1212     EL_KAEFER,
1213     EL_MOLE,
1214     EL_PINGUIN,
1215     EL_SCHWEIN,
1216     EL_DRACHE,
1217     EL_SONDE,
1218     EL_SP_DISK_RED,
1219     EL_SP_DISK_ORANGE,
1220     EL_SP_DISK_YELLOW,
1221     EL_SP_SNIKSNAK,
1222     EL_SP_ELECTRON,
1223     EL_DX_SUPABOMB
1224   };
1225   static int ep_explosive_num = SIZEOF_ARRAY_INT(ep_explosive);
1226
1227   static int ep_mampf3[] =
1228   {
1229     EL_EDELSTEIN,
1230     EL_EDELSTEIN_BD,
1231     EL_EDELSTEIN_GELB,
1232     EL_EDELSTEIN_ROT,
1233     EL_EDELSTEIN_LILA,
1234     EL_DIAMANT,
1235     EL_PEARL,
1236     EL_CRYSTAL
1237   };
1238   static int ep_mampf3_num = SIZEOF_ARRAY_INT(ep_mampf3);
1239
1240   static int ep_pushable[] =
1241   {
1242     EL_FELSBROCKEN,
1243     EL_BD_ROCK,
1244     EL_BOMBE,
1245     EL_KOKOSNUSS,
1246     EL_ZEIT_LEER,
1247     EL_SOKOBAN_FELD_VOLL,
1248     EL_SOKOBAN_OBJEKT,
1249     EL_SONDE,
1250     EL_SP_ZONK,
1251     EL_SP_DISK_ORANGE,
1252     EL_SP_DISK_YELLOW,
1253     EL_BALLOON,
1254     EL_SPRING,
1255     EL_DX_SUPABOMB
1256   };
1257   static int ep_pushable_num = SIZEOF_ARRAY_INT(ep_pushable);
1258
1259   static int ep_player[] =
1260   {
1261     EL_SPIELFIGUR,
1262     EL_SPIELER1,
1263     EL_SPIELER2,
1264     EL_SPIELER3,
1265     EL_SPIELER4
1266   };
1267   static int ep_player_num = SIZEOF_ARRAY_INT(ep_player);
1268
1269   static int ep_has_content[] =
1270   {
1271     EL_MAMPFER,
1272     EL_AMOEBE_NASS,
1273     EL_AMOEBE_NORM,
1274     EL_AMOEBE_VOLL,
1275     EL_AMOEBE_BD
1276   };
1277   static int ep_has_content_num = SIZEOF_ARRAY_INT(ep_has_content);
1278
1279   static int ep_eatable[] =
1280   {
1281     EL_ERDREICH,
1282     EL_SP_BASE,
1283     EL_SP_BUG,
1284     EL_TRAP_INACTIVE,
1285     EL_SAND_INVISIBLE
1286   };
1287   static int ep_eatable_num = SIZEOF_ARRAY_INT(ep_eatable);
1288
1289   static int ep_sp_element[] =
1290   {
1291     EL_SP_EMPTY,
1292     EL_SP_ZONK,
1293     EL_SP_BASE,
1294     EL_SP_MURPHY,
1295     EL_SP_INFOTRON,
1296     EL_SP_CHIP_SINGLE,
1297     EL_SP_HARD_GRAY,
1298     EL_SP_EXIT,
1299     EL_SP_DISK_ORANGE,
1300     EL_SP_PORT1_RIGHT,
1301     EL_SP_PORT1_DOWN,
1302     EL_SP_PORT1_LEFT,
1303     EL_SP_PORT1_UP,
1304     EL_SP_PORT2_RIGHT,
1305     EL_SP_PORT2_DOWN,
1306     EL_SP_PORT2_LEFT,
1307     EL_SP_PORT2_UP,
1308     EL_SP_SNIKSNAK,
1309     EL_SP_DISK_YELLOW,
1310     EL_SP_TERMINAL,
1311     EL_SP_DISK_RED,
1312     EL_SP_PORT_Y,
1313     EL_SP_PORT_X,
1314     EL_SP_PORT_XY,
1315     EL_SP_ELECTRON,
1316     EL_SP_BUG,
1317     EL_SP_CHIP_LEFT,
1318     EL_SP_CHIP_RIGHT,
1319     EL_SP_HARD_BASE1,
1320     EL_SP_HARD_GREEN,
1321     EL_SP_HARD_BLUE,
1322     EL_SP_HARD_RED,
1323     EL_SP_HARD_YELLOW,
1324     EL_SP_HARD_BASE2,
1325     EL_SP_HARD_BASE3,
1326     EL_SP_HARD_BASE4,
1327     EL_SP_HARD_BASE5,
1328     EL_SP_HARD_BASE6,
1329     EL_SP_CHIP_UPPER,
1330     EL_SP_CHIP_LOWER,
1331     /* additional elements that appeared in newer Supaplex levels */
1332     EL_UNSICHTBAR,
1333     /* more than one murphy in a level results in an inactive clone */
1334     EL_SP_MURPHY_CLONE
1335   };
1336   static int ep_sp_element_num = SIZEOF_ARRAY_INT(ep_sp_element);
1337
1338   static int ep_quick_gate[] =
1339   {
1340     EL_EM_GATE_1,
1341     EL_EM_GATE_2,
1342     EL_EM_GATE_3,
1343     EL_EM_GATE_4,
1344     EL_EM_GATE_1X,
1345     EL_EM_GATE_2X,
1346     EL_EM_GATE_3X,
1347     EL_EM_GATE_4X,
1348     EL_SP_PORT1_LEFT,
1349     EL_SP_PORT2_LEFT,
1350     EL_SP_PORT1_RIGHT,
1351     EL_SP_PORT2_RIGHT,
1352     EL_SP_PORT1_UP,
1353     EL_SP_PORT2_UP,
1354     EL_SP_PORT1_DOWN,
1355     EL_SP_PORT2_DOWN,
1356     EL_SP_PORT_X,
1357     EL_SP_PORT_Y,
1358     EL_SP_PORT_XY,
1359     EL_SWITCHGATE_OPEN,
1360     EL_TIMEGATE_OPEN
1361   };
1362   static int ep_quick_gate_num = SIZEOF_ARRAY_INT(ep_quick_gate);
1363
1364   static int ep_over_player[] =
1365   {
1366     EL_SP_PORT1_LEFT,
1367     EL_SP_PORT2_LEFT,
1368     EL_SP_PORT1_RIGHT,
1369     EL_SP_PORT2_RIGHT,
1370     EL_SP_PORT1_UP,
1371     EL_SP_PORT2_UP,
1372     EL_SP_PORT1_DOWN,
1373     EL_SP_PORT2_DOWN,
1374     EL_SP_PORT_X,
1375     EL_SP_PORT_Y,
1376     EL_SP_PORT_XY,
1377     EL_TUBE_CROSS,
1378     EL_TUBE_VERTICAL,
1379     EL_TUBE_HORIZONTAL,
1380     EL_TUBE_VERT_LEFT,
1381     EL_TUBE_VERT_RIGHT,
1382     EL_TUBE_HORIZ_UP,
1383     EL_TUBE_HORIZ_DOWN,
1384     EL_TUBE_LEFT_UP,
1385     EL_TUBE_LEFT_DOWN,
1386     EL_TUBE_RIGHT_UP,
1387     EL_TUBE_RIGHT_DOWN
1388   };
1389   static int ep_over_player_num = SIZEOF_ARRAY_INT(ep_over_player);
1390
1391   static int ep_active_bomb[] =
1392   {
1393     EL_DYNAMITE_ACTIVE,
1394     EL_DYNABOMB_ACTIVE_1,
1395     EL_DYNABOMB_ACTIVE_2,
1396     EL_DYNABOMB_ACTIVE_3,
1397     EL_DYNABOMB_ACTIVE_4
1398   };
1399   static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb);
1400
1401   static int ep_belt[] =
1402   {
1403     EL_BELT1_LEFT,
1404     EL_BELT1_MIDDLE,
1405     EL_BELT1_RIGHT,
1406     EL_BELT2_LEFT,
1407     EL_BELT2_MIDDLE,
1408     EL_BELT2_RIGHT,
1409     EL_BELT3_LEFT,
1410     EL_BELT3_MIDDLE,
1411     EL_BELT3_RIGHT,
1412     EL_BELT4_LEFT,
1413     EL_BELT4_MIDDLE,
1414     EL_BELT4_RIGHT,
1415   };
1416   static int ep_belt_num = SIZEOF_ARRAY_INT(ep_belt);
1417
1418   static int ep_belt_switch[] =
1419   {
1420     EL_BELT1_SWITCH_LEFT,
1421     EL_BELT1_SWITCH_MIDDLE,
1422     EL_BELT1_SWITCH_RIGHT,
1423     EL_BELT2_SWITCH_LEFT,
1424     EL_BELT2_SWITCH_MIDDLE,
1425     EL_BELT2_SWITCH_RIGHT,
1426     EL_BELT3_SWITCH_LEFT,
1427     EL_BELT3_SWITCH_MIDDLE,
1428     EL_BELT3_SWITCH_RIGHT,
1429     EL_BELT4_SWITCH_LEFT,
1430     EL_BELT4_SWITCH_MIDDLE,
1431     EL_BELT4_SWITCH_RIGHT,
1432   };
1433   static int ep_belt_switch_num = SIZEOF_ARRAY_INT(ep_belt_switch);
1434
1435   static int ep_tube[] =
1436   {
1437     EL_TUBE_CROSS,
1438     EL_TUBE_VERTICAL,
1439     EL_TUBE_HORIZONTAL,
1440     EL_TUBE_VERT_LEFT,
1441     EL_TUBE_VERT_RIGHT,
1442     EL_TUBE_HORIZ_UP,
1443     EL_TUBE_HORIZ_DOWN,
1444     EL_TUBE_LEFT_UP,
1445     EL_TUBE_LEFT_DOWN,
1446     EL_TUBE_RIGHT_UP,
1447     EL_TUBE_RIGHT_DOWN
1448   };
1449   static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
1450
1451   static long ep1_bit[] =
1452   {
1453     EP_BIT_AMOEBALIVE,
1454     EP_BIT_AMOEBOID,
1455     EP_BIT_SCHLUESSEL,
1456     EP_BIT_PFORTE,
1457     EP_BIT_SOLID,
1458     EP_BIT_MASSIVE,
1459     EP_BIT_SLIPPERY,
1460     EP_BIT_ENEMY,
1461     EP_BIT_MAUER,
1462     EP_BIT_CAN_FALL,
1463     EP_BIT_CAN_SMASH,
1464     EP_BIT_CAN_CHANGE,
1465     EP_BIT_CAN_MOVE,
1466     EP_BIT_COULD_MOVE,
1467     EP_BIT_DONT_TOUCH,
1468     EP_BIT_DONT_GO_TO,
1469     EP_BIT_MAMPF2,
1470     EP_BIT_BD_ELEMENT,
1471     EP_BIT_SB_ELEMENT,
1472     EP_BIT_GEM,
1473     EP_BIT_INACTIVE,
1474     EP_BIT_EXPLOSIVE,
1475     EP_BIT_MAMPF3,
1476     EP_BIT_PUSHABLE,
1477     EP_BIT_PLAYER,
1478     EP_BIT_HAS_CONTENT,
1479     EP_BIT_EATABLE,
1480     EP_BIT_SP_ELEMENT,
1481     EP_BIT_QUICK_GATE,
1482     EP_BIT_OVER_PLAYER,
1483     EP_BIT_ACTIVE_BOMB
1484   };
1485   static long ep2_bit[] =
1486   {
1487     EP_BIT_BELT,
1488     EP_BIT_BELT_SWITCH,
1489     EP_BIT_TUBE
1490   };
1491   static int *ep1_array[] =
1492   {
1493     ep_amoebalive,
1494     ep_amoeboid,
1495     ep_schluessel,
1496     ep_pforte,
1497     ep_solid,
1498     ep_massive,
1499     ep_slippery,
1500     ep_enemy,
1501     ep_mauer,
1502     ep_can_fall,
1503     ep_can_smash,
1504     ep_can_change,
1505     ep_can_move,
1506     ep_could_move,
1507     ep_dont_touch,
1508     ep_dont_go_to,
1509     ep_mampf2,
1510     ep_bd_element,
1511     ep_sb_element,
1512     ep_gem,
1513     ep_inactive,
1514     ep_explosive,
1515     ep_mampf3,
1516     ep_pushable,
1517     ep_player,
1518     ep_has_content,
1519     ep_eatable,
1520     ep_sp_element,
1521     ep_quick_gate,
1522     ep_over_player,
1523     ep_active_bomb
1524   };
1525   static int *ep2_array[] =
1526   {
1527     ep_belt,
1528     ep_belt_switch,
1529     ep_tube
1530   };
1531   static int *ep1_num[] =
1532   {
1533     &ep_amoebalive_num,
1534     &ep_amoeboid_num,
1535     &ep_schluessel_num,
1536     &ep_pforte_num,
1537     &ep_solid_num,
1538     &ep_massive_num,
1539     &ep_slippery_num,
1540     &ep_enemy_num,
1541     &ep_mauer_num,
1542     &ep_can_fall_num,
1543     &ep_can_smash_num,
1544     &ep_can_change_num,
1545     &ep_can_move_num,
1546     &ep_could_move_num,
1547     &ep_dont_touch_num,
1548     &ep_dont_go_to_num,
1549     &ep_mampf2_num,
1550     &ep_bd_element_num,
1551     &ep_sb_element_num,
1552     &ep_gem_num,
1553     &ep_inactive_num,
1554     &ep_explosive_num,
1555     &ep_mampf3_num,
1556     &ep_pushable_num,
1557     &ep_player_num,
1558     &ep_has_content_num,
1559     &ep_eatable_num,
1560     &ep_sp_element_num,
1561     &ep_quick_gate_num,
1562     &ep_over_player_num,
1563     &ep_active_bomb_num
1564   };
1565   static int *ep2_num[] =
1566   {
1567     &ep_belt_num,
1568     &ep_belt_switch_num,
1569     &ep_tube_num
1570   };
1571   static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
1572   static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
1573
1574   for(i=0; i<MAX_ELEMENTS; i++)
1575   {
1576     Elementeigenschaften1[i] = 0;
1577     Elementeigenschaften2[i] = 0;
1578   }
1579
1580   for(i=0; i<num_properties1; i++)
1581     for(j=0; j<*(ep1_num[i]); j++)
1582       Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1583   for(i=0; i<num_properties2; i++)
1584     for(j=0; j<*(ep2_num[i]); j++)
1585       Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1586
1587   for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1588     Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1589 }
1590
1591 void CloseAllAndExit(int exit_value)
1592 {
1593   int i;
1594
1595   StopSounds();
1596   CloseAudio();
1597   FreeAllSounds();
1598   FreeAllMusic();
1599
1600   FreeTileClipmasks();
1601   for(i=0; i<NUM_BITMAPS; i++)
1602     FreeBitmap(pix[i]);
1603
1604   CloseVideoDisplay();
1605   ClosePlatformDependantStuff();
1606
1607   exit(exit_value);
1608 }