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 #include "conf_e2g.c" /* include auto-generated data structure definitions */
32 static char *image_filename[NUM_PICTURES] =
40 "RocksFontMedium.pcx",
53 "RocksFontMedium.pcx",
58 static Bitmap *bitmap_font_initial = NULL;
60 static void InitGlobal(void);
61 static void InitSetup(void);
62 static void InitPlayerInfo(void);
63 static void InitLevelInfo(void);
64 static void InitArtworkInfo(void);
65 static void InitLevelArtworkInfo(void);
66 static void InitNetworkServer(void);
67 static void InitImages(void);
68 static void InitMixer(void);
69 static void InitSound(void);
70 static void InitGfx(void);
71 static void InitGfxBackground(void);
72 static void InitGadgets(void);
73 static void InitElementProperties(void);
74 static void InitElementInfo(void);
75 static void InitGraphicInfo(void);
76 static void InitSoundInfo();
77 static void Execute_Command(char *);
81 InitGlobal(); /* initialize some global variables */
83 if (options.execute_command)
84 Execute_Command(options.execute_command);
86 if (options.serveronly)
88 #if defined(PLATFORM_UNIX)
89 NetworkServer(options.server_port, options.serveronly);
91 Error(ERR_WARN, "networking only supported in Unix version");
93 exit(0); /* never reached */
96 InitProgramInfo(UNIX_USERDATA_DIRECTORY,
97 PROGRAM_TITLE_STRING, getWindowTitleString(),
98 ICON_TITLE_STRING, X11_ICON_FILENAME, X11_ICONMASK_FILENAME,
99 MSDOS_POINTER_FILENAME,
100 COOKIE_PREFIX, FILENAME_PREFIX, GAME_VERSION_ACTUAL);
104 InitArtworkInfo(); /* needed before loading gfx, sound & music */
109 InitRND(NEW_RANDOMIZE);
112 InitVideoBuffer(&backbuffer, &window, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH,
115 InitEventFilter(FilterMouseMotionEvents);
117 InitElementProperties(); /* initializes IS_CHAR() for el2gfx() */
123 InitLevelArtworkInfo();
125 InitImages(); /* needs to know current level directory */
126 InitSound(); /* needs to know current level directory */
128 InitGadgets(); /* needs images + number of level series */
133 if (global.autoplay_leveldir)
146 global.autoplay_leveldir = NULL;
148 global.frames_per_second = 0;
149 global.fps_slowdown = FALSE;
150 global.fps_slowdown_factor = 1;
155 LoadSetup(); /* global setup info */
158 void InitPlayerInfo()
162 /* choose default local player */
163 local_player = &stored_player[0];
165 for (i=0; i<MAX_PLAYERS; i++)
166 stored_player[i].connected = FALSE;
168 local_player->connected = TRUE;
173 LoadLevelInfo(); /* global level info */
174 LoadLevelSetup_LastSeries(); /* last played series info */
175 LoadLevelSetup_SeriesInfo(); /* last played level info */
178 void InitArtworkInfo()
183 void InitLevelArtworkInfo()
185 LoadLevelArtworkInfo();
188 void InitNetworkServer()
190 #if defined(PLATFORM_UNIX)
194 if (!options.network)
197 #if defined(PLATFORM_UNIX)
198 nr_wanted = Request("Choose player", REQ_PLAYER | REQ_STAY_CLOSED);
200 if (!ConnectToServer(options.server_host, options.server_port))
201 Error(ERR_EXIT, "cannot connect to network game server");
203 SendToServer_PlayerName(setup.player_name);
204 SendToServer_ProtocolVersion();
207 SendToServer_NrWanted(nr_wanted);
211 static void ReinitializeGraphics()
213 ReloadCustomImages(); /* load custom image files */
215 InitGraphicInfo(); /* initialize graphic info from config file */
217 InitFontInfo(bitmap_font_initial,
218 new_graphic_info[IMG_FONT_BIG].bitmap,
219 new_graphic_info[IMG_FONT_MEDIUM].bitmap,
220 new_graphic_info[IMG_FONT_SMALL].bitmap,
221 new_graphic_info[IMG_FONT_EM].bitmap);
223 SetMainBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
224 SetDoorBackgroundBitmap(new_graphic_info[IMG_BACKGROUND_DOOR].bitmap ?
225 new_graphic_info[IMG_BACKGROUND_DOOR].bitmap :
226 new_graphic_info[IMG_BACKGROUND_DEFAULT].bitmap);
232 static void InitImages()
234 InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
236 ReinitializeGraphics();
239 static void InitMixer()
243 InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES);
248 static void InitSound()
250 /* load custom sounds and music */
251 InitReloadSounds(artwork.snd_current->identifier);
252 InitReloadMusic(artwork.mus_current->identifier);
257 static void InitTileClipmasks()
259 #if defined(TARGET_X11)
260 XGCValues clip_gc_values;
261 unsigned long clip_gc_valuemask;
263 #if defined(TARGET_X11_NATIVE)
273 tile_needs_clipping[] =
275 { GFX_SPIELER1_UP, 4 },
276 { GFX_SPIELER1_DOWN, 4 },
277 { GFX_SPIELER1_LEFT, 4 },
278 { GFX_SPIELER1_RIGHT, 4 },
279 { GFX_SPIELER1_PUSH_LEFT, 4 },
280 { GFX_SPIELER1_PUSH_RIGHT, 4 },
281 { GFX_SPIELER2_UP, 4 },
282 { GFX_SPIELER2_DOWN, 4 },
283 { GFX_SPIELER2_LEFT, 4 },
284 { GFX_SPIELER2_RIGHT, 4 },
285 { GFX_SPIELER2_PUSH_LEFT, 4 },
286 { GFX_SPIELER2_PUSH_RIGHT, 4 },
287 { GFX_SPIELER3_UP, 4 },
288 { GFX_SPIELER3_DOWN, 4 },
289 { GFX_SPIELER3_LEFT, 4 },
290 { GFX_SPIELER3_RIGHT, 4 },
291 { GFX_SPIELER3_PUSH_LEFT, 4 },
292 { GFX_SPIELER3_PUSH_RIGHT, 4 },
293 { GFX_SPIELER4_UP, 4 },
294 { GFX_SPIELER4_DOWN, 4 },
295 { GFX_SPIELER4_LEFT, 4 },
296 { GFX_SPIELER4_RIGHT, 4 },
297 { GFX_SPIELER4_PUSH_LEFT, 4 },
298 { GFX_SPIELER4_PUSH_RIGHT, 4 },
299 { GFX_SP_MURPHY, 1 },
300 { GFX_MURPHY_GO_LEFT, 3 },
301 { GFX_MURPHY_GO_RIGHT, 3 },
302 { GFX_MURPHY_SNAP_UP, 1 },
303 { GFX_MURPHY_SNAP_DOWN, 1 },
304 { GFX_MURPHY_SNAP_RIGHT, 1 },
305 { GFX_MURPHY_SNAP_LEFT, 1 },
306 { GFX_MURPHY_PUSH_RIGHT, 1 },
307 { GFX_MURPHY_PUSH_LEFT, 1 },
308 { GFX_GEBLUBBER, 4 },
311 { GFX_EXPLOSION, 8 },
312 { GFX_SOKOBAN_OBJEKT, 1 },
313 { GFX_FUNKELN_BLAU, 3 },
314 { GFX_FUNKELN_WEISS, 3 },
315 { GFX2_SHIELD_PASSIVE, 3 },
316 { GFX2_SHIELD_ACTIVE, 3 },
321 #endif /* TARGET_X11_NATIVE */
322 #endif /* TARGET_X11 */
326 /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */
327 for (i=0; i<NUM_TILES; i++)
328 tile_clipmask[i] = None;
330 #if defined(TARGET_X11)
331 /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is
332 often very slow when preparing a masked XCopyArea() for big Pixmaps.
333 To prevent this, create small (tile-sized) mask Pixmaps which will then
334 be set much faster with XSetClipOrigin() and speed things up a lot. */
336 clip_gc_values.graphics_exposures = False;
337 clip_gc_valuemask = GCGraphicsExposures;
338 tile_clip_gc = XCreateGC(display, window->drawable,
339 clip_gc_valuemask, &clip_gc_values);
342 for (i=0; i<NUM_BITMAPS; i++)
344 if (pix[i]->clip_mask)
346 clip_gc_values.graphics_exposures = False;
347 clip_gc_values.clip_mask = pix[i]->clip_mask;
348 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
349 pix[i]->stored_clip_gc = XCreateGC(display, window->drawable,
350 clip_gc_valuemask, &clip_gc_values);
355 #if defined(TARGET_X11_NATIVE)
358 /* create graphic context structures needed for clipping */
359 clip_gc_values.graphics_exposures = False;
360 clip_gc_valuemask = GCGraphicsExposures;
361 copy_clipmask_gc = XCreateGC(display, pix[PIX_BACK]->clip_mask,
362 clip_gc_valuemask, &clip_gc_values);
364 /* create only those clipping Pixmaps we really need */
365 for (i=0; tile_needs_clipping[i].start>=0; i++)
369 for (j=0; j<tile_needs_clipping[i].count; j++)
371 int tile = tile_needs_clipping[i].start + j;
377 getGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
378 src_pixmap = src_bitmap->clip_mask;
380 tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
383 XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc,
384 src_x, src_y, TILEX, TILEY, 0, 0);
388 XFreeGC(display, copy_clipmask_gc);
391 #endif /* TARGET_X11_NATIVE */
392 #endif /* TARGET_X11 */
395 void FreeTileClipmasks()
397 #if defined(TARGET_X11)
400 for (i=0; i<NUM_TILES; i++)
402 if (tile_clipmask[i] != None)
404 XFreePixmap(display, tile_clipmask[i]);
405 tile_clipmask[i] = None;
410 XFreeGC(display, tile_clip_gc);
414 for (i=0; i<NUM_BITMAPS; i++)
416 if (pix[i] != NULL && pix[i]->stored_clip_gc)
418 XFreeGC(display, pix[i]->stored_clip_gc);
419 pix[i]->stored_clip_gc = None;
424 #endif /* TARGET_X11 */
433 /* initialize screen properties */
434 InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
435 REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
436 InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
437 InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
438 InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
440 /* create additional image buffers for double-buffering */
441 bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
442 bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
445 pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
447 InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL);
449 bitmap_font_initial = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
451 InitFontInfo(bitmap_font_initial, NULL, NULL, NULL, NULL);
454 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
455 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
457 DrawInitText("Loading graphics:", 120, FC_GREEN);
460 for (i=0; i<NUM_PICTURES; i++)
463 if (i != PIX_FONT_SMALL)
466 DrawInitText(image_filename[i], 150, FC_YELLOW);
468 pix[i] = LoadCustomImage(image_filename[i]);
474 InitFontInfo(pix[PIX_FONT_BIG], pix[PIX_FONT_MEDIUM], pix[PIX_FONT_SMALL],
481 void InitGfxBackground()
486 fieldbuffer = bitmap_db_field;
487 SetDrawtoField(DRAW_BACKBUFFER);
489 BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
490 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
491 ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
492 ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
494 for (x=0; x<MAX_BUF_XSIZE; x++)
495 for (y=0; y<MAX_BUF_YSIZE; y++)
498 redraw_mask = REDRAW_ALL;
501 void ReloadCustomArtwork()
503 static char *leveldir_current_identifier = NULL;
504 static boolean last_override_level_graphics = FALSE;
505 static boolean last_override_level_sounds = FALSE;
506 static boolean last_override_level_music = FALSE;
507 /* identifier for new artwork; default: artwork configured in setup */
508 char *gfx_new_identifier = artwork.gfx_current->identifier;
509 char *snd_new_identifier = artwork.snd_current->identifier;
510 char *mus_new_identifier = artwork.mus_current->identifier;
511 boolean redraw_screen = FALSE;
513 if (leveldir_current_identifier == NULL)
514 leveldir_current_identifier = leveldir_current->identifier;
517 printf("CURRENT GFX: '%s' ['%s']\n", artwork.gfx_current->identifier,
518 leveldir_current->graphics_set);
519 printf("CURRENT LEV: '%s' / '%s'\n", leveldir_current_identifier,
520 leveldir_current->identifier);
524 printf("graphics --> '%s' ('%s')\n",
525 artwork.gfx_current_identifier, artwork.gfx_current->filename);
526 printf("sounds --> '%s' ('%s')\n",
527 artwork.snd_current_identifier, artwork.snd_current->filename);
528 printf("music --> '%s' ('%s')\n",
529 artwork.mus_current_identifier, artwork.mus_current->filename);
532 /* leveldir_current may be invalid (level group, parent link) */
533 if (!validLevelSeries(leveldir_current))
537 printf("--> '%s'\n", artwork.gfx_current_identifier);
540 /* when a new level series was selected, check if there was a change
541 in custom artwork stored in level series directory */
542 if (leveldir_current_identifier != leveldir_current->identifier)
544 char *identifier_old = leveldir_current_identifier;
545 char *identifier_new = leveldir_current->identifier;
547 if (getTreeInfoFromIdentifier(artwork.gfx_first, identifier_old) !=
548 getTreeInfoFromIdentifier(artwork.gfx_first, identifier_new))
549 gfx_new_identifier = identifier_new;
550 if (getTreeInfoFromIdentifier(artwork.snd_first, identifier_old) !=
551 getTreeInfoFromIdentifier(artwork.snd_first, identifier_new))
552 snd_new_identifier = identifier_new;
553 if (getTreeInfoFromIdentifier(artwork.mus_first, identifier_new) !=
554 getTreeInfoFromIdentifier(artwork.mus_first, identifier_new))
555 mus_new_identifier = identifier_new;
557 leveldir_current_identifier = leveldir_current->identifier;
560 /* custom level artwork configured in level series configuration file
561 always overrides custom level artwork stored in level series directory
562 and (level independant) custom artwork configured in setup menue */
563 if (leveldir_current->graphics_set != NULL)
564 gfx_new_identifier = leveldir_current->graphics_set;
565 if (leveldir_current->sounds_set != NULL)
566 snd_new_identifier = leveldir_current->sounds_set;
567 if (leveldir_current->music_set != NULL)
568 mus_new_identifier = leveldir_current->music_set;
570 if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 ||
571 last_override_level_graphics != setup.override_level_graphics)
574 printf("CHANGED GFX: '%s' -> '%s'\n",
575 artwork.gfx_current_identifier, gfx_new_identifier);
582 setLevelArtworkDir(artwork.gfx_first);
584 ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
587 for (i=0; i<NUM_PICTURES; i++)
589 DrawInitText(image_filename[i], 150, FC_YELLOW);
590 ReloadCustomImage(pix[i], image_filename[i]);
598 ReinitializeGraphics();
606 /* force redraw of (open or closed) door graphics */
607 SetDoorState(DOOR_OPEN_ALL);
608 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
612 artwork.gfx_current_identifier = gfx_new_identifier;
614 artwork.gfx_current_identifier = artwork.gfx_current->identifier;
616 last_override_level_graphics = setup.override_level_graphics;
618 redraw_screen = TRUE;
621 if (strcmp(artwork.snd_current_identifier, snd_new_identifier) != 0 ||
622 last_override_level_sounds != setup.override_level_sounds)
624 /* set artwork path to send it to the sound server process */
625 setLevelArtworkDir(artwork.snd_first);
627 InitReloadSounds(snd_new_identifier);
629 artwork.snd_current_identifier = snd_new_identifier;
630 last_override_level_sounds = setup.override_level_sounds;
632 redraw_screen = TRUE;
635 if (strcmp(artwork.mus_current_identifier, mus_new_identifier) != 0 ||
636 last_override_level_music != setup.override_level_music)
638 /* set artwork path to send it to the sound server process */
639 setLevelArtworkDir(artwork.mus_first);
641 InitReloadMusic(mus_new_identifier);
643 artwork.mus_current_identifier = mus_new_identifier;
644 last_override_level_music = setup.override_level_music;
646 redraw_screen = TRUE;
653 /* force redraw of (open or closed) door graphics */
654 SetDoorState(DOOR_OPEN_ALL);
655 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
659 printf("<-- '%s'\n", artwork.gfx_current_identifier);
665 FreeLevelEditorGadgets();
674 static boolean gadgets_initialized = FALSE;
676 if (gadgets_initialized)
679 CreateLevelEditorGadgets();
683 CreateScreenGadgets();
685 gadgets_initialized = TRUE;
688 void InitElementInfo()
693 /* set values to -1 to identify later as "uninitialized" values */
694 for (i=0; i<MAX_ELEMENTS; i++)
696 for (act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
698 element_info[i].graphic[act] = -1;
700 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
701 element_info[i].direction_graphic[act][dir] = -1;
705 for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
706 element_info[i].graphic[GFX_ACTION_DEFAULT] =
707 IMG_CHAR_START + (i - EL_CHAR_START);
709 for (i=EL_CUSTOM_START; i<=EL_CUSTOM_END; i++)
710 element_info[i].graphic[GFX_ACTION_DEFAULT] =
711 IMG_CUSTOM_START + (i - EL_CUSTOM_START);
714 while (element_to_graphic[i].element > -1)
716 int element = element_to_graphic[i].element;
717 int direction = element_to_graphic[i].direction;
718 int action = element_to_graphic[i].action;
719 int graphic = element_to_graphic[i].graphic;
722 action = graphics_action_mapping[action];
724 action = GFX_ACTION_DEFAULT;
728 direction = MV_DIR_BIT(direction);
730 element_info[element].direction_graphic[action][direction] = graphic;
733 element_info[element].graphic[action] = graphic;
738 /* now set all '-1' values to element specific default values */
739 for (i=0; i<MAX_ELEMENTS; i++)
741 int default_action_graphic = element_info[i].graphic[GFX_ACTION_DEFAULT];
742 int default_action_direction_graphic[NUM_MV_DIRECTIONS];
744 if (default_action_graphic == -1)
745 default_action_graphic = IMG_CHAR_QUESTION;
747 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
749 default_action_direction_graphic[dir] =
750 element_info[i].direction_graphic[GFX_ACTION_DEFAULT][dir];
752 if (default_action_direction_graphic[dir] == -1)
753 default_action_direction_graphic[dir] = default_action_graphic;
756 for (act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
758 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
760 int default_direction_graphic = element_info[i].graphic[act];
762 /* no graphic for current action -- use default direction graphic */
763 if (default_direction_graphic == -1)
764 default_direction_graphic = default_action_direction_graphic[dir];
766 if (element_info[i].direction_graphic[act][dir] == -1)
767 element_info[i].direction_graphic[act][dir] =
768 default_direction_graphic;
771 /* no graphic for this specific action -- use default action graphic */
772 if (element_info[i].graphic[act] == -1)
773 element_info[i].graphic[act] = default_action_graphic;
778 static void InitGraphicInfo()
780 static boolean clipmasks_initialized = FALSE;
781 static int gfx_action[NUM_IMAGE_FILES];
784 int first_frame, last_frame;
786 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
788 XGCValues clip_gc_values;
789 unsigned long clip_gc_valuemask;
790 GC copy_clipmask_gc = None;
793 image_files = getCurrentImageList();
795 /* set temporary graphics action field to default value */
796 for (i=0; i<NUM_IMAGE_FILES; i++)
797 gfx_action[i] = GFX_ACTION_DEFAULT;
799 /* set temporary graphics action field from element_to_graphic list */
801 while (element_to_graphic[i].element > -1)
803 int action = element_to_graphic[i].action;
804 int graphic = element_to_graphic[i].graphic;
807 action = GFX_ACTION_DEFAULT;
809 gfx_action[graphic] = action;
814 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
815 if (clipmasks_initialized)
817 for (i=0; i<NUM_IMAGE_FILES; i++)
819 if (new_graphic_info[i].clip_mask)
820 XFreePixmap(display, new_graphic_info[i].clip_mask);
821 if (new_graphic_info[i].clip_gc)
822 XFreeGC(display, new_graphic_info[i].clip_gc);
824 new_graphic_info[i].clip_mask = None;
825 new_graphic_info[i].clip_gc = None;
830 for (i=0; i<NUM_IMAGE_FILES; i++)
832 int *parameter = image_files[i].parameter;
834 new_graphic_info[i].bitmap = getBitmapFromImageID(i);
836 new_graphic_info[i].src_x = parameter[GFX_ARG_XPOS] * TILEX;
837 new_graphic_info[i].src_y = parameter[GFX_ARG_YPOS] * TILEY;
838 new_graphic_info[i].offset_x = parameter[GFX_ARG_OFFSET];
839 new_graphic_info[i].offset_y = 0;
841 /* animation frames are ordered vertically instead of horizontally */
842 if (parameter[GFX_ARG_VERTICAL])
844 new_graphic_info[i].offset_x = 0;
845 new_graphic_info[i].offset_y = parameter[GFX_ARG_OFFSET];
848 /* optionally, the x and y offset of frames can be specified directly */
849 if (parameter[GFX_ARG_XOFFSET] != GFX_ARG_UNDEFINED_VALUE)
850 new_graphic_info[i].offset_x = parameter[GFX_ARG_XOFFSET];
851 if (parameter[GFX_ARG_YOFFSET] != GFX_ARG_UNDEFINED_VALUE)
852 new_graphic_info[i].offset_y = parameter[GFX_ARG_YOFFSET];
854 new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES];
856 new_graphic_info[i].anim_delay = parameter[GFX_ARG_DELAY];
857 if (new_graphic_info[i].anim_delay == 0) /* delay must be at least 1 */
858 new_graphic_info[i].anim_delay = 1;
860 /* set mode for animation frame order */
861 if (parameter[GFX_ARG_MODE_LOOP])
862 new_graphic_info[i].anim_mode = ANIM_LOOP;
863 else if (parameter[GFX_ARG_MODE_LINEAR])
864 new_graphic_info[i].anim_mode = ANIM_LINEAR;
865 else if (parameter[GFX_ARG_MODE_PINGPONG])
866 new_graphic_info[i].anim_mode = ANIM_PINGPONG;
867 else if (parameter[GFX_ARG_MODE_PINGPONG2])
868 new_graphic_info[i].anim_mode = ANIM_PINGPONG2;
869 else if (parameter[GFX_ARG_FRAMES] > 1)
870 new_graphic_info[i].anim_mode = ANIM_LOOP;
872 new_graphic_info[i].anim_mode = ANIM_NONE;
874 /* set additional flag to play animation frames in reverse order */
875 if (parameter[GFX_ARG_MODE_REVERSE])
876 new_graphic_info[i].anim_mode |= ANIM_REVERSE;
878 /* set first frame of animation after determining animation mode */
879 new_graphic_info[i].anim_start_frame = parameter[GFX_ARG_START_FRAME];
881 /* automatically determine correct start frame, if not defined */
882 if (parameter[GFX_ARG_START_FRAME] == GFX_ARG_UNDEFINED_VALUE)
883 new_graphic_info[i].anim_start_frame = 0;
884 else if (new_graphic_info[i].anim_mode & ANIM_REVERSE)
885 new_graphic_info[i].anim_start_frame =
886 new_graphic_info[i].anim_frames - parameter[GFX_ARG_START_FRAME] - 1;
888 /* animation synchronized with global frame counter, not move position */
889 new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
891 /* set global_sync for all animations with undefined "animation action" */
892 if (parameter[GFX_ARG_GLOBAL_SYNC] == GFX_ARG_UNDEFINED_VALUE)
893 new_graphic_info[i].anim_global_sync =
894 (gfx_action[i] == GFX_ACTION_DEFAULT ? TRUE : FALSE);
896 /* "linear" animations are never globally synchronized */
897 if (parameter[GFX_ARG_MODE_LINEAR])
898 new_graphic_info[i].anim_global_sync = FALSE;
900 /* now check if no animation frames are outside of the loaded image */
902 if (new_graphic_info[i].bitmap == NULL)
903 continue; /* skip check for optional images that are undefined */
906 getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
907 if (src_x < 0 || src_y < 0 ||
908 src_x + TILEX > src_bitmap->width ||
909 src_y + TILEY > src_bitmap->height)
911 Error(ERR_RETURN, "custom artwork configuration error:");
912 Error(ERR_RETURN, "- config file: '%s'",
913 getImageConfigFilename());
914 Error(ERR_RETURN, "- config token: '%s'",
915 getTokenFromImageID(i));
916 Error(ERR_RETURN, "- image file: '%s'",
917 src_bitmap->source_filename);
918 Error(ERR_EXIT, "error: first animation frame out of bounds (%d,%d)",
922 last_frame = new_graphic_info[i].anim_frames - 1;
923 getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
924 if (src_x < 0 || src_y < 0 ||
925 src_x + TILEX > src_bitmap->width ||
926 src_y + TILEY > src_bitmap->height)
928 Error(ERR_RETURN, "custom artwork configuration error:");
929 Error(ERR_RETURN, "- config file: '%s'",
930 getImageConfigFilename());
931 Error(ERR_RETURN, "- config token: '%s'",
932 getTokenFromImageID(i));
933 Error(ERR_RETURN, "- image file: '%s'",
934 src_bitmap->source_filename);
935 Error(ERR_EXIT, "error: last animation frame out of bounds (%d,%d)",
939 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
940 /* currently we need only a tile clip mask from the first frame */
941 getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
943 if (copy_clipmask_gc == None)
945 clip_gc_values.graphics_exposures = False;
946 clip_gc_valuemask = GCGraphicsExposures;
947 copy_clipmask_gc = XCreateGC(display, src_bitmap->clip_mask,
948 clip_gc_valuemask, &clip_gc_values);
951 new_graphic_info[i].clip_mask =
952 XCreatePixmap(display, window->drawable, TILEX, TILEY, 1);
954 src_pixmap = src_bitmap->clip_mask;
955 XCopyArea(display, src_pixmap, new_graphic_info[i].clip_mask,
956 copy_clipmask_gc, src_x, src_y, TILEX, TILEY, 0, 0);
958 clip_gc_values.graphics_exposures = False;
959 clip_gc_values.clip_mask = new_graphic_info[i].clip_mask;
960 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
961 new_graphic_info[i].clip_gc =
962 XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
966 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
967 if (copy_clipmask_gc)
968 XFreeGC(display, copy_clipmask_gc);
971 clipmasks_initialized = TRUE;
974 static void InitSoundInfo()
976 sound_files = getCurrentSoundList();
978 /* initialize sound effect lookup table for element actions */
982 void InitElementProperties()
986 static int ep_amoebalive[] =
993 static int ep_amoebalive_num = SIZEOF_ARRAY_INT(ep_amoebalive);
995 static int ep_amoeboid[] =
1003 static int ep_amoeboid_num = SIZEOF_ARRAY_INT(ep_amoeboid);
1005 static int ep_schluessel[] =
1016 static int ep_schluessel_num = SIZEOF_ARRAY_INT(ep_schluessel);
1018 static int ep_pforte[] =
1037 EL_SWITCHGATE_OPENING,
1038 EL_SWITCHGATE_CLOSED,
1039 EL_SWITCHGATE_CLOSING,
1041 EL_TIMEGATE_OPENING,
1043 EL_TIMEGATE_CLOSING,
1047 EL_TUBE_VERTICAL_LEFT,
1048 EL_TUBE_VERTICAL_RIGHT,
1049 EL_TUBE_HORIZONTAL_UP,
1050 EL_TUBE_HORIZONTAL_DOWN,
1056 static int ep_pforte_num = SIZEOF_ARRAY_INT(ep_pforte);
1058 static int ep_solid[] =
1078 EL_QUICKSAND_FILLING,
1079 EL_QUICKSAND_EMPTYING,
1081 EL_MAGIC_WALL_ACTIVE,
1082 EL_MAGIC_WALL_EMPTYING,
1083 EL_MAGIC_WALL_FILLING,
1087 EL_BD_MAGIC_WALL_ACTIVE,
1088 EL_BD_MAGIC_WALL_EMPTYING,
1089 EL_BD_MAGIC_WALL_FULL,
1090 EL_BD_MAGIC_WALL_FILLING,
1091 EL_BD_MAGIC_WALL_DEAD,
1094 EL_ACIDPOOL_TOPLEFT,
1095 EL_ACIDPOOL_TOPRIGHT,
1096 EL_ACIDPOOL_BOTTOMLEFT,
1098 EL_ACIDPOOL_BOTTOMRIGHT,
1116 EL_SP_TERMINAL_ACTIVE,
1119 EL_INVISIBLE_STEELWALL,
1120 EL_INVISIBLE_STEELWALL_ACTIVE,
1122 EL_INVISIBLE_WALL_ACTIVE,
1123 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1124 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1125 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1126 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1127 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1128 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1129 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1130 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1131 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1132 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1133 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1134 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1135 EL_SWITCHGATE_SWITCH_UP,
1136 EL_SWITCHGATE_SWITCH_DOWN,
1138 EL_LIGHT_SWITCH_ACTIVE,
1140 EL_TIMEGATE_SWITCH_ACTIVE,
1141 EL_SIGN_EXCLAMATION,
1142 EL_SIGN_RADIOACTIVITY,
1153 EL_STEELWALL_SLANTED,
1158 EL_EMC_WALL_PILLAR_UPPER,
1159 EL_EMC_WALL_PILLAR_MIDDLE,
1160 EL_EMC_WALL_PILLAR_LOWER,
1186 EL_SWITCHGATE_OPENING,
1187 EL_SWITCHGATE_CLOSED,
1188 EL_SWITCHGATE_CLOSING,
1190 EL_TIMEGATE_OPENING,
1192 EL_TIMEGATE_CLOSING,
1196 EL_TUBE_VERTICAL_LEFT,
1197 EL_TUBE_VERTICAL_RIGHT,
1198 EL_TUBE_HORIZONTAL_UP,
1199 EL_TUBE_HORIZONTAL_DOWN,
1205 static int ep_solid_num = SIZEOF_ARRAY_INT(ep_solid);
1207 static int ep_massive[] =
1211 EL_ACIDPOOL_TOPLEFT,
1212 EL_ACIDPOOL_TOPRIGHT,
1213 EL_ACIDPOOL_BOTTOMLEFT,
1215 EL_ACIDPOOL_BOTTOMRIGHT,
1227 EL_INVISIBLE_STEELWALL,
1228 EL_INVISIBLE_STEELWALL_ACTIVE,
1229 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1230 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1231 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1232 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1233 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1234 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1235 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1236 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1237 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1238 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1239 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1240 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1242 EL_LIGHT_SWITCH_ACTIVE,
1243 EL_SIGN_EXCLAMATION,
1244 EL_SIGN_RADIOACTIVITY,
1255 EL_STEELWALL_SLANTED,
1278 EL_SWITCHGATE_OPENING,
1279 EL_SWITCHGATE_CLOSED,
1280 EL_SWITCHGATE_CLOSING,
1282 EL_TIMEGATE_OPENING,
1284 EL_TIMEGATE_CLOSING,
1288 EL_TUBE_VERTICAL_LEFT,
1289 EL_TUBE_VERTICAL_RIGHT,
1290 EL_TUBE_HORIZONTAL_UP,
1291 EL_TUBE_HORIZONTAL_DOWN,
1297 static int ep_massive_num = SIZEOF_ARRAY_INT(ep_massive);
1299 static int ep_slippery[] =
1313 EL_ROBOT_WHEEL_ACTIVE,
1319 EL_ACIDPOOL_TOPLEFT,
1320 EL_ACIDPOOL_TOPRIGHT,
1330 EL_STEELWALL_SLANTED,
1334 static int ep_slippery_num = SIZEOF_ARRAY_INT(ep_slippery);
1336 static int ep_enemy[] =
1349 static int ep_enemy_num = SIZEOF_ARRAY_INT(ep_enemy);
1351 static int ep_mauer[] =
1379 EL_WALL_GROWING_ACTIVE,
1398 EL_SP_TERMINAL_ACTIVE,
1401 EL_INVISIBLE_STEELWALL,
1402 EL_INVISIBLE_STEELWALL_ACTIVE,
1404 EL_INVISIBLE_WALL_ACTIVE,
1405 EL_STEELWALL_SLANTED,
1410 EL_EMC_WALL_PILLAR_UPPER,
1411 EL_EMC_WALL_PILLAR_MIDDLE,
1412 EL_EMC_WALL_PILLAR_LOWER,
1419 static int ep_mauer_num = SIZEOF_ARRAY_INT(ep_mauer);
1421 static int ep_can_fall[] =
1436 EL_BD_MAGIC_WALL_FULL,
1447 static int ep_can_fall_num = SIZEOF_ARRAY_INT(ep_can_fall);
1449 static int ep_can_smash[] =
1480 static int ep_can_smash_num = SIZEOF_ARRAY_INT(ep_can_smash);
1482 static int ep_can_change[] =
1493 static int ep_can_change_num = SIZEOF_ARRAY_INT(ep_can_change);
1495 static int ep_can_move[] =
1515 static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move);
1517 static int ep_could_move[] =
1527 EL_BD_BUTTERFLY_RIGHT,
1529 EL_BD_BUTTERFLY_LEFT,
1530 EL_BD_BUTTERFLY_DOWN,
1531 EL_BD_FIREFLY_RIGHT,
1540 static int ep_could_move_num = SIZEOF_ARRAY_INT(ep_could_move);
1542 static int ep_dont_touch[] =
1549 static int ep_dont_touch_num = SIZEOF_ARRAY_INT(ep_dont_touch);
1551 static int ep_dont_go_to[] =
1565 EL_SP_BUGGY_BASE_ACTIVE,
1569 static int ep_dont_go_to_num = SIZEOF_ARRAY_INT(ep_dont_go_to);
1571 static int ep_mampf2[] =
1596 static int ep_mampf2_num = SIZEOF_ARRAY_INT(ep_mampf2);
1598 static int ep_bd_element[] =
1625 static int ep_bd_element_num = SIZEOF_ARRAY_INT(ep_bd_element);
1627 static int ep_sb_element[] =
1632 EL_SOKOBAN_FIELD_EMPTY,
1633 EL_SOKOBAN_FIELD_FULL,
1635 EL_INVISIBLE_STEELWALL
1637 static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element);
1639 static int ep_gem[] =
1648 static int ep_gem_num = SIZEOF_ARRAY_INT(ep_gem);
1650 static int ep_inactive[] =
1687 EL_INVISIBLE_STEELWALL,
1695 EL_WALL_EMERALD_YELLOW,
1700 EL_SOKOBAN_FIELD_EMPTY,
1701 EL_SOKOBAN_FIELD_FULL,
1702 EL_WALL_EMERALD_RED,
1703 EL_WALL_EMERALD_PURPLE,
1704 EL_ACIDPOOL_TOPLEFT,
1705 EL_ACIDPOOL_TOPRIGHT,
1706 EL_ACIDPOOL_BOTTOMLEFT,
1708 EL_ACIDPOOL_BOTTOMRIGHT,
1712 EL_BD_MAGIC_WALL_DEAD,
1713 EL_AMOEBA_TO_DIAMOND,
1746 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1747 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1748 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1749 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1750 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1751 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1752 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1753 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1754 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1755 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1756 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1757 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1758 EL_SIGN_EXCLAMATION,
1759 EL_SIGN_RADIOACTIVITY,
1770 EL_STEELWALL_SLANTED,
1775 EL_EMC_WALL_PILLAR_UPPER,
1776 EL_EMC_WALL_PILLAR_MIDDLE,
1777 EL_EMC_WALL_PILLAR_LOWER,
1784 static int ep_inactive_num = SIZEOF_ARRAY_INT(ep_inactive);
1786 static int ep_explosive[] =
1791 EL_DYNABOMB_PLAYER1_ACTIVE,
1792 EL_DYNABOMB_PLAYER2_ACTIVE,
1793 EL_DYNABOMB_PLAYER3_ACTIVE,
1794 EL_DYNABOMB_PLAYER4_ACTIVE,
1811 static int ep_explosive_num = SIZEOF_ARRAY_INT(ep_explosive);
1813 static int ep_mampf3[] =
1824 static int ep_mampf3_num = SIZEOF_ARRAY_INT(ep_mampf3);
1826 static int ep_pushable[] =
1833 EL_SOKOBAN_FIELD_FULL,
1843 static int ep_pushable_num = SIZEOF_ARRAY_INT(ep_pushable);
1845 static int ep_player[] =
1852 static int ep_player_num = SIZEOF_ARRAY_INT(ep_player);
1854 static int ep_has_content[] =
1862 static int ep_has_content_num = SIZEOF_ARRAY_INT(ep_has_content);
1864 static int ep_eatable[] =
1871 EL_INVISIBLE_SAND_ACTIVE
1873 static int ep_eatable_num = SIZEOF_ARRAY_INT(ep_eatable);
1875 static int ep_sp_element[] =
1918 /* additional elements that appeared in newer Supaplex levels */
1920 /* more than one murphy in a level results in an inactive clone */
1923 static int ep_sp_element_num = SIZEOF_ARRAY_INT(ep_sp_element);
1925 static int ep_quick_gate[] =
1949 static int ep_quick_gate_num = SIZEOF_ARRAY_INT(ep_quick_gate);
1951 static int ep_over_player[] =
1967 EL_TUBE_VERTICAL_LEFT,
1968 EL_TUBE_VERTICAL_RIGHT,
1969 EL_TUBE_HORIZONTAL_UP,
1970 EL_TUBE_HORIZONTAL_DOWN,
1976 static int ep_over_player_num = SIZEOF_ARRAY_INT(ep_over_player);
1978 static int ep_active_bomb[] =
1981 EL_DYNABOMB_PLAYER1_ACTIVE,
1982 EL_DYNABOMB_PLAYER2_ACTIVE,
1983 EL_DYNABOMB_PLAYER3_ACTIVE,
1984 EL_DYNABOMB_PLAYER4_ACTIVE
1986 static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb);
1988 static int ep_belt[] =
1990 EL_CONVEYOR_BELT1_LEFT,
1991 EL_CONVEYOR_BELT1_MIDDLE,
1992 EL_CONVEYOR_BELT1_RIGHT,
1993 EL_CONVEYOR_BELT2_LEFT,
1994 EL_CONVEYOR_BELT2_MIDDLE,
1995 EL_CONVEYOR_BELT2_RIGHT,
1996 EL_CONVEYOR_BELT3_LEFT,
1997 EL_CONVEYOR_BELT3_MIDDLE,
1998 EL_CONVEYOR_BELT3_RIGHT,
1999 EL_CONVEYOR_BELT4_LEFT,
2000 EL_CONVEYOR_BELT4_MIDDLE,
2001 EL_CONVEYOR_BELT4_RIGHT,
2003 static int ep_belt_num = SIZEOF_ARRAY_INT(ep_belt);
2005 static int ep_belt_active[] =
2007 EL_CONVEYOR_BELT1_LEFT_ACTIVE,
2008 EL_CONVEYOR_BELT1_MIDDLE_ACTIVE,
2009 EL_CONVEYOR_BELT1_RIGHT_ACTIVE,
2010 EL_CONVEYOR_BELT2_LEFT_ACTIVE,
2011 EL_CONVEYOR_BELT2_MIDDLE_ACTIVE,
2012 EL_CONVEYOR_BELT2_RIGHT_ACTIVE,
2013 EL_CONVEYOR_BELT3_LEFT_ACTIVE,
2014 EL_CONVEYOR_BELT3_MIDDLE_ACTIVE,
2015 EL_CONVEYOR_BELT3_RIGHT_ACTIVE,
2016 EL_CONVEYOR_BELT4_LEFT_ACTIVE,
2017 EL_CONVEYOR_BELT4_MIDDLE_ACTIVE,
2018 EL_CONVEYOR_BELT4_RIGHT_ACTIVE,
2020 static int ep_belt_active_num = SIZEOF_ARRAY_INT(ep_belt_active);
2022 static int ep_belt_switch[] =
2024 EL_CONVEYOR_BELT1_SWITCH_LEFT,
2025 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
2026 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
2027 EL_CONVEYOR_BELT2_SWITCH_LEFT,
2028 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
2029 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
2030 EL_CONVEYOR_BELT3_SWITCH_LEFT,
2031 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
2032 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
2033 EL_CONVEYOR_BELT4_SWITCH_LEFT,
2034 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
2035 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
2037 static int ep_belt_switch_num = SIZEOF_ARRAY_INT(ep_belt_switch);
2039 static int ep_tube[] =
2044 EL_TUBE_VERTICAL_LEFT,
2045 EL_TUBE_VERTICAL_RIGHT,
2046 EL_TUBE_HORIZONTAL_UP,
2047 EL_TUBE_HORIZONTAL_DOWN,
2053 static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
2055 static long ep1_bit[] =
2089 static long ep2_bit[] =
2096 static int *ep1_array[] =
2130 static int *ep2_array[] =
2137 static int *ep1_num[] =
2164 &ep_has_content_num,
2168 &ep_over_player_num,
2171 static int *ep2_num[] =
2174 &ep_belt_active_num,
2175 &ep_belt_switch_num,
2178 static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
2179 static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
2181 for (i=0; i<MAX_ELEMENTS; i++)
2183 Elementeigenschaften1[i] = 0;
2184 Elementeigenschaften2[i] = 0;
2187 for (i=0; i<num_properties1; i++)
2188 for (j=0; j<*(ep1_num[i]); j++)
2189 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
2190 for (i=0; i<num_properties2; i++)
2191 for (j=0; j<*(ep2_num[i]); j++)
2192 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
2194 for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
2195 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
2198 void Execute_Command(char *command)
2200 if (strcmp(command, "print graphicsinfo.conf") == 0)
2204 printf("# You can configure additional/alternative image files here.\n");
2205 printf("# (The images below are default and therefore commented out.)\n");
2207 printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics"));
2209 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2212 for (i=0; image_config[i].token != NULL; i++)
2214 getFormattedSetupEntry(image_config[i].token,
2215 image_config[i].value));
2219 else if (strcmp(command, "print soundsinfo.conf") == 0)
2223 printf("# You can configure additional/alternative sound files here.\n");
2224 printf("# (The sounds below are default and therefore commented out.)\n");
2226 printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
2228 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2231 for (i=0; sound_config[i].token != NULL; i++)
2233 getFormattedSetupEntry(sound_config[i].token,
2234 sound_config[i].value));
2238 else if (strcmp(command, "print musicinfo.conf") == 0)
2240 printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n");
2242 printf("%s\n", getFormattedSetupEntry("name", "Classic Music"));
2244 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2248 else if (strncmp(command, "dump tape ", 10) == 0)
2250 char *filename = &command[10];
2252 if (access(filename, F_OK) != 0)
2253 Error(ERR_EXIT, "cannot open file '%s'", filename);
2255 LoadTapeFromFilename(filename);
2260 else if (strncmp(command, "autoplay ", 9) == 0)
2262 char *str_copy = getStringCopy(&command[9]);
2263 char *str_ptr = strchr(str_copy, ' ');
2265 global.autoplay_leveldir = str_copy;
2266 global.autoplay_level_nr = -1;
2268 if (str_ptr != NULL)
2270 *str_ptr++ = '\0'; /* terminate leveldir string */
2271 global.autoplay_level_nr = atoi(str_ptr); /* get level_nr value */
2276 Error(ERR_EXIT_HELP, "unrecognized command '%s'", command);
2280 void CloseAllAndExit(int exit_value)
2285 CloseAudio(); /* called after freeing sounds (needed for SDL) */
2288 FreeTileClipmasks();
2290 if (bitmap_font_initial)
2291 FreeBitmap(bitmap_font_initial);
2293 CloseVideoDisplay();
2294 ClosePlatformDependantStuff();