1 /***********************************************************
2 * Rocks'n'Diamonds -- McDuffin Strikes Back! *
3 *----------------------------------------------------------*
4 * (c) 1995-2002 Artsoft Entertainment *
6 * Detmolder Strasse 189 *
9 * e-mail: info@artsoft.org *
10 *----------------------------------------------------------*
12 ***********************************************************/
14 #include "libgame/libgame.h"
29 static char *image_filename[NUM_PICTURES] =
43 static void InitSetup(void);
44 static void InitPlayerInfo(void);
45 static void InitLevelInfo(void);
46 static void InitArtworkInfo(void);
47 static void InitLevelArtworkInfo(void);
48 static void InitNetworkServer(void);
49 static void InitMixer(void);
50 static void InitSound(void);
51 static void InitGfx(void);
52 static void InitGfxBackground(void);
53 static void InitGadgets(void);
54 static void InitElementProperties(void);
55 static void Execute_Debug_Command(char *);
59 if (options.debug_command)
61 Execute_Debug_Command(options.debug_command);
66 if (options.serveronly)
68 #if defined(PLATFORM_UNIX)
69 NetworkServer(options.server_port, options.serveronly);
71 Error(ERR_WARN, "networking only supported in Unix version");
73 exit(0); /* never reached */
76 InitProgramInfo(UNIX_USERDATA_DIRECTORY,
77 PROGRAM_TITLE_STRING, getWindowTitleString(),
78 ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
79 MSDOS_POINTER_FILENAME,
80 COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
84 InitArtworkInfo(); /* needed before loading gfx, sound & music */
89 InitRND(NEW_RANDOMIZE);
92 InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
95 InitEventFilter(FilterMouseMotionEvents);
98 InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
101 InitLevelArtworkInfo();
102 InitGadgets(); /* needs to know number of level series */
103 InitSound(); /* needs to know current level directory */
115 LoadSetup(); /* global setup info */
118 void InitPlayerInfo()
122 /* choose default local player */
123 local_player = &stored_player[0];
125 for (i=0; i<MAX_PLAYERS; i++)
126 stored_player[i].connected = FALSE;
128 local_player->connected = TRUE;
133 LoadLevelInfo(); /* global level info */
134 LoadLevelSetup_LastSeries(); /* last played series info */
135 LoadLevelSetup_SeriesInfo(); /* last played level info */
138 void InitArtworkInfo()
143 void InitLevelArtworkInfo()
145 LoadLevelArtworkInfo();
148 void InitNetworkServer()
150 #if defined(PLATFORM_UNIX)
154 if (!options.network)
157 #if defined(PLATFORM_UNIX)
158 nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
160 if (!ConnectToServer(options.server_host, options.server_port))
161 Error(ERR_EXIT, "cannot connect to network game server");
163 SendToServer_PlayerName(setup.player_name);
164 SendToServer_ProtocolVersion();
167 SendToServer_NrWanted(nr_wanted);
171 static void InitMixer()
174 InitSoundList(sound_effects, NUM_SOUND_EFFECTS);
179 static void InitSound()
181 /* load custom sounds and music */
182 InitReloadSounds(artwork.snd_current->identifier);
183 InitReloadMusic(artwork.mus_current->identifier);
185 /* initialize sound effect lookup table for element actions */
189 static void InitTileClipmasks()
191 #if defined(TARGET_X11)
192 XGCValues clip_gc_values;
193 unsigned long clip_gc_valuemask;
195 #if defined(TARGET_X11_NATIVE)
203 tile_needs_clipping[] =
205 { GFX_SPIELER1_UP, 4 },
206 { GFX_SPIELER1_DOWN, 4 },
207 { GFX_SPIELER1_LEFT, 4 },
208 { GFX_SPIELER1_RIGHT, 4 },
209 { GFX_SPIELER1_PUSH_LEFT, 4 },
210 { GFX_SPIELER1_PUSH_RIGHT, 4 },
211 { GFX_SPIELER2_UP, 4 },
212 { GFX_SPIELER2_DOWN, 4 },
213 { GFX_SPIELER2_LEFT, 4 },
214 { GFX_SPIELER2_RIGHT, 4 },
215 { GFX_SPIELER2_PUSH_LEFT, 4 },
216 { GFX_SPIELER2_PUSH_RIGHT, 4 },
217 { GFX_SPIELER3_UP, 4 },
218 { GFX_SPIELER3_DOWN, 4 },
219 { GFX_SPIELER3_LEFT, 4 },
220 { GFX_SPIELER3_RIGHT, 4 },
221 { GFX_SPIELER3_PUSH_LEFT, 4 },
222 { GFX_SPIELER3_PUSH_RIGHT, 4 },
223 { GFX_SPIELER4_UP, 4 },
224 { GFX_SPIELER4_DOWN, 4 },
225 { GFX_SPIELER4_LEFT, 4 },
226 { GFX_SPIELER4_RIGHT, 4 },
227 { GFX_SPIELER4_PUSH_LEFT, 4 },
228 { GFX_SPIELER4_PUSH_RIGHT, 4 },
229 { GFX_SP_MURPHY, 1 },
230 { GFX_MURPHY_GO_LEFT, 3 },
231 { GFX_MURPHY_GO_RIGHT, 3 },
232 { GFX_MURPHY_SNAP_UP, 1 },
233 { GFX_MURPHY_SNAP_DOWN, 1 },
234 { GFX_MURPHY_SNAP_RIGHT, 1 },
235 { GFX_MURPHY_SNAP_LEFT, 1 },
236 { GFX_MURPHY_PUSH_RIGHT, 1 },
237 { GFX_MURPHY_PUSH_LEFT, 1 },
238 { GFX_GEBLUBBER, 4 },
241 { GFX_EXPLOSION, 8 },
242 { GFX_SOKOBAN_OBJEKT, 1 },
243 { GFX_FUNKELN_BLAU, 3 },
244 { GFX_FUNKELN_WEISS, 3 },
245 { GFX2_SHIELD_PASSIVE, 3 },
246 { GFX2_SHIELD_ACTIVE, 3 },
249 #endif /* TARGET_X11_NATIVE */
250 #endif /* TARGET_X11 */
254 /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */
255 for(i=0; i<NUM_TILES; i++)
256 tile_clipmask[i] = None;
258 #if defined(TARGET_X11)
259 /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is
260 often very slow when preparing a masked XCopyArea() for big Pixmaps.
261 To prevent this, create small (tile-sized) mask Pixmaps which will then
262 be set much faster with XSetClipOrigin() and speed things up a lot. */
264 clip_gc_values.graphics_exposures = False;
265 clip_gc_valuemask = GCGraphicsExposures;
267 XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
269 for(i=0; i<NUM_BITMAPS; i++)
271 if (pix[i]->clip_mask)
273 clip_gc_values.graphics_exposures = False;
274 clip_gc_values.clip_mask = pix[i]->clip_mask;
275 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
276 pix[i]->stored_clip_gc = XCreateGC(display, window->drawable,
277 clip_gc_valuemask, &clip_gc_values);
281 #if defined(TARGET_X11_NATIVE)
283 /* create graphic context structures needed for clipping */
284 clip_gc_values.graphics_exposures = False;
285 clip_gc_valuemask = GCGraphicsExposures;
287 XCreateGC(display, pix[PIX_BACK]->clip_mask,
288 clip_gc_valuemask, &clip_gc_values);
290 /* create only those clipping Pixmaps we really need */
291 for(i=0; tile_needs_clipping[i].start>=0; i++)
295 for(j=0; j<tile_needs_clipping[i].count; j++)
297 int tile = tile_needs_clipping[i].start + j;
303 getGraphicSource(graphic, &pixmap_nr, &src_x, &src_y);
304 src_pixmap = pix[pixmap_nr]->clip_mask;
306 tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
309 XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc,
310 src_x, src_y, TILEX, TILEY, 0, 0);
314 XFreeGC(display, copy_clipmask_gc);
316 #endif /* TARGET_X11_NATIVE */
317 #endif /* TARGET_X11 */
320 void FreeTileClipmasks()
322 #if defined(TARGET_X11)
325 for(i=0; i<NUM_TILES; i++)
327 if (tile_clipmask[i] != None)
329 XFreePixmap(display, tile_clipmask[i]);
330 tile_clipmask[i] = None;
335 XFreeGC(display, tile_clip_gc);
338 for(i=0; i<NUM_BITMAPS; i++)
340 if (pix[i] != NULL && pix[i]->stored_clip_gc)
342 XFreeGC(display, pix[i]->stored_clip_gc);
343 pix[i]->stored_clip_gc = None;
346 #endif /* TARGET_X11 */
353 /* initialize some global variables */
354 global.frames_per_second = 0;
355 global.fps_slowdown = FALSE;
356 global.fps_slowdown_factor = 1;
358 /* initialize screen properties */
359 InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
360 REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
361 InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
362 InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
363 InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
365 /* create additional image buffers for double-buffering */
366 pix[PIX_DB_DOOR] = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
367 pix[PIX_DB_FIELD] = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
369 pix[PIX_SMALLFONT] = LoadCustomImage(image_filename[PIX_SMALLFONT]);
371 InitFontInfo(NULL, NULL, pix[PIX_SMALLFONT]);
373 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
374 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
376 DrawInitText("Loading graphics:", 120, FC_GREEN);
378 for(i=0; i<NUM_PICTURES; i++)
380 if (i != PIX_SMALLFONT)
382 DrawInitText(image_filename[i], 150, FC_YELLOW);
384 pix[i] = LoadCustomImage(image_filename[i]);
388 InitFontInfo(pix[PIX_BIGFONT], pix[PIX_MEDIUMFONT], pix[PIX_SMALLFONT]);
393 void InitGfxBackground()
398 fieldbuffer = pix[PIX_DB_FIELD];
399 SetDrawtoField(DRAW_BACKBUFFER);
401 BlitBitmap(pix[PIX_BACK], backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
402 ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
403 ClearRectangle(pix[PIX_DB_DOOR], 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
405 for(x=0; x<MAX_BUF_XSIZE; x++)
406 for(y=0; y<MAX_BUF_YSIZE; y++)
409 redraw_mask = REDRAW_ALL;
412 void ReloadCustomArtwork()
414 static char *leveldir_current_identifier = NULL;
415 static boolean last_override_level_graphics = FALSE;
416 static boolean last_override_level_sounds = FALSE;
417 static boolean last_override_level_music = FALSE;
419 /* identifier for new artwork; default: artwork configured in setup */
420 char *gfx_new_identifier = artwork.gfx_current->identifier;
421 char *snd_new_identifier = artwork.snd_current->identifier;
422 char *mus_new_identifier = artwork.mus_current->identifier;
425 printf("graphics --> '%s' ('%s')\n",
426 artwork.gfx_current_identifier, artwork.gfx_current->filename);
427 printf("sounds --> '%s' ('%s')\n",
428 artwork.snd_current_identifier, artwork.snd_current->filename);
429 printf("music --> '%s' ('%s')\n",
430 artwork.mus_current_identifier, artwork.mus_current->filename);
433 /* leveldir_current may be invalid (level group, parent link) */
434 if (!validLevelSeries(leveldir_current))
438 printf("--> '%s'\n", artwork.gfx_current_identifier);
441 /* when a new level series was selected, check if there was a change
442 in custom artwork stored in level series directory */
443 if (leveldir_current_identifier != leveldir_current->identifier)
445 char *identifier_old = leveldir_current_identifier;
446 char *identifier_new = leveldir_current->identifier;
448 if (getTreeInfoFromIdentifier(artwork.gfx_first, identifier_old) !=
449 getTreeInfoFromIdentifier(artwork.gfx_first, identifier_new))
450 gfx_new_identifier = identifier_new;
451 if (getTreeInfoFromIdentifier(artwork.snd_first, identifier_old) !=
452 getTreeInfoFromIdentifier(artwork.snd_first, identifier_new))
453 snd_new_identifier = identifier_new;
454 if (getTreeInfoFromIdentifier(artwork.mus_first, identifier_new) !=
455 getTreeInfoFromIdentifier(artwork.mus_first, identifier_new))
456 mus_new_identifier = identifier_new;
458 leveldir_current_identifier = leveldir_current->identifier;
461 /* custom level artwork configured in level series configuration file
462 always overrides custom level artwork stored in level series directory
463 and (level independant) custom artwork configured in setup menue */
464 if (leveldir_current->graphics_set != NULL)
465 gfx_new_identifier = leveldir_current->graphics_set;
466 if (leveldir_current->sounds_set != NULL)
467 snd_new_identifier = leveldir_current->sounds_set;
468 if (leveldir_current->music_set != NULL)
469 mus_new_identifier = leveldir_current->music_set;
471 if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 ||
472 last_override_level_graphics != setup.override_level_graphics)
476 setLevelArtworkDir(artwork.gfx_first);
478 ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
480 for(i=0; i<NUM_PICTURES; i++)
482 DrawInitText(image_filename[i], 150, FC_YELLOW);
483 ReloadCustomImage(pix[i], image_filename[i]);
490 /* force redraw of (open or closed) door graphics */
491 SetDoorState(DOOR_OPEN_ALL);
492 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
494 artwork.gfx_current_identifier = gfx_new_identifier;
495 last_override_level_graphics = setup.override_level_graphics;
498 if (strcmp(artwork.snd_current_identifier, snd_new_identifier) != 0 ||
499 last_override_level_sounds != setup.override_level_sounds)
501 /* set artwork path to send it to the sound server process */
502 setLevelArtworkDir(artwork.snd_first);
504 InitReloadSounds(snd_new_identifier);
506 artwork.snd_current_identifier = snd_new_identifier;
507 last_override_level_sounds = setup.override_level_sounds;
510 if (strcmp(artwork.mus_current_identifier, mus_new_identifier) != 0 ||
511 last_override_level_music != setup.override_level_music)
513 /* set artwork path to send it to the sound server process */
514 setLevelArtworkDir(artwork.mus_first);
516 InitReloadMusic(mus_new_identifier);
518 artwork.mus_current_identifier = mus_new_identifier;
519 last_override_level_music = setup.override_level_music;
523 printf("<-- '%s'\n", artwork.gfx_current_identifier);
529 CreateLevelEditorGadgets();
533 CreateScreenGadgets();
536 void InitElementProperties()
540 static int ep_amoebalive[] =
547 static int ep_amoebalive_num = SIZEOF_ARRAY_INT(ep_amoebalive);
549 static int ep_amoeboid[] =
557 static int ep_amoeboid_num = SIZEOF_ARRAY_INT(ep_amoeboid);
559 static int ep_schluessel[] =
570 static int ep_schluessel_num = SIZEOF_ARRAY_INT(ep_schluessel);
572 static int ep_pforte[] =
591 EL_SWITCHGATE_OPENING,
592 EL_SWITCHGATE_CLOSED,
593 EL_SWITCHGATE_CLOSING,
610 static int ep_pforte_num = SIZEOF_ARRAY_INT(ep_pforte);
612 static int ep_solid[] =
632 EL_QUICKSAND_FILLING,
633 EL_QUICKSAND_EMPTYING,
636 EL_MAGIC_WALL_EMPTYING,
637 EL_MAGIC_WALL_FILLING,
640 EL_MAGIC_WALL_BD_OFF,
641 EL_MAGIC_WALL_BD_EMPTY,
642 EL_MAGIC_WALL_BD_EMPTYING,
643 EL_MAGIC_WALL_BD_FULL,
644 EL_MAGIC_WALL_BD_FILLING,
645 EL_MAGIC_WALL_BD_DEAD,
670 EL_SP_TERMINAL_ACTIVE,
673 EL_BELT1_SWITCH_LEFT,
674 EL_BELT1_SWITCH_MIDDLE,
675 EL_BELT1_SWITCH_RIGHT,
676 EL_BELT2_SWITCH_LEFT,
677 EL_BELT2_SWITCH_MIDDLE,
678 EL_BELT2_SWITCH_RIGHT,
679 EL_BELT3_SWITCH_LEFT,
680 EL_BELT3_SWITCH_MIDDLE,
681 EL_BELT3_SWITCH_RIGHT,
682 EL_BELT4_SWITCH_LEFT,
683 EL_BELT4_SWITCH_MIDDLE,
684 EL_BELT4_SWITCH_RIGHT,
685 EL_SWITCHGATE_SWITCH_1,
686 EL_SWITCHGATE_SWITCH_2,
689 EL_TIMEGATE_SWITCH_OFF,
690 EL_TIMEGATE_SWITCH_ON,
692 EL_SIGN_RADIOACTIVITY,
736 EL_SWITCHGATE_OPENING,
737 EL_SWITCHGATE_CLOSED,
738 EL_SWITCHGATE_CLOSING,
755 static int ep_solid_num = SIZEOF_ARRAY_INT(ep_solid);
757 static int ep_massive[] =
778 EL_BELT1_SWITCH_LEFT,
779 EL_BELT1_SWITCH_MIDDLE,
780 EL_BELT1_SWITCH_RIGHT,
781 EL_BELT2_SWITCH_LEFT,
782 EL_BELT2_SWITCH_MIDDLE,
783 EL_BELT2_SWITCH_RIGHT,
784 EL_BELT3_SWITCH_LEFT,
785 EL_BELT3_SWITCH_MIDDLE,
786 EL_BELT3_SWITCH_RIGHT,
787 EL_BELT4_SWITCH_LEFT,
788 EL_BELT4_SWITCH_MIDDLE,
789 EL_BELT4_SWITCH_RIGHT,
793 EL_SIGN_RADIOACTIVITY,
827 EL_SWITCHGATE_OPENING,
828 EL_SWITCHGATE_CLOSED,
829 EL_SWITCHGATE_CLOSING,
846 static int ep_massive_num = SIZEOF_ARRAY_INT(ep_massive);
848 static int ep_slippery[] =
883 static int ep_slippery_num = SIZEOF_ARRAY_INT(ep_slippery);
885 static int ep_enemy[] =
898 static int ep_enemy_num = SIZEOF_ARRAY_INT(ep_enemy);
900 static int ep_mauer[] =
947 EL_SP_TERMINAL_ACTIVE,
964 static int ep_mauer_num = SIZEOF_ARRAY_INT(ep_mauer);
966 static int ep_can_fall[] =
981 EL_MAGIC_WALL_BD_FULL,
992 static int ep_can_fall_num = SIZEOF_ARRAY_INT(ep_can_fall);
994 static int ep_can_smash[] =
1025 static int ep_can_smash_num = SIZEOF_ARRAY_INT(ep_can_smash);
1027 static int ep_can_change[] =
1038 static int ep_can_change_num = SIZEOF_ARRAY_INT(ep_can_change);
1040 static int ep_can_move[] =
1060 static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move);
1062 static int ep_could_move[] =
1085 static int ep_could_move_num = SIZEOF_ARRAY_INT(ep_could_move);
1087 static int ep_dont_touch[] =
1094 static int ep_dont_touch_num = SIZEOF_ARRAY_INT(ep_dont_touch);
1096 static int ep_dont_go_to[] =
1114 static int ep_dont_go_to_num = SIZEOF_ARRAY_INT(ep_dont_go_to);
1116 static int ep_mampf2[] =
1141 static int ep_mampf2_num = SIZEOF_ARRAY_INT(ep_mampf2);
1143 static int ep_bd_element[] =
1152 EL_MAGIC_WALL_BD_OFF,
1170 static int ep_bd_element_num = SIZEOF_ARRAY_INT(ep_bd_element);
1172 static int ep_sb_element[] =
1177 EL_SOKOBAN_FELD_LEER,
1178 EL_SOKOBAN_FELD_VOLL,
1182 static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element);
1184 static int ep_gem[] =
1193 static int ep_gem_num = SIZEOF_ARRAY_INT(ep_gem);
1195 static int ep_inactive[] =
1232 EL_DYNAMITE_INACTIVE,
1244 EL_SOKOBAN_FELD_LEER,
1245 EL_SOKOBAN_FELD_VOLL,
1255 EL_MAGIC_WALL_BD_OFF,
1256 EL_MAGIC_WALL_BD_DEAD,
1292 EL_BELT1_SWITCH_LEFT,
1293 EL_BELT1_SWITCH_MIDDLE,
1294 EL_BELT1_SWITCH_RIGHT,
1295 EL_BELT2_SWITCH_LEFT,
1296 EL_BELT2_SWITCH_MIDDLE,
1297 EL_BELT2_SWITCH_RIGHT,
1298 EL_BELT3_SWITCH_LEFT,
1299 EL_BELT3_SWITCH_MIDDLE,
1300 EL_BELT3_SWITCH_RIGHT,
1301 EL_BELT4_SWITCH_LEFT,
1302 EL_BELT4_SWITCH_MIDDLE,
1303 EL_BELT4_SWITCH_RIGHT,
1304 EL_SIGN_EXCLAMATION,
1305 EL_SIGN_RADIOACTIVITY,
1317 EL_EMC_STEEL_WALL_1,
1318 EL_EMC_STEEL_WALL_2,
1319 EL_EMC_STEEL_WALL_3,
1320 EL_EMC_STEEL_WALL_4,
1330 static int ep_inactive_num = SIZEOF_ARRAY_INT(ep_inactive);
1332 static int ep_explosive[] =
1336 EL_DYNAMITE_INACTIVE,
1337 EL_DYNABOMB_ACTIVE_1,
1338 EL_DYNABOMB_ACTIVE_2,
1339 EL_DYNABOMB_ACTIVE_3,
1340 EL_DYNABOMB_ACTIVE_4,
1357 static int ep_explosive_num = SIZEOF_ARRAY_INT(ep_explosive);
1359 static int ep_mampf3[] =
1370 static int ep_mampf3_num = SIZEOF_ARRAY_INT(ep_mampf3);
1372 static int ep_pushable[] =
1379 EL_SOKOBAN_FELD_VOLL,
1389 static int ep_pushable_num = SIZEOF_ARRAY_INT(ep_pushable);
1391 static int ep_player[] =
1399 static int ep_player_num = SIZEOF_ARRAY_INT(ep_player);
1401 static int ep_has_content[] =
1409 static int ep_has_content_num = SIZEOF_ARRAY_INT(ep_has_content);
1411 static int ep_eatable[] =
1419 static int ep_eatable_num = SIZEOF_ARRAY_INT(ep_eatable);
1421 static int ep_sp_element[] =
1463 /* additional elements that appeared in newer Supaplex levels */
1465 /* more than one murphy in a level results in an inactive clone */
1468 static int ep_sp_element_num = SIZEOF_ARRAY_INT(ep_sp_element);
1470 static int ep_quick_gate[] =
1494 static int ep_quick_gate_num = SIZEOF_ARRAY_INT(ep_quick_gate);
1496 static int ep_over_player[] =
1521 static int ep_over_player_num = SIZEOF_ARRAY_INT(ep_over_player);
1523 static int ep_active_bomb[] =
1526 EL_DYNABOMB_ACTIVE_1,
1527 EL_DYNABOMB_ACTIVE_2,
1528 EL_DYNABOMB_ACTIVE_3,
1529 EL_DYNABOMB_ACTIVE_4
1531 static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb);
1533 static int ep_belt[] =
1548 static int ep_belt_num = SIZEOF_ARRAY_INT(ep_belt);
1550 static int ep_belt_switch[] =
1552 EL_BELT1_SWITCH_LEFT,
1553 EL_BELT1_SWITCH_MIDDLE,
1554 EL_BELT1_SWITCH_RIGHT,
1555 EL_BELT2_SWITCH_LEFT,
1556 EL_BELT2_SWITCH_MIDDLE,
1557 EL_BELT2_SWITCH_RIGHT,
1558 EL_BELT3_SWITCH_LEFT,
1559 EL_BELT3_SWITCH_MIDDLE,
1560 EL_BELT3_SWITCH_RIGHT,
1561 EL_BELT4_SWITCH_LEFT,
1562 EL_BELT4_SWITCH_MIDDLE,
1563 EL_BELT4_SWITCH_RIGHT,
1565 static int ep_belt_switch_num = SIZEOF_ARRAY_INT(ep_belt_switch);
1567 static int ep_tube[] =
1581 static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
1583 static long ep1_bit[] =
1617 static long ep2_bit[] =
1623 static int *ep1_array[] =
1657 static int *ep2_array[] =
1663 static int *ep1_num[] =
1690 &ep_has_content_num,
1694 &ep_over_player_num,
1697 static int *ep2_num[] =
1700 &ep_belt_switch_num,
1703 static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
1704 static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
1706 for(i=0; i<MAX_ELEMENTS; i++)
1708 Elementeigenschaften1[i] = 0;
1709 Elementeigenschaften2[i] = 0;
1712 for(i=0; i<num_properties1; i++)
1713 for(j=0; j<*(ep1_num[i]); j++)
1714 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
1715 for(i=0; i<num_properties2; i++)
1716 for(j=0; j<*(ep2_num[i]); j++)
1717 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
1719 for(i=EL_CHAR_START; i<=EL_CHAR_END; i++)
1720 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
1723 void Execute_Debug_Command(char *command)
1725 if (strcmp(command, "create graphicsinfo.conf") == 0)
1727 printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n");
1729 printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics"));
1731 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
1733 else if (strcmp(command, "create soundsinfo.conf") == 0)
1737 printf("# You can configure additional/alternative sound effects here\n");
1738 printf("# (The sounds below are default and therefore commented out.)\n");
1740 printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
1742 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
1745 for (i=0; i<NUM_SOUND_EFFECTS; i++)
1747 getFormattedSetupEntry(sound_effects[i].text,
1748 sound_effects[i].default_filename));
1750 else if (strcmp(command, "create musicinfo.conf") == 0)
1752 printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n");
1754 printf("%s\n", getFormattedSetupEntry("name", "Classic Music"));
1756 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
1760 void CloseAllAndExit(int exit_value)
1767 CloseAudio(); /* called after freeing sounds (needed for SDL) */
1769 FreeTileClipmasks();
1770 for(i=0; i<NUM_BITMAPS; i++)
1773 CloseVideoDisplay();
1774 ClosePlatformDependantStuff();