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_MENU_FONT_BIG].bitmap,
219 new_graphic_info[IMG_MENU_FONT_MEDIUM].bitmap,
220 new_graphic_info[IMG_MENU_FONT_SMALL].bitmap,
221 new_graphic_info[IMG_MENU_FONT_EM].bitmap);
223 SetBackgroundBitmap(NULL);
229 static void InitImages()
231 InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
233 ReinitializeGraphics();
236 static void InitMixer()
240 InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES);
245 static void InitSound()
247 /* load custom sounds and music */
248 InitReloadSounds(artwork.snd_current->identifier);
249 InitReloadMusic(artwork.mus_current->identifier);
254 static void InitTileClipmasks()
256 #if defined(TARGET_X11)
257 XGCValues clip_gc_values;
258 unsigned long clip_gc_valuemask;
260 #if defined(TARGET_X11_NATIVE)
270 tile_needs_clipping[] =
272 { GFX_SPIELER1_UP, 4 },
273 { GFX_SPIELER1_DOWN, 4 },
274 { GFX_SPIELER1_LEFT, 4 },
275 { GFX_SPIELER1_RIGHT, 4 },
276 { GFX_SPIELER1_PUSH_LEFT, 4 },
277 { GFX_SPIELER1_PUSH_RIGHT, 4 },
278 { GFX_SPIELER2_UP, 4 },
279 { GFX_SPIELER2_DOWN, 4 },
280 { GFX_SPIELER2_LEFT, 4 },
281 { GFX_SPIELER2_RIGHT, 4 },
282 { GFX_SPIELER2_PUSH_LEFT, 4 },
283 { GFX_SPIELER2_PUSH_RIGHT, 4 },
284 { GFX_SPIELER3_UP, 4 },
285 { GFX_SPIELER3_DOWN, 4 },
286 { GFX_SPIELER3_LEFT, 4 },
287 { GFX_SPIELER3_RIGHT, 4 },
288 { GFX_SPIELER3_PUSH_LEFT, 4 },
289 { GFX_SPIELER3_PUSH_RIGHT, 4 },
290 { GFX_SPIELER4_UP, 4 },
291 { GFX_SPIELER4_DOWN, 4 },
292 { GFX_SPIELER4_LEFT, 4 },
293 { GFX_SPIELER4_RIGHT, 4 },
294 { GFX_SPIELER4_PUSH_LEFT, 4 },
295 { GFX_SPIELER4_PUSH_RIGHT, 4 },
296 { GFX_SP_MURPHY, 1 },
297 { GFX_MURPHY_GO_LEFT, 3 },
298 { GFX_MURPHY_GO_RIGHT, 3 },
299 { GFX_MURPHY_SNAP_UP, 1 },
300 { GFX_MURPHY_SNAP_DOWN, 1 },
301 { GFX_MURPHY_SNAP_RIGHT, 1 },
302 { GFX_MURPHY_SNAP_LEFT, 1 },
303 { GFX_MURPHY_PUSH_RIGHT, 1 },
304 { GFX_MURPHY_PUSH_LEFT, 1 },
305 { GFX_GEBLUBBER, 4 },
308 { GFX_EXPLOSION, 8 },
309 { GFX_SOKOBAN_OBJEKT, 1 },
310 { GFX_FUNKELN_BLAU, 3 },
311 { GFX_FUNKELN_WEISS, 3 },
312 { GFX2_SHIELD_PASSIVE, 3 },
313 { GFX2_SHIELD_ACTIVE, 3 },
318 #endif /* TARGET_X11_NATIVE */
319 #endif /* TARGET_X11 */
323 /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */
324 for (i=0; i<NUM_TILES; i++)
325 tile_clipmask[i] = None;
327 #if defined(TARGET_X11)
328 /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is
329 often very slow when preparing a masked XCopyArea() for big Pixmaps.
330 To prevent this, create small (tile-sized) mask Pixmaps which will then
331 be set much faster with XSetClipOrigin() and speed things up a lot. */
333 clip_gc_values.graphics_exposures = False;
334 clip_gc_valuemask = GCGraphicsExposures;
335 tile_clip_gc = XCreateGC(display, window->drawable,
336 clip_gc_valuemask, &clip_gc_values);
339 for (i=0; i<NUM_BITMAPS; i++)
341 if (pix[i]->clip_mask)
343 clip_gc_values.graphics_exposures = False;
344 clip_gc_values.clip_mask = pix[i]->clip_mask;
345 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
346 pix[i]->stored_clip_gc = XCreateGC(display, window->drawable,
347 clip_gc_valuemask, &clip_gc_values);
352 #if defined(TARGET_X11_NATIVE)
355 /* create graphic context structures needed for clipping */
356 clip_gc_values.graphics_exposures = False;
357 clip_gc_valuemask = GCGraphicsExposures;
358 copy_clipmask_gc = XCreateGC(display, pix[PIX_BACK]->clip_mask,
359 clip_gc_valuemask, &clip_gc_values);
361 /* create only those clipping Pixmaps we really need */
362 for (i=0; tile_needs_clipping[i].start>=0; i++)
366 for (j=0; j<tile_needs_clipping[i].count; j++)
368 int tile = tile_needs_clipping[i].start + j;
374 getGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
375 src_pixmap = src_bitmap->clip_mask;
377 tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
380 XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc,
381 src_x, src_y, TILEX, TILEY, 0, 0);
385 XFreeGC(display, copy_clipmask_gc);
388 #endif /* TARGET_X11_NATIVE */
389 #endif /* TARGET_X11 */
392 void FreeTileClipmasks()
394 #if defined(TARGET_X11)
397 for (i=0; i<NUM_TILES; i++)
399 if (tile_clipmask[i] != None)
401 XFreePixmap(display, tile_clipmask[i]);
402 tile_clipmask[i] = None;
407 XFreeGC(display, tile_clip_gc);
411 for (i=0; i<NUM_BITMAPS; i++)
413 if (pix[i] != NULL && pix[i]->stored_clip_gc)
415 XFreeGC(display, pix[i]->stored_clip_gc);
416 pix[i]->stored_clip_gc = None;
421 #endif /* TARGET_X11 */
430 /* initialize screen properties */
431 InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
432 REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
433 InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
434 InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
435 InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
437 /* create additional image buffers for double-buffering */
438 bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
439 bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
442 pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
444 InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL);
446 bitmap_font_initial = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
448 InitFontInfo(bitmap_font_initial, NULL, NULL, NULL, NULL);
451 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
452 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
454 DrawInitText("Loading graphics:", 120, FC_GREEN);
457 for (i=0; i<NUM_PICTURES; i++)
460 if (i != PIX_FONT_SMALL)
463 DrawInitText(image_filename[i], 150, FC_YELLOW);
465 pix[i] = LoadCustomImage(image_filename[i]);
471 InitFontInfo(pix[PIX_FONT_BIG], pix[PIX_FONT_MEDIUM], pix[PIX_FONT_SMALL],
478 void InitGfxBackground()
483 fieldbuffer = bitmap_db_field;
484 SetDrawtoField(DRAW_BACKBUFFER);
486 BlitBitmap(new_graphic_info[IMG_MENU_FRAME].bitmap, backbuffer,
487 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
488 ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
489 ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
491 for (x=0; x<MAX_BUF_XSIZE; x++)
492 for (y=0; y<MAX_BUF_YSIZE; y++)
495 redraw_mask = REDRAW_ALL;
498 void ReloadCustomArtwork()
500 static char *leveldir_current_identifier = NULL;
501 static boolean last_override_level_graphics = FALSE;
502 static boolean last_override_level_sounds = FALSE;
503 static boolean last_override_level_music = FALSE;
504 /* identifier for new artwork; default: artwork configured in setup */
505 char *gfx_new_identifier = artwork.gfx_current->identifier;
506 char *snd_new_identifier = artwork.snd_current->identifier;
507 char *mus_new_identifier = artwork.mus_current->identifier;
508 boolean redraw_screen = FALSE;
510 if (leveldir_current_identifier == NULL)
511 leveldir_current_identifier = leveldir_current->identifier;
514 printf("CURRENT GFX: '%s' ['%s']\n", artwork.gfx_current->identifier,
515 leveldir_current->graphics_set);
516 printf("CURRENT LEV: '%s' / '%s'\n", leveldir_current_identifier,
517 leveldir_current->identifier);
521 printf("graphics --> '%s' ('%s')\n",
522 artwork.gfx_current_identifier, artwork.gfx_current->filename);
523 printf("sounds --> '%s' ('%s')\n",
524 artwork.snd_current_identifier, artwork.snd_current->filename);
525 printf("music --> '%s' ('%s')\n",
526 artwork.mus_current_identifier, artwork.mus_current->filename);
529 /* leveldir_current may be invalid (level group, parent link) */
530 if (!validLevelSeries(leveldir_current))
534 printf("--> '%s'\n", artwork.gfx_current_identifier);
537 /* when a new level series was selected, check if there was a change
538 in custom artwork stored in level series directory */
539 if (leveldir_current_identifier != leveldir_current->identifier)
541 char *identifier_old = leveldir_current_identifier;
542 char *identifier_new = leveldir_current->identifier;
544 if (getTreeInfoFromIdentifier(artwork.gfx_first, identifier_old) !=
545 getTreeInfoFromIdentifier(artwork.gfx_first, identifier_new))
546 gfx_new_identifier = identifier_new;
547 if (getTreeInfoFromIdentifier(artwork.snd_first, identifier_old) !=
548 getTreeInfoFromIdentifier(artwork.snd_first, identifier_new))
549 snd_new_identifier = identifier_new;
550 if (getTreeInfoFromIdentifier(artwork.mus_first, identifier_new) !=
551 getTreeInfoFromIdentifier(artwork.mus_first, identifier_new))
552 mus_new_identifier = identifier_new;
554 leveldir_current_identifier = leveldir_current->identifier;
557 /* custom level artwork configured in level series configuration file
558 always overrides custom level artwork stored in level series directory
559 and (level independant) custom artwork configured in setup menue */
560 if (leveldir_current->graphics_set != NULL)
561 gfx_new_identifier = leveldir_current->graphics_set;
562 if (leveldir_current->sounds_set != NULL)
563 snd_new_identifier = leveldir_current->sounds_set;
564 if (leveldir_current->music_set != NULL)
565 mus_new_identifier = leveldir_current->music_set;
567 if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 ||
568 last_override_level_graphics != setup.override_level_graphics)
571 printf("CHANGED GFX: '%s' -> '%s'\n",
572 artwork.gfx_current_identifier, gfx_new_identifier);
579 setLevelArtworkDir(artwork.gfx_first);
581 ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
584 for (i=0; i<NUM_PICTURES; i++)
586 DrawInitText(image_filename[i], 150, FC_YELLOW);
587 ReloadCustomImage(pix[i], image_filename[i]);
595 ReinitializeGraphics();
603 /* force redraw of (open or closed) door graphics */
604 SetDoorState(DOOR_OPEN_ALL);
605 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
609 artwork.gfx_current_identifier = gfx_new_identifier;
611 artwork.gfx_current_identifier = artwork.gfx_current->identifier;
613 last_override_level_graphics = setup.override_level_graphics;
615 redraw_screen = TRUE;
618 if (strcmp(artwork.snd_current_identifier, snd_new_identifier) != 0 ||
619 last_override_level_sounds != setup.override_level_sounds)
621 /* set artwork path to send it to the sound server process */
622 setLevelArtworkDir(artwork.snd_first);
624 InitReloadSounds(snd_new_identifier);
626 artwork.snd_current_identifier = snd_new_identifier;
627 last_override_level_sounds = setup.override_level_sounds;
629 redraw_screen = TRUE;
632 if (strcmp(artwork.mus_current_identifier, mus_new_identifier) != 0 ||
633 last_override_level_music != setup.override_level_music)
635 /* set artwork path to send it to the sound server process */
636 setLevelArtworkDir(artwork.mus_first);
638 InitReloadMusic(mus_new_identifier);
640 artwork.mus_current_identifier = mus_new_identifier;
641 last_override_level_music = setup.override_level_music;
643 redraw_screen = TRUE;
650 /* force redraw of (open or closed) door graphics */
651 SetDoorState(DOOR_OPEN_ALL);
652 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
656 printf("<-- '%s'\n", artwork.gfx_current_identifier);
662 FreeLevelEditorGadgets();
671 static boolean gadgets_initialized = FALSE;
673 if (gadgets_initialized)
676 CreateLevelEditorGadgets();
680 CreateScreenGadgets();
682 gadgets_initialized = TRUE;
685 void InitElementInfo()
690 /* set values to -1 to identify later as "uninitialized" values */
691 for (i=0; i<MAX_ELEMENTS; i++)
693 for (act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
695 element_info[i].graphic[act] = -1;
697 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
698 element_info[i].direction_graphic[act][dir] = -1;
702 for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
703 element_info[i].graphic[GFX_ACTION_DEFAULT] =
704 IMG_CHAR_START + (i - EL_CHAR_START);
706 for (i=EL_CUSTOM_START; i<=EL_CUSTOM_END; i++)
707 element_info[i].graphic[GFX_ACTION_DEFAULT] =
708 IMG_CUSTOM_START + (i - EL_CUSTOM_START);
711 while (element_to_graphic[i].element > -1)
713 int element = element_to_graphic[i].element;
714 int direction = element_to_graphic[i].direction;
715 int action = element_to_graphic[i].action;
716 int graphic = element_to_graphic[i].graphic;
719 action = graphics_action_mapping[action];
721 action = GFX_ACTION_DEFAULT;
725 direction = MV_DIR_BIT(direction);
727 element_info[element].direction_graphic[action][direction] = graphic;
730 element_info[element].graphic[action] = graphic;
735 /* now set all '-1' values to element specific default values */
736 for (i=0; i<MAX_ELEMENTS; i++)
738 int default_action_graphic = element_info[i].graphic[GFX_ACTION_DEFAULT];
739 int default_action_direction_graphic[NUM_MV_DIRECTIONS];
741 if (default_action_graphic == -1)
742 default_action_graphic = IMG_CHAR_QUESTION;
744 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
746 default_action_direction_graphic[dir] =
747 element_info[i].direction_graphic[GFX_ACTION_DEFAULT][dir];
749 if (default_action_direction_graphic[dir] == -1)
750 default_action_direction_graphic[dir] = default_action_graphic;
753 for (act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
755 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
757 int default_direction_graphic = element_info[i].graphic[act];
759 /* no graphic for current action -- use default direction graphic */
760 if (default_direction_graphic == -1)
761 default_direction_graphic = default_action_direction_graphic[dir];
763 if (element_info[i].direction_graphic[act][dir] == -1)
764 element_info[i].direction_graphic[act][dir] =
765 default_direction_graphic;
768 /* no graphic for this specific action -- use default action graphic */
769 if (element_info[i].graphic[act] == -1)
770 element_info[i].graphic[act] = default_action_graphic;
775 static void InitGraphicInfo()
777 static boolean clipmasks_initialized = FALSE;
778 static int gfx_action[NUM_IMAGE_FILES];
781 int first_frame, last_frame;
783 #if defined(TARGET_X11_NATIVE)
785 XGCValues clip_gc_values;
786 unsigned long clip_gc_valuemask;
787 GC copy_clipmask_gc = None;
790 image_files = getCurrentImageList();
792 /* set temporary graphics action field to default value */
793 for (i=0; i<NUM_IMAGE_FILES; i++)
794 gfx_action[i] = GFX_ACTION_DEFAULT;
796 /* set temporary graphics action field from element_to_graphic list */
798 while (element_to_graphic[i].element > -1)
800 int action = element_to_graphic[i].action;
801 int graphic = element_to_graphic[i].graphic;
804 action = GFX_ACTION_DEFAULT;
806 gfx_action[graphic] = action;
811 #if defined(TARGET_X11_NATIVE)
812 if (clipmasks_initialized)
814 for (i=0; i<NUM_IMAGE_FILES; i++)
816 if (new_graphic_info[i].clip_mask)
817 XFreePixmap(display, new_graphic_info[i].clip_mask);
818 if (new_graphic_info[i].clip_gc)
819 XFreeGC(display, new_graphic_info[i].clip_gc);
821 new_graphic_info[i].clip_mask = None;
822 new_graphic_info[i].clip_gc = None;
827 for (i=0; i<NUM_IMAGE_FILES; i++)
829 int *parameter = image_files[i].parameter;
831 new_graphic_info[i].bitmap = getBitmapFromImageID(i);
833 new_graphic_info[i].src_x = parameter[GFX_ARG_XPOS] * TILEX;
834 new_graphic_info[i].src_y = parameter[GFX_ARG_YPOS] * TILEY;
835 new_graphic_info[i].offset_x = parameter[GFX_ARG_OFFSET];
836 new_graphic_info[i].offset_y = 0;
838 /* animation frames are ordered vertically instead of horizontally */
839 if (parameter[GFX_ARG_VERTICAL])
841 new_graphic_info[i].offset_x = 0;
842 new_graphic_info[i].offset_y = parameter[GFX_ARG_OFFSET];
845 /* optionally, the x and y offset of frames can be specified directly */
846 if (parameter[GFX_ARG_XOFFSET] != GFX_ARG_UNDEFINED_VALUE)
847 new_graphic_info[i].offset_x = parameter[GFX_ARG_XOFFSET];
848 if (parameter[GFX_ARG_YOFFSET] != GFX_ARG_UNDEFINED_VALUE)
849 new_graphic_info[i].offset_y = parameter[GFX_ARG_YOFFSET];
851 new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES];
853 new_graphic_info[i].anim_delay = parameter[GFX_ARG_DELAY];
854 if (new_graphic_info[i].anim_delay == 0) /* delay must be at least 1 */
855 new_graphic_info[i].anim_delay = 1;
857 /* set mode for animation frame order */
858 if (parameter[GFX_ARG_MODE_LOOP])
859 new_graphic_info[i].anim_mode = ANIM_LOOP;
860 else if (parameter[GFX_ARG_MODE_LINEAR])
861 new_graphic_info[i].anim_mode = ANIM_LINEAR;
862 else if (parameter[GFX_ARG_MODE_PINGPONG])
863 new_graphic_info[i].anim_mode = ANIM_PINGPONG;
864 else if (parameter[GFX_ARG_MODE_PINGPONG2])
865 new_graphic_info[i].anim_mode = ANIM_PINGPONG2;
866 else if (parameter[GFX_ARG_FRAMES] > 1)
867 new_graphic_info[i].anim_mode = ANIM_LOOP;
869 new_graphic_info[i].anim_mode = ANIM_NONE;
871 /* set additional flag to play animation frames in reverse order */
872 if (parameter[GFX_ARG_MODE_REVERSE])
873 new_graphic_info[i].anim_mode |= ANIM_REVERSE;
875 /* set first frame of animation after determining animation mode */
876 new_graphic_info[i].anim_start_frame = parameter[GFX_ARG_START_FRAME];
878 /* automatically determine correct start frame, if not defined */
879 if (parameter[GFX_ARG_START_FRAME] == GFX_ARG_UNDEFINED_VALUE)
880 new_graphic_info[i].anim_start_frame = 0;
881 else if (new_graphic_info[i].anim_mode & ANIM_REVERSE)
882 new_graphic_info[i].anim_start_frame =
883 new_graphic_info[i].anim_frames - parameter[GFX_ARG_START_FRAME] - 1;
885 /* animation synchronized with global frame counter, not move position */
886 new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
888 /* set global_sync for all animations with undefined "animation action" */
889 if (parameter[GFX_ARG_GLOBAL_SYNC] == GFX_ARG_UNDEFINED_VALUE)
890 new_graphic_info[i].anim_global_sync =
891 (gfx_action[i] == GFX_ACTION_DEFAULT ? TRUE : FALSE);
893 /* "linear" animations are never globally synchronized */
894 if (parameter[GFX_ARG_MODE_LINEAR])
895 new_graphic_info[i].anim_global_sync = FALSE;
897 /* now check if no animation frames are outside of the loaded image */
899 if (new_graphic_info[i].bitmap == NULL)
900 continue; /* skip check for optional images that are undefined */
903 getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
904 if (src_x < 0 || src_y < 0 ||
905 src_x + TILEX > src_bitmap->width ||
906 src_y + TILEY > src_bitmap->height)
908 Error(ERR_RETURN, "custom artwork configuration error:");
909 Error(ERR_RETURN, "- config file: '%s'",
910 getImageConfigFilename());
911 Error(ERR_RETURN, "- config token: '%s'",
912 getTokenFromImageID(i));
913 Error(ERR_RETURN, "- image file: '%s'",
914 src_bitmap->source_filename);
915 Error(ERR_EXIT, "error: first animation frame out of bounds (%d,%d)",
919 last_frame = new_graphic_info[i].anim_frames - 1;
920 getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
921 if (src_x < 0 || src_y < 0 ||
922 src_x + TILEX > src_bitmap->width ||
923 src_y + TILEY > src_bitmap->height)
925 Error(ERR_RETURN, "custom artwork configuration error:");
926 Error(ERR_RETURN, "- config file: '%s'",
927 getImageConfigFilename());
928 Error(ERR_RETURN, "- config token: '%s'",
929 getTokenFromImageID(i));
930 Error(ERR_RETURN, "- image file: '%s'",
931 src_bitmap->source_filename);
932 Error(ERR_EXIT, "error: last animation frame out of bounds (%d,%d)",
936 #if defined(TARGET_X11_NATIVE)
937 /* currently we need only a tile clip mask from the first frame */
938 getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
940 if (copy_clipmask_gc == None)
942 clip_gc_values.graphics_exposures = False;
943 clip_gc_valuemask = GCGraphicsExposures;
944 copy_clipmask_gc = XCreateGC(display, src_bitmap->clip_mask,
945 clip_gc_valuemask, &clip_gc_values);
948 new_graphic_info[i].clip_mask =
949 XCreatePixmap(display, window->drawable, TILEX, TILEY, 1);
951 src_pixmap = src_bitmap->clip_mask;
952 XCopyArea(display, src_pixmap, new_graphic_info[i].clip_mask,
953 copy_clipmask_gc, src_x, src_y, TILEX, TILEY, 0, 0);
955 clip_gc_values.graphics_exposures = False;
956 clip_gc_values.clip_mask = new_graphic_info[i].clip_mask;
957 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
958 new_graphic_info[i].clip_gc =
959 XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
963 #if defined(TARGET_X11_NATIVE)
964 if (copy_clipmask_gc)
965 XFreeGC(display, copy_clipmask_gc);
968 clipmasks_initialized = TRUE;
971 static void InitSoundInfo()
973 sound_files = getCurrentSoundList();
975 /* initialize sound effect lookup table for element actions */
979 void InitElementProperties()
983 static int ep_amoebalive[] =
990 static int ep_amoebalive_num = SIZEOF_ARRAY_INT(ep_amoebalive);
992 static int ep_amoeboid[] =
1000 static int ep_amoeboid_num = SIZEOF_ARRAY_INT(ep_amoeboid);
1002 static int ep_schluessel[] =
1013 static int ep_schluessel_num = SIZEOF_ARRAY_INT(ep_schluessel);
1015 static int ep_pforte[] =
1034 EL_SWITCHGATE_OPENING,
1035 EL_SWITCHGATE_CLOSED,
1036 EL_SWITCHGATE_CLOSING,
1038 EL_TIMEGATE_OPENING,
1040 EL_TIMEGATE_CLOSING,
1044 EL_TUBE_VERTICAL_LEFT,
1045 EL_TUBE_VERTICAL_RIGHT,
1046 EL_TUBE_HORIZONTAL_UP,
1047 EL_TUBE_HORIZONTAL_DOWN,
1053 static int ep_pforte_num = SIZEOF_ARRAY_INT(ep_pforte);
1055 static int ep_solid[] =
1075 EL_QUICKSAND_FILLING,
1076 EL_QUICKSAND_EMPTYING,
1078 EL_MAGIC_WALL_ACTIVE,
1079 EL_MAGIC_WALL_EMPTYING,
1080 EL_MAGIC_WALL_FILLING,
1084 EL_BD_MAGIC_WALL_ACTIVE,
1085 EL_BD_MAGIC_WALL_EMPTYING,
1086 EL_BD_MAGIC_WALL_FULL,
1087 EL_BD_MAGIC_WALL_FILLING,
1088 EL_BD_MAGIC_WALL_DEAD,
1091 EL_ACIDPOOL_TOPLEFT,
1092 EL_ACIDPOOL_TOPRIGHT,
1093 EL_ACIDPOOL_BOTTOMLEFT,
1095 EL_ACIDPOOL_BOTTOMRIGHT,
1113 EL_SP_TERMINAL_ACTIVE,
1116 EL_INVISIBLE_STEELWALL,
1117 EL_INVISIBLE_STEELWALL_ACTIVE,
1119 EL_INVISIBLE_WALL_ACTIVE,
1120 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1121 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1122 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1123 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1124 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1125 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1126 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1127 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1128 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1129 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1130 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1131 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1132 EL_SWITCHGATE_SWITCH_UP,
1133 EL_SWITCHGATE_SWITCH_DOWN,
1135 EL_LIGHT_SWITCH_ACTIVE,
1137 EL_TIMEGATE_SWITCH_ACTIVE,
1138 EL_SIGN_EXCLAMATION,
1139 EL_SIGN_RADIOACTIVITY,
1150 EL_STEELWALL_SLANTED,
1155 EL_EMC_WALL_PILLAR_UPPER,
1156 EL_EMC_WALL_PILLAR_MIDDLE,
1157 EL_EMC_WALL_PILLAR_LOWER,
1183 EL_SWITCHGATE_OPENING,
1184 EL_SWITCHGATE_CLOSED,
1185 EL_SWITCHGATE_CLOSING,
1187 EL_TIMEGATE_OPENING,
1189 EL_TIMEGATE_CLOSING,
1193 EL_TUBE_VERTICAL_LEFT,
1194 EL_TUBE_VERTICAL_RIGHT,
1195 EL_TUBE_HORIZONTAL_UP,
1196 EL_TUBE_HORIZONTAL_DOWN,
1202 static int ep_solid_num = SIZEOF_ARRAY_INT(ep_solid);
1204 static int ep_massive[] =
1208 EL_ACIDPOOL_TOPLEFT,
1209 EL_ACIDPOOL_TOPRIGHT,
1210 EL_ACIDPOOL_BOTTOMLEFT,
1212 EL_ACIDPOOL_BOTTOMRIGHT,
1224 EL_INVISIBLE_STEELWALL,
1225 EL_INVISIBLE_STEELWALL_ACTIVE,
1226 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1227 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1228 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1229 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1230 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1231 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1232 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1233 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1234 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1235 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1236 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1237 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1239 EL_LIGHT_SWITCH_ACTIVE,
1240 EL_SIGN_EXCLAMATION,
1241 EL_SIGN_RADIOACTIVITY,
1252 EL_STEELWALL_SLANTED,
1275 EL_SWITCHGATE_OPENING,
1276 EL_SWITCHGATE_CLOSED,
1277 EL_SWITCHGATE_CLOSING,
1279 EL_TIMEGATE_OPENING,
1281 EL_TIMEGATE_CLOSING,
1285 EL_TUBE_VERTICAL_LEFT,
1286 EL_TUBE_VERTICAL_RIGHT,
1287 EL_TUBE_HORIZONTAL_UP,
1288 EL_TUBE_HORIZONTAL_DOWN,
1294 static int ep_massive_num = SIZEOF_ARRAY_INT(ep_massive);
1296 static int ep_slippery[] =
1310 EL_ROBOT_WHEEL_ACTIVE,
1316 EL_ACIDPOOL_TOPLEFT,
1317 EL_ACIDPOOL_TOPRIGHT,
1327 EL_STEELWALL_SLANTED,
1331 static int ep_slippery_num = SIZEOF_ARRAY_INT(ep_slippery);
1333 static int ep_enemy[] =
1346 static int ep_enemy_num = SIZEOF_ARRAY_INT(ep_enemy);
1348 static int ep_mauer[] =
1376 EL_WALL_GROWING_ACTIVE,
1395 EL_SP_TERMINAL_ACTIVE,
1398 EL_INVISIBLE_STEELWALL,
1399 EL_INVISIBLE_STEELWALL_ACTIVE,
1401 EL_INVISIBLE_WALL_ACTIVE,
1402 EL_STEELWALL_SLANTED,
1407 EL_EMC_WALL_PILLAR_UPPER,
1408 EL_EMC_WALL_PILLAR_MIDDLE,
1409 EL_EMC_WALL_PILLAR_LOWER,
1416 static int ep_mauer_num = SIZEOF_ARRAY_INT(ep_mauer);
1418 static int ep_can_fall[] =
1433 EL_BD_MAGIC_WALL_FULL,
1444 static int ep_can_fall_num = SIZEOF_ARRAY_INT(ep_can_fall);
1446 static int ep_can_smash[] =
1477 static int ep_can_smash_num = SIZEOF_ARRAY_INT(ep_can_smash);
1479 static int ep_can_change[] =
1490 static int ep_can_change_num = SIZEOF_ARRAY_INT(ep_can_change);
1492 static int ep_can_move[] =
1512 static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move);
1514 static int ep_could_move[] =
1524 EL_BD_BUTTERFLY_RIGHT,
1526 EL_BD_BUTTERFLY_LEFT,
1527 EL_BD_BUTTERFLY_DOWN,
1528 EL_BD_FIREFLY_RIGHT,
1537 static int ep_could_move_num = SIZEOF_ARRAY_INT(ep_could_move);
1539 static int ep_dont_touch[] =
1546 static int ep_dont_touch_num = SIZEOF_ARRAY_INT(ep_dont_touch);
1548 static int ep_dont_go_to[] =
1562 EL_SP_BUGGY_BASE_ACTIVE,
1566 static int ep_dont_go_to_num = SIZEOF_ARRAY_INT(ep_dont_go_to);
1568 static int ep_mampf2[] =
1593 static int ep_mampf2_num = SIZEOF_ARRAY_INT(ep_mampf2);
1595 static int ep_bd_element[] =
1622 static int ep_bd_element_num = SIZEOF_ARRAY_INT(ep_bd_element);
1624 static int ep_sb_element[] =
1629 EL_SOKOBAN_FIELD_EMPTY,
1630 EL_SOKOBAN_FIELD_FULL,
1632 EL_INVISIBLE_STEELWALL
1634 static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element);
1636 static int ep_gem[] =
1645 static int ep_gem_num = SIZEOF_ARRAY_INT(ep_gem);
1647 static int ep_inactive[] =
1684 EL_INVISIBLE_STEELWALL,
1692 EL_WALL_EMERALD_YELLOW,
1697 EL_SOKOBAN_FIELD_EMPTY,
1698 EL_SOKOBAN_FIELD_FULL,
1699 EL_WALL_EMERALD_RED,
1700 EL_WALL_EMERALD_PURPLE,
1701 EL_ACIDPOOL_TOPLEFT,
1702 EL_ACIDPOOL_TOPRIGHT,
1703 EL_ACIDPOOL_BOTTOMLEFT,
1705 EL_ACIDPOOL_BOTTOMRIGHT,
1709 EL_BD_MAGIC_WALL_DEAD,
1710 EL_AMOEBA_TO_DIAMOND,
1743 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1744 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1745 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1746 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1747 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1748 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1749 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1750 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1751 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1752 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1753 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1754 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1755 EL_SIGN_EXCLAMATION,
1756 EL_SIGN_RADIOACTIVITY,
1767 EL_STEELWALL_SLANTED,
1772 EL_EMC_WALL_PILLAR_UPPER,
1773 EL_EMC_WALL_PILLAR_MIDDLE,
1774 EL_EMC_WALL_PILLAR_LOWER,
1781 static int ep_inactive_num = SIZEOF_ARRAY_INT(ep_inactive);
1783 static int ep_explosive[] =
1788 EL_DYNABOMB_PLAYER1_ACTIVE,
1789 EL_DYNABOMB_PLAYER2_ACTIVE,
1790 EL_DYNABOMB_PLAYER3_ACTIVE,
1791 EL_DYNABOMB_PLAYER4_ACTIVE,
1808 static int ep_explosive_num = SIZEOF_ARRAY_INT(ep_explosive);
1810 static int ep_mampf3[] =
1821 static int ep_mampf3_num = SIZEOF_ARRAY_INT(ep_mampf3);
1823 static int ep_pushable[] =
1830 EL_SOKOBAN_FIELD_FULL,
1840 static int ep_pushable_num = SIZEOF_ARRAY_INT(ep_pushable);
1842 static int ep_player[] =
1849 static int ep_player_num = SIZEOF_ARRAY_INT(ep_player);
1851 static int ep_has_content[] =
1859 static int ep_has_content_num = SIZEOF_ARRAY_INT(ep_has_content);
1861 static int ep_eatable[] =
1868 EL_INVISIBLE_SAND_ACTIVE
1870 static int ep_eatable_num = SIZEOF_ARRAY_INT(ep_eatable);
1872 static int ep_sp_element[] =
1915 /* additional elements that appeared in newer Supaplex levels */
1917 /* more than one murphy in a level results in an inactive clone */
1920 static int ep_sp_element_num = SIZEOF_ARRAY_INT(ep_sp_element);
1922 static int ep_quick_gate[] =
1946 static int ep_quick_gate_num = SIZEOF_ARRAY_INT(ep_quick_gate);
1948 static int ep_over_player[] =
1964 EL_TUBE_VERTICAL_LEFT,
1965 EL_TUBE_VERTICAL_RIGHT,
1966 EL_TUBE_HORIZONTAL_UP,
1967 EL_TUBE_HORIZONTAL_DOWN,
1973 static int ep_over_player_num = SIZEOF_ARRAY_INT(ep_over_player);
1975 static int ep_active_bomb[] =
1978 EL_DYNABOMB_PLAYER1_ACTIVE,
1979 EL_DYNABOMB_PLAYER2_ACTIVE,
1980 EL_DYNABOMB_PLAYER3_ACTIVE,
1981 EL_DYNABOMB_PLAYER4_ACTIVE
1983 static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb);
1985 static int ep_belt[] =
1987 EL_CONVEYOR_BELT1_LEFT,
1988 EL_CONVEYOR_BELT1_MIDDLE,
1989 EL_CONVEYOR_BELT1_RIGHT,
1990 EL_CONVEYOR_BELT2_LEFT,
1991 EL_CONVEYOR_BELT2_MIDDLE,
1992 EL_CONVEYOR_BELT2_RIGHT,
1993 EL_CONVEYOR_BELT3_LEFT,
1994 EL_CONVEYOR_BELT3_MIDDLE,
1995 EL_CONVEYOR_BELT3_RIGHT,
1996 EL_CONVEYOR_BELT4_LEFT,
1997 EL_CONVEYOR_BELT4_MIDDLE,
1998 EL_CONVEYOR_BELT4_RIGHT,
2000 static int ep_belt_num = SIZEOF_ARRAY_INT(ep_belt);
2002 static int ep_belt_active[] =
2004 EL_CONVEYOR_BELT1_LEFT_ACTIVE,
2005 EL_CONVEYOR_BELT1_MIDDLE_ACTIVE,
2006 EL_CONVEYOR_BELT1_RIGHT_ACTIVE,
2007 EL_CONVEYOR_BELT2_LEFT_ACTIVE,
2008 EL_CONVEYOR_BELT2_MIDDLE_ACTIVE,
2009 EL_CONVEYOR_BELT2_RIGHT_ACTIVE,
2010 EL_CONVEYOR_BELT3_LEFT_ACTIVE,
2011 EL_CONVEYOR_BELT3_MIDDLE_ACTIVE,
2012 EL_CONVEYOR_BELT3_RIGHT_ACTIVE,
2013 EL_CONVEYOR_BELT4_LEFT_ACTIVE,
2014 EL_CONVEYOR_BELT4_MIDDLE_ACTIVE,
2015 EL_CONVEYOR_BELT4_RIGHT_ACTIVE,
2017 static int ep_belt_active_num = SIZEOF_ARRAY_INT(ep_belt_active);
2019 static int ep_belt_switch[] =
2021 EL_CONVEYOR_BELT1_SWITCH_LEFT,
2022 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
2023 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
2024 EL_CONVEYOR_BELT2_SWITCH_LEFT,
2025 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
2026 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
2027 EL_CONVEYOR_BELT3_SWITCH_LEFT,
2028 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
2029 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
2030 EL_CONVEYOR_BELT4_SWITCH_LEFT,
2031 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
2032 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
2034 static int ep_belt_switch_num = SIZEOF_ARRAY_INT(ep_belt_switch);
2036 static int ep_tube[] =
2041 EL_TUBE_VERTICAL_LEFT,
2042 EL_TUBE_VERTICAL_RIGHT,
2043 EL_TUBE_HORIZONTAL_UP,
2044 EL_TUBE_HORIZONTAL_DOWN,
2050 static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
2052 static long ep1_bit[] =
2086 static long ep2_bit[] =
2093 static int *ep1_array[] =
2127 static int *ep2_array[] =
2134 static int *ep1_num[] =
2161 &ep_has_content_num,
2165 &ep_over_player_num,
2168 static int *ep2_num[] =
2171 &ep_belt_active_num,
2172 &ep_belt_switch_num,
2175 static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
2176 static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
2178 for (i=0; i<MAX_ELEMENTS; i++)
2180 Elementeigenschaften1[i] = 0;
2181 Elementeigenschaften2[i] = 0;
2184 for (i=0; i<num_properties1; i++)
2185 for (j=0; j<*(ep1_num[i]); j++)
2186 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
2187 for (i=0; i<num_properties2; i++)
2188 for (j=0; j<*(ep2_num[i]); j++)
2189 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
2191 for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
2192 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
2195 void Execute_Command(char *command)
2197 if (strcmp(command, "print graphicsinfo.conf") == 0)
2201 printf("# You can configure additional/alternative image files here.\n");
2202 printf("# (The images below are default and therefore commented out.)\n");
2204 printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics"));
2206 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2209 for (i=0; image_config[i].token != NULL; i++)
2211 getFormattedSetupEntry(image_config[i].token,
2212 image_config[i].value));
2216 else if (strcmp(command, "print soundsinfo.conf") == 0)
2220 printf("# You can configure additional/alternative sound files here.\n");
2221 printf("# (The sounds below are default and therefore commented out.)\n");
2223 printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
2225 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2228 for (i=0; sound_config[i].token != NULL; i++)
2230 getFormattedSetupEntry(sound_config[i].token,
2231 sound_config[i].value));
2235 else if (strcmp(command, "print musicinfo.conf") == 0)
2237 printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n");
2239 printf("%s\n", getFormattedSetupEntry("name", "Classic Music"));
2241 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2245 else if (strncmp(command, "dump tape ", 10) == 0)
2247 char *filename = &command[10];
2249 if (access(filename, F_OK) != 0)
2250 Error(ERR_EXIT, "cannot open file '%s'", filename);
2252 LoadTapeFromFilename(filename);
2257 else if (strncmp(command, "autoplay ", 9) == 0)
2259 char *str_copy = getStringCopy(&command[9]);
2260 char *str_ptr = strchr(str_copy, ' ');
2262 global.autoplay_leveldir = str_copy;
2263 global.autoplay_level_nr = -1;
2265 if (str_ptr != NULL)
2267 *str_ptr++ = '\0'; /* terminate leveldir string */
2268 global.autoplay_level_nr = atoi(str_ptr); /* get level_nr value */
2273 Error(ERR_EXIT_HELP, "unrecognized command '%s'", command);
2277 void CloseAllAndExit(int exit_value)
2282 CloseAudio(); /* called after freeing sounds (needed for SDL) */
2285 FreeTileClipmasks();
2287 if (bitmap_font_initial)
2288 FreeBitmap(bitmap_font_initial);
2290 CloseVideoDisplay();
2291 ClosePlatformDependantStuff();