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(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)
155 sound_status = SOUND_AVAILABLE;
156 sound_loops_allowed = TRUE;
160 sound_status = SOUND_OFF;
162 #else /* !TARGET_SDL */
164 #if !defined(MSDOS) && !defined(WIN32)
165 if ((sound_status = CheckAudio(sound_device_name)) == SOUND_OFF)
169 sound_loops_allowed = TRUE;
172 #else /* MSDOS || WIN32 */
173 sound_loops_allowed = TRUE;
175 #endif /* MSDOS || WIN32 */
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)
198 #if !defined(MSDOS) && !defined(WIN32)
200 if (pipe(sound_pipe)<0)
202 Error(ERR_WARN, "cannot create pipe - no sounds");
203 sound_status = SOUND_OFF;
207 if ((sound_process_id = fork()) < 0)
209 Error(ERR_WARN, "cannot create sound server process - no sounds");
210 sound_status = SOUND_OFF;
214 if (!sound_process_id) /* we are child */
221 else /* we are parent */
222 close(sound_pipe[0]); /* no reading from pipe needed */
224 #else /* MSDOS || WIN32 */
230 #endif /* !TARGET_SDL */
235 #ifdef USE_SDL_JOYSTICK
236 static boolean sdl_joystick_subsystem_initialized = FALSE;
241 if (global_joystick_status == JOYSTICK_OFF)
244 joystick_status = JOYSTICK_OFF;
246 #ifdef USE_SDL_JOYSTICK
248 if (!sdl_joystick_subsystem_initialized)
250 sdl_joystick_subsystem_initialized = TRUE;
252 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
254 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
259 for (i=0; i<MAX_PLAYERS; i++)
261 char *device_name = setup.input[i].joy.device_name;
262 int joystick_nr = getJoystickNrFromDeviceName(device_name);
264 if (joystick_nr >= SDL_NumJoysticks())
267 /* misuse joystick file descriptor variable to store joystick number */
268 stored_player[i].joystick_fd = joystick_nr;
270 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
271 if (Check_SDL_JoystickOpened(joystick_nr))
272 Close_SDL_Joystick(joystick_nr);
274 if (!setup.input[i].use_joystick)
277 if (!Open_SDL_Joystick(joystick_nr))
279 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
283 joystick_status = JOYSTICK_AVAILABLE;
286 #else /* !USE_SDL_JOYSTICK */
289 for (i=0; i<MAX_PLAYERS; i++)
291 char *device_name = setup.input[i].joy.device_name;
293 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
294 if (stored_player[i].joystick_fd != -1)
296 close(stored_player[i].joystick_fd);
297 stored_player[i].joystick_fd = -1;
300 if (!setup.input[i].use_joystick)
303 if (access(device_name, R_OK) != 0)
305 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
309 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
311 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
315 joystick_status = JOYSTICK_AVAILABLE;
320 /* try to access two joysticks; if that fails, try to access just one */
321 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
322 install_joystick(JOY_TYPE_AUTODETECT) == 0)
323 joystick_status = JOYSTICK_AVAILABLE;
326 load_joystick_data(JOYSTICK_FILENAME);
329 for (i=0; i<MAX_PLAYERS; i++)
331 char *device_name = setup.input[i].joy.device_name;
332 int joystick_nr = getJoystickNrFromDeviceName(device_name);
334 if (joystick_nr >= num_joysticks)
337 /* misuse joystick file descriptor variable to store joystick number */
338 stored_player[i].joystick_fd = joystick_nr;
342 #endif /* !TARGET_SDL */
350 SDL_Surface *sdl_image_tmp;
353 XGCValues clip_gc_values;
354 unsigned long clip_gc_valuemask;
358 static struct PictureFileInfo pic[NUM_PICTURES] =
372 static struct PictureFileInfo pic[NUM_PICTURES] =
374 { "RocksScreen", TRUE },
375 { "RocksDoor", TRUE },
376 { "RocksHeroes", TRUE },
377 { "RocksToons", TRUE },
380 { "RocksMore", TRUE },
381 { "RocksFont", FALSE },
382 { "RocksFont2", FALSE },
383 { "RocksFont3", FALSE }
392 tile_needs_clipping[] =
394 { GFX_SPIELER1_UP, 4 },
395 { GFX_SPIELER1_DOWN, 4 },
396 { GFX_SPIELER1_LEFT, 4 },
397 { GFX_SPIELER1_RIGHT, 4 },
398 { GFX_SPIELER1_PUSH_LEFT, 4 },
399 { GFX_SPIELER1_PUSH_RIGHT, 4 },
400 { GFX_SPIELER2_UP, 4 },
401 { GFX_SPIELER2_DOWN, 4 },
402 { GFX_SPIELER2_LEFT, 4 },
403 { GFX_SPIELER2_RIGHT, 4 },
404 { GFX_SPIELER2_PUSH_LEFT, 4 },
405 { GFX_SPIELER2_PUSH_RIGHT, 4 },
406 { GFX_SPIELER3_UP, 4 },
407 { GFX_SPIELER3_DOWN, 4 },
408 { GFX_SPIELER3_LEFT, 4 },
409 { GFX_SPIELER3_RIGHT, 4 },
410 { GFX_SPIELER3_PUSH_LEFT, 4 },
411 { GFX_SPIELER3_PUSH_RIGHT, 4 },
412 { GFX_SPIELER4_UP, 4 },
413 { GFX_SPIELER4_DOWN, 4 },
414 { GFX_SPIELER4_LEFT, 4 },
415 { GFX_SPIELER4_RIGHT, 4 },
416 { GFX_SPIELER4_PUSH_LEFT, 4 },
417 { GFX_SPIELER4_PUSH_RIGHT, 4 },
418 { GFX_SP_MURPHY, 1 },
419 { GFX_MURPHY_GO_LEFT, 3 },
420 { GFX_MURPHY_GO_RIGHT, 3 },
421 { GFX_MURPHY_SNAP_UP, 1 },
422 { GFX_MURPHY_SNAP_DOWN, 1 },
423 { GFX_MURPHY_SNAP_RIGHT, 1 },
424 { GFX_MURPHY_SNAP_LEFT, 1 },
425 { GFX_MURPHY_PUSH_RIGHT, 1 },
426 { GFX_MURPHY_PUSH_LEFT, 1 },
427 { GFX_GEBLUBBER, 4 },
430 { GFX_EXPLOSION, 8 },
431 { GFX_SOKOBAN_OBJEKT, 1 },
432 { GFX_FUNKELN_BLAU, 3 },
433 { GFX_FUNKELN_WEISS, 3 },
434 { GFX2_SHIELD_PASSIVE, 3 },
435 { GFX2_SHIELD_ACTIVE, 3 },
439 /* create additional image buffers for double-buffering */
441 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
442 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
444 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
445 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
446 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
448 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
451 DrawInitText("Loading graphics:",120,FC_GREEN);
453 for(i=0; i<NUM_PICTURES; i++)
454 if (i != PIX_SMALLFONT)
457 /* create additional image buffers for masking of graphics */
461 /* initialize surface array to 'NULL' */
462 for(i=0; i<NUM_TILES; i++)
463 tile_masked[i] = NULL;
465 /* create only those masked surfaces we really need */
466 for(i=0; tile_needs_clipping[i].start>=0; i++)
468 for(j=0; j<tile_needs_clipping[i].count; j++)
470 int tile = tile_needs_clipping[i].start + j;
476 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
477 src_bitmap = pix_masked[bitmap_nr];
479 /* create surface for masked tile graphic */
480 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
481 WIN_SDL_DEPTH, 0, 0, 0, 0))
483 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
485 /* create native transparent surface for current image */
486 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
487 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
488 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
489 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
491 SDL_FreeSurface(sdl_image_tmp);
493 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
497 #else /* !TARGET_SDL */
499 /* create graphic context structures needed for clipping */
500 clip_gc_values.graphics_exposures = False;
501 clip_gc_valuemask = GCGraphicsExposures;
503 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
505 clip_gc_values.graphics_exposures = False;
506 clip_gc_valuemask = GCGraphicsExposures;
508 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
510 for(i=0; i<NUM_BITMAPS; i++)
514 clip_gc_values.graphics_exposures = False;
515 clip_gc_values.clip_mask = clipmask[i];
516 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
517 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
521 /* initialize pixmap array to Pixmap 'None' */
522 for(i=0; i<NUM_TILES; i++)
523 tile_clipmask[i] = None;
525 /* create only those clipping Pixmaps we really need */
526 for(i=0; tile_needs_clipping[i].start>=0; i++)
528 for(j=0; j<tile_needs_clipping[i].count; j++)
530 int tile = tile_needs_clipping[i].start + j;
536 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
537 src_pixmap = clipmask[pixmap_nr];
539 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
541 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
542 src_x,src_y, TILEX,TILEY, 0,0);
546 #endif /* !TARGET_SDL */
549 void InitGfxBackground()
553 drawto = backbuffer = pix[PIX_DB_BACK];
554 fieldbuffer = pix[PIX_DB_FIELD];
555 SetDrawtoField(DRAW_BACKBUFFER);
557 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
558 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
559 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
561 for(x=0; x<MAX_BUF_XSIZE; x++)
562 for(y=0; y<MAX_BUF_YSIZE; y++)
565 redraw_mask = REDRAW_ALL;
568 void LoadGfx(int pos, struct PictureFileInfo *pic)
570 char basefilename[256];
574 SDL_Surface *sdl_image_tmp;
575 #else /* !TARGET_SDL */
577 #endif /* !TARGET_SDL */
578 char *picture_ext = ".pcx";
581 if (pic->picture_filename)
583 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
584 DrawInitText(basefilename, 150, FC_YELLOW);
585 sprintf(filename, "%s/%s/%s",
586 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
593 /* load image to temporary surface */
594 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
595 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
597 /* create native non-transparent surface for current image */
598 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
599 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
601 /* create native transparent surface for current image */
602 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
603 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
604 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
605 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
607 /* free temporary surface */
608 SDL_FreeSurface(sdl_image_tmp);
610 #else /* !TARGET_SDL */
612 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
613 &pix[pos], &clipmask[pos]);
619 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
621 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
622 case PCX_FileInvalid:
623 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
625 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
626 case PCX_ColorFailed:
627 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
633 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
635 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
636 use pix_masked[], although they are the same when not using SDL */
637 pix_masked[pos] = pix[pos];
639 #endif /* !TARGET_SDL */
643 /* zugehörige Maske laden (wenn vorhanden) */
644 if (pic->picture_with_mask && !clipmask[pos])
645 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
646 #endif /* !TARGET_SDL */
651 CreateLevelEditorGadgets();
655 CreateScreenGadgets();
658 void InitElementProperties()
662 static int ep_amoebalive[] =
669 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
671 static int ep_amoeboid[] =
679 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
681 static int ep_schluessel[] =
692 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
694 static int ep_pforte[] =
713 EL_SWITCHGATE_CLOSED,
728 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
730 static int ep_solid[] =
754 EL_MAGIC_WALL_BD_OFF,
755 EL_MAGIC_WALL_BD_EMPTY,
756 EL_MAGIC_WALL_BD_FULL,
757 EL_MAGIC_WALL_BD_DEAD,
784 EL_BELT1_SWITCH_LEFT,
785 EL_BELT1_SWITCH_MIDDLE,
786 EL_BELT1_SWITCH_RIGHT,
787 EL_BELT2_SWITCH_LEFT,
788 EL_BELT2_SWITCH_MIDDLE,
789 EL_BELT2_SWITCH_RIGHT,
790 EL_BELT3_SWITCH_LEFT,
791 EL_BELT3_SWITCH_MIDDLE,
792 EL_BELT3_SWITCH_RIGHT,
793 EL_BELT4_SWITCH_LEFT,
794 EL_BELT4_SWITCH_MIDDLE,
795 EL_BELT4_SWITCH_RIGHT,
796 EL_SWITCHGATE_SWITCH_1,
797 EL_SWITCHGATE_SWITCH_2,
800 EL_TIMEGATE_SWITCH_OFF,
801 EL_TIMEGATE_SWITCH_ON,
803 EL_SIGN_RADIOACTIVITY,
842 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
844 static int ep_massive[] =
870 EL_SWITCHGATE_CLOSED,
885 EL_BELT1_SWITCH_LEFT,
886 EL_BELT1_SWITCH_MIDDLE,
887 EL_BELT1_SWITCH_RIGHT,
888 EL_BELT2_SWITCH_LEFT,
889 EL_BELT2_SWITCH_MIDDLE,
890 EL_BELT2_SWITCH_RIGHT,
891 EL_BELT3_SWITCH_LEFT,
892 EL_BELT3_SWITCH_MIDDLE,
893 EL_BELT3_SWITCH_RIGHT,
894 EL_BELT4_SWITCH_LEFT,
895 EL_BELT4_SWITCH_MIDDLE,
896 EL_BELT4_SWITCH_RIGHT,
900 EL_SIGN_RADIOACTIVITY,
929 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
931 static int ep_slippery[] =
966 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
968 static int ep_enemy[] =
981 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
983 static int ep_mauer[] =
1033 EL_EMC_STEEL_WALL_1,
1034 EL_EMC_STEEL_WALL_2,
1035 EL_EMC_STEEL_WALL_3,
1036 EL_EMC_STEEL_WALL_4,
1046 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1048 static int ep_can_fall[] =
1063 EL_MAGIC_WALL_BD_FULL,
1074 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1076 static int ep_can_smash[] =
1107 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1109 static int ep_can_change[] =
1120 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1122 static int ep_can_move[] =
1142 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1144 static int ep_could_move[] =
1167 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1169 static int ep_dont_touch[] =
1176 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1178 static int ep_dont_go_to[] =
1196 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1198 static int ep_mampf2[] =
1223 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1225 static int ep_bd_element[] =
1234 EL_MAGIC_WALL_BD_OFF,
1252 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1254 static int ep_sb_element[] =
1259 EL_SOKOBAN_FELD_LEER,
1260 EL_SOKOBAN_FELD_VOLL,
1264 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1266 static int ep_gem[] =
1276 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1278 static int ep_inactive[] =
1315 EL_DYNAMITE_INACTIVE,
1327 EL_SOKOBAN_FELD_LEER,
1328 EL_SOKOBAN_FELD_VOLL,
1338 EL_MAGIC_WALL_BD_OFF,
1339 EL_MAGIC_WALL_BD_DEAD,
1375 EL_BELT1_SWITCH_LEFT,
1376 EL_BELT1_SWITCH_MIDDLE,
1377 EL_BELT1_SWITCH_RIGHT,
1378 EL_BELT2_SWITCH_LEFT,
1379 EL_BELT2_SWITCH_MIDDLE,
1380 EL_BELT2_SWITCH_RIGHT,
1381 EL_BELT3_SWITCH_LEFT,
1382 EL_BELT3_SWITCH_MIDDLE,
1383 EL_BELT3_SWITCH_RIGHT,
1384 EL_BELT4_SWITCH_LEFT,
1385 EL_BELT4_SWITCH_MIDDLE,
1386 EL_BELT4_SWITCH_RIGHT,
1387 EL_SIGN_EXCLAMATION,
1388 EL_SIGN_RADIOACTIVITY,
1400 EL_EMC_STEEL_WALL_1,
1401 EL_EMC_STEEL_WALL_2,
1402 EL_EMC_STEEL_WALL_3,
1403 EL_EMC_STEEL_WALL_4,
1413 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1415 static int ep_explosive[] =
1419 EL_DYNAMITE_INACTIVE,
1420 EL_DYNABOMB_ACTIVE_1,
1421 EL_DYNABOMB_ACTIVE_2,
1422 EL_DYNABOMB_ACTIVE_3,
1423 EL_DYNABOMB_ACTIVE_4,
1440 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1442 static int ep_mampf3[] =
1453 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1455 static int ep_pushable[] =
1462 EL_SOKOBAN_FELD_VOLL,
1472 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1474 static int ep_player[] =
1482 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1484 static int ep_has_content[] =
1492 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1494 static int ep_eatable[] =
1502 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1504 static int ep_sp_element[] =
1546 /* additional elements that appeared in newer Supaplex levels */
1548 /* more than one murphy in a level results in an inactive clone */
1551 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1553 static int ep_quick_gate[] =
1577 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1579 static int ep_over_player[] =
1604 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1606 static int ep_active_bomb[] =
1609 EL_DYNABOMB_ACTIVE_1,
1610 EL_DYNABOMB_ACTIVE_2,
1611 EL_DYNABOMB_ACTIVE_3,
1612 EL_DYNABOMB_ACTIVE_4
1614 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1616 static int ep_belt[] =
1631 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1633 static int ep_belt_switch[] =
1635 EL_BELT1_SWITCH_LEFT,
1636 EL_BELT1_SWITCH_MIDDLE,
1637 EL_BELT1_SWITCH_RIGHT,
1638 EL_BELT2_SWITCH_LEFT,
1639 EL_BELT2_SWITCH_MIDDLE,
1640 EL_BELT2_SWITCH_RIGHT,
1641 EL_BELT3_SWITCH_LEFT,
1642 EL_BELT3_SWITCH_MIDDLE,
1643 EL_BELT3_SWITCH_RIGHT,
1644 EL_BELT4_SWITCH_LEFT,
1645 EL_BELT4_SWITCH_MIDDLE,
1646 EL_BELT4_SWITCH_RIGHT,
1648 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1650 static int ep_tube[] =
1664 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1666 static long ep1_bit[] =
1700 static long ep2_bit[] =
1706 static int *ep1_array[] =
1740 static int *ep2_array[] =
1746 static int *ep1_num[] =
1773 &ep_has_content_num,
1777 &ep_over_player_num,
1780 static int *ep2_num[] =
1783 &ep_belt_switch_num,
1786 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1787 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1789 for(i=0; i<MAX_ELEMENTS; i++)
1791 Elementeigenschaften1[i] = 0;
1792 Elementeigenschaften2[i] = 0;
1795 for(i=0; i<num_properties1; i++)
1796 for(j=0; j<*(ep1_num[i]); j++)
1797 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1798 for(i=0; i<num_properties2; i++)
1799 for(j=0; j<*(ep2_num[i]); j++)
1800 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1802 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1803 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1806 void CloseAllAndExit(int exit_value)
1812 FreeSounds(NUM_SOUNDS);
1814 if (sound_process_id)
1817 kill(sound_process_id, SIGTERM);
1818 FreeSounds(NUM_SOUNDS);
1822 for(i=0; i<NUM_BITMAPS; i++)
1828 FreeBitmap(pix_masked[i]);
1831 FreeBitmap(clipmask[i]);
1833 XFreeGC(display, clip_gc[i]);
1838 KeyboardAutoRepeatOn();
1841 XFreeGC(display, gc);
1845 KeyboardAutoRepeatOn();
1846 XCloseDisplay(display);
1850 #if defined(MSDOS) || defined(WIN32)