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);
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");
66 InitProgramInfo(UNIX_USERDATA_DIRECTORY,
67 PROGRAM_TITLE_STRING, WINDOW_TITLE_STRING,
68 ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
69 MSDOS_POINTER_FILENAME);
77 InitRND(NEW_RANDOMIZE);
79 signal(SIGINT, CloseAllAndExit);
80 signal(SIGTERM, CloseAllAndExit);
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(PLATFORM_UNIX)
128 if (!options.network)
131 #if defined(PLATFORM_UNIX)
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);
151 AllocSoundArray(NUM_SOUNDS);
153 for(i=0; i<NUM_SOUNDS; i++)
155 if (!LoadSound(i, sound_name[i]))
157 audio.sound_available = FALSE;
158 audio.loops_available = FALSE;
159 audio.sound_enabled = FALSE;
166 void InitSoundServer()
168 if (!audio.sound_available)
171 #if !defined(TARGET_SDL)
172 #if defined(PLATFORM_UNIX)
174 if (pipe(audio.soundserver_pipe) < 0)
176 Error(ERR_WARN, "cannot create pipe - no sounds");
177 audio.sound_available = FALSE;
181 if ((audio.soundserver_pid = fork()) < 0)
183 Error(ERR_WARN, "cannot create sound server process - no sounds");
184 audio.sound_available = FALSE;
188 if (audio.soundserver_pid == 0) /* we are child */
195 else /* we are parent */
196 close(audio.soundserver_pipe[0]); /* no reading from pipe needed */
198 #else /* !PLATFORM_UNIX */
202 #endif /* !PLATFORM_UNIX */
203 #endif /* !TARGET_SDL */
208 #if defined(TARGET_SDL)
209 static boolean sdl_joystick_subsystem_initialized = FALSE;
214 if (global_joystick_status == JOYSTICK_OFF)
217 joystick_status = JOYSTICK_OFF;
219 #if defined(TARGET_SDL)
221 if (!sdl_joystick_subsystem_initialized)
223 sdl_joystick_subsystem_initialized = TRUE;
225 if (SDL_Init(SDL_INIT_JOYSTICK) < 0)
227 Error(ERR_EXIT, "SDL_Init() failed: %s", SDL_GetError());
232 for (i=0; i<MAX_PLAYERS; i++)
234 char *device_name = setup.input[i].joy.device_name;
235 int joystick_nr = getJoystickNrFromDeviceName(device_name);
237 if (joystick_nr >= SDL_NumJoysticks())
240 /* misuse joystick file descriptor variable to store joystick number */
241 stored_player[i].joystick_fd = joystick_nr;
243 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
244 if (Check_SDL_JoystickOpened(joystick_nr))
245 Close_SDL_Joystick(joystick_nr);
247 if (!setup.input[i].use_joystick)
250 if (!Open_SDL_Joystick(joystick_nr))
252 Error(ERR_WARN, "cannot open joystick %d", joystick_nr);
256 joystick_status = JOYSTICK_AVAILABLE;
259 #else /* !TARGET_SDL */
261 #if defined(PLATFORM_UNIX)
262 for (i=0; i<MAX_PLAYERS; i++)
264 char *device_name = setup.input[i].joy.device_name;
266 /* this allows subsequent calls to 'InitJoysticks' for re-initialization */
267 if (stored_player[i].joystick_fd != -1)
269 close(stored_player[i].joystick_fd);
270 stored_player[i].joystick_fd = -1;
273 if (!setup.input[i].use_joystick)
276 if (access(device_name, R_OK) != 0)
278 Error(ERR_WARN, "cannot access joystick device '%s'", device_name);
282 if ((stored_player[i].joystick_fd = open(device_name, O_RDONLY)) < 0)
284 Error(ERR_WARN, "cannot open joystick device '%s'", device_name);
288 joystick_status = JOYSTICK_AVAILABLE;
291 #else /* !PLATFORM_UNIX */
293 /* try to access two joysticks; if that fails, try to access just one */
294 if (install_joystick(JOY_TYPE_2PADS) == 0 ||
295 install_joystick(JOY_TYPE_AUTODETECT) == 0)
296 joystick_status = JOYSTICK_AVAILABLE;
299 load_joystick_data(JOYSTICK_FILENAME);
302 for (i=0; i<MAX_PLAYERS; i++)
304 char *device_name = setup.input[i].joy.device_name;
305 int joystick_nr = getJoystickNrFromDeviceName(device_name);
307 if (joystick_nr >= num_joysticks)
310 /* misuse joystick file descriptor variable to store joystick number */
311 stored_player[i].joystick_fd = joystick_nr;
315 #endif /* !TARGET_SDL */
321 InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
329 #if defined(TARGET_X11)
331 XGCValues clip_gc_values;
332 unsigned long clip_gc_valuemask;
335 #if !defined(PLATFORM_MSDOS)
336 static struct PictureFileInfo pic[NUM_PICTURES] =
338 { "RocksScreen", TRUE },
339 { "RocksDoor", TRUE },
340 { "RocksHeroes", TRUE },
341 { "RocksToons", TRUE },
344 { "RocksMore", TRUE },
345 { "RocksFont", FALSE },
346 { "RocksFont2", FALSE },
347 { "RocksFont3", FALSE }
350 static struct PictureFileInfo pic[NUM_PICTURES] =
371 tile_needs_clipping[] =
373 { GFX_SPIELER1_UP, 4 },
374 { GFX_SPIELER1_DOWN, 4 },
375 { GFX_SPIELER1_LEFT, 4 },
376 { GFX_SPIELER1_RIGHT, 4 },
377 { GFX_SPIELER1_PUSH_LEFT, 4 },
378 { GFX_SPIELER1_PUSH_RIGHT, 4 },
379 { GFX_SPIELER2_UP, 4 },
380 { GFX_SPIELER2_DOWN, 4 },
381 { GFX_SPIELER2_LEFT, 4 },
382 { GFX_SPIELER2_RIGHT, 4 },
383 { GFX_SPIELER2_PUSH_LEFT, 4 },
384 { GFX_SPIELER2_PUSH_RIGHT, 4 },
385 { GFX_SPIELER3_UP, 4 },
386 { GFX_SPIELER3_DOWN, 4 },
387 { GFX_SPIELER3_LEFT, 4 },
388 { GFX_SPIELER3_RIGHT, 4 },
389 { GFX_SPIELER3_PUSH_LEFT, 4 },
390 { GFX_SPIELER3_PUSH_RIGHT, 4 },
391 { GFX_SPIELER4_UP, 4 },
392 { GFX_SPIELER4_DOWN, 4 },
393 { GFX_SPIELER4_LEFT, 4 },
394 { GFX_SPIELER4_RIGHT, 4 },
395 { GFX_SPIELER4_PUSH_LEFT, 4 },
396 { GFX_SPIELER4_PUSH_RIGHT, 4 },
397 { GFX_SP_MURPHY, 1 },
398 { GFX_MURPHY_GO_LEFT, 3 },
399 { GFX_MURPHY_GO_RIGHT, 3 },
400 { GFX_MURPHY_SNAP_UP, 1 },
401 { GFX_MURPHY_SNAP_DOWN, 1 },
402 { GFX_MURPHY_SNAP_RIGHT, 1 },
403 { GFX_MURPHY_SNAP_LEFT, 1 },
404 { GFX_MURPHY_PUSH_RIGHT, 1 },
405 { GFX_MURPHY_PUSH_LEFT, 1 },
406 { GFX_GEBLUBBER, 4 },
409 { GFX_EXPLOSION, 8 },
410 { GFX_SOKOBAN_OBJEKT, 1 },
411 { GFX_FUNKELN_BLAU, 3 },
412 { GFX_FUNKELN_WEISS, 3 },
413 { GFX2_SHIELD_PASSIVE, 3 },
414 { GFX2_SHIELD_ACTIVE, 3 },
419 /* initialize some global variables */
420 global.frames_per_second = 0;
421 global.fps_slowdown = FALSE;
422 global.fps_slowdown_factor = 1;
424 /* initialize screen properties */
425 InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
426 REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
427 InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
428 InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
429 InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
431 /* create additional image buffers for double-buffering */
432 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
433 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
435 LoadGfx(PIX_SMALLFONT, &pic[PIX_SMALLFONT]);
436 InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]);
438 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
439 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
440 #if defined(PLATFORM_MSDOS)
441 DrawInitText(PROGRAM_DOS_PORT_STRING, 210, FC_BLUE);
444 DrawInitText("Loading graphics:",120,FC_GREEN);
446 for(i=0; i<NUM_PICTURES; i++)
447 if (i != PIX_SMALLFONT)
450 InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
452 /* create additional image buffers for masking of graphics */
454 #if defined(TARGET_SDL)
457 /* initialize surface array to 'NULL' */
458 for(i=0; i<NUM_TILES; i++)
459 tile_masked[i] = NULL;
461 /* create only those masked surfaces we really need */
462 for(i=0; tile_needs_clipping[i].start>=0; i++)
464 for(j=0; j<tile_needs_clipping[i].count; j++)
466 SDL_Surface *sdl_image_tmp;
467 int tile = tile_needs_clipping[i].start + j;
473 getGraphicSource(graphic, &bitmap_nr, &src_x, &src_y);
474 src_bitmap = pix[bitmap_nr];
476 /* create surface for masked tile graphic */
477 if ((sdl_image_tmp = SDL_CreateRGBSurface(SDL_SWSURFACE, TILEX, TILEY,
478 WIN_SDL_DEPTH, 0, 0, 0, 0))
480 Error(ERR_EXIT, "SDL_CreateRGBSurface() failed: %s", SDL_GetError());
482 /* create native transparent surface for current image */
483 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
484 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
485 if ((tile_masked[tile] = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
486 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
488 SDL_FreeSurface(sdl_image_tmp);
490 BlitBitmap(src_bitmap, tile_masked[tile], src_x,src_y, TILEX,TILEY, 0,0);
495 #else /* !TARGET_SDL */
497 /* create graphic context structures needed for clipping */
498 clip_gc_values.graphics_exposures = False;
499 clip_gc_valuemask = GCGraphicsExposures;
501 XCreateGC(display, pix[PIX_BACK]->clip_mask,
502 clip_gc_valuemask, &clip_gc_values);
504 clip_gc_values.graphics_exposures = False;
505 clip_gc_valuemask = GCGraphicsExposures;
507 XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
509 for(i=0; i<NUM_BITMAPS; i++)
511 if (pix[i]->clip_mask)
513 clip_gc_values.graphics_exposures = False;
514 clip_gc_values.clip_mask = pix[i]->clip_mask;
515 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
516 pix[i]->stored_clip_gc = XCreateGC(display, window->drawable,
517 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++)
530 for(j=0; j<tile_needs_clipping[i].count; j++)
532 int tile = tile_needs_clipping[i].start + j;
538 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
539 src_pixmap = pix[pixmap_nr]->clip_mask;
541 tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
544 XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc,
545 src_x, src_y, TILEX, TILEY, 0, 0);
549 #endif /* !TARGET_SDL */
552 void InitGfxBackground()
557 fieldbuffer = pix[PIX_DB_FIELD];
558 SetDrawtoField(DRAW_BACKBUFFER);
560 BlitBitmap(pix[PIX_BACK], backbuffer, 0,0, WIN_XSIZE,WIN_YSIZE, 0,0);
561 ClearRectangle(backbuffer, REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE);
562 ClearRectangle(pix[PIX_DB_DOOR], 0,0, 3*DXSIZE,DYSIZE+VYSIZE);
564 for(x=0; x<MAX_BUF_XSIZE; x++)
565 for(y=0; y<MAX_BUF_YSIZE; y++)
568 redraw_mask = REDRAW_ALL;
571 void LoadGfx(int pos, struct PictureFileInfo *pic)
573 char basefilename[256];
576 #if defined(TARGET_SDL)
577 SDL_Surface *sdl_image_tmp;
581 char *picture_ext = ".pcx";
584 if (pic->picture_filename)
586 sprintf(basefilename, "%s%s", pic->picture_filename, picture_ext);
587 DrawInitText(basefilename, 150, FC_YELLOW);
588 sprintf(filename, "%s/%s/%s",
589 options.ro_base_directory, GRAPHICS_DIRECTORY, basefilename);
591 #if defined(PLATFORM_MSDOS)
595 pix[pos] = CreateBitmapStruct();
597 #if defined(TARGET_SDL)
598 /* load image to temporary surface */
599 if ((sdl_image_tmp = IMG_Load(filename)) == NULL)
600 Error(ERR_EXIT, "IMG_Load() failed: %s", SDL_GetError());
602 /* create native non-transparent surface for current image */
603 if ((pix[pos]->surface = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
604 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
606 /* create native transparent surface for current image */
607 SDL_SetColorKey(sdl_image_tmp, SDL_SRCCOLORKEY,
608 SDL_MapRGB(sdl_image_tmp->format, 0x00, 0x00, 0x00));
609 if ((pix[pos]->surface_masked = SDL_DisplayFormat(sdl_image_tmp)) == NULL)
610 Error(ERR_EXIT, "SDL_DisplayFormat() failed: %s", SDL_GetError());
612 /* free temporary surface */
613 SDL_FreeSurface(sdl_image_tmp);
615 #else /* !TARGET_SDL */
617 pcx_err = Read_PCX_to_Pixmap(display, window->drawable, window->gc,
619 &pix[pos]->drawable, &pix[pos]->clip_mask);
625 Error(ERR_EXIT, "cannot open PCX file '%s'", filename);
627 Error(ERR_EXIT, "cannot read PCX file '%s'", filename);
628 case PCX_FileInvalid:
629 Error(ERR_EXIT, "invalid PCX file '%s'", filename);
631 Error(ERR_EXIT, "not enough memory for PCX file '%s'", filename);
632 case PCX_ColorFailed:
633 Error(ERR_EXIT, "cannot get colors for PCX file '%s'", filename);
638 if (!pix[pos]->drawable)
639 Error(ERR_EXIT, "cannot get graphics for '%s'", pic->picture_filename);
642 /* setting pix_masked[] to pix[] allows BlitBitmapMasked() to always
643 use pix_masked[], although they are the same when not using SDL */
644 pix_masked[pos] = pix[pos];
647 #endif /* !TARGET_SDL */
650 #if defined(TARGET_X11)
651 /* check if clip mask was correctly created */
652 if (pic->picture_with_mask && !pix[pos]->clip_mask)
653 Error(ERR_EXIT, "cannot get clipmask for '%s'", pic->picture_filename);
659 CreateLevelEditorGadgets();
663 CreateScreenGadgets();
666 void InitElementProperties()
670 static int ep_amoebalive[] =
677 static int ep_amoebalive_num = sizeof(ep_amoebalive)/sizeof(int);
679 static int ep_amoeboid[] =
687 static int ep_amoeboid_num = sizeof(ep_amoeboid)/sizeof(int);
689 static int ep_schluessel[] =
700 static int ep_schluessel_num = sizeof(ep_schluessel)/sizeof(int);
702 static int ep_pforte[] =
721 EL_SWITCHGATE_CLOSED,
736 static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
738 static int ep_solid[] =
762 EL_MAGIC_WALL_BD_OFF,
763 EL_MAGIC_WALL_BD_EMPTY,
764 EL_MAGIC_WALL_BD_FULL,
765 EL_MAGIC_WALL_BD_DEAD,
792 EL_BELT1_SWITCH_LEFT,
793 EL_BELT1_SWITCH_MIDDLE,
794 EL_BELT1_SWITCH_RIGHT,
795 EL_BELT2_SWITCH_LEFT,
796 EL_BELT2_SWITCH_MIDDLE,
797 EL_BELT2_SWITCH_RIGHT,
798 EL_BELT3_SWITCH_LEFT,
799 EL_BELT3_SWITCH_MIDDLE,
800 EL_BELT3_SWITCH_RIGHT,
801 EL_BELT4_SWITCH_LEFT,
802 EL_BELT4_SWITCH_MIDDLE,
803 EL_BELT4_SWITCH_RIGHT,
804 EL_SWITCHGATE_SWITCH_1,
805 EL_SWITCHGATE_SWITCH_2,
808 EL_TIMEGATE_SWITCH_OFF,
809 EL_TIMEGATE_SWITCH_ON,
811 EL_SIGN_RADIOACTIVITY,
850 static int ep_solid_num = sizeof(ep_solid)/sizeof(int);
852 static int ep_massive[] =
878 EL_SWITCHGATE_CLOSED,
893 EL_BELT1_SWITCH_LEFT,
894 EL_BELT1_SWITCH_MIDDLE,
895 EL_BELT1_SWITCH_RIGHT,
896 EL_BELT2_SWITCH_LEFT,
897 EL_BELT2_SWITCH_MIDDLE,
898 EL_BELT2_SWITCH_RIGHT,
899 EL_BELT3_SWITCH_LEFT,
900 EL_BELT3_SWITCH_MIDDLE,
901 EL_BELT3_SWITCH_RIGHT,
902 EL_BELT4_SWITCH_LEFT,
903 EL_BELT4_SWITCH_MIDDLE,
904 EL_BELT4_SWITCH_RIGHT,
908 EL_SIGN_RADIOACTIVITY,
937 static int ep_massive_num = sizeof(ep_massive)/sizeof(int);
939 static int ep_slippery[] =
974 static int ep_slippery_num = sizeof(ep_slippery)/sizeof(int);
976 static int ep_enemy[] =
989 static int ep_enemy_num = sizeof(ep_enemy)/sizeof(int);
991 static int ep_mauer[] =
1041 EL_EMC_STEEL_WALL_1,
1042 EL_EMC_STEEL_WALL_2,
1043 EL_EMC_STEEL_WALL_3,
1044 EL_EMC_STEEL_WALL_4,
1054 static int ep_mauer_num = sizeof(ep_mauer)/sizeof(int);
1056 static int ep_can_fall[] =
1071 EL_MAGIC_WALL_BD_FULL,
1082 static int ep_can_fall_num = sizeof(ep_can_fall)/sizeof(int);
1084 static int ep_can_smash[] =
1115 static int ep_can_smash_num = sizeof(ep_can_smash)/sizeof(int);
1117 static int ep_can_change[] =
1128 static int ep_can_change_num = sizeof(ep_can_change)/sizeof(int);
1130 static int ep_can_move[] =
1150 static int ep_can_move_num = sizeof(ep_can_move)/sizeof(int);
1152 static int ep_could_move[] =
1175 static int ep_could_move_num = sizeof(ep_could_move)/sizeof(int);
1177 static int ep_dont_touch[] =
1184 static int ep_dont_touch_num = sizeof(ep_dont_touch)/sizeof(int);
1186 static int ep_dont_go_to[] =
1204 static int ep_dont_go_to_num = sizeof(ep_dont_go_to)/sizeof(int);
1206 static int ep_mampf2[] =
1231 static int ep_mampf2_num = sizeof(ep_mampf2)/sizeof(int);
1233 static int ep_bd_element[] =
1242 EL_MAGIC_WALL_BD_OFF,
1260 static int ep_bd_element_num = sizeof(ep_bd_element)/sizeof(int);
1262 static int ep_sb_element[] =
1267 EL_SOKOBAN_FELD_LEER,
1268 EL_SOKOBAN_FELD_VOLL,
1272 static int ep_sb_element_num = sizeof(ep_sb_element)/sizeof(int);
1274 static int ep_gem[] =
1284 static int ep_gem_num = sizeof(ep_gem)/sizeof(int);
1286 static int ep_inactive[] =
1323 EL_DYNAMITE_INACTIVE,
1335 EL_SOKOBAN_FELD_LEER,
1336 EL_SOKOBAN_FELD_VOLL,
1346 EL_MAGIC_WALL_BD_OFF,
1347 EL_MAGIC_WALL_BD_DEAD,
1383 EL_BELT1_SWITCH_LEFT,
1384 EL_BELT1_SWITCH_MIDDLE,
1385 EL_BELT1_SWITCH_RIGHT,
1386 EL_BELT2_SWITCH_LEFT,
1387 EL_BELT2_SWITCH_MIDDLE,
1388 EL_BELT2_SWITCH_RIGHT,
1389 EL_BELT3_SWITCH_LEFT,
1390 EL_BELT3_SWITCH_MIDDLE,
1391 EL_BELT3_SWITCH_RIGHT,
1392 EL_BELT4_SWITCH_LEFT,
1393 EL_BELT4_SWITCH_MIDDLE,
1394 EL_BELT4_SWITCH_RIGHT,
1395 EL_SIGN_EXCLAMATION,
1396 EL_SIGN_RADIOACTIVITY,
1408 EL_EMC_STEEL_WALL_1,
1409 EL_EMC_STEEL_WALL_2,
1410 EL_EMC_STEEL_WALL_3,
1411 EL_EMC_STEEL_WALL_4,
1421 static int ep_inactive_num = sizeof(ep_inactive)/sizeof(int);
1423 static int ep_explosive[] =
1427 EL_DYNAMITE_INACTIVE,
1428 EL_DYNABOMB_ACTIVE_1,
1429 EL_DYNABOMB_ACTIVE_2,
1430 EL_DYNABOMB_ACTIVE_3,
1431 EL_DYNABOMB_ACTIVE_4,
1448 static int ep_explosive_num = sizeof(ep_explosive)/sizeof(int);
1450 static int ep_mampf3[] =
1461 static int ep_mampf3_num = sizeof(ep_mampf3)/sizeof(int);
1463 static int ep_pushable[] =
1470 EL_SOKOBAN_FELD_VOLL,
1480 static int ep_pushable_num = sizeof(ep_pushable)/sizeof(int);
1482 static int ep_player[] =
1490 static int ep_player_num = sizeof(ep_player)/sizeof(int);
1492 static int ep_has_content[] =
1500 static int ep_has_content_num = sizeof(ep_has_content)/sizeof(int);
1502 static int ep_eatable[] =
1510 static int ep_eatable_num = sizeof(ep_eatable)/sizeof(int);
1512 static int ep_sp_element[] =
1554 /* additional elements that appeared in newer Supaplex levels */
1556 /* more than one murphy in a level results in an inactive clone */
1559 static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
1561 static int ep_quick_gate[] =
1585 static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
1587 static int ep_over_player[] =
1612 static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
1614 static int ep_active_bomb[] =
1617 EL_DYNABOMB_ACTIVE_1,
1618 EL_DYNABOMB_ACTIVE_2,
1619 EL_DYNABOMB_ACTIVE_3,
1620 EL_DYNABOMB_ACTIVE_4
1622 static int ep_active_bomb_num = sizeof(ep_active_bomb)/sizeof(int);
1624 static int ep_belt[] =
1639 static int ep_belt_num = sizeof(ep_belt)/sizeof(int);
1641 static int ep_belt_switch[] =
1643 EL_BELT1_SWITCH_LEFT,
1644 EL_BELT1_SWITCH_MIDDLE,
1645 EL_BELT1_SWITCH_RIGHT,
1646 EL_BELT2_SWITCH_LEFT,
1647 EL_BELT2_SWITCH_MIDDLE,
1648 EL_BELT2_SWITCH_RIGHT,
1649 EL_BELT3_SWITCH_LEFT,
1650 EL_BELT3_SWITCH_MIDDLE,
1651 EL_BELT3_SWITCH_RIGHT,
1652 EL_BELT4_SWITCH_LEFT,
1653 EL_BELT4_SWITCH_MIDDLE,
1654 EL_BELT4_SWITCH_RIGHT,
1656 static int ep_belt_switch_num = sizeof(ep_belt_switch)/sizeof(int);
1658 static int ep_tube[] =
1672 static int ep_tube_num = sizeof(ep_tube)/sizeof(int);
1674 static long ep1_bit[] =
1708 static long ep2_bit[] =
1714 static int *ep1_array[] =
1748 static int *ep2_array[] =
1754 static int *ep1_num[] =
1781 &ep_has_content_num,
1785 &ep_over_player_num,
1788 static int *ep2_num[] =
1791 &ep_belt_switch_num,
1794 static int num_properties1 = sizeof(ep1_num)/sizeof(int *);
1795 static int num_properties2 = sizeof(ep2_num)/sizeof(int *);
1797 for(i=0; i<MAX_ELEMENTS; i++)
1799 Elementeigenschaften1[i] = 0;
1800 Elementeigenschaften2[i] = 0;
1803 for(i=0; i<num_properties1; i++)
1804 for(j=0; j<*(ep1_num[i]); j++)
1805 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1806 for(i=0; i<num_properties2; i++)
1807 for(j=0; j<*(ep2_num[i]); j++)
1808 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1810 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1811 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1814 void CloseAllAndExit(int exit_value)
1818 #if defined(TARGET_SDL)
1820 FreeSounds(NUM_SOUNDS);
1822 if (audio.soundserver_pid)
1825 kill(audio.soundserver_pid, SIGTERM);
1826 FreeSounds(NUM_SOUNDS);
1830 for(i=0; i<NUM_BITMAPS; i++)
1833 #if defined(TARGET_SDL)
1834 KeyboardAutoRepeatOn();
1839 XFreeGC(display, gc);
1844 KeyboardAutoRepeatOn();
1845 XCloseDisplay(display);
1849 #if !defined(PLATFORM_UNIX)