1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-98 Artsoft Entertainment *
8 * phone: ++49 +521 290471 *
9 * email: aeglos@valinor.owl.de *
10 *----------------------------------------------------------*
12 ***********************************************************/
32 struct PictureFileInfo
34 char *picture_filename;
35 boolean picture_with_mask;
38 #ifndef USE_SDL_LIBRARY
39 static int sound_process_id = 0;
42 static void InitPlayerInfo(void);
43 static void InitLevelInfo(void);
44 static void InitNetworkServer(void);
45 static void InitSound(void);
46 static void InitSoundServer(void);
47 static void InitGfx(void);
48 static void InitGfxBackground(void);
49 static void LoadGfx(int, struct PictureFileInfo *);
50 static void InitGadgets(void);
51 static void InitElementProperties(void);
53 void OpenAll(int argc, char *argv[])
55 #if defined(MSDOS) || defined(WIN32)
59 if (options.serveronly)
62 Error(ERR_WARN, "networking not supported in Windows version");
64 NetworkServer(options.server_port, options.serveronly);
77 InitRND(NEW_RANDOMIZE);
79 signal(SIGINT, CloseAllAndExit);
80 signal(SIGTERM, CloseAllAndExit);
82 InitBufferedDisplay(&backbuffer, &window);
83 InitEventFilter(FilterMouseMotionEvents);
86 InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
89 InitGadgets(); /* needs to know number of level series */
101 /* choose default local player */
102 local_player = &stored_player[0];
104 for (i=0; i<MAX_PLAYERS; i++)
106 stored_player[i].joystick_fd = -1; /* joystick device closed */
107 stored_player[i].connected = FALSE;
110 local_player->connected = TRUE;
112 LoadSetup(); /* global setup info */
117 LoadLevelInfo(); /* global level info */
118 LoadLevelSetup_LastSeries(); /* last played series info */
119 LoadLevelSetup_SeriesInfo(); /* last played level info */
122 void InitNetworkServer()
124 #if !defined(MSDOS) && !defined(WIN32)
128 if (!options.network)
131 #if !defined(MSDOS) && !defined(WIN32)
132 nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
134 if (!ConnectToServer(options.server_host, options.server_port))
135 Error(ERR_EXIT, "cannot connect to network game server");
137 SendToServer_PlayerName(setup.player_name);
138 SendToServer_ProtocolVersion();
141 SendToServer_NrWanted(nr_wanted);
149 if (sound_status == SOUND_OFF)
152 #ifdef USE_SDL_LIBRARY
153 /* initialize SDL audio */
155 if (SDL_Init(SDL_INIT_AUDIO) < 0)
157 Error(ERR_WARN, "SDL_Init() failed: %s", SDL_GetError());
158 sound_status = SOUND_OFF;
162 if (Mix_OpenAudio(22050, AUDIO_S16, 2, 512) < 0)
164 Error(ERR_WARN, "Mix_OpenAudio() failed: %s", SDL_GetError());
165 sound_status = SOUND_OFF;
169 Mix_Volume(-1, SDL_MIX_MAXVOLUME / 4);
170 Mix_VolumeMusic(SDL_MIX_MAXVOLUME / 4);
172 sound_status = SOUND_AVAILABLE;
173 sound_loops_allowed = TRUE;
175 #else /* !USE_SDL_LIBRARY */
177 #if !defined(MSDOS) && !defined(WIN32)
178 if (access(sound_device_name, W_OK) != 0)
180 Error(ERR_WARN, "cannot access sound device - no sounds");
181 sound_status = SOUND_OFF;
185 if ((sound_device = OpenAudio(sound_device_name)) < 0)
187 Error(ERR_WARN, "cannot open sound device - no sounds");
188 sound_status = SOUND_OFF;
193 sound_status = SOUND_AVAILABLE;
196 sound_loops_allowed = TRUE;
199 setup.sound_loops_on = TRUE;
203 #else /* MSDOS || WIN32 */
204 sound_loops_allowed = TRUE;
207 setup.sound_loops_on = TRUE;
210 #endif /* MSDOS || WIN32 */
211 #endif /* !USE_SDL_LIBRARY */
213 for(i=0; i<NUM_SOUNDS; i++)
215 Sound[i].name = sound_name[i];
217 if (!LoadSound(&Sound[i]))
219 sound_status = SOUND_OFF;
220 sound_loops_allowed = FALSE;
226 sound_status = SOUND_OFF;
231 void InitSoundServer()
233 if (sound_status == SOUND_OFF)
236 #ifndef USE_SDL_LIBRARY
238 #if !defined(MSDOS) && !defined(WIN32)
240 if (pipe(sound_pipe)<0)
242 Error(ERR_WARN, "cannot create pipe - no sounds");
243 sound_status = SOUND_OFF;
247 if ((sound_process_id = fork()) < 0)
249 Error(ERR_WARN, "cannot create sound server process - no sounds");
250 sound_status = SOUND_OFF;
254 if (!sound_process_id) /* we are child */
261 else /* we are parent */
262 close(sound_pipe[0]); /* no reading from pipe needed */
264 #else /* MSDOS || WIN32 */
270 #endif /* !USE_SDL_LIBRARY */
275 #ifdef USE_SDL_JOYSTICK
276 static boolean sdl_joystick_subsystem_initialized = FALSE;
281 if (global_joystick_status == JOYSTICK_OFF)
284 joystick_status = JOYSTICK_OFF;
286 #ifdef USE_SDL_JOYSTICK
288 if (!sdl_joystick_subsystem_initialized)
290 sdl_joystick_subsystem_initialized = TRUE;
292 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
294 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
299 for (i=0; i<MAX_PLAYERS; i++)
301 char *device_name = setup.input[i].joy.device_name;
302 int joystick_nr = getJoystickNrFromDeviceName(device_name);
304 if (joystick_nr >= SDL_NumJoysticks())
307 /* misuse joystick file descriptor variable to store joystick number */
308 stored_player[i].joystick_fd = joystick_nr;
310 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
311 if (Check_SDL_JoystickOpened(joystick_nr))
312 Close_SDL_Joystick(joystick_nr);
314 if (!setup.input[i].use_joystick)
317 if (!Open_SDL_Joystick(joystick_nr))
319 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
323 joystick_status = JOYSTICK_AVAILABLE;
326 #else /* !USE_SDL_JOYSTICK */
329 for (i=0; i<MAX_PLAYERS; i++)
331 char *device_name = setup.input[i].joy.device_name;
333 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
334 if (stored_player[i].joystick_fd != -1)
336 close(stored_player[i].joystick_fd);
337 stored_player[i].joystick_fd = -1;
340 if (!setup.input[i].use_joystick)
343 if (access(device_name, R_OK) != 0)
345 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
349 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
351 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
355 joystick_status = JOYSTICK_AVAILABLE;
360 /* try to access two joysticks; if that fails, try to access just one */
361 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
362 install_joystick(JOY_TYPE_AUTODETECT) == 0)
363 joystick_status = JOYSTICK_AVAILABLE;
366 load_joystick_data(JOYSTICK_FILENAME);
369 for (i=0; i<MAX_PLAYERS; i++)
371 char *device_name = setup.input[i].joy.device_name;
372 int joystick_nr = getJoystickNrFromDeviceName(device_name);
374 if (joystick_nr >= num_joysticks)
377 /* misuse joystick file descriptor variable to store joystick number */
378 stored_player[i].joystick_fd = joystick_nr;
382 #endif /* !USE_SDL_LIBRARY */
389 #ifdef USE_SDL_LIBRARY
390 SDL_Surface *sdl_image_tmp;
393 XGCValues clip_gc_values;
394 unsigned long clip_gc_valuemask;
398 static struct PictureFileInfo pic[NUM_PICTURES] =
412 static struct PictureFileInfo pic[NUM_PICTURES] =
414 { "RocksScreen", TRUE },
415 { "RocksDoor", TRUE },
416 { "RocksHeroes", TRUE },
417 { "RocksToons", TRUE },
420 { "RocksMore", TRUE },
421 { "RocksFont", FALSE },
422 { "RocksFont2", FALSE },
423 { "RocksFont3", FALSE }
432 tile_needs_clipping[] =
434 { GFX_SPIELER1_UP, 4 },
435 { GFX_SPIELER1_DOWN, 4 },
436 { GFX_SPIELER1_LEFT, 4 },
437 { GFX_SPIELER1_RIGHT, 4 },
438 { GFX_SPIELER1_PUSH_LEFT, 4 },
439 { GFX_SPIELER1_PUSH_RIGHT, 4 },
440 { GFX_SPIELER2_UP, 4 },
441 { GFX_SPIELER2_DOWN, 4 },
442 { GFX_SPIELER2_LEFT, 4 },
443 { GFX_SPIELER2_RIGHT, 4 },
444 { GFX_SPIELER2_PUSH_LEFT, 4 },
445 { GFX_SPIELER2_PUSH_RIGHT, 4 },
446 { GFX_SPIELER3_UP, 4 },
447 { GFX_SPIELER3_DOWN, 4 },
448 { GFX_SPIELER3_LEFT, 4 },
449 { GFX_SPIELER3_RIGHT, 4 },
450 { GFX_SPIELER3_PUSH_LEFT, 4 },
451 { GFX_SPIELER3_PUSH_RIGHT, 4 },
452 { GFX_SPIELER4_UP, 4 },
453 { GFX_SPIELER4_DOWN, 4 },
454 { GFX_SPIELER4_LEFT, 4 },
455 { GFX_SPIELER4_RIGHT, 4 },
456 { GFX_SPIELER4_PUSH_LEFT, 4 },
457 { GFX_SPIELER4_PUSH_RIGHT, 4 },
458 { GFX_SP_MURPHY, 1 },
459 { GFX_MURPHY_GO_LEFT, 3 },
460 { GFX_MURPHY_GO_RIGHT, 3 },
461 { GFX_MURPHY_SNAP_UP, 1 },
462 { GFX_MURPHY_SNAP_DOWN, 1 },
463 { GFX_MURPHY_SNAP_RIGHT, 1 },
464 { GFX_MURPHY_SNAP_LEFT, 1 },
465 { GFX_MURPHY_PUSH_RIGHT, 1 },
466 { GFX_MURPHY_PUSH_LEFT, 1 },
467 { GFX_GEBLUBBER, 4 },
470 { GFX_EXPLOSION, 8 },
471 { GFX_SOKOBAN_OBJEKT, 1 },
472 { GFX_FUNKELN_BLAU, 3 },
473 { GFX_FUNKELN_WEISS, 3 },
474 { GFX2_SHIELD_PASSIVE, 3 },
475 { GFX2_SHIELD_ACTIVE, 3 },
479 /* create additional image buffers for double-buffering */
481 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
482 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
484 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
485 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
486 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
488 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
491 DrawInitText("Loading graphics:",120,FC_GREEN);
493 for(i=0; i<NUM_PICTURES; i++)
494 if (i != PIX_SMALLFONT)
497 /* create additional image buffers for masking of graphics */
499 #ifdef USE_SDL_LIBRARY
501 /* initialize surface array to 'NULL' */
502 for(i=0; i<NUM_TILES; i++)
503 tile_masked[i] = NULL;
505 /* create only those masked surfaces we really need */
506 for(i=0; tile_needs_clipping[i].start>=0; i++)
508 for(j=0; j<tile_needs_clipping[i].count; j++)
510 int tile = tile_needs_clipping[i].start + j;
516 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
517 src_bitmap = pix_masked[bitmap_nr];
519 /* create surface for masked tile graphic */
520 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
521 WIN_SDL_DEPTH, 0, 0, 0, 0))
523 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
525 /* create native transparent surface for current image */
526 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
527 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
528 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
529 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
531 SDL_FreeSurface(sdl_image_tmp);
533 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
537 #else /* !USE_SDL_LIBRARY */
539 /* create graphic context structures needed for clipping */
540 clip_gc_values.graphics_exposures = False;
541 clip_gc_valuemask = GCGraphicsExposures;
543 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
545 clip_gc_values.graphics_exposures = False;
546 clip_gc_valuemask = GCGraphicsExposures;
548 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
550 for(i=0; i<NUM_BITMAPS; i++)
554 clip_gc_values.graphics_exposures = False;
555 clip_gc_values.clip_mask = clipmask[i];
556 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
557 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
561 /* initialize pixmap array to Pixmap 'None' */
562 for(i=0; i<NUM_TILES; i++)
563 tile_clipmask[i] = None;
565 /* create only those clipping Pixmaps we really need */
566 for(i=0; tile_needs_clipping[i].start>=0; i++)
568 for(j=0; j<tile_needs_clipping[i].count; j++)
570 int tile = tile_needs_clipping[i].start + j;
576 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
577 src_pixmap = clipmask[pixmap_nr];
579 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
581 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
582 src_x,src_y, TILEX,TILEY, 0,0);
586 #endif /* !USE_SDL_LIBRARY */
589 void InitGfxBackground()
593 drawto = backbuffer = pix[PIX_DB_BACK];
594 fieldbuffer = pix[PIX_DB_FIELD];
595 SetDrawtoField(DRAW_BACKBUFFER);
597 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
598 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
599 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
601 for(x=0; x<MAX_BUF_XSIZE; x++)
602 for(y=0; y<MAX_BUF_YSIZE; y++)
605 redraw_mask = REDRAW_ALL;
608 void LoadGfx(int pos, struct PictureFileInfo *pic)
610 char basefilename[256];
613 #ifdef USE_SDL_LIBRARY
614 SDL_Surface *sdl_image_tmp;
615 #else /* !USE_SDL_LIBRARY */
617 #endif /* !USE_SDL_LIBRARY */
618 char *picture_ext = ".pcx";
621 if (pic->picture_filename)
623 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
624 DrawInitText(basefilename, 150, FC_YELLOW);
625 sprintf(filename, "%s/%s/%s",
626 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
632 #ifdef USE_SDL_LIBRARY
633 /* load image to temporary surface */
634 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
635 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
637 /* create native non-transparent surface for current image */
638 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
639 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
641 /* create native transparent surface for current image */
642 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
643 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
644 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
645 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
647 /* free temporary surface */
648 SDL_FreeSurface(sdl_image_tmp);
650 #else /* !USE_SDL_LIBRARY */
652 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
653 &pix[pos], &clipmask[pos]);
659 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
661 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
662 case PCX_FileInvalid:
663 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
665 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
666 case PCX_ColorFailed:
667 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
673 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
675 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
676 use pix_masked[], although they are the same when not using SDL */
677 pix_masked[pos] = pix[pos];
679 #endif /* !USE_SDL_LIBRARY */
682 #ifndef USE_SDL_LIBRARY
683 /* zugehörige Maske laden (wenn vorhanden) */
684 if (pic->picture_with_mask && !clipmask[pos])
685 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
686 #endif /* !USE_SDL_LIBRARY */
691 CreateLevelEditorGadgets();
695 CreateScreenGadgets();
698 void InitElementProperties()
702 static int ep_amoebalive[] =
709 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
711 static int ep_amoeboid[] =
719 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
721 static int ep_schluessel[] =
732 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
734 static int ep_pforte[] =
753 EL_SWITCHGATE_CLOSED,
768 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
770 static int ep_solid[] =
794 EL_MAGIC_WALL_BD_OFF,
795 EL_MAGIC_WALL_BD_EMPTY,
796 EL_MAGIC_WALL_BD_FULL,
797 EL_MAGIC_WALL_BD_DEAD,
824 EL_BELT1_SWITCH_LEFT,
825 EL_BELT1_SWITCH_MIDDLE,
826 EL_BELT1_SWITCH_RIGHT,
827 EL_BELT2_SWITCH_LEFT,
828 EL_BELT2_SWITCH_MIDDLE,
829 EL_BELT2_SWITCH_RIGHT,
830 EL_BELT3_SWITCH_LEFT,
831 EL_BELT3_SWITCH_MIDDLE,
832 EL_BELT3_SWITCH_RIGHT,
833 EL_BELT4_SWITCH_LEFT,
834 EL_BELT4_SWITCH_MIDDLE,
835 EL_BELT4_SWITCH_RIGHT,
836 EL_SWITCHGATE_SWITCH_1,
837 EL_SWITCHGATE_SWITCH_2,
840 EL_TIMEGATE_SWITCH_OFF,
841 EL_TIMEGATE_SWITCH_ON,
843 EL_SIGN_RADIOACTIVITY,
882 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
884 static int ep_massive[] =
910 EL_SWITCHGATE_CLOSED,
925 EL_BELT1_SWITCH_LEFT,
926 EL_BELT1_SWITCH_MIDDLE,
927 EL_BELT1_SWITCH_RIGHT,
928 EL_BELT2_SWITCH_LEFT,
929 EL_BELT2_SWITCH_MIDDLE,
930 EL_BELT2_SWITCH_RIGHT,
931 EL_BELT3_SWITCH_LEFT,
932 EL_BELT3_SWITCH_MIDDLE,
933 EL_BELT3_SWITCH_RIGHT,
934 EL_BELT4_SWITCH_LEFT,
935 EL_BELT4_SWITCH_MIDDLE,
936 EL_BELT4_SWITCH_RIGHT,
940 EL_SIGN_RADIOACTIVITY,
969 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
971 static int ep_slippery[] =
1006 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
1008 static int ep_enemy[] =
1021 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
1023 static int ep_mauer[] =
1073 EL_EMC_STEEL_WALL_1,
1074 EL_EMC_STEEL_WALL_2,
1075 EL_EMC_STEEL_WALL_3,
1076 EL_EMC_STEEL_WALL_4,
1086 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1088 static int ep_can_fall[] =
1103 EL_MAGIC_WALL_BD_FULL,
1114 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1116 static int ep_can_smash[] =
1147 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1149 static int ep_can_change[] =
1160 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1162 static int ep_can_move[] =
1182 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1184 static int ep_could_move[] =
1207 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1209 static int ep_dont_touch[] =
1216 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1218 static int ep_dont_go_to[] =
1236 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1238 static int ep_mampf2[] =
1263 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1265 static int ep_bd_element[] =
1274 EL_MAGIC_WALL_BD_OFF,
1292 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1294 static int ep_sb_element[] =
1299 EL_SOKOBAN_FELD_LEER,
1300 EL_SOKOBAN_FELD_VOLL,
1304 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1306 static int ep_gem[] =
1316 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1318 static int ep_inactive[] =
1355 EL_DYNAMITE_INACTIVE,
1367 EL_SOKOBAN_FELD_LEER,
1368 EL_SOKOBAN_FELD_VOLL,
1378 EL_MAGIC_WALL_BD_OFF,
1379 EL_MAGIC_WALL_BD_DEAD,
1415 EL_BELT1_SWITCH_LEFT,
1416 EL_BELT1_SWITCH_MIDDLE,
1417 EL_BELT1_SWITCH_RIGHT,
1418 EL_BELT2_SWITCH_LEFT,
1419 EL_BELT2_SWITCH_MIDDLE,
1420 EL_BELT2_SWITCH_RIGHT,
1421 EL_BELT3_SWITCH_LEFT,
1422 EL_BELT3_SWITCH_MIDDLE,
1423 EL_BELT3_SWITCH_RIGHT,
1424 EL_BELT4_SWITCH_LEFT,
1425 EL_BELT4_SWITCH_MIDDLE,
1426 EL_BELT4_SWITCH_RIGHT,
1427 EL_SIGN_EXCLAMATION,
1428 EL_SIGN_RADIOACTIVITY,
1440 EL_EMC_STEEL_WALL_1,
1441 EL_EMC_STEEL_WALL_2,
1442 EL_EMC_STEEL_WALL_3,
1443 EL_EMC_STEEL_WALL_4,
1453 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1455 static int ep_explosive[] =
1459 EL_DYNAMITE_INACTIVE,
1460 EL_DYNABOMB_ACTIVE_1,
1461 EL_DYNABOMB_ACTIVE_2,
1462 EL_DYNABOMB_ACTIVE_3,
1463 EL_DYNABOMB_ACTIVE_4,
1480 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1482 static int ep_mampf3[] =
1493 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1495 static int ep_pushable[] =
1502 EL_SOKOBAN_FELD_VOLL,
1512 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1514 static int ep_player[] =
1522 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1524 static int ep_has_content[] =
1532 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1534 static int ep_eatable[] =
1542 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1544 static int ep_sp_element[] =
1586 /* additional elements that appeared in newer Supaplex levels */
1588 /* more than one murphy in a level results in an inactive clone */
1591 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1593 static int ep_quick_gate[] =
1617 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1619 static int ep_over_player[] =
1644 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1646 static int ep_active_bomb[] =
1649 EL_DYNABOMB_ACTIVE_1,
1650 EL_DYNABOMB_ACTIVE_2,
1651 EL_DYNABOMB_ACTIVE_3,
1652 EL_DYNABOMB_ACTIVE_4
1654 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1656 static int ep_belt[] =
1671 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1673 static int ep_belt_switch[] =
1675 EL_BELT1_SWITCH_LEFT,
1676 EL_BELT1_SWITCH_MIDDLE,
1677 EL_BELT1_SWITCH_RIGHT,
1678 EL_BELT2_SWITCH_LEFT,
1679 EL_BELT2_SWITCH_MIDDLE,
1680 EL_BELT2_SWITCH_RIGHT,
1681 EL_BELT3_SWITCH_LEFT,
1682 EL_BELT3_SWITCH_MIDDLE,
1683 EL_BELT3_SWITCH_RIGHT,
1684 EL_BELT4_SWITCH_LEFT,
1685 EL_BELT4_SWITCH_MIDDLE,
1686 EL_BELT4_SWITCH_RIGHT,
1688 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1690 static int ep_tube[] =
1704 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1706 static long ep1_bit[] =
1740 static long ep2_bit[] =
1746 static int *ep1_array[] =
1780 static int *ep2_array[] =
1786 static int *ep1_num[] =
1813 &ep_has_content_num,
1817 &ep_over_player_num,
1820 static int *ep2_num[] =
1823 &ep_belt_switch_num,
1826 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1827 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1829 for(i=0; i<MAX_ELEMENTS; i++)
1831 Elementeigenschaften1[i] = 0;
1832 Elementeigenschaften2[i] = 0;
1835 for(i=0; i<num_properties1; i++)
1836 for(j=0; j<*(ep1_num[i]); j++)
1837 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1838 for(i=0; i<num_properties2; i++)
1839 for(j=0; j<*(ep2_num[i]); j++)
1840 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1842 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1843 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1846 void CloseAllAndExit(int exit_value)
1850 #ifdef USE_SDL_LIBRARY
1852 FreeSounds(NUM_SOUNDS);
1854 if (sound_process_id)
1857 kill(sound_process_id, SIGTERM);
1858 FreeSounds(NUM_SOUNDS);
1862 for(i=0; i<NUM_BITMAPS; i++)
1867 #ifdef USE_SDL_LIBRARY
1868 FreeBitmap(pix_masked[i]);
1871 FreeBitmap(clipmask[i]);
1873 XFreeGC(display, clip_gc[i]);
1877 #ifdef USE_SDL_LIBRARY
1878 KeyboardAutoRepeatOn();
1881 XFreeGC(display, gc);
1885 KeyboardAutoRepeatOn();
1886 XCloseDisplay(display);
1890 #if defined(MSDOS) || defined(WIN32)