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;
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(PLATFORM_UNIX)
59 if (options.serveronly)
61 #if defined(PLATFORM_UNIX)
62 NetworkServer(options.server_port, options.serveronly);
64 Error(ERR_WARN, "networking not supported in Windows version");
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(PLATFORM_UNIX)
128 if (!options.network)
131 #if defined(PLATFORM_UNIX)
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 #if defined(TARGET_SDL)
155 sound_status = SOUND_AVAILABLE;
156 sound_loops_allowed = TRUE;
160 sound_status = SOUND_OFF;
162 #else /* !TARGET_SDL */
164 #if defined(PLATFORM_UNIX)
165 if ((sound_status = CheckAudio(sound_device_name)) == SOUND_OFF)
169 sound_loops_allowed = TRUE;
172 #else /* !PLATFORM_UNIX */
173 sound_loops_allowed = TRUE;
175 #endif /* !PLATFORM_UNIX */
176 #endif /* !TARGET_SDL */
178 for(i=0; i<NUM_SOUNDS; i++)
180 Sound[i].name = sound_name[i];
182 if (!LoadSound(&Sound[i]))
184 sound_status = SOUND_OFF;
185 sound_loops_allowed = FALSE;
191 void InitSoundServer()
193 if (sound_status == SOUND_OFF)
196 #if !defined(TARGET_SDL)
197 #if defined(PLATFORM_UNIX)
199 if (pipe(sound_pipe)<0)
201 Error(ERR_WARN, "cannot create pipe - no sounds");
202 sound_status = SOUND_OFF;
206 if ((sound_process_id = fork()) < 0)
208 Error(ERR_WARN, "cannot create sound server process - no sounds");
209 sound_status = SOUND_OFF;
213 if (!sound_process_id) /* we are child */
220 else /* we are parent */
221 close(sound_pipe[0]); /* no reading from pipe needed */
223 #else /* !PLATFORM_UNIX */
227 #endif /* !PLATFORM_UNIX */
228 #endif /* !TARGET_SDL */
233 #if defined(TARGET_SDL)
234 static boolean sdl_joystick_subsystem_initialized = FALSE;
239 if (global_joystick_status == JOYSTICK_OFF)
242 joystick_status = JOYSTICK_OFF;
244 #if defined(TARGET_SDL)
246 if (!sdl_joystick_subsystem_initialized)
248 sdl_joystick_subsystem_initialized = TRUE;
250 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
252 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
257 for (i=0; i<MAX_PLAYERS; i++)
259 char *device_name = setup.input[i].joy.device_name;
260 int joystick_nr = getJoystickNrFromDeviceName(device_name);
262 if (joystick_nr >= SDL_NumJoysticks())
265 /* misuse joystick file descriptor variable to store joystick number */
266 stored_player[i].joystick_fd = joystick_nr;
268 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
269 if (Check_SDL_JoystickOpened(joystick_nr))
270 Close_SDL_Joystick(joystick_nr);
272 if (!setup.input[i].use_joystick)
275 if (!Open_SDL_Joystick(joystick_nr))
277 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
281 joystick_status = JOYSTICK_AVAILABLE;
284 #else /* !TARGET_SDL */
286 #if defined(PLATFORM_UNIX)
287 for (i=0; i<MAX_PLAYERS; i++)
289 char *device_name = setup.input[i].joy.device_name;
291 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
292 if (stored_player[i].joystick_fd != -1)
294 close(stored_player[i].joystick_fd);
295 stored_player[i].joystick_fd = -1;
298 if (!setup.input[i].use_joystick)
301 if (access(device_name, R_OK) != 0)
303 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
307 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
309 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
313 joystick_status = JOYSTICK_AVAILABLE;
316 #else /* !PLATFORM_UNIX */
318 /* try to access two joysticks; if that fails, try to access just one */
319 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
320 install_joystick(JOY_TYPE_AUTODETECT) == 0)
321 joystick_status = JOYSTICK_AVAILABLE;
324 load_joystick_data(JOYSTICK_FILENAME);
327 for (i=0; i<MAX_PLAYERS; i++)
329 char *device_name = setup.input[i].joy.device_name;
330 int joystick_nr = getJoystickNrFromDeviceName(device_name);
332 if (joystick_nr >= num_joysticks)
335 /* misuse joystick file descriptor variable to store joystick number */
336 stored_player[i].joystick_fd = joystick_nr;
340 #endif /* !TARGET_SDL */
347 #if defined(TARGET_SDL)
348 SDL_Surface *sdl_image_tmp;
351 XGCValues clip_gc_values;
352 unsigned long clip_gc_valuemask;
355 #if !defined(PLATFORM_MSDOS)
356 static struct PictureFileInfo pic[NUM_PICTURES] =
358 { "RocksScreen", TRUE },
359 { "RocksDoor", TRUE },
360 { "RocksHeroes", TRUE },
361 { "RocksToons", TRUE },
364 { "RocksMore", TRUE },
365 { "RocksFont", FALSE },
366 { "RocksFont2", FALSE },
367 { "RocksFont3", FALSE }
370 static struct PictureFileInfo pic[NUM_PICTURES] =
390 tile_needs_clipping[] =
392 { GFX_SPIELER1_UP, 4 },
393 { GFX_SPIELER1_DOWN, 4 },
394 { GFX_SPIELER1_LEFT, 4 },
395 { GFX_SPIELER1_RIGHT, 4 },
396 { GFX_SPIELER1_PUSH_LEFT, 4 },
397 { GFX_SPIELER1_PUSH_RIGHT, 4 },
398 { GFX_SPIELER2_UP, 4 },
399 { GFX_SPIELER2_DOWN, 4 },
400 { GFX_SPIELER2_LEFT, 4 },
401 { GFX_SPIELER2_RIGHT, 4 },
402 { GFX_SPIELER2_PUSH_LEFT, 4 },
403 { GFX_SPIELER2_PUSH_RIGHT, 4 },
404 { GFX_SPIELER3_UP, 4 },
405 { GFX_SPIELER3_DOWN, 4 },
406 { GFX_SPIELER3_LEFT, 4 },
407 { GFX_SPIELER3_RIGHT, 4 },
408 { GFX_SPIELER3_PUSH_LEFT, 4 },
409 { GFX_SPIELER3_PUSH_RIGHT, 4 },
410 { GFX_SPIELER4_UP, 4 },
411 { GFX_SPIELER4_DOWN, 4 },
412 { GFX_SPIELER4_LEFT, 4 },
413 { GFX_SPIELER4_RIGHT, 4 },
414 { GFX_SPIELER4_PUSH_LEFT, 4 },
415 { GFX_SPIELER4_PUSH_RIGHT, 4 },
416 { GFX_SP_MURPHY, 1 },
417 { GFX_MURPHY_GO_LEFT, 3 },
418 { GFX_MURPHY_GO_RIGHT, 3 },
419 { GFX_MURPHY_SNAP_UP, 1 },
420 { GFX_MURPHY_SNAP_DOWN, 1 },
421 { GFX_MURPHY_SNAP_RIGHT, 1 },
422 { GFX_MURPHY_SNAP_LEFT, 1 },
423 { GFX_MURPHY_PUSH_RIGHT, 1 },
424 { GFX_MURPHY_PUSH_LEFT, 1 },
425 { GFX_GEBLUBBER, 4 },
428 { GFX_EXPLOSION, 8 },
429 { GFX_SOKOBAN_OBJEKT, 1 },
430 { GFX_FUNKELN_BLAU, 3 },
431 { GFX_FUNKELN_WEISS, 3 },
432 { GFX2_SHIELD_PASSIVE, 3 },
433 { GFX2_SHIELD_ACTIVE, 3 },
437 /* create additional image buffers for double-buffering */
439 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
440 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
442 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
443 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
444 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
445 #if defined(PLATFORM_MSDOS)
446 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
449 DrawInitText("Loading graphics:",120,FC_GREEN);
451 for(i=0; i<NUM_PICTURES; i++)
452 if (i != PIX_SMALLFONT)
455 /* create additional image buffers for masking of graphics */
457 #if defined(TARGET_SDL)
459 /* initialize surface array to 'NULL' */
460 for(i=0; i<NUM_TILES; i++)
461 tile_masked[i] = NULL;
463 /* create only those masked surfaces we really need */
464 for(i=0; tile_needs_clipping[i].start>=0; i++)
466 for(j=0; j<tile_needs_clipping[i].count; j++)
468 int tile = tile_needs_clipping[i].start + j;
474 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
475 src_bitmap = pix_masked[bitmap_nr];
477 /* create surface for masked tile graphic */
478 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
479 WIN_SDL_DEPTH, 0, 0, 0, 0))
481 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
483 /* create native transparent surface for current image */
484 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
485 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
486 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
487 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
489 SDL_FreeSurface(sdl_image_tmp);
491 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
495 #else /* !TARGET_SDL */
497 /* create graphic context structures needed for clipping */
498 clip_gc_values.graphics_exposures = False;
499 clip_gc_valuemask = GCGraphicsExposures;
501 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
503 clip_gc_values.graphics_exposures = False;
504 clip_gc_valuemask = GCGraphicsExposures;
506 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
508 for(i=0; i<NUM_BITMAPS; i++)
512 clip_gc_values.graphics_exposures = False;
513 clip_gc_values.clip_mask = clipmask[i];
514 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
515 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
519 /* initialize pixmap array to Pixmap 'None' */
520 for(i=0; i<NUM_TILES; i++)
521 tile_clipmask[i] = None;
523 /* create only those clipping Pixmaps we really need */
524 for(i=0; tile_needs_clipping[i].start>=0; i++)
526 for(j=0; j<tile_needs_clipping[i].count; j++)
528 int tile = tile_needs_clipping[i].start + j;
534 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
535 src_pixmap = clipmask[pixmap_nr];
537 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
539 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
540 src_x,src_y, TILEX,TILEY, 0,0);
544 #endif /* !TARGET_SDL */
547 void InitGfxBackground()
551 drawto = backbuffer = pix[PIX_DB_BACK];
552 fieldbuffer = pix[PIX_DB_FIELD];
553 SetDrawtoField(DRAW_BACKBUFFER);
555 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
556 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
557 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
559 for(x=0; x<MAX_BUF_XSIZE; x++)
560 for(y=0; y<MAX_BUF_YSIZE; y++)
563 redraw_mask = REDRAW_ALL;
566 void LoadGfx(int pos, struct PictureFileInfo *pic)
568 char basefilename[256];
571 #if defined(TARGET_SDL)
572 SDL_Surface *sdl_image_tmp;
576 char *picture_ext = ".pcx";
579 if (pic->picture_filename)
581 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
582 DrawInitText(basefilename, 150, FC_YELLOW);
583 sprintf(filename, "%s/%s/%s",
584 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
586 #if defined(PLATFORM_MSDOS)
590 #if defined(TARGET_SDL)
591 /* load image to temporary surface */
592 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
593 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
595 /* create native non-transparent surface for current image */
596 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
597 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
599 /* create native transparent surface for current image */
600 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
601 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
602 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
603 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
605 /* free temporary surface */
606 SDL_FreeSurface(sdl_image_tmp);
608 #else /* !TARGET_SDL */
610 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
611 &pix[pos], &clipmask[pos]);
617 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
619 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
620 case PCX_FileInvalid:
621 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
623 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
624 case PCX_ColorFailed:
625 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
631 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
633 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
634 use pix_masked[], although they are the same when not using SDL */
635 pix_masked[pos] = pix[pos];
637 #endif /* !TARGET_SDL */
640 #if defined(TARGET_X11)
641 /* check if clip mask was correctly created */
642 if (pic->picture_with_mask && !clipmask[pos])
643 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
649 CreateLevelEditorGadgets();
653 CreateScreenGadgets();
656 void InitElementProperties()
660 static int ep_amoebalive[] =
667 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
669 static int ep_amoeboid[] =
677 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
679 static int ep_schluessel[] =
690 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
692 static int ep_pforte[] =
711 EL_SWITCHGATE_CLOSED,
726 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
728 static int ep_solid[] =
752 EL_MAGIC_WALL_BD_OFF,
753 EL_MAGIC_WALL_BD_EMPTY,
754 EL_MAGIC_WALL_BD_FULL,
755 EL_MAGIC_WALL_BD_DEAD,
782 EL_BELT1_SWITCH_LEFT,
783 EL_BELT1_SWITCH_MIDDLE,
784 EL_BELT1_SWITCH_RIGHT,
785 EL_BELT2_SWITCH_LEFT,
786 EL_BELT2_SWITCH_MIDDLE,
787 EL_BELT2_SWITCH_RIGHT,
788 EL_BELT3_SWITCH_LEFT,
789 EL_BELT3_SWITCH_MIDDLE,
790 EL_BELT3_SWITCH_RIGHT,
791 EL_BELT4_SWITCH_LEFT,
792 EL_BELT4_SWITCH_MIDDLE,
793 EL_BELT4_SWITCH_RIGHT,
794 EL_SWITCHGATE_SWITCH_1,
795 EL_SWITCHGATE_SWITCH_2,
798 EL_TIMEGATE_SWITCH_OFF,
799 EL_TIMEGATE_SWITCH_ON,
801 EL_SIGN_RADIOACTIVITY,
840 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
842 static int ep_massive[] =
868 EL_SWITCHGATE_CLOSED,
883 EL_BELT1_SWITCH_LEFT,
884 EL_BELT1_SWITCH_MIDDLE,
885 EL_BELT1_SWITCH_RIGHT,
886 EL_BELT2_SWITCH_LEFT,
887 EL_BELT2_SWITCH_MIDDLE,
888 EL_BELT2_SWITCH_RIGHT,
889 EL_BELT3_SWITCH_LEFT,
890 EL_BELT3_SWITCH_MIDDLE,
891 EL_BELT3_SWITCH_RIGHT,
892 EL_BELT4_SWITCH_LEFT,
893 EL_BELT4_SWITCH_MIDDLE,
894 EL_BELT4_SWITCH_RIGHT,
898 EL_SIGN_RADIOACTIVITY,
927 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
929 static int ep_slippery[] =
964 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
966 static int ep_enemy[] =
979 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
981 static int ep_mauer[] =
1031 EL_EMC_STEEL_WALL_1,
1032 EL_EMC_STEEL_WALL_2,
1033 EL_EMC_STEEL_WALL_3,
1034 EL_EMC_STEEL_WALL_4,
1044 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1046 static int ep_can_fall[] =
1061 EL_MAGIC_WALL_BD_FULL,
1072 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1074 static int ep_can_smash[] =
1105 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1107 static int ep_can_change[] =
1118 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1120 static int ep_can_move[] =
1140 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1142 static int ep_could_move[] =
1165 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1167 static int ep_dont_touch[] =
1174 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1176 static int ep_dont_go_to[] =
1194 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1196 static int ep_mampf2[] =
1221 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1223 static int ep_bd_element[] =
1232 EL_MAGIC_WALL_BD_OFF,
1250 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1252 static int ep_sb_element[] =
1257 EL_SOKOBAN_FELD_LEER,
1258 EL_SOKOBAN_FELD_VOLL,
1262 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1264 static int ep_gem[] =
1274 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1276 static int ep_inactive[] =
1313 EL_DYNAMITE_INACTIVE,
1325 EL_SOKOBAN_FELD_LEER,
1326 EL_SOKOBAN_FELD_VOLL,
1336 EL_MAGIC_WALL_BD_OFF,
1337 EL_MAGIC_WALL_BD_DEAD,
1373 EL_BELT1_SWITCH_LEFT,
1374 EL_BELT1_SWITCH_MIDDLE,
1375 EL_BELT1_SWITCH_RIGHT,
1376 EL_BELT2_SWITCH_LEFT,
1377 EL_BELT2_SWITCH_MIDDLE,
1378 EL_BELT2_SWITCH_RIGHT,
1379 EL_BELT3_SWITCH_LEFT,
1380 EL_BELT3_SWITCH_MIDDLE,
1381 EL_BELT3_SWITCH_RIGHT,
1382 EL_BELT4_SWITCH_LEFT,
1383 EL_BELT4_SWITCH_MIDDLE,
1384 EL_BELT4_SWITCH_RIGHT,
1385 EL_SIGN_EXCLAMATION,
1386 EL_SIGN_RADIOACTIVITY,
1398 EL_EMC_STEEL_WALL_1,
1399 EL_EMC_STEEL_WALL_2,
1400 EL_EMC_STEEL_WALL_3,
1401 EL_EMC_STEEL_WALL_4,
1411 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1413 static int ep_explosive[] =
1417 EL_DYNAMITE_INACTIVE,
1418 EL_DYNABOMB_ACTIVE_1,
1419 EL_DYNABOMB_ACTIVE_2,
1420 EL_DYNABOMB_ACTIVE_3,
1421 EL_DYNABOMB_ACTIVE_4,
1438 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1440 static int ep_mampf3[] =
1451 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1453 static int ep_pushable[] =
1460 EL_SOKOBAN_FELD_VOLL,
1470 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1472 static int ep_player[] =
1480 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1482 static int ep_has_content[] =
1490 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1492 static int ep_eatable[] =
1500 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1502 static int ep_sp_element[] =
1544 /* additional elements that appeared in newer Supaplex levels */
1546 /* more than one murphy in a level results in an inactive clone */
1549 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1551 static int ep_quick_gate[] =
1575 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1577 static int ep_over_player[] =
1602 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1604 static int ep_active_bomb[] =
1607 EL_DYNABOMB_ACTIVE_1,
1608 EL_DYNABOMB_ACTIVE_2,
1609 EL_DYNABOMB_ACTIVE_3,
1610 EL_DYNABOMB_ACTIVE_4
1612 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1614 static int ep_belt[] =
1629 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1631 static int ep_belt_switch[] =
1633 EL_BELT1_SWITCH_LEFT,
1634 EL_BELT1_SWITCH_MIDDLE,
1635 EL_BELT1_SWITCH_RIGHT,
1636 EL_BELT2_SWITCH_LEFT,
1637 EL_BELT2_SWITCH_MIDDLE,
1638 EL_BELT2_SWITCH_RIGHT,
1639 EL_BELT3_SWITCH_LEFT,
1640 EL_BELT3_SWITCH_MIDDLE,
1641 EL_BELT3_SWITCH_RIGHT,
1642 EL_BELT4_SWITCH_LEFT,
1643 EL_BELT4_SWITCH_MIDDLE,
1644 EL_BELT4_SWITCH_RIGHT,
1646 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1648 static int ep_tube[] =
1662 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1664 static long ep1_bit[] =
1698 static long ep2_bit[] =
1704 static int *ep1_array[] =
1738 static int *ep2_array[] =
1744 static int *ep1_num[] =
1771 &ep_has_content_num,
1775 &ep_over_player_num,
1778 static int *ep2_num[] =
1781 &ep_belt_switch_num,
1784 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1785 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1787 for(i=0; i<MAX_ELEMENTS; i++)
1789 Elementeigenschaften1[i] = 0;
1790 Elementeigenschaften2[i] = 0;
1793 for(i=0; i<num_properties1; i++)
1794 for(j=0; j<*(ep1_num[i]); j++)
1795 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1796 for(i=0; i<num_properties2; i++)
1797 for(j=0; j<*(ep2_num[i]); j++)
1798 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1800 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1801 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1804 void CloseAllAndExit(int exit_value)
1808 #if defined(TARGET_SDL)
1810 FreeSounds(NUM_SOUNDS);
1812 if (sound_process_id)
1815 kill(sound_process_id, SIGTERM);
1816 FreeSounds(NUM_SOUNDS);
1820 for(i=0; i<NUM_BITMAPS; i++)
1825 #if defined(TARGET_SDL)
1826 FreeBitmap(pix_masked[i]);
1829 FreeBitmap(clipmask[i]);
1831 XFreeGC(display, clip_gc[i]);
1835 #if defined(TARGET_SDL)
1836 KeyboardAutoRepeatOn();
1839 XFreeGC(display, gc);
1843 KeyboardAutoRepeatOn();
1844 XCloseDisplay(display);
1848 #if !defined(PLATFORM_UNIX)