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 ***********************************************************/
16 #include "libgame/libgame.h"
30 struct PictureFileInfo
32 char *picture_filename;
33 boolean picture_with_mask;
36 static void InitPlayerInfo(void);
37 static void InitLevelInfo(void);
38 static void InitNetworkServer(void);
39 static void InitSound(void);
40 static void InitSoundServer(void);
41 static void InitDisplay(void);
42 static void InitGfx(void);
43 static void InitGfxBackground(void);
44 static void LoadGfx(int, struct PictureFileInfo *);
45 static void InitGadgets(void);
46 static void InitElementProperties(void);
48 void OpenAll(int argc, char *argv[])
50 #if !defined(PLATFORM_UNIX)
54 if (options.serveronly)
56 #if defined(PLATFORM_UNIX)
57 NetworkServer(options.server_port, options.serveronly);
59 Error(ERR_WARN, "networking not supported in Windows version");
72 InitRND(NEW_RANDOMIZE);
74 signal(SIGINT, CloseAllAndExit);
75 signal(SIGTERM, CloseAllAndExit);
78 InitEventFilter(FilterMouseMotionEvents);
81 InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
84 InitGadgets(); /* needs to know number of level series */
96 /* choose default local player */
97 local_player = &stored_player[0];
99 for (i=0; i<MAX_PLAYERS; i++)
101 stored_player[i].joystick_fd = -1; /* joystick device closed */
102 stored_player[i].connected = FALSE;
105 local_player->connected = TRUE;
107 LoadSetup(); /* global setup info */
112 LoadLevelInfo(); /* global level info */
113 LoadLevelSetup_LastSeries(); /* last played series info */
114 LoadLevelSetup_SeriesInfo(); /* last played level info */
117 void InitNetworkServer()
119 #if defined(PLATFORM_UNIX)
123 if (!options.network)
126 #if defined(PLATFORM_UNIX)
127 nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
129 if (!ConnectToServer(options.server_host, options.server_port))
130 Error(ERR_EXIT, "cannot connect to network game server");
132 SendToServer_PlayerName(setup.player_name);
133 SendToServer_ProtocolVersion();
136 SendToServer_NrWanted(nr_wanted);
146 for(i=0; i<NUM_SOUNDS; i++)
148 Sound[i].name = sound_name[i];
150 if (!LoadSound(&Sound[i]))
152 audio.sound_available = FALSE;
153 audio.loops_available = FALSE;
159 void InitSoundServer()
161 if (!audio.sound_available)
164 #if !defined(TARGET_SDL)
165 #if defined(PLATFORM_UNIX)
167 if (pipe(audio.soundserver_pipe) < 0)
169 Error(ERR_WARN, "cannot create pipe - no sounds");
170 audio.sound_available = FALSE;
174 if ((audio.soundserver_pid = fork()) < 0)
176 Error(ERR_WARN, "cannot create sound server process - no sounds");
177 audio.sound_available = FALSE;
181 if (audio.soundserver_pid == 0) /* we are child */
188 else /* we are parent */
189 close(audio.soundserver_pipe[0]); /* no reading from pipe needed */
191 #else /* !PLATFORM_UNIX */
195 #endif /* !PLATFORM_UNIX */
196 #endif /* !TARGET_SDL */
201 #if defined(TARGET_SDL)
202 static boolean sdl_joystick_subsystem_initialized = FALSE;
207 if (global_joystick_status == JOYSTICK_OFF)
210 joystick_status = JOYSTICK_OFF;
212 #if defined(TARGET_SDL)
214 if (!sdl_joystick_subsystem_initialized)
216 sdl_joystick_subsystem_initialized = TRUE;
218 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
220 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
225 for (i=0; i<MAX_PLAYERS; i++)
227 char *device_name = setup.input[i].joy.device_name;
228 int joystick_nr = getJoystickNrFromDeviceName(device_name);
230 if (joystick_nr >= SDL_NumJoysticks())
233 /* misuse joystick file descriptor variable to store joystick number */
234 stored_player[i].joystick_fd = joystick_nr;
236 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
237 if (Check_SDL_JoystickOpened(joystick_nr))
238 Close_SDL_Joystick(joystick_nr);
240 if (!setup.input[i].use_joystick)
243 if (!Open_SDL_Joystick(joystick_nr))
245 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
249 joystick_status = JOYSTICK_AVAILABLE;
252 #else /* !TARGET_SDL */
254 #if defined(PLATFORM_UNIX)
255 for (i=0; i<MAX_PLAYERS; i++)
257 char *device_name = setup.input[i].joy.device_name;
259 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
260 if (stored_player[i].joystick_fd != -1)
262 close(stored_player[i].joystick_fd);
263 stored_player[i].joystick_fd = -1;
266 if (!setup.input[i].use_joystick)
269 if (access(device_name, R_OK) != 0)
271 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
275 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
277 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
281 joystick_status = JOYSTICK_AVAILABLE;
284 #else /* !PLATFORM_UNIX */
286 /* try to access two joysticks; if that fails, try to access just one */
287 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
288 install_joystick(JOY_TYPE_AUTODETECT) == 0)
289 joystick_status = JOYSTICK_AVAILABLE;
292 load_joystick_data(JOYSTICK_FILENAME);
295 for (i=0; i<MAX_PLAYERS; i++)
297 char *device_name = setup.input[i].joy.device_name;
298 int joystick_nr = getJoystickNrFromDeviceName(device_name);
300 if (joystick_nr >= num_joysticks)
303 /* misuse joystick file descriptor variable to store joystick number */
304 stored_player[i].joystick_fd = joystick_nr;
308 #endif /* !TARGET_SDL */
313 char *x11_icon_filename = getPath3(options.ro_base_directory,
316 char *x11_iconmask_filename = getPath3(options.ro_base_directory,
318 "rocks_iconmask.xbm");
320 InitProgramInfo(program_name, PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
321 ICON_TITLE_STRING, x11_icon_filename, x11_iconmask_filename);
323 InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
331 #if defined(TARGET_SDL)
332 SDL_Surface *sdl_image_tmp;
335 XGCValues clip_gc_values;
336 unsigned long clip_gc_valuemask;
339 #if !defined(PLATFORM_MSDOS)
340 static struct PictureFileInfo pic[NUM_PICTURES] =
342 { "RocksScreen", TRUE },
343 { "RocksDoor", TRUE },
344 { "RocksHeroes", TRUE },
345 { "RocksToons", TRUE },
348 { "RocksMore", TRUE },
349 { "RocksFont", FALSE },
350 { "RocksFont2", FALSE },
351 { "RocksFont3", FALSE }
354 static struct PictureFileInfo pic[NUM_PICTURES] =
374 tile_needs_clipping[] =
376 { GFX_SPIELER1_UP, 4 },
377 { GFX_SPIELER1_DOWN, 4 },
378 { GFX_SPIELER1_LEFT, 4 },
379 { GFX_SPIELER1_RIGHT, 4 },
380 { GFX_SPIELER1_PUSH_LEFT, 4 },
381 { GFX_SPIELER1_PUSH_RIGHT, 4 },
382 { GFX_SPIELER2_UP, 4 },
383 { GFX_SPIELER2_DOWN, 4 },
384 { GFX_SPIELER2_LEFT, 4 },
385 { GFX_SPIELER2_RIGHT, 4 },
386 { GFX_SPIELER2_PUSH_LEFT, 4 },
387 { GFX_SPIELER2_PUSH_RIGHT, 4 },
388 { GFX_SPIELER3_UP, 4 },
389 { GFX_SPIELER3_DOWN, 4 },
390 { GFX_SPIELER3_LEFT, 4 },
391 { GFX_SPIELER3_RIGHT, 4 },
392 { GFX_SPIELER3_PUSH_LEFT, 4 },
393 { GFX_SPIELER3_PUSH_RIGHT, 4 },
394 { GFX_SPIELER4_UP, 4 },
395 { GFX_SPIELER4_DOWN, 4 },
396 { GFX_SPIELER4_LEFT, 4 },
397 { GFX_SPIELER4_RIGHT, 4 },
398 { GFX_SPIELER4_PUSH_LEFT, 4 },
399 { GFX_SPIELER4_PUSH_RIGHT, 4 },
400 { GFX_SP_MURPHY, 1 },
401 { GFX_MURPHY_GO_LEFT, 3 },
402 { GFX_MURPHY_GO_RIGHT, 3 },
403 { GFX_MURPHY_SNAP_UP, 1 },
404 { GFX_MURPHY_SNAP_DOWN, 1 },
405 { GFX_MURPHY_SNAP_RIGHT, 1 },
406 { GFX_MURPHY_SNAP_LEFT, 1 },
407 { GFX_MURPHY_PUSH_RIGHT, 1 },
408 { GFX_MURPHY_PUSH_LEFT, 1 },
409 { GFX_GEBLUBBER, 4 },
412 { GFX_EXPLOSION, 8 },
413 { GFX_SOKOBAN_OBJEKT, 1 },
414 { GFX_FUNKELN_BLAU, 3 },
415 { GFX_FUNKELN_WEISS, 3 },
416 { GFX2_SHIELD_PASSIVE, 3 },
417 { GFX2_SHIELD_ACTIVE, 3 },
421 /* create additional image buffers for double-buffering */
423 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
424 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
426 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
427 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
428 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
429 #if defined(PLATFORM_MSDOS)
430 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
433 DrawInitText("Loading graphics:",120,FC_GREEN);
435 for(i=0; i<NUM_PICTURES; i++)
436 if (i != PIX_SMALLFONT)
439 /* create additional image buffers for masking of graphics */
441 #if defined(TARGET_SDL)
443 /* initialize surface array to 'NULL' */
444 for(i=0; i<NUM_TILES; i++)
445 tile_masked[i] = NULL;
447 /* create only those masked surfaces we really need */
448 for(i=0; tile_needs_clipping[i].start>=0; i++)
450 for(j=0; j<tile_needs_clipping[i].count; j++)
452 int tile = tile_needs_clipping[i].start + j;
458 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
459 src_bitmap = pix_masked[bitmap_nr];
461 /* create surface for masked tile graphic */
462 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
463 WIN_SDL_DEPTH, 0, 0, 0, 0))
465 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
467 /* create native transparent surface for current image */
468 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
469 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
470 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
471 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
473 SDL_FreeSurface(sdl_image_tmp);
475 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
479 #else /* !TARGET_SDL */
481 /* create graphic context structures needed for clipping */
482 clip_gc_values.graphics_exposures = False;
483 clip_gc_valuemask = GCGraphicsExposures;
485 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
487 clip_gc_values.graphics_exposures = False;
488 clip_gc_valuemask = GCGraphicsExposures;
490 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
492 for(i=0; i<NUM_BITMAPS; i++)
496 clip_gc_values.graphics_exposures = False;
497 clip_gc_values.clip_mask = clipmask[i];
498 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
499 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
503 /* initialize pixmap array to Pixmap 'None' */
504 for(i=0; i<NUM_TILES; i++)
505 tile_clipmask[i] = None;
507 /* create only those clipping Pixmaps we really need */
508 for(i=0; tile_needs_clipping[i].start>=0; i++)
510 for(j=0; j<tile_needs_clipping[i].count; j++)
512 int tile = tile_needs_clipping[i].start + j;
518 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
519 src_pixmap = clipmask[pixmap_nr];
521 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
523 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
524 src_x,src_y, TILEX,TILEY, 0,0);
528 #endif /* !TARGET_SDL */
531 void InitGfxBackground()
536 fieldbuffer = pix[PIX_DB_FIELD];
537 SetDrawtoField(DRAW_BACKBUFFER);
539 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
540 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
541 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
543 for(x=0; x<MAX_BUF_XSIZE; x++)
544 for(y=0; y<MAX_BUF_YSIZE; y++)
547 redraw_mask = REDRAW_ALL;
550 void LoadGfx(int pos, struct PictureFileInfo *pic)
552 char basefilename[256];
555 #if defined(TARGET_SDL)
556 SDL_Surface *sdl_image_tmp;
560 char *picture_ext = ".pcx";
563 if (pic->picture_filename)
565 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
566 DrawInitText(basefilename, 150, FC_YELLOW);
567 sprintf(filename, "%s/%s/%s",
568 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
570 #if defined(PLATFORM_MSDOS)
574 #if defined(TARGET_SDL)
575 /* load image to temporary surface */
576 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
577 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
579 /* create native non-transparent surface for current image */
580 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
581 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
583 /* create native transparent surface for current image */
584 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
585 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
586 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
587 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
589 /* free temporary surface */
590 SDL_FreeSurface(sdl_image_tmp);
592 #else /* !TARGET_SDL */
594 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
595 &pix[pos], &clipmask[pos]);
601 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
603 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
604 case PCX_FileInvalid:
605 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
607 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
608 case PCX_ColorFailed:
609 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
615 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
617 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
618 use pix_masked[], although they are the same when not using SDL */
619 pix_masked[pos] = pix[pos];
621 #endif /* !TARGET_SDL */
624 #if defined(TARGET_X11)
625 /* check if clip mask was correctly created */
626 if (pic->picture_with_mask && !clipmask[pos])
627 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
633 CreateLevelEditorGadgets();
637 CreateScreenGadgets();
640 void InitElementProperties()
644 static int ep_amoebalive[] =
651 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
653 static int ep_amoeboid[] =
661 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
663 static int ep_schluessel[] =
674 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
676 static int ep_pforte[] =
695 EL_SWITCHGATE_CLOSED,
710 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
712 static int ep_solid[] =
736 EL_MAGIC_WALL_BD_OFF,
737 EL_MAGIC_WALL_BD_EMPTY,
738 EL_MAGIC_WALL_BD_FULL,
739 EL_MAGIC_WALL_BD_DEAD,
766 EL_BELT1_SWITCH_LEFT,
767 EL_BELT1_SWITCH_MIDDLE,
768 EL_BELT1_SWITCH_RIGHT,
769 EL_BELT2_SWITCH_LEFT,
770 EL_BELT2_SWITCH_MIDDLE,
771 EL_BELT2_SWITCH_RIGHT,
772 EL_BELT3_SWITCH_LEFT,
773 EL_BELT3_SWITCH_MIDDLE,
774 EL_BELT3_SWITCH_RIGHT,
775 EL_BELT4_SWITCH_LEFT,
776 EL_BELT4_SWITCH_MIDDLE,
777 EL_BELT4_SWITCH_RIGHT,
778 EL_SWITCHGATE_SWITCH_1,
779 EL_SWITCHGATE_SWITCH_2,
782 EL_TIMEGATE_SWITCH_OFF,
783 EL_TIMEGATE_SWITCH_ON,
785 EL_SIGN_RADIOACTIVITY,
824 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
826 static int ep_massive[] =
852 EL_SWITCHGATE_CLOSED,
867 EL_BELT1_SWITCH_LEFT,
868 EL_BELT1_SWITCH_MIDDLE,
869 EL_BELT1_SWITCH_RIGHT,
870 EL_BELT2_SWITCH_LEFT,
871 EL_BELT2_SWITCH_MIDDLE,
872 EL_BELT2_SWITCH_RIGHT,
873 EL_BELT3_SWITCH_LEFT,
874 EL_BELT3_SWITCH_MIDDLE,
875 EL_BELT3_SWITCH_RIGHT,
876 EL_BELT4_SWITCH_LEFT,
877 EL_BELT4_SWITCH_MIDDLE,
878 EL_BELT4_SWITCH_RIGHT,
882 EL_SIGN_RADIOACTIVITY,
911 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
913 static int ep_slippery[] =
948 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
950 static int ep_enemy[] =
963 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
965 static int ep_mauer[] =
1015 EL_EMC_STEEL_WALL_1,
1016 EL_EMC_STEEL_WALL_2,
1017 EL_EMC_STEEL_WALL_3,
1018 EL_EMC_STEEL_WALL_4,
1028 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1030 static int ep_can_fall[] =
1045 EL_MAGIC_WALL_BD_FULL,
1056 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1058 static int ep_can_smash[] =
1089 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1091 static int ep_can_change[] =
1102 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1104 static int ep_can_move[] =
1124 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1126 static int ep_could_move[] =
1149 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1151 static int ep_dont_touch[] =
1158 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1160 static int ep_dont_go_to[] =
1178 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1180 static int ep_mampf2[] =
1205 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1207 static int ep_bd_element[] =
1216 EL_MAGIC_WALL_BD_OFF,
1234 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1236 static int ep_sb_element[] =
1241 EL_SOKOBAN_FELD_LEER,
1242 EL_SOKOBAN_FELD_VOLL,
1246 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1248 static int ep_gem[] =
1258 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1260 static int ep_inactive[] =
1297 EL_DYNAMITE_INACTIVE,
1309 EL_SOKOBAN_FELD_LEER,
1310 EL_SOKOBAN_FELD_VOLL,
1320 EL_MAGIC_WALL_BD_OFF,
1321 EL_MAGIC_WALL_BD_DEAD,
1357 EL_BELT1_SWITCH_LEFT,
1358 EL_BELT1_SWITCH_MIDDLE,
1359 EL_BELT1_SWITCH_RIGHT,
1360 EL_BELT2_SWITCH_LEFT,
1361 EL_BELT2_SWITCH_MIDDLE,
1362 EL_BELT2_SWITCH_RIGHT,
1363 EL_BELT3_SWITCH_LEFT,
1364 EL_BELT3_SWITCH_MIDDLE,
1365 EL_BELT3_SWITCH_RIGHT,
1366 EL_BELT4_SWITCH_LEFT,
1367 EL_BELT4_SWITCH_MIDDLE,
1368 EL_BELT4_SWITCH_RIGHT,
1369 EL_SIGN_EXCLAMATION,
1370 EL_SIGN_RADIOACTIVITY,
1382 EL_EMC_STEEL_WALL_1,
1383 EL_EMC_STEEL_WALL_2,
1384 EL_EMC_STEEL_WALL_3,
1385 EL_EMC_STEEL_WALL_4,
1395 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1397 static int ep_explosive[] =
1401 EL_DYNAMITE_INACTIVE,
1402 EL_DYNABOMB_ACTIVE_1,
1403 EL_DYNABOMB_ACTIVE_2,
1404 EL_DYNABOMB_ACTIVE_3,
1405 EL_DYNABOMB_ACTIVE_4,
1422 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1424 static int ep_mampf3[] =
1435 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1437 static int ep_pushable[] =
1444 EL_SOKOBAN_FELD_VOLL,
1454 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1456 static int ep_player[] =
1464 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1466 static int ep_has_content[] =
1474 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1476 static int ep_eatable[] =
1484 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1486 static int ep_sp_element[] =
1528 /* additional elements that appeared in newer Supaplex levels */
1530 /* more than one murphy in a level results in an inactive clone */
1533 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1535 static int ep_quick_gate[] =
1559 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1561 static int ep_over_player[] =
1586 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1588 static int ep_active_bomb[] =
1591 EL_DYNABOMB_ACTIVE_1,
1592 EL_DYNABOMB_ACTIVE_2,
1593 EL_DYNABOMB_ACTIVE_3,
1594 EL_DYNABOMB_ACTIVE_4
1596 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1598 static int ep_belt[] =
1613 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1615 static int ep_belt_switch[] =
1617 EL_BELT1_SWITCH_LEFT,
1618 EL_BELT1_SWITCH_MIDDLE,
1619 EL_BELT1_SWITCH_RIGHT,
1620 EL_BELT2_SWITCH_LEFT,
1621 EL_BELT2_SWITCH_MIDDLE,
1622 EL_BELT2_SWITCH_RIGHT,
1623 EL_BELT3_SWITCH_LEFT,
1624 EL_BELT3_SWITCH_MIDDLE,
1625 EL_BELT3_SWITCH_RIGHT,
1626 EL_BELT4_SWITCH_LEFT,
1627 EL_BELT4_SWITCH_MIDDLE,
1628 EL_BELT4_SWITCH_RIGHT,
1630 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1632 static int ep_tube[] =
1646 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1648 static long ep1_bit[] =
1682 static long ep2_bit[] =
1688 static int *ep1_array[] =
1722 static int *ep2_array[] =
1728 static int *ep1_num[] =
1755 &ep_has_content_num,
1759 &ep_over_player_num,
1762 static int *ep2_num[] =
1765 &ep_belt_switch_num,
1768 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1769 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1771 for(i=0; i<MAX_ELEMENTS; i++)
1773 Elementeigenschaften1[i] = 0;
1774 Elementeigenschaften2[i] = 0;
1777 for(i=0; i<num_properties1; i++)
1778 for(j=0; j<*(ep1_num[i]); j++)
1779 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1780 for(i=0; i<num_properties2; i++)
1781 for(j=0; j<*(ep2_num[i]); j++)
1782 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1784 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1785 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1788 void CloseAllAndExit(int exit_value)
1792 #if defined(TARGET_SDL)
1794 FreeSounds(NUM_SOUNDS);
1796 if (audio.soundserver_pid)
1799 kill(audio.soundserver_pid, SIGTERM);
1800 FreeSounds(NUM_SOUNDS);
1804 for(i=0; i<NUM_BITMAPS; i++)
1809 #if defined(TARGET_SDL)
1810 FreeBitmap(pix_masked[i]);
1813 FreeBitmap(clipmask[i]);
1815 XFreeGC(display, clip_gc[i]);
1819 #if defined(TARGET_SDL)
1820 KeyboardAutoRepeatOn();
1823 XFreeGC(display, gc);
1827 KeyboardAutoRepeatOn();
1828 XCloseDisplay(display);
1832 #if !defined(PLATFORM_UNIX)