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 InitGfx(void);
42 static void InitGfxBackground(void);
43 static void LoadGfx(int, struct PictureFileInfo *);
44 static void InitGadgets(void);
45 static void InitElementProperties(void);
47 void OpenAll(int argc, char *argv[])
49 #if !defined(PLATFORM_UNIX)
53 if (options.serveronly)
55 #if defined(PLATFORM_UNIX)
56 NetworkServer(options.server_port, options.serveronly);
58 Error(ERR_WARN, "networking not supported in Windows version");
71 InitRND(NEW_RANDOMIZE);
73 signal(SIGINT, CloseAllAndExit);
74 signal(SIGTERM, CloseAllAndExit);
76 InitBufferedDisplay(&backbuffer, &window);
77 InitEventFilter(FilterMouseMotionEvents);
80 InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
83 InitGadgets(); /* needs to know number of level series */
95 /* choose default local player */
96 local_player = &stored_player[0];
98 for (i=0; i<MAX_PLAYERS; i++)
100 stored_player[i].joystick_fd = -1; /* joystick device closed */
101 stored_player[i].connected = FALSE;
104 local_player->connected = TRUE;
106 LoadSetup(); /* global setup info */
111 LoadLevelInfo(); /* global level info */
112 LoadLevelSetup_LastSeries(); /* last played series info */
113 LoadLevelSetup_SeriesInfo(); /* last played level info */
116 void InitNetworkServer()
118 #if defined(PLATFORM_UNIX)
122 if (!options.network)
125 #if defined(PLATFORM_UNIX)
126 nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
128 if (!ConnectToServer(options.server_host, options.server_port))
129 Error(ERR_EXIT, "cannot connect to network game server");
131 SendToServer_PlayerName(setup.player_name);
132 SendToServer_ProtocolVersion();
135 SendToServer_NrWanted(nr_wanted);
145 for(i=0; i<NUM_SOUNDS; i++)
147 Sound[i].name = sound_name[i];
149 if (!LoadSound(&Sound[i]))
151 audio.sound_available = FALSE;
152 audio.loops_available = FALSE;
158 void InitSoundServer()
160 if (!audio.sound_available)
163 #if !defined(TARGET_SDL)
164 #if defined(PLATFORM_UNIX)
166 if (pipe(audio.soundserver_pipe) < 0)
168 Error(ERR_WARN, "cannot create pipe - no sounds");
169 audio.sound_available = FALSE;
173 if ((audio.soundserver_pid = fork()) < 0)
175 Error(ERR_WARN, "cannot create sound server process - no sounds");
176 audio.sound_available = FALSE;
180 if (audio.soundserver_pid == 0) /* we are child */
187 else /* we are parent */
188 close(audio.soundserver_pipe[0]); /* no reading from pipe needed */
190 #else /* !PLATFORM_UNIX */
194 #endif /* !PLATFORM_UNIX */
195 #endif /* !TARGET_SDL */
200 #if defined(TARGET_SDL)
201 static boolean sdl_joystick_subsystem_initialized = FALSE;
206 if (global_joystick_status == JOYSTICK_OFF)
209 joystick_status = JOYSTICK_OFF;
211 #if defined(TARGET_SDL)
213 if (!sdl_joystick_subsystem_initialized)
215 sdl_joystick_subsystem_initialized = TRUE;
217 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
219 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
224 for (i=0; i<MAX_PLAYERS; i++)
226 char *device_name = setup.input[i].joy.device_name;
227 int joystick_nr = getJoystickNrFromDeviceName(device_name);
229 if (joystick_nr >= SDL_NumJoysticks())
232 /* misuse joystick file descriptor variable to store joystick number */
233 stored_player[i].joystick_fd = joystick_nr;
235 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
236 if (Check_SDL_JoystickOpened(joystick_nr))
237 Close_SDL_Joystick(joystick_nr);
239 if (!setup.input[i].use_joystick)
242 if (!Open_SDL_Joystick(joystick_nr))
244 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
248 joystick_status = JOYSTICK_AVAILABLE;
251 #else /* !TARGET_SDL */
253 #if defined(PLATFORM_UNIX)
254 for (i=0; i<MAX_PLAYERS; i++)
256 char *device_name = setup.input[i].joy.device_name;
258 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
259 if (stored_player[i].joystick_fd != -1)
261 close(stored_player[i].joystick_fd);
262 stored_player[i].joystick_fd = -1;
265 if (!setup.input[i].use_joystick)
268 if (access(device_name, R_OK) != 0)
270 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
274 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
276 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
280 joystick_status = JOYSTICK_AVAILABLE;
283 #else /* !PLATFORM_UNIX */
285 /* try to access two joysticks; if that fails, try to access just one */
286 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
287 install_joystick(JOY_TYPE_AUTODETECT) == 0)
288 joystick_status = JOYSTICK_AVAILABLE;
291 load_joystick_data(JOYSTICK_FILENAME);
294 for (i=0; i<MAX_PLAYERS; i++)
296 char *device_name = setup.input[i].joy.device_name;
297 int joystick_nr = getJoystickNrFromDeviceName(device_name);
299 if (joystick_nr >= num_joysticks)
302 /* misuse joystick file descriptor variable to store joystick number */
303 stored_player[i].joystick_fd = joystick_nr;
307 #endif /* !TARGET_SDL */
314 #if defined(TARGET_SDL)
315 SDL_Surface *sdl_image_tmp;
318 XGCValues clip_gc_values;
319 unsigned long clip_gc_valuemask;
322 #if !defined(PLATFORM_MSDOS)
323 static struct PictureFileInfo pic[NUM_PICTURES] =
325 { "RocksScreen", TRUE },
326 { "RocksDoor", TRUE },
327 { "RocksHeroes", TRUE },
328 { "RocksToons", TRUE },
331 { "RocksMore", TRUE },
332 { "RocksFont", FALSE },
333 { "RocksFont2", FALSE },
334 { "RocksFont3", FALSE }
337 static struct PictureFileInfo pic[NUM_PICTURES] =
357 tile_needs_clipping[] =
359 { GFX_SPIELER1_UP, 4 },
360 { GFX_SPIELER1_DOWN, 4 },
361 { GFX_SPIELER1_LEFT, 4 },
362 { GFX_SPIELER1_RIGHT, 4 },
363 { GFX_SPIELER1_PUSH_LEFT, 4 },
364 { GFX_SPIELER1_PUSH_RIGHT, 4 },
365 { GFX_SPIELER2_UP, 4 },
366 { GFX_SPIELER2_DOWN, 4 },
367 { GFX_SPIELER2_LEFT, 4 },
368 { GFX_SPIELER2_RIGHT, 4 },
369 { GFX_SPIELER2_PUSH_LEFT, 4 },
370 { GFX_SPIELER2_PUSH_RIGHT, 4 },
371 { GFX_SPIELER3_UP, 4 },
372 { GFX_SPIELER3_DOWN, 4 },
373 { GFX_SPIELER3_LEFT, 4 },
374 { GFX_SPIELER3_RIGHT, 4 },
375 { GFX_SPIELER3_PUSH_LEFT, 4 },
376 { GFX_SPIELER3_PUSH_RIGHT, 4 },
377 { GFX_SPIELER4_UP, 4 },
378 { GFX_SPIELER4_DOWN, 4 },
379 { GFX_SPIELER4_LEFT, 4 },
380 { GFX_SPIELER4_RIGHT, 4 },
381 { GFX_SPIELER4_PUSH_LEFT, 4 },
382 { GFX_SPIELER4_PUSH_RIGHT, 4 },
383 { GFX_SP_MURPHY, 1 },
384 { GFX_MURPHY_GO_LEFT, 3 },
385 { GFX_MURPHY_GO_RIGHT, 3 },
386 { GFX_MURPHY_SNAP_UP, 1 },
387 { GFX_MURPHY_SNAP_DOWN, 1 },
388 { GFX_MURPHY_SNAP_RIGHT, 1 },
389 { GFX_MURPHY_SNAP_LEFT, 1 },
390 { GFX_MURPHY_PUSH_RIGHT, 1 },
391 { GFX_MURPHY_PUSH_LEFT, 1 },
392 { GFX_GEBLUBBER, 4 },
395 { GFX_EXPLOSION, 8 },
396 { GFX_SOKOBAN_OBJEKT, 1 },
397 { GFX_FUNKELN_BLAU, 3 },
398 { GFX_FUNKELN_WEISS, 3 },
399 { GFX2_SHIELD_PASSIVE, 3 },
400 { GFX2_SHIELD_ACTIVE, 3 },
404 /* create additional image buffers for double-buffering */
406 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
407 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
409 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
410 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
411 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
412 #if defined(PLATFORM_MSDOS)
413 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
416 DrawInitText("Loading graphics:",120,FC_GREEN);
418 for(i=0; i<NUM_PICTURES; i++)
419 if (i != PIX_SMALLFONT)
422 /* create additional image buffers for masking of graphics */
424 #if defined(TARGET_SDL)
426 /* initialize surface array to 'NULL' */
427 for(i=0; i<NUM_TILES; i++)
428 tile_masked[i] = NULL;
430 /* create only those masked surfaces we really need */
431 for(i=0; tile_needs_clipping[i].start>=0; i++)
433 for(j=0; j<tile_needs_clipping[i].count; j++)
435 int tile = tile_needs_clipping[i].start + j;
441 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
442 src_bitmap = pix_masked[bitmap_nr];
444 /* create surface for masked tile graphic */
445 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
446 WIN_SDL_DEPTH, 0, 0, 0, 0))
448 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
450 /* create native transparent surface for current image */
451 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
452 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
453 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
454 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
456 SDL_FreeSurface(sdl_image_tmp);
458 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
462 #else /* !TARGET_SDL */
464 /* create graphic context structures needed for clipping */
465 clip_gc_values.graphics_exposures = False;
466 clip_gc_valuemask = GCGraphicsExposures;
468 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
470 clip_gc_values.graphics_exposures = False;
471 clip_gc_valuemask = GCGraphicsExposures;
473 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
475 for(i=0; i<NUM_BITMAPS; i++)
479 clip_gc_values.graphics_exposures = False;
480 clip_gc_values.clip_mask = clipmask[i];
481 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
482 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
486 /* initialize pixmap array to Pixmap 'None' */
487 for(i=0; i<NUM_TILES; i++)
488 tile_clipmask[i] = None;
490 /* create only those clipping Pixmaps we really need */
491 for(i=0; tile_needs_clipping[i].start>=0; i++)
493 for(j=0; j<tile_needs_clipping[i].count; j++)
495 int tile = tile_needs_clipping[i].start + j;
501 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
502 src_pixmap = clipmask[pixmap_nr];
504 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
506 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
507 src_x,src_y, TILEX,TILEY, 0,0);
511 #endif /* !TARGET_SDL */
514 void InitGfxBackground()
518 drawto = backbuffer = pix[PIX_DB_BACK];
519 fieldbuffer = pix[PIX_DB_FIELD];
520 SetDrawtoField(DRAW_BACKBUFFER);
522 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
523 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
524 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
526 for(x=0; x<MAX_BUF_XSIZE; x++)
527 for(y=0; y<MAX_BUF_YSIZE; y++)
530 redraw_mask = REDRAW_ALL;
533 void LoadGfx(int pos, struct PictureFileInfo *pic)
535 char basefilename[256];
538 #if defined(TARGET_SDL)
539 SDL_Surface *sdl_image_tmp;
543 char *picture_ext = ".pcx";
546 if (pic->picture_filename)
548 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
549 DrawInitText(basefilename, 150, FC_YELLOW);
550 sprintf(filename, "%s/%s/%s",
551 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
553 #if defined(PLATFORM_MSDOS)
557 #if defined(TARGET_SDL)
558 /* load image to temporary surface */
559 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
560 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
562 /* create native non-transparent surface for current image */
563 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
564 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
566 /* create native transparent surface for current image */
567 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
568 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
569 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
570 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
572 /* free temporary surface */
573 SDL_FreeSurface(sdl_image_tmp);
575 #else /* !TARGET_SDL */
577 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
578 &pix[pos], &clipmask[pos]);
584 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
586 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
587 case PCX_FileInvalid:
588 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
590 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
591 case PCX_ColorFailed:
592 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
598 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
600 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
601 use pix_masked[], although they are the same when not using SDL */
602 pix_masked[pos] = pix[pos];
604 #endif /* !TARGET_SDL */
607 #if defined(TARGET_X11)
608 /* check if clip mask was correctly created */
609 if (pic->picture_with_mask && !clipmask[pos])
610 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
616 CreateLevelEditorGadgets();
620 CreateScreenGadgets();
623 void InitElementProperties()
627 static int ep_amoebalive[] =
634 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
636 static int ep_amoeboid[] =
644 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
646 static int ep_schluessel[] =
657 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
659 static int ep_pforte[] =
678 EL_SWITCHGATE_CLOSED,
693 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
695 static int ep_solid[] =
719 EL_MAGIC_WALL_BD_OFF,
720 EL_MAGIC_WALL_BD_EMPTY,
721 EL_MAGIC_WALL_BD_FULL,
722 EL_MAGIC_WALL_BD_DEAD,
749 EL_BELT1_SWITCH_LEFT,
750 EL_BELT1_SWITCH_MIDDLE,
751 EL_BELT1_SWITCH_RIGHT,
752 EL_BELT2_SWITCH_LEFT,
753 EL_BELT2_SWITCH_MIDDLE,
754 EL_BELT2_SWITCH_RIGHT,
755 EL_BELT3_SWITCH_LEFT,
756 EL_BELT3_SWITCH_MIDDLE,
757 EL_BELT3_SWITCH_RIGHT,
758 EL_BELT4_SWITCH_LEFT,
759 EL_BELT4_SWITCH_MIDDLE,
760 EL_BELT4_SWITCH_RIGHT,
761 EL_SWITCHGATE_SWITCH_1,
762 EL_SWITCHGATE_SWITCH_2,
765 EL_TIMEGATE_SWITCH_OFF,
766 EL_TIMEGATE_SWITCH_ON,
768 EL_SIGN_RADIOACTIVITY,
807 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
809 static int ep_massive[] =
835 EL_SWITCHGATE_CLOSED,
850 EL_BELT1_SWITCH_LEFT,
851 EL_BELT1_SWITCH_MIDDLE,
852 EL_BELT1_SWITCH_RIGHT,
853 EL_BELT2_SWITCH_LEFT,
854 EL_BELT2_SWITCH_MIDDLE,
855 EL_BELT2_SWITCH_RIGHT,
856 EL_BELT3_SWITCH_LEFT,
857 EL_BELT3_SWITCH_MIDDLE,
858 EL_BELT3_SWITCH_RIGHT,
859 EL_BELT4_SWITCH_LEFT,
860 EL_BELT4_SWITCH_MIDDLE,
861 EL_BELT4_SWITCH_RIGHT,
865 EL_SIGN_RADIOACTIVITY,
894 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
896 static int ep_slippery[] =
931 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
933 static int ep_enemy[] =
946 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
948 static int ep_mauer[] =
1000 EL_EMC_STEEL_WALL_3,
1001 EL_EMC_STEEL_WALL_4,
1011 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1013 static int ep_can_fall[] =
1028 EL_MAGIC_WALL_BD_FULL,
1039 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1041 static int ep_can_smash[] =
1072 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1074 static int ep_can_change[] =
1085 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1087 static int ep_can_move[] =
1107 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1109 static int ep_could_move[] =
1132 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1134 static int ep_dont_touch[] =
1141 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1143 static int ep_dont_go_to[] =
1161 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1163 static int ep_mampf2[] =
1188 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1190 static int ep_bd_element[] =
1199 EL_MAGIC_WALL_BD_OFF,
1217 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1219 static int ep_sb_element[] =
1224 EL_SOKOBAN_FELD_LEER,
1225 EL_SOKOBAN_FELD_VOLL,
1229 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1231 static int ep_gem[] =
1241 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1243 static int ep_inactive[] =
1280 EL_DYNAMITE_INACTIVE,
1292 EL_SOKOBAN_FELD_LEER,
1293 EL_SOKOBAN_FELD_VOLL,
1303 EL_MAGIC_WALL_BD_OFF,
1304 EL_MAGIC_WALL_BD_DEAD,
1340 EL_BELT1_SWITCH_LEFT,
1341 EL_BELT1_SWITCH_MIDDLE,
1342 EL_BELT1_SWITCH_RIGHT,
1343 EL_BELT2_SWITCH_LEFT,
1344 EL_BELT2_SWITCH_MIDDLE,
1345 EL_BELT2_SWITCH_RIGHT,
1346 EL_BELT3_SWITCH_LEFT,
1347 EL_BELT3_SWITCH_MIDDLE,
1348 EL_BELT3_SWITCH_RIGHT,
1349 EL_BELT4_SWITCH_LEFT,
1350 EL_BELT4_SWITCH_MIDDLE,
1351 EL_BELT4_SWITCH_RIGHT,
1352 EL_SIGN_EXCLAMATION,
1353 EL_SIGN_RADIOACTIVITY,
1365 EL_EMC_STEEL_WALL_1,
1366 EL_EMC_STEEL_WALL_2,
1367 EL_EMC_STEEL_WALL_3,
1368 EL_EMC_STEEL_WALL_4,
1378 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1380 static int ep_explosive[] =
1384 EL_DYNAMITE_INACTIVE,
1385 EL_DYNABOMB_ACTIVE_1,
1386 EL_DYNABOMB_ACTIVE_2,
1387 EL_DYNABOMB_ACTIVE_3,
1388 EL_DYNABOMB_ACTIVE_4,
1405 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1407 static int ep_mampf3[] =
1418 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1420 static int ep_pushable[] =
1427 EL_SOKOBAN_FELD_VOLL,
1437 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1439 static int ep_player[] =
1447 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1449 static int ep_has_content[] =
1457 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1459 static int ep_eatable[] =
1467 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1469 static int ep_sp_element[] =
1511 /* additional elements that appeared in newer Supaplex levels */
1513 /* more than one murphy in a level results in an inactive clone */
1516 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1518 static int ep_quick_gate[] =
1542 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1544 static int ep_over_player[] =
1569 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1571 static int ep_active_bomb[] =
1574 EL_DYNABOMB_ACTIVE_1,
1575 EL_DYNABOMB_ACTIVE_2,
1576 EL_DYNABOMB_ACTIVE_3,
1577 EL_DYNABOMB_ACTIVE_4
1579 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1581 static int ep_belt[] =
1596 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1598 static int ep_belt_switch[] =
1600 EL_BELT1_SWITCH_LEFT,
1601 EL_BELT1_SWITCH_MIDDLE,
1602 EL_BELT1_SWITCH_RIGHT,
1603 EL_BELT2_SWITCH_LEFT,
1604 EL_BELT2_SWITCH_MIDDLE,
1605 EL_BELT2_SWITCH_RIGHT,
1606 EL_BELT3_SWITCH_LEFT,
1607 EL_BELT3_SWITCH_MIDDLE,
1608 EL_BELT3_SWITCH_RIGHT,
1609 EL_BELT4_SWITCH_LEFT,
1610 EL_BELT4_SWITCH_MIDDLE,
1611 EL_BELT4_SWITCH_RIGHT,
1613 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1615 static int ep_tube[] =
1629 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1631 static long ep1_bit[] =
1665 static long ep2_bit[] =
1671 static int *ep1_array[] =
1705 static int *ep2_array[] =
1711 static int *ep1_num[] =
1738 &ep_has_content_num,
1742 &ep_over_player_num,
1745 static int *ep2_num[] =
1748 &ep_belt_switch_num,
1751 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1752 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1754 for(i=0; i<MAX_ELEMENTS; i++)
1756 Elementeigenschaften1[i] = 0;
1757 Elementeigenschaften2[i] = 0;
1760 for(i=0; i<num_properties1; i++)
1761 for(j=0; j<*(ep1_num[i]); j++)
1762 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1763 for(i=0; i<num_properties2; i++)
1764 for(j=0; j<*(ep2_num[i]); j++)
1765 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1767 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1768 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1771 void CloseAllAndExit(int exit_value)
1775 #if defined(TARGET_SDL)
1777 FreeSounds(NUM_SOUNDS);
1779 if (audio.soundserver_pid)
1782 kill(audio.soundserver_pid, SIGTERM);
1783 FreeSounds(NUM_SOUNDS);
1787 for(i=0; i<NUM_BITMAPS; i++)
1792 #if defined(TARGET_SDL)
1793 FreeBitmap(pix_masked[i]);
1796 FreeBitmap(clipmask[i]);
1798 XFreeGC(display, clip_gc[i]);
1802 #if defined(TARGET_SDL)
1803 KeyboardAutoRepeatOn();
1806 XFreeGC(display, gc);
1810 KeyboardAutoRepeatOn();
1811 XCloseDisplay(display);
1815 #if !defined(PLATFORM_UNIX)