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 *gfx_dir = getPath2(options.ro_base_directory, GRAPHICS_DIRECTORY);
314 char *x11_icon_filename = getPath2(gfx_dir, X11_ICON_FILENAME);
315 char *x11_iconmask_filename = getPath2(gfx_dir, X11_ICONMASK_FILENAME);
316 char *msdos_pointer_filename = getPath2(gfx_dir, MSDOS_POINTER_FILENAME);
320 InitProgramInfo(program_name, PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
321 ICON_TITLE_STRING, x11_icon_filename, x11_iconmask_filename,
322 msdos_pointer_filename);
324 InitScrollbufferSize(FXSIZE, FYSIZE); /* (only needed for MS-DOS code) */
327 InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
335 #if defined(TARGET_SDL)
336 SDL_Surface *sdl_image_tmp;
339 XGCValues clip_gc_values;
340 unsigned long clip_gc_valuemask;
343 #if !defined(PLATFORM_MSDOS)
344 static struct PictureFileInfo pic[NUM_PICTURES] =
346 { "RocksScreen", TRUE },
347 { "RocksDoor", TRUE },
348 { "RocksHeroes", TRUE },
349 { "RocksToons", TRUE },
352 { "RocksMore", TRUE },
353 { "RocksFont", FALSE },
354 { "RocksFont2", FALSE },
355 { "RocksFont3", FALSE }
358 static struct PictureFileInfo pic[NUM_PICTURES] =
378 tile_needs_clipping[] =
380 { GFX_SPIELER1_UP, 4 },
381 { GFX_SPIELER1_DOWN, 4 },
382 { GFX_SPIELER1_LEFT, 4 },
383 { GFX_SPIELER1_RIGHT, 4 },
384 { GFX_SPIELER1_PUSH_LEFT, 4 },
385 { GFX_SPIELER1_PUSH_RIGHT, 4 },
386 { GFX_SPIELER2_UP, 4 },
387 { GFX_SPIELER2_DOWN, 4 },
388 { GFX_SPIELER2_LEFT, 4 },
389 { GFX_SPIELER2_RIGHT, 4 },
390 { GFX_SPIELER2_PUSH_LEFT, 4 },
391 { GFX_SPIELER2_PUSH_RIGHT, 4 },
392 { GFX_SPIELER3_UP, 4 },
393 { GFX_SPIELER3_DOWN, 4 },
394 { GFX_SPIELER3_LEFT, 4 },
395 { GFX_SPIELER3_RIGHT, 4 },
396 { GFX_SPIELER3_PUSH_LEFT, 4 },
397 { GFX_SPIELER3_PUSH_RIGHT, 4 },
398 { GFX_SPIELER4_UP, 4 },
399 { GFX_SPIELER4_DOWN, 4 },
400 { GFX_SPIELER4_LEFT, 4 },
401 { GFX_SPIELER4_RIGHT, 4 },
402 { GFX_SPIELER4_PUSH_LEFT, 4 },
403 { GFX_SPIELER4_PUSH_RIGHT, 4 },
404 { GFX_SP_MURPHY, 1 },
405 { GFX_MURPHY_GO_LEFT, 3 },
406 { GFX_MURPHY_GO_RIGHT, 3 },
407 { GFX_MURPHY_SNAP_UP, 1 },
408 { GFX_MURPHY_SNAP_DOWN, 1 },
409 { GFX_MURPHY_SNAP_RIGHT, 1 },
410 { GFX_MURPHY_SNAP_LEFT, 1 },
411 { GFX_MURPHY_PUSH_RIGHT, 1 },
412 { GFX_MURPHY_PUSH_LEFT, 1 },
413 { GFX_GEBLUBBER, 4 },
416 { GFX_EXPLOSION, 8 },
417 { GFX_SOKOBAN_OBJEKT, 1 },
418 { GFX_FUNKELN_BLAU, 3 },
419 { GFX_FUNKELN_WEISS, 3 },
420 { GFX2_SHIELD_PASSIVE, 3 },
421 { GFX2_SHIELD_ACTIVE, 3 },
425 /* create additional image buffers for double-buffering */
427 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
428 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
430 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
431 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
432 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
433 #if defined(PLATFORM_MSDOS)
434 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
437 DrawInitText("Loading graphics:",120,FC_GREEN);
439 for(i=0; i<NUM_PICTURES; i++)
440 if (i != PIX_SMALLFONT)
443 /* create additional image buffers for masking of graphics */
445 #if defined(TARGET_SDL)
447 /* initialize surface array to 'NULL' */
448 for(i=0; i<NUM_TILES; i++)
449 tile_masked[i] = NULL;
451 /* create only those masked surfaces we really need */
452 for(i=0; tile_needs_clipping[i].start>=0; i++)
454 for(j=0; j<tile_needs_clipping[i].count; j++)
456 int tile = tile_needs_clipping[i].start + j;
462 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
463 src_bitmap = pix_masked[bitmap_nr];
465 /* create surface for masked tile graphic */
466 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
467 WIN_SDL_DEPTH, 0, 0, 0, 0))
469 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
471 /* create native transparent surface for current image */
472 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
473 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
474 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
475 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
477 SDL_FreeSurface(sdl_image_tmp);
479 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
483 #else /* !TARGET_SDL */
485 /* create graphic context structures needed for clipping */
486 clip_gc_values.graphics_exposures = False;
487 clip_gc_valuemask = GCGraphicsExposures;
489 XCreateGC(display, clipmask[PIX_BACK], clip_gc_valuemask, &clip_gc_values);
491 clip_gc_values.graphics_exposures = False;
492 clip_gc_valuemask = GCGraphicsExposures;
494 XCreateGC(display, window, clip_gc_valuemask, &clip_gc_values);
496 for(i=0; i<NUM_BITMAPS; i++)
500 clip_gc_values.graphics_exposures = False;
501 clip_gc_values.clip_mask = clipmask[i];
502 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
503 clip_gc[i] = XCreateGC(display,window,clip_gc_valuemask,&clip_gc_values);
507 /* initialize pixmap array to Pixmap 'None' */
508 for(i=0; i<NUM_TILES; i++)
509 tile_clipmask[i] = None;
511 /* create only those clipping Pixmaps we really need */
512 for(i=0; tile_needs_clipping[i].start>=0; i++)
514 for(j=0; j<tile_needs_clipping[i].count; j++)
516 int tile = tile_needs_clipping[i].start + j;
522 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
523 src_pixmap = clipmask[pixmap_nr];
525 tile_clipmask[tile] = XCreatePixmap(display, window, TILEX,TILEY, 1);
527 XCopyArea(display,src_pixmap,tile_clipmask[tile],copy_clipmask_gc,
528 src_x,src_y, TILEX,TILEY, 0,0);
532 #endif /* !TARGET_SDL */
535 void InitGfxBackground()
540 fieldbuffer = pix[PIX_DB_FIELD];
541 SetDrawtoField(DRAW_BACKBUFFER);
543 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
544 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
545 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
547 for(x=0; x<MAX_BUF_XSIZE; x++)
548 for(y=0; y<MAX_BUF_YSIZE; y++)
551 redraw_mask = REDRAW_ALL;
554 void LoadGfx(int pos, struct PictureFileInfo *pic)
556 char basefilename[256];
559 #if defined(TARGET_SDL)
560 SDL_Surface *sdl_image_tmp;
564 char *picture_ext = ".pcx";
567 if (pic->picture_filename)
569 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
570 DrawInitText(basefilename, 150, FC_YELLOW);
571 sprintf(filename, "%s/%s/%s",
572 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
574 #if defined(PLATFORM_MSDOS)
578 #if defined(TARGET_SDL)
579 /* load image to temporary surface */
580 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
581 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
583 /* create native non-transparent surface for current image */
584 if ((pix[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
585 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
587 /* create native transparent surface for current image */
588 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
589 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
590 if ((pix_masked[pos] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
591 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
593 /* free temporary surface */
594 SDL_FreeSurface(sdl_image_tmp);
596 #else /* !TARGET_SDL */
598 pcx_err = Read_PCX_to_Pixmap(display, window, gc, filename,
599 &pix[pos], &clipmask[pos]);
605 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
607 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
608 case PCX_FileInvalid:
609 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
611 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
612 case PCX_ColorFailed:
613 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
619 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
621 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
622 use pix_masked[], although they are the same when not using SDL */
623 pix_masked[pos] = pix[pos];
625 #endif /* !TARGET_SDL */
628 #if defined(TARGET_X11)
629 /* check if clip mask was correctly created */
630 if (pic->picture_with_mask && !clipmask[pos])
631 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
637 CreateLevelEditorGadgets();
641 CreateScreenGadgets();
644 void InitElementProperties()
648 static int ep_amoebalive[] =
655 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
657 static int ep_amoeboid[] =
665 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
667 static int ep_schluessel[] =
678 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
680 static int ep_pforte[] =
699 EL_SWITCHGATE_CLOSED,
714 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
716 static int ep_solid[] =
740 EL_MAGIC_WALL_BD_OFF,
741 EL_MAGIC_WALL_BD_EMPTY,
742 EL_MAGIC_WALL_BD_FULL,
743 EL_MAGIC_WALL_BD_DEAD,
770 EL_BELT1_SWITCH_LEFT,
771 EL_BELT1_SWITCH_MIDDLE,
772 EL_BELT1_SWITCH_RIGHT,
773 EL_BELT2_SWITCH_LEFT,
774 EL_BELT2_SWITCH_MIDDLE,
775 EL_BELT2_SWITCH_RIGHT,
776 EL_BELT3_SWITCH_LEFT,
777 EL_BELT3_SWITCH_MIDDLE,
778 EL_BELT3_SWITCH_RIGHT,
779 EL_BELT4_SWITCH_LEFT,
780 EL_BELT4_SWITCH_MIDDLE,
781 EL_BELT4_SWITCH_RIGHT,
782 EL_SWITCHGATE_SWITCH_1,
783 EL_SWITCHGATE_SWITCH_2,
786 EL_TIMEGATE_SWITCH_OFF,
787 EL_TIMEGATE_SWITCH_ON,
789 EL_SIGN_RADIOACTIVITY,
828 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
830 static int ep_massive[] =
856 EL_SWITCHGATE_CLOSED,
871 EL_BELT1_SWITCH_LEFT,
872 EL_BELT1_SWITCH_MIDDLE,
873 EL_BELT1_SWITCH_RIGHT,
874 EL_BELT2_SWITCH_LEFT,
875 EL_BELT2_SWITCH_MIDDLE,
876 EL_BELT2_SWITCH_RIGHT,
877 EL_BELT3_SWITCH_LEFT,
878 EL_BELT3_SWITCH_MIDDLE,
879 EL_BELT3_SWITCH_RIGHT,
880 EL_BELT4_SWITCH_LEFT,
881 EL_BELT4_SWITCH_MIDDLE,
882 EL_BELT4_SWITCH_RIGHT,
886 EL_SIGN_RADIOACTIVITY,
915 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
917 static int ep_slippery[] =
952 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
954 static int ep_enemy[] =
967 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
969 static int ep_mauer[] =
1019 EL_EMC_STEEL_WALL_1,
1020 EL_EMC_STEEL_WALL_2,
1021 EL_EMC_STEEL_WALL_3,
1022 EL_EMC_STEEL_WALL_4,
1032 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1034 static int ep_can_fall[] =
1049 EL_MAGIC_WALL_BD_FULL,
1060 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1062 static int ep_can_smash[] =
1093 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1095 static int ep_can_change[] =
1106 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1108 static int ep_can_move[] =
1128 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1130 static int ep_could_move[] =
1153 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1155 static int ep_dont_touch[] =
1162 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1164 static int ep_dont_go_to[] =
1182 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1184 static int ep_mampf2[] =
1209 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1211 static int ep_bd_element[] =
1220 EL_MAGIC_WALL_BD_OFF,
1238 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1240 static int ep_sb_element[] =
1245 EL_SOKOBAN_FELD_LEER,
1246 EL_SOKOBAN_FELD_VOLL,
1250 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1252 static int ep_gem[] =
1262 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1264 static int ep_inactive[] =
1301 EL_DYNAMITE_INACTIVE,
1313 EL_SOKOBAN_FELD_LEER,
1314 EL_SOKOBAN_FELD_VOLL,
1324 EL_MAGIC_WALL_BD_OFF,
1325 EL_MAGIC_WALL_BD_DEAD,
1361 EL_BELT1_SWITCH_LEFT,
1362 EL_BELT1_SWITCH_MIDDLE,
1363 EL_BELT1_SWITCH_RIGHT,
1364 EL_BELT2_SWITCH_LEFT,
1365 EL_BELT2_SWITCH_MIDDLE,
1366 EL_BELT2_SWITCH_RIGHT,
1367 EL_BELT3_SWITCH_LEFT,
1368 EL_BELT3_SWITCH_MIDDLE,
1369 EL_BELT3_SWITCH_RIGHT,
1370 EL_BELT4_SWITCH_LEFT,
1371 EL_BELT4_SWITCH_MIDDLE,
1372 EL_BELT4_SWITCH_RIGHT,
1373 EL_SIGN_EXCLAMATION,
1374 EL_SIGN_RADIOACTIVITY,
1386 EL_EMC_STEEL_WALL_1,
1387 EL_EMC_STEEL_WALL_2,
1388 EL_EMC_STEEL_WALL_3,
1389 EL_EMC_STEEL_WALL_4,
1399 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1401 static int ep_explosive[] =
1405 EL_DYNAMITE_INACTIVE,
1406 EL_DYNABOMB_ACTIVE_1,
1407 EL_DYNABOMB_ACTIVE_2,
1408 EL_DYNABOMB_ACTIVE_3,
1409 EL_DYNABOMB_ACTIVE_4,
1426 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1428 static int ep_mampf3[] =
1439 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1441 static int ep_pushable[] =
1448 EL_SOKOBAN_FELD_VOLL,
1458 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1460 static int ep_player[] =
1468 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1470 static int ep_has_content[] =
1478 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1480 static int ep_eatable[] =
1488 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1490 static int ep_sp_element[] =
1532 /* additional elements that appeared in newer Supaplex levels */
1534 /* more than one murphy in a level results in an inactive clone */
1537 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1539 static int ep_quick_gate[] =
1563 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1565 static int ep_over_player[] =
1590 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1592 static int ep_active_bomb[] =
1595 EL_DYNABOMB_ACTIVE_1,
1596 EL_DYNABOMB_ACTIVE_2,
1597 EL_DYNABOMB_ACTIVE_3,
1598 EL_DYNABOMB_ACTIVE_4
1600 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1602 static int ep_belt[] =
1617 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1619 static int ep_belt_switch[] =
1621 EL_BELT1_SWITCH_LEFT,
1622 EL_BELT1_SWITCH_MIDDLE,
1623 EL_BELT1_SWITCH_RIGHT,
1624 EL_BELT2_SWITCH_LEFT,
1625 EL_BELT2_SWITCH_MIDDLE,
1626 EL_BELT2_SWITCH_RIGHT,
1627 EL_BELT3_SWITCH_LEFT,
1628 EL_BELT3_SWITCH_MIDDLE,
1629 EL_BELT3_SWITCH_RIGHT,
1630 EL_BELT4_SWITCH_LEFT,
1631 EL_BELT4_SWITCH_MIDDLE,
1632 EL_BELT4_SWITCH_RIGHT,
1634 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1636 static int ep_tube[] =
1650 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1652 static long ep1_bit[] =
1686 static long ep2_bit[] =
1692 static int *ep1_array[] =
1726 static int *ep2_array[] =
1732 static int *ep1_num[] =
1759 &ep_has_content_num,
1763 &ep_over_player_num,
1766 static int *ep2_num[] =
1769 &ep_belt_switch_num,
1772 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1773 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1775 for(i=0; i<MAX_ELEMENTS; i++)
1777 Elementeigenschaften1[i] = 0;
1778 Elementeigenschaften2[i] = 0;
1781 for(i=0; i<num_properties1; i++)
1782 for(j=0; j<*(ep1_num[i]); j++)
1783 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1784 for(i=0; i<num_properties2; i++)
1785 for(j=0; j<*(ep2_num[i]); j++)
1786 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1788 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1789 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1792 void CloseAllAndExit(int exit_value)
1796 #if defined(TARGET_SDL)
1798 FreeSounds(NUM_SOUNDS);
1800 if (audio.soundserver_pid)
1803 kill(audio.soundserver_pid, SIGTERM);
1804 FreeSounds(NUM_SOUNDS);
1808 for(i=0; i<NUM_BITMAPS; i++)
1813 #if defined(TARGET_SDL)
1814 FreeBitmap(pix_masked[i]);
1817 FreeBitmap(clipmask[i]);
1819 XFreeGC(display, clip_gc[i]);
1823 #if defined(TARGET_SDL)
1824 KeyboardAutoRepeatOn();
1827 XFreeGC(display, gc);
1831 KeyboardAutoRepeatOn();
1832 XCloseDisplay(display);
1836 #if !defined(PLATFORM_UNIX)