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 static void InitPlayerInfo(void);
39 static void InitLevelInfo(void);
40 static void InitNetworkServer(void);
41 static void InitSound(void);
42 static void InitSoundServer(void);
43 static void InitGfx(void);
44 static void InitGfxBackground(void);
45 static void LoadGfx(int, struct PictureFileInfo *);
46 static void InitGadgets(void);
47 static void InitElementProperties(void);
49 void OpenAll(int argc, char *argv[])
51 #if !defined(PLATFORM_UNIX)
55 if (options.serveronly)
57 #if defined(PLATFORM_UNIX)
58 NetworkServer(options.server_port, options.serveronly);
60 Error(ERR_WARN, "networking not supported in Windows version");
73 InitRND(NEW_RANDOMIZE);
75 signal(SIGINT, CloseAllAndExit);
76 signal(SIGTERM, CloseAllAndExit);
78 InitBufferedDisplay(&backbuffer, &window);
79 InitEventFilter(FilterMouseMotionEvents);
82 InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
85 InitGadgets(); /* needs to know number of level series */
97 /* choose default local player */
98 local_player = &stored_player[0];
100 for (i=0; i<MAX_PLAYERS; i++)
102 stored_player[i].joystick_fd = -1; /* joystick device closed */
103 stored_player[i].connected = FALSE;
106 local_player->connected = TRUE;
108 LoadSetup(); /* global setup info */
113 LoadLevelInfo(); /* global level info */
114 LoadLevelSetup_LastSeries(); /* last played series info */
115 LoadLevelSetup_SeriesInfo(); /* last played level info */
118 void InitNetworkServer()
120 #if defined(PLATFORM_UNIX)
124 if (!options.network)
127 #if defined(PLATFORM_UNIX)
128 nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
130 if (!ConnectToServer(options.server_host, options.server_port))
131 Error(ERR_EXIT, "cannot connect to network game server");
133 SendToServer_PlayerName(setup.player_name);
134 SendToServer_ProtocolVersion();
137 SendToServer_NrWanted(nr_wanted);
147 for(i=0; i<NUM_SOUNDS; i++)
149 Sound[i].name = sound_name[i];
151 if (!LoadSound(&Sound[i]))
153 audio.sound_available = FALSE;
154 audio.loops_available = FALSE;
160 void InitSoundServer()
162 if (!audio.sound_available)
165 #if !defined(TARGET_SDL)
166 #if defined(PLATFORM_UNIX)
168 if (pipe(audio.soundserver_pipe) < 0)
170 Error(ERR_WARN, "cannot create pipe - no sounds");
171 audio.sound_available = FALSE;
175 if ((audio.soundserver_pid = fork()) < 0)
177 Error(ERR_WARN, "cannot create sound server process - no sounds");
178 audio.sound_available = FALSE;
182 if (audio.soundserver_pid == 0) /* we are child */
189 else /* we are parent */
190 close(audio.soundserver_pipe[0]); /* no reading from pipe needed */
192 #else /* !PLATFORM_UNIX */
196 #endif /* !PLATFORM_UNIX */
197 #endif /* !TARGET_SDL */
202 #if defined(TARGET_SDL)
203 static boolean sdl_joystick_subsystem_initialized = FALSE;
208 if (global_joystick_status == JOYSTICK_OFF)
211 joystick_status = JOYSTICK_OFF;
213 #if defined(TARGET_SDL)
215 if (!sdl_joystick_subsystem_initialized)
217 sdl_joystick_subsystem_initialized = TRUE;
219 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
221 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
226 for (i=0; i<MAX_PLAYERS; i++)
228 char *device_name = setup.input[i].joy.device_name;
229 int joystick_nr = getJoystickNrFromDeviceName(device_name);
231 if (joystick_nr >= SDL_NumJoysticks())
234 /* misuse joystick file descriptor variable to store joystick number */
235 stored_player[i].joystick_fd = joystick_nr;
237 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
238 if (Check_SDL_JoystickOpened(joystick_nr))
239 Close_SDL_Joystick(joystick_nr);
241 if (!setup.input[i].use_joystick)
244 if (!Open_SDL_Joystick(joystick_nr))
246 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
250 joystick_status = JOYSTICK_AVAILABLE;
253 #else /* !TARGET_SDL */
255 #if defined(PLATFORM_UNIX)
256 for (i=0; i<MAX_PLAYERS; i++)
258 char *device_name = setup.input[i].joy.device_name;
260 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
261 if (stored_player[i].joystick_fd != -1)
263 close(stored_player[i].joystick_fd);
264 stored_player[i].joystick_fd = -1;
267 if (!setup.input[i].use_joystick)
270 if (access(device_name, R_OK) != 0)
272 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
276 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
278 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
282 joystick_status = JOYSTICK_AVAILABLE;
285 #else /* !PLATFORM_UNIX */
287 /* try to access two joysticks; if that fails, try to access just one */
288 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
289 install_joystick(JOY_TYPE_AUTODETECT) == 0)
290 joystick_status = JOYSTICK_AVAILABLE;
293 load_joystick_data(JOYSTICK_FILENAME);
296 for (i=0; i<MAX_PLAYERS; i++)
298 char *device_name = setup.input[i].joy.device_name;
299 int joystick_nr = getJoystickNrFromDeviceName(device_name);
301 if (joystick_nr >= num_joysticks)
304 /* misuse joystick file descriptor variable to store joystick number */
305 stored_player[i].joystick_fd = joystick_nr;
309 #endif /* !TARGET_SDL */
316 #if defined(TARGET_SDL)
317 SDL_Surface *sdl_image_tmp;
320 XGCValues clip_gc_values;
321 unsigned long clip_gc_valuemask;
324 #if !defined(PLATFORM_MSDOS)
325 static struct PictureFileInfo pic[NUM_PICTURES] =
327 { "RocksScreen", TRUE },
328 { "RocksDoor", TRUE },
329 { "RocksHeroes", TRUE },
330 { "RocksToons", TRUE },
333 { "RocksMore", TRUE },
334 { "RocksFont", FALSE },
335 { "RocksFont2", FALSE },
336 { "RocksFont3", FALSE }
339 static struct PictureFileInfo pic[NUM_PICTURES] =
359 tile_needs_clipping[] =
361 { GFX_SPIELER1_UP, 4 },
362 { GFX_SPIELER1_DOWN, 4 },
363 { GFX_SPIELER1_LEFT, 4 },
364 { GFX_SPIELER1_RIGHT, 4 },
365 { GFX_SPIELER1_PUSH_LEFT, 4 },
366 { GFX_SPIELER1_PUSH_RIGHT, 4 },
367 { GFX_SPIELER2_UP, 4 },
368 { GFX_SPIELER2_DOWN, 4 },
369 { GFX_SPIELER2_LEFT, 4 },
370 { GFX_SPIELER2_RIGHT, 4 },
371 { GFX_SPIELER2_PUSH_LEFT, 4 },
372 { GFX_SPIELER2_PUSH_RIGHT, 4 },
373 { GFX_SPIELER3_UP, 4 },
374 { GFX_SPIELER3_DOWN, 4 },
375 { GFX_SPIELER3_LEFT, 4 },
376 { GFX_SPIELER3_RIGHT, 4 },
377 { GFX_SPIELER3_PUSH_LEFT, 4 },
378 { GFX_SPIELER3_PUSH_RIGHT, 4 },
379 { GFX_SPIELER4_UP, 4 },
380 { GFX_SPIELER4_DOWN, 4 },
381 { GFX_SPIELER4_LEFT, 4 },
382 { GFX_SPIELER4_RIGHT, 4 },
383 { GFX_SPIELER4_PUSH_LEFT, 4 },
384 { GFX_SPIELER4_PUSH_RIGHT, 4 },
385 { GFX_SP_MURPHY, 1 },
386 { GFX_MURPHY_GO_LEFT, 3 },
387 { GFX_MURPHY_GO_RIGHT, 3 },
388 { GFX_MURPHY_SNAP_UP, 1 },
389 { GFX_MURPHY_SNAP_DOWN, 1 },
390 { GFX_MURPHY_SNAP_RIGHT, 1 },
391 { GFX_MURPHY_SNAP_LEFT, 1 },
392 { GFX_MURPHY_PUSH_RIGHT, 1 },
393 { GFX_MURPHY_PUSH_LEFT, 1 },
394 { GFX_GEBLUBBER, 4 },
397 { GFX_EXPLOSION, 8 },
398 { GFX_SOKOBAN_OBJEKT, 1 },
399 { GFX_FUNKELN_BLAU, 3 },
400 { GFX_FUNKELN_WEISS, 3 },
401 { GFX2_SHIELD_PASSIVE, 3 },
402 { GFX2_SHIELD_ACTIVE, 3 },
406 /* create additional image buffers for double-buffering */
408 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
409 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
411 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
412 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
413 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
414 #if defined(PLATFORM_MSDOS)
415 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
418 DrawInitText("Loading graphics:",120,FC_GREEN);
420 for(i=0; i<NUM_PICTURES; i++)
421 if (i != PIX_SMALLFONT)
424 /* create additional image buffers for masking of graphics */
426 #if defined(TARGET_SDL)
428 /* initialize surface array to 'NULL' */
429 for(i=0; i<NUM_TILES; i++)
430 tile_masked[i] = NULL;
432 /* create only those masked surfaces we really need */
433 for(i=0; tile_needs_clipping[i].start>=0; i++)
435 for(j=0; j<tile_needs_clipping[i].count; j++)
437 int tile = tile_needs_clipping[i].start + j;
443 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
444 src_bitmap = pix_masked[bitmap_nr];
446 /* create surface for masked tile graphic */
447 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
448 WIN_SDL_DEPTH, 0, 0, 0, 0))
450 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
452 /* create native transparent surface for current image */
453 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
454 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
455 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
456 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
458 SDL_FreeSurface(sdl_image_tmp);
460 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
464 #else /* !TARGET_SDL */
466 /* create graphic context structures needed for clipping */
467 clip_gc_values.graphics_exposures = False;
468 clip_gc_valuemask = GCGraphicsExposures;
470 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
472 clip_gc_values.graphics_exposures = False;
473 clip_gc_valuemask = GCGraphicsExposures;
475 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
477 for(i=0; i<NUM_BITMAPS; i++)
481 clip_gc_values.graphics_exposures = False;
482 clip_gc_values.clip_mask = clipmask[i];
483 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
484 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
488 /* initialize pixmap array to Pixmap 'None' */
489 for(i=0; i<NUM_TILES; i++)
490 tile_clipmask[i] = None;
492 /* create only those clipping Pixmaps we really need */
493 for(i=0; tile_needs_clipping[i].start>=0; i++)
495 for(j=0; j<tile_needs_clipping[i].count; j++)
497 int tile = tile_needs_clipping[i].start + j;
503 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
504 src_pixmap = clipmask[pixmap_nr];
506 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
508 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
509 src_x,src_y, TILEX,TILEY, 0,0);
513 #endif /* !TARGET_SDL */
516 void InitGfxBackground()
520 drawto = backbuffer = pix[PIX_DB_BACK];
521 fieldbuffer = pix[PIX_DB_FIELD];
522 SetDrawtoField(DRAW_BACKBUFFER);
524 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
525 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
526 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
528 for(x=0; x<MAX_BUF_XSIZE; x++)
529 for(y=0; y<MAX_BUF_YSIZE; y++)
532 redraw_mask = REDRAW_ALL;
535 void LoadGfx(int pos, struct PictureFileInfo *pic)
537 char basefilename[256];
540 #if defined(TARGET_SDL)
541 SDL_Surface *sdl_image_tmp;
545 char *picture_ext = ".pcx";
548 if (pic->picture_filename)
550 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
551 DrawInitText(basefilename, 150, FC_YELLOW);
552 sprintf(filename, "%s/%s/%s",
553 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
555 #if defined(PLATFORM_MSDOS)
559 #if defined(TARGET_SDL)
560 /* load image to temporary surface */
561 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
562 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
564 /* create native non-transparent surface for current image */
565 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
566 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
568 /* create native transparent surface for current image */
569 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
570 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
571 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
572 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
574 /* free temporary surface */
575 SDL_FreeSurface(sdl_image_tmp);
577 #else /* !TARGET_SDL */
579 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
580 &pix[pos], &clipmask[pos]);
586 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
588 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
589 case PCX_FileInvalid:
590 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
592 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
593 case PCX_ColorFailed:
594 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
600 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
602 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
603 use pix_masked[], although they are the same when not using SDL */
604 pix_masked[pos] = pix[pos];
606 #endif /* !TARGET_SDL */
609 #if defined(TARGET_X11)
610 /* check if clip mask was correctly created */
611 if (pic->picture_with_mask && !clipmask[pos])
612 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
618 CreateLevelEditorGadgets();
622 CreateScreenGadgets();
625 void InitElementProperties()
629 static int ep_amoebalive[] =
636 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
638 static int ep_amoeboid[] =
646 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
648 static int ep_schluessel[] =
659 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
661 static int ep_pforte[] =
680 EL_SWITCHGATE_CLOSED,
695 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
697 static int ep_solid[] =
721 EL_MAGIC_WALL_BD_OFF,
722 EL_MAGIC_WALL_BD_EMPTY,
723 EL_MAGIC_WALL_BD_FULL,
724 EL_MAGIC_WALL_BD_DEAD,
751 EL_BELT1_SWITCH_LEFT,
752 EL_BELT1_SWITCH_MIDDLE,
753 EL_BELT1_SWITCH_RIGHT,
754 EL_BELT2_SWITCH_LEFT,
755 EL_BELT2_SWITCH_MIDDLE,
756 EL_BELT2_SWITCH_RIGHT,
757 EL_BELT3_SWITCH_LEFT,
758 EL_BELT3_SWITCH_MIDDLE,
759 EL_BELT3_SWITCH_RIGHT,
760 EL_BELT4_SWITCH_LEFT,
761 EL_BELT4_SWITCH_MIDDLE,
762 EL_BELT4_SWITCH_RIGHT,
763 EL_SWITCHGATE_SWITCH_1,
764 EL_SWITCHGATE_SWITCH_2,
767 EL_TIMEGATE_SWITCH_OFF,
768 EL_TIMEGATE_SWITCH_ON,
770 EL_SIGN_RADIOACTIVITY,
809 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
811 static int ep_massive[] =
837 EL_SWITCHGATE_CLOSED,
852 EL_BELT1_SWITCH_LEFT,
853 EL_BELT1_SWITCH_MIDDLE,
854 EL_BELT1_SWITCH_RIGHT,
855 EL_BELT2_SWITCH_LEFT,
856 EL_BELT2_SWITCH_MIDDLE,
857 EL_BELT2_SWITCH_RIGHT,
858 EL_BELT3_SWITCH_LEFT,
859 EL_BELT3_SWITCH_MIDDLE,
860 EL_BELT3_SWITCH_RIGHT,
861 EL_BELT4_SWITCH_LEFT,
862 EL_BELT4_SWITCH_MIDDLE,
863 EL_BELT4_SWITCH_RIGHT,
867 EL_SIGN_RADIOACTIVITY,
896 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
898 static int ep_slippery[] =
933 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
935 static int ep_enemy[] =
948 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
950 static int ep_mauer[] =
1000 EL_EMC_STEEL_WALL_1,
1001 EL_EMC_STEEL_WALL_2,
1002 EL_EMC_STEEL_WALL_3,
1003 EL_EMC_STEEL_WALL_4,
1013 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1015 static int ep_can_fall[] =
1030 EL_MAGIC_WALL_BD_FULL,
1041 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1043 static int ep_can_smash[] =
1074 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1076 static int ep_can_change[] =
1087 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1089 static int ep_can_move[] =
1109 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1111 static int ep_could_move[] =
1134 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1136 static int ep_dont_touch[] =
1143 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1145 static int ep_dont_go_to[] =
1163 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1165 static int ep_mampf2[] =
1190 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1192 static int ep_bd_element[] =
1201 EL_MAGIC_WALL_BD_OFF,
1219 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1221 static int ep_sb_element[] =
1226 EL_SOKOBAN_FELD_LEER,
1227 EL_SOKOBAN_FELD_VOLL,
1231 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1233 static int ep_gem[] =
1243 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1245 static int ep_inactive[] =
1282 EL_DYNAMITE_INACTIVE,
1294 EL_SOKOBAN_FELD_LEER,
1295 EL_SOKOBAN_FELD_VOLL,
1305 EL_MAGIC_WALL_BD_OFF,
1306 EL_MAGIC_WALL_BD_DEAD,
1342 EL_BELT1_SWITCH_LEFT,
1343 EL_BELT1_SWITCH_MIDDLE,
1344 EL_BELT1_SWITCH_RIGHT,
1345 EL_BELT2_SWITCH_LEFT,
1346 EL_BELT2_SWITCH_MIDDLE,
1347 EL_BELT2_SWITCH_RIGHT,
1348 EL_BELT3_SWITCH_LEFT,
1349 EL_BELT3_SWITCH_MIDDLE,
1350 EL_BELT3_SWITCH_RIGHT,
1351 EL_BELT4_SWITCH_LEFT,
1352 EL_BELT4_SWITCH_MIDDLE,
1353 EL_BELT4_SWITCH_RIGHT,
1354 EL_SIGN_EXCLAMATION,
1355 EL_SIGN_RADIOACTIVITY,
1367 EL_EMC_STEEL_WALL_1,
1368 EL_EMC_STEEL_WALL_2,
1369 EL_EMC_STEEL_WALL_3,
1370 EL_EMC_STEEL_WALL_4,
1380 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1382 static int ep_explosive[] =
1386 EL_DYNAMITE_INACTIVE,
1387 EL_DYNABOMB_ACTIVE_1,
1388 EL_DYNABOMB_ACTIVE_2,
1389 EL_DYNABOMB_ACTIVE_3,
1390 EL_DYNABOMB_ACTIVE_4,
1407 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1409 static int ep_mampf3[] =
1420 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1422 static int ep_pushable[] =
1429 EL_SOKOBAN_FELD_VOLL,
1439 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1441 static int ep_player[] =
1449 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1451 static int ep_has_content[] =
1459 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1461 static int ep_eatable[] =
1469 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1471 static int ep_sp_element[] =
1513 /* additional elements that appeared in newer Supaplex levels */
1515 /* more than one murphy in a level results in an inactive clone */
1518 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1520 static int ep_quick_gate[] =
1544 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1546 static int ep_over_player[] =
1571 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1573 static int ep_active_bomb[] =
1576 EL_DYNABOMB_ACTIVE_1,
1577 EL_DYNABOMB_ACTIVE_2,
1578 EL_DYNABOMB_ACTIVE_3,
1579 EL_DYNABOMB_ACTIVE_4
1581 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1583 static int ep_belt[] =
1598 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1600 static int ep_belt_switch[] =
1602 EL_BELT1_SWITCH_LEFT,
1603 EL_BELT1_SWITCH_MIDDLE,
1604 EL_BELT1_SWITCH_RIGHT,
1605 EL_BELT2_SWITCH_LEFT,
1606 EL_BELT2_SWITCH_MIDDLE,
1607 EL_BELT2_SWITCH_RIGHT,
1608 EL_BELT3_SWITCH_LEFT,
1609 EL_BELT3_SWITCH_MIDDLE,
1610 EL_BELT3_SWITCH_RIGHT,
1611 EL_BELT4_SWITCH_LEFT,
1612 EL_BELT4_SWITCH_MIDDLE,
1613 EL_BELT4_SWITCH_RIGHT,
1615 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1617 static int ep_tube[] =
1631 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1633 static long ep1_bit[] =
1667 static long ep2_bit[] =
1673 static int *ep1_array[] =
1707 static int *ep2_array[] =
1713 static int *ep1_num[] =
1740 &ep_has_content_num,
1744 &ep_over_player_num,
1747 static int *ep2_num[] =
1750 &ep_belt_switch_num,
1753 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1754 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1756 for(i=0; i<MAX_ELEMENTS; i++)
1758 Elementeigenschaften1[i] = 0;
1759 Elementeigenschaften2[i] = 0;
1762 for(i=0; i<num_properties1; i++)
1763 for(j=0; j<*(ep1_num[i]); j++)
1764 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1765 for(i=0; i<num_properties2; i++)
1766 for(j=0; j<*(ep2_num[i]); j++)
1767 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1769 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1770 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1773 void CloseAllAndExit(int exit_value)
1777 #if defined(TARGET_SDL)
1779 FreeSounds(NUM_SOUNDS);
1781 if (audio.soundserver_pid)
1784 kill(audio.soundserver_pid, SIGTERM);
1785 FreeSounds(NUM_SOUNDS);
1789 for(i=0; i<NUM_BITMAPS; i++)
1794 #if defined(TARGET_SDL)
1795 FreeBitmap(pix_masked[i]);
1798 FreeBitmap(clipmask[i]);
1800 XFreeGC(display, clip_gc[i]);
1804 #if defined(TARGET_SDL)
1805 KeyboardAutoRepeatOn();
1808 XFreeGC(display, gc);
1812 KeyboardAutoRepeatOn();
1813 XCloseDisplay(display);
1817 #if !defined(PLATFORM_UNIX)