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 SetMainBackgroundImage(IMG_BACKGROUND_DEFAULT);
224 SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
230 static void InitImages()
232 InitImageList(image_config, image_config_suffix, NUM_IMAGE_FILES);
234 ReinitializeGraphics();
237 static void InitMixer()
241 InitSoundList(sound_config, sound_config_suffix, NUM_SOUND_FILES);
246 static void InitSound()
248 /* load custom sounds and music */
249 InitReloadSounds(artwork.snd_current->identifier);
250 InitReloadMusic(artwork.mus_current->identifier);
255 static void InitTileClipmasks()
257 #if defined(TARGET_X11)
258 XGCValues clip_gc_values;
259 unsigned long clip_gc_valuemask;
261 #if defined(TARGET_X11_NATIVE)
271 tile_needs_clipping[] =
273 { GFX_SPIELER1_UP, 4 },
274 { GFX_SPIELER1_DOWN, 4 },
275 { GFX_SPIELER1_LEFT, 4 },
276 { GFX_SPIELER1_RIGHT, 4 },
277 { GFX_SPIELER1_PUSH_LEFT, 4 },
278 { GFX_SPIELER1_PUSH_RIGHT, 4 },
279 { GFX_SPIELER2_UP, 4 },
280 { GFX_SPIELER2_DOWN, 4 },
281 { GFX_SPIELER2_LEFT, 4 },
282 { GFX_SPIELER2_RIGHT, 4 },
283 { GFX_SPIELER2_PUSH_LEFT, 4 },
284 { GFX_SPIELER2_PUSH_RIGHT, 4 },
285 { GFX_SPIELER3_UP, 4 },
286 { GFX_SPIELER3_DOWN, 4 },
287 { GFX_SPIELER3_LEFT, 4 },
288 { GFX_SPIELER3_RIGHT, 4 },
289 { GFX_SPIELER3_PUSH_LEFT, 4 },
290 { GFX_SPIELER3_PUSH_RIGHT, 4 },
291 { GFX_SPIELER4_UP, 4 },
292 { GFX_SPIELER4_DOWN, 4 },
293 { GFX_SPIELER4_LEFT, 4 },
294 { GFX_SPIELER4_RIGHT, 4 },
295 { GFX_SPIELER4_PUSH_LEFT, 4 },
296 { GFX_SPIELER4_PUSH_RIGHT, 4 },
297 { GFX_SP_MURPHY, 1 },
298 { GFX_MURPHY_GO_LEFT, 3 },
299 { GFX_MURPHY_GO_RIGHT, 3 },
300 { GFX_MURPHY_SNAP_UP, 1 },
301 { GFX_MURPHY_SNAP_DOWN, 1 },
302 { GFX_MURPHY_SNAP_RIGHT, 1 },
303 { GFX_MURPHY_SNAP_LEFT, 1 },
304 { GFX_MURPHY_PUSH_RIGHT, 1 },
305 { GFX_MURPHY_PUSH_LEFT, 1 },
306 { GFX_GEBLUBBER, 4 },
309 { GFX_EXPLOSION, 8 },
310 { GFX_SOKOBAN_OBJEKT, 1 },
311 { GFX_FUNKELN_BLAU, 3 },
312 { GFX_FUNKELN_WEISS, 3 },
313 { GFX2_SHIELD_PASSIVE, 3 },
314 { GFX2_SHIELD_ACTIVE, 3 },
319 #endif /* TARGET_X11_NATIVE */
320 #endif /* TARGET_X11 */
324 /* initialize pixmap array for special X11 tile clipping to Pixmap 'None' */
325 for (i=0; i<NUM_TILES; i++)
326 tile_clipmask[i] = None;
328 #if defined(TARGET_X11)
329 /* This stuff is needed because X11 (XSetClipOrigin(), to be precise) is
330 often very slow when preparing a masked XCopyArea() for big Pixmaps.
331 To prevent this, create small (tile-sized) mask Pixmaps which will then
332 be set much faster with XSetClipOrigin() and speed things up a lot. */
334 clip_gc_values.graphics_exposures = False;
335 clip_gc_valuemask = GCGraphicsExposures;
336 tile_clip_gc = XCreateGC(display, window->drawable,
337 clip_gc_valuemask, &clip_gc_values);
340 for (i=0; i<NUM_BITMAPS; i++)
342 if (pix[i]->clip_mask)
344 clip_gc_values.graphics_exposures = False;
345 clip_gc_values.clip_mask = pix[i]->clip_mask;
346 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
347 pix[i]->stored_clip_gc = XCreateGC(display, window->drawable,
348 clip_gc_valuemask, &clip_gc_values);
353 #if defined(TARGET_X11_NATIVE)
356 /* create graphic context structures needed for clipping */
357 clip_gc_values.graphics_exposures = False;
358 clip_gc_valuemask = GCGraphicsExposures;
359 copy_clipmask_gc = XCreateGC(display, pix[PIX_BACK]->clip_mask,
360 clip_gc_valuemask, &clip_gc_values);
362 /* create only those clipping Pixmaps we really need */
363 for (i=0; tile_needs_clipping[i].start>=0; i++)
367 for (j=0; j<tile_needs_clipping[i].count; j++)
369 int tile = tile_needs_clipping[i].start + j;
375 getGraphicSource(graphic, &src_bitmap, &src_x, &src_y);
376 src_pixmap = src_bitmap->clip_mask;
378 tile_clipmask[tile] = XCreatePixmap(display, window->drawable,
381 XCopyArea(display, src_pixmap, tile_clipmask[tile], copy_clipmask_gc,
382 src_x, src_y, TILEX, TILEY, 0, 0);
386 XFreeGC(display, copy_clipmask_gc);
389 #endif /* TARGET_X11_NATIVE */
390 #endif /* TARGET_X11 */
393 void FreeTileClipmasks()
395 #if defined(TARGET_X11)
398 for (i=0; i<NUM_TILES; i++)
400 if (tile_clipmask[i] != None)
402 XFreePixmap(display, tile_clipmask[i]);
403 tile_clipmask[i] = None;
408 XFreeGC(display, tile_clip_gc);
412 for (i=0; i<NUM_BITMAPS; i++)
414 if (pix[i] != NULL && pix[i]->stored_clip_gc)
416 XFreeGC(display, pix[i]->stored_clip_gc);
417 pix[i]->stored_clip_gc = None;
422 #endif /* TARGET_X11 */
431 /* initialize screen properties */
432 InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
433 REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
434 InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
435 InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
436 InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
438 /* create additional image buffers for double-buffering */
439 bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
440 bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
443 pix[PIX_FONT_SMALL] = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
445 InitFontInfo(NULL, NULL, pix[PIX_FONT_SMALL], NULL);
447 bitmap_font_initial = LoadCustomImage(image_filename[PIX_FONT_SMALL]);
449 InitFontInfo(bitmap_font_initial, NULL, NULL, NULL, NULL);
452 DrawInitText(WINDOW_TITLE_STRING, 20, FC_YELLOW);
453 DrawInitText(WINDOW_SUBTITLE_STRING, 50, FC_RED);
455 DrawInitText("Loading graphics:", 120, FC_GREEN);
458 for (i=0; i<NUM_PICTURES; i++)
461 if (i != PIX_FONT_SMALL)
464 DrawInitText(image_filename[i], 150, FC_YELLOW);
466 pix[i] = LoadCustomImage(image_filename[i]);
472 InitFontInfo(pix[PIX_FONT_BIG], pix[PIX_FONT_MEDIUM], pix[PIX_FONT_SMALL],
479 void InitGfxBackground()
484 fieldbuffer = bitmap_db_field;
485 SetDrawtoField(DRAW_BACKBUFFER);
487 BlitBitmap(new_graphic_info[IMG_GLOBAL_BORDER].bitmap, backbuffer,
488 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
489 ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE);
490 ClearRectangle(bitmap_db_door, 0, 0, 3 * DXSIZE, DYSIZE + VYSIZE);
492 for (x=0; x<MAX_BUF_XSIZE; x++)
493 for (y=0; y<MAX_BUF_YSIZE; y++)
496 redraw_mask = REDRAW_ALL;
499 void ReloadCustomArtwork()
501 static char *leveldir_current_identifier = NULL;
502 static boolean last_override_level_graphics = FALSE;
503 static boolean last_override_level_sounds = FALSE;
504 static boolean last_override_level_music = FALSE;
505 /* identifier for new artwork; default: artwork configured in setup */
506 char *gfx_new_identifier = artwork.gfx_current->identifier;
507 char *snd_new_identifier = artwork.snd_current->identifier;
508 char *mus_new_identifier = artwork.mus_current->identifier;
509 boolean redraw_screen = FALSE;
511 if (leveldir_current_identifier == NULL)
512 leveldir_current_identifier = leveldir_current->identifier;
515 printf("CURRENT GFX: '%s' ['%s']\n", artwork.gfx_current->identifier,
516 leveldir_current->graphics_set);
517 printf("CURRENT LEV: '%s' / '%s'\n", leveldir_current_identifier,
518 leveldir_current->identifier);
522 printf("graphics --> '%s' ('%s')\n",
523 artwork.gfx_current_identifier, artwork.gfx_current->filename);
524 printf("sounds --> '%s' ('%s')\n",
525 artwork.snd_current_identifier, artwork.snd_current->filename);
526 printf("music --> '%s' ('%s')\n",
527 artwork.mus_current_identifier, artwork.mus_current->filename);
530 /* leveldir_current may be invalid (level group, parent link) */
531 if (!validLevelSeries(leveldir_current))
535 printf("--> '%s'\n", artwork.gfx_current_identifier);
538 /* when a new level series was selected, check if there was a change
539 in custom artwork stored in level series directory */
540 if (leveldir_current_identifier != leveldir_current->identifier)
542 char *identifier_old = leveldir_current_identifier;
543 char *identifier_new = leveldir_current->identifier;
545 if (getTreeInfoFromIdentifier(artwork.gfx_first, identifier_old) !=
546 getTreeInfoFromIdentifier(artwork.gfx_first, identifier_new))
547 gfx_new_identifier = identifier_new;
548 if (getTreeInfoFromIdentifier(artwork.snd_first, identifier_old) !=
549 getTreeInfoFromIdentifier(artwork.snd_first, identifier_new))
550 snd_new_identifier = identifier_new;
551 if (getTreeInfoFromIdentifier(artwork.mus_first, identifier_new) !=
552 getTreeInfoFromIdentifier(artwork.mus_first, identifier_new))
553 mus_new_identifier = identifier_new;
555 leveldir_current_identifier = leveldir_current->identifier;
558 /* custom level artwork configured in level series configuration file
559 always overrides custom level artwork stored in level series directory
560 and (level independant) custom artwork configured in setup menue */
561 if (leveldir_current->graphics_set != NULL)
562 gfx_new_identifier = leveldir_current->graphics_set;
563 if (leveldir_current->sounds_set != NULL)
564 snd_new_identifier = leveldir_current->sounds_set;
565 if (leveldir_current->music_set != NULL)
566 mus_new_identifier = leveldir_current->music_set;
568 if (strcmp(artwork.gfx_current_identifier, gfx_new_identifier) != 0 ||
569 last_override_level_graphics != setup.override_level_graphics)
572 printf("CHANGED GFX: '%s' -> '%s'\n",
573 artwork.gfx_current_identifier, gfx_new_identifier);
580 setLevelArtworkDir(artwork.gfx_first);
582 ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
585 for (i=0; i<NUM_PICTURES; i++)
587 DrawInitText(image_filename[i], 150, FC_YELLOW);
588 ReloadCustomImage(pix[i], image_filename[i]);
596 ReinitializeGraphics();
604 /* force redraw of (open or closed) door graphics */
605 SetDoorState(DOOR_OPEN_ALL);
606 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
610 artwork.gfx_current_identifier = gfx_new_identifier;
612 artwork.gfx_current_identifier = artwork.gfx_current->identifier;
614 last_override_level_graphics = setup.override_level_graphics;
616 redraw_screen = TRUE;
619 if (strcmp(artwork.snd_current_identifier, snd_new_identifier) != 0 ||
620 last_override_level_sounds != setup.override_level_sounds)
622 /* set artwork path to send it to the sound server process */
623 setLevelArtworkDir(artwork.snd_first);
625 InitReloadSounds(snd_new_identifier);
627 artwork.snd_current_identifier = snd_new_identifier;
628 last_override_level_sounds = setup.override_level_sounds;
630 redraw_screen = TRUE;
633 if (strcmp(artwork.mus_current_identifier, mus_new_identifier) != 0 ||
634 last_override_level_music != setup.override_level_music)
636 /* set artwork path to send it to the sound server process */
637 setLevelArtworkDir(artwork.mus_first);
639 InitReloadMusic(mus_new_identifier);
641 artwork.mus_current_identifier = mus_new_identifier;
642 last_override_level_music = setup.override_level_music;
644 redraw_screen = TRUE;
651 /* force redraw of (open or closed) door graphics */
652 SetDoorState(DOOR_OPEN_ALL);
653 CloseDoor(DOOR_CLOSE_ALL | DOOR_NO_DELAY);
657 printf("<-- '%s'\n", artwork.gfx_current_identifier);
663 FreeLevelEditorGadgets();
672 static boolean gadgets_initialized = FALSE;
674 if (gadgets_initialized)
677 CreateLevelEditorGadgets();
681 CreateScreenGadgets();
683 gadgets_initialized = TRUE;
686 void InitElementInfo()
691 /* set values to -1 to identify later as "uninitialized" values */
692 for (i=0; i<MAX_ELEMENTS; i++)
694 for (act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
696 element_info[i].graphic[act] = -1;
698 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
699 element_info[i].direction_graphic[act][dir] = -1;
703 for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
704 element_info[i].graphic[GFX_ACTION_DEFAULT] =
705 IMG_CHAR_START + (i - EL_CHAR_START);
707 for (i=EL_CUSTOM_START; i<=EL_CUSTOM_END; i++)
708 element_info[i].graphic[GFX_ACTION_DEFAULT] =
709 IMG_CUSTOM_START + (i - EL_CUSTOM_START);
712 while (element_to_graphic[i].element > -1)
714 int element = element_to_graphic[i].element;
715 int direction = element_to_graphic[i].direction;
716 int action = element_to_graphic[i].action;
717 int graphic = element_to_graphic[i].graphic;
720 action = graphics_action_mapping[action];
722 action = GFX_ACTION_DEFAULT;
726 direction = MV_DIR_BIT(direction);
728 element_info[element].direction_graphic[action][direction] = graphic;
731 element_info[element].graphic[action] = graphic;
736 /* now set all '-1' values to element specific default values */
737 for (i=0; i<MAX_ELEMENTS; i++)
739 int default_action_graphic = element_info[i].graphic[GFX_ACTION_DEFAULT];
740 int default_action_direction_graphic[NUM_MV_DIRECTIONS];
742 if (default_action_graphic == -1)
743 default_action_graphic = IMG_CHAR_QUESTION;
745 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
747 default_action_direction_graphic[dir] =
748 element_info[i].direction_graphic[GFX_ACTION_DEFAULT][dir];
750 if (default_action_direction_graphic[dir] == -1)
751 default_action_direction_graphic[dir] = default_action_graphic;
754 for (act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
756 for (dir=0; dir<NUM_MV_DIRECTIONS; dir++)
758 int default_direction_graphic = element_info[i].graphic[act];
760 /* no graphic for current action -- use default direction graphic */
761 if (default_direction_graphic == -1)
762 default_direction_graphic = default_action_direction_graphic[dir];
764 if (element_info[i].direction_graphic[act][dir] == -1)
765 element_info[i].direction_graphic[act][dir] =
766 default_direction_graphic;
769 /* no graphic for this specific action -- use default action graphic */
770 if (element_info[i].graphic[act] == -1)
771 element_info[i].graphic[act] = default_action_graphic;
776 static void InitGraphicInfo()
778 static boolean clipmasks_initialized = FALSE;
779 static int gfx_action[NUM_IMAGE_FILES];
781 int first_frame, last_frame;
783 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
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_PERFORMANCE_WORKAROUND)
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 Bitmap *src_bitmap = getBitmapFromImageID(i);
830 int num_xtiles = (src_bitmap ? src_bitmap->width : TILEX) / TILEX;
831 int num_ytiles = (src_bitmap ? src_bitmap->height * 2 / 3 : TILEY) / TILEY;
832 int *parameter = image_files[i].parameter;
834 new_graphic_info[i].bitmap = src_bitmap;
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 /* automatically determine correct number of frames, if not defined */
855 if (parameter[GFX_ARG_FRAMES] != GFX_ARG_UNDEFINED_VALUE)
856 new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES];
857 else if (parameter[GFX_ARG_XPOS] == 0 && !parameter[GFX_ARG_VERTICAL])
858 new_graphic_info[i].anim_frames = num_xtiles;
859 else if (parameter[GFX_ARG_YPOS] == 0 && parameter[GFX_ARG_VERTICAL])
860 new_graphic_info[i].anim_frames = num_ytiles;
862 new_graphic_info[i].anim_frames = 1;
864 new_graphic_info[i].anim_delay = parameter[GFX_ARG_DELAY];
865 if (new_graphic_info[i].anim_delay == 0) /* delay must be at least 1 */
866 new_graphic_info[i].anim_delay = 1;
868 /* set mode for animation frame order */
869 if (parameter[GFX_ARG_MODE_LOOP])
870 new_graphic_info[i].anim_mode = ANIM_LOOP;
871 else if (parameter[GFX_ARG_MODE_LINEAR])
872 new_graphic_info[i].anim_mode = ANIM_LINEAR;
873 else if (parameter[GFX_ARG_MODE_PINGPONG])
874 new_graphic_info[i].anim_mode = ANIM_PINGPONG;
875 else if (parameter[GFX_ARG_MODE_PINGPONG2])
876 new_graphic_info[i].anim_mode = ANIM_PINGPONG2;
877 else if (new_graphic_info[i].anim_frames > 1)
878 new_graphic_info[i].anim_mode = ANIM_LOOP;
880 new_graphic_info[i].anim_mode = ANIM_NONE;
882 /* set additional flag to play animation frames in reverse order */
883 if (parameter[GFX_ARG_MODE_REVERSE])
884 new_graphic_info[i].anim_mode |= ANIM_REVERSE;
886 /* set first frame of animation after determining animation mode */
887 new_graphic_info[i].anim_start_frame = parameter[GFX_ARG_START_FRAME];
889 /* automatically determine correct start frame, if not defined */
890 if (parameter[GFX_ARG_START_FRAME] == GFX_ARG_UNDEFINED_VALUE)
891 new_graphic_info[i].anim_start_frame = 0;
892 else if (new_graphic_info[i].anim_mode & ANIM_REVERSE)
893 new_graphic_info[i].anim_start_frame =
894 new_graphic_info[i].anim_frames - parameter[GFX_ARG_START_FRAME] - 1;
896 /* animation synchronized with global frame counter, not move position */
897 new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
899 /* set global_sync for all animations with undefined "animation action" */
900 if (parameter[GFX_ARG_GLOBAL_SYNC] == GFX_ARG_UNDEFINED_VALUE)
901 new_graphic_info[i].anim_global_sync =
902 (gfx_action[i] == GFX_ACTION_DEFAULT ? TRUE : FALSE);
904 /* "linear" animations are never globally synchronized */
905 if (parameter[GFX_ARG_MODE_LINEAR])
906 new_graphic_info[i].anim_global_sync = FALSE;
908 /* now check if no animation frames are outside of the loaded image */
910 if (new_graphic_info[i].bitmap == NULL)
911 continue; /* skip check for optional images that are undefined */
914 getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
915 if (src_x < 0 || src_y < 0 ||
916 src_x + TILEX > src_bitmap->width ||
917 src_y + TILEY > src_bitmap->height)
919 Error(ERR_RETURN, "custom artwork configuration error:");
920 Error(ERR_RETURN, "- config file: '%s'",
921 getImageConfigFilename());
922 Error(ERR_RETURN, "- config token: '%s'",
923 getTokenFromImageID(i));
924 Error(ERR_RETURN, "- image file: '%s'",
925 src_bitmap->source_filename);
926 Error(ERR_EXIT, "error: first animation frame out of bounds (%d,%d)",
930 last_frame = new_graphic_info[i].anim_frames - 1;
931 getGraphicSource(i, last_frame, &src_bitmap, &src_x, &src_y);
932 if (src_x < 0 || src_y < 0 ||
933 src_x + TILEX > src_bitmap->width ||
934 src_y + TILEY > src_bitmap->height)
936 Error(ERR_RETURN, "custom artwork configuration error:");
937 Error(ERR_RETURN, "- config file: '%s'",
938 getImageConfigFilename());
939 Error(ERR_RETURN, "- config token: '%s'",
940 getTokenFromImageID(i));
941 Error(ERR_RETURN, "- image file: '%s'",
942 src_bitmap->source_filename);
943 Error(ERR_EXIT, "error: last animation frame (%d) out of bounds (%d,%d)",
944 last_frame, src_x, src_y);
947 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
948 /* currently we need only a tile clip mask from the first frame */
949 getGraphicSource(i, first_frame, &src_bitmap, &src_x, &src_y);
951 if (copy_clipmask_gc == None)
953 clip_gc_values.graphics_exposures = False;
954 clip_gc_valuemask = GCGraphicsExposures;
955 copy_clipmask_gc = XCreateGC(display, src_bitmap->clip_mask,
956 clip_gc_valuemask, &clip_gc_values);
959 new_graphic_info[i].clip_mask =
960 XCreatePixmap(display, window->drawable, TILEX, TILEY, 1);
962 src_pixmap = src_bitmap->clip_mask;
963 XCopyArea(display, src_pixmap, new_graphic_info[i].clip_mask,
964 copy_clipmask_gc, src_x, src_y, TILEX, TILEY, 0, 0);
966 clip_gc_values.graphics_exposures = False;
967 clip_gc_values.clip_mask = new_graphic_info[i].clip_mask;
968 clip_gc_valuemask = GCGraphicsExposures | GCClipMask;
969 new_graphic_info[i].clip_gc =
970 XCreateGC(display, window->drawable, clip_gc_valuemask, &clip_gc_values);
974 #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND)
975 if (copy_clipmask_gc)
976 XFreeGC(display, copy_clipmask_gc);
979 clipmasks_initialized = TRUE;
982 static void InitSoundInfo()
984 sound_files = getCurrentSoundList();
986 /* initialize sound effect lookup table for element actions */
990 void InitElementProperties()
994 static int ep_amoebalive[] =
1001 static int ep_amoebalive_num = SIZEOF_ARRAY_INT(ep_amoebalive);
1003 static int ep_amoeboid[] =
1011 static int ep_amoeboid_num = SIZEOF_ARRAY_INT(ep_amoeboid);
1013 static int ep_schluessel[] =
1024 static int ep_schluessel_num = SIZEOF_ARRAY_INT(ep_schluessel);
1026 static int ep_pforte[] =
1045 EL_SWITCHGATE_OPENING,
1046 EL_SWITCHGATE_CLOSED,
1047 EL_SWITCHGATE_CLOSING,
1049 EL_TIMEGATE_OPENING,
1051 EL_TIMEGATE_CLOSING,
1055 EL_TUBE_VERTICAL_LEFT,
1056 EL_TUBE_VERTICAL_RIGHT,
1057 EL_TUBE_HORIZONTAL_UP,
1058 EL_TUBE_HORIZONTAL_DOWN,
1064 static int ep_pforte_num = SIZEOF_ARRAY_INT(ep_pforte);
1066 static int ep_solid[] =
1086 EL_QUICKSAND_FILLING,
1087 EL_QUICKSAND_EMPTYING,
1089 EL_MAGIC_WALL_ACTIVE,
1090 EL_MAGIC_WALL_EMPTYING,
1091 EL_MAGIC_WALL_FILLING,
1095 EL_BD_MAGIC_WALL_ACTIVE,
1096 EL_BD_MAGIC_WALL_EMPTYING,
1097 EL_BD_MAGIC_WALL_FULL,
1098 EL_BD_MAGIC_WALL_FILLING,
1099 EL_BD_MAGIC_WALL_DEAD,
1102 EL_ACIDPOOL_TOPLEFT,
1103 EL_ACIDPOOL_TOPRIGHT,
1104 EL_ACIDPOOL_BOTTOMLEFT,
1106 EL_ACIDPOOL_BOTTOMRIGHT,
1124 EL_SP_TERMINAL_ACTIVE,
1127 EL_INVISIBLE_STEELWALL,
1128 EL_INVISIBLE_STEELWALL_ACTIVE,
1130 EL_INVISIBLE_WALL_ACTIVE,
1131 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1132 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1133 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1134 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1135 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1136 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1137 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1138 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1139 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1140 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1141 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1142 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1143 EL_SWITCHGATE_SWITCH_UP,
1144 EL_SWITCHGATE_SWITCH_DOWN,
1146 EL_LIGHT_SWITCH_ACTIVE,
1148 EL_TIMEGATE_SWITCH_ACTIVE,
1149 EL_SIGN_EXCLAMATION,
1150 EL_SIGN_RADIOACTIVITY,
1161 EL_STEELWALL_SLANTED,
1166 EL_EMC_WALL_PILLAR_UPPER,
1167 EL_EMC_WALL_PILLAR_MIDDLE,
1168 EL_EMC_WALL_PILLAR_LOWER,
1194 EL_SWITCHGATE_OPENING,
1195 EL_SWITCHGATE_CLOSED,
1196 EL_SWITCHGATE_CLOSING,
1198 EL_TIMEGATE_OPENING,
1200 EL_TIMEGATE_CLOSING,
1204 EL_TUBE_VERTICAL_LEFT,
1205 EL_TUBE_VERTICAL_RIGHT,
1206 EL_TUBE_HORIZONTAL_UP,
1207 EL_TUBE_HORIZONTAL_DOWN,
1213 static int ep_solid_num = SIZEOF_ARRAY_INT(ep_solid);
1215 static int ep_massive[] =
1219 EL_ACIDPOOL_TOPLEFT,
1220 EL_ACIDPOOL_TOPRIGHT,
1221 EL_ACIDPOOL_BOTTOMLEFT,
1223 EL_ACIDPOOL_BOTTOMRIGHT,
1235 EL_INVISIBLE_STEELWALL,
1236 EL_INVISIBLE_STEELWALL_ACTIVE,
1237 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1238 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1239 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1240 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1241 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1242 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1243 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1244 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1245 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1246 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1247 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1248 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1250 EL_LIGHT_SWITCH_ACTIVE,
1251 EL_SIGN_EXCLAMATION,
1252 EL_SIGN_RADIOACTIVITY,
1263 EL_STEELWALL_SLANTED,
1286 EL_SWITCHGATE_OPENING,
1287 EL_SWITCHGATE_CLOSED,
1288 EL_SWITCHGATE_CLOSING,
1290 EL_TIMEGATE_OPENING,
1292 EL_TIMEGATE_CLOSING,
1296 EL_TUBE_VERTICAL_LEFT,
1297 EL_TUBE_VERTICAL_RIGHT,
1298 EL_TUBE_HORIZONTAL_UP,
1299 EL_TUBE_HORIZONTAL_DOWN,
1305 static int ep_massive_num = SIZEOF_ARRAY_INT(ep_massive);
1307 static int ep_slippery[] =
1321 EL_ROBOT_WHEEL_ACTIVE,
1327 EL_ACIDPOOL_TOPLEFT,
1328 EL_ACIDPOOL_TOPRIGHT,
1338 EL_STEELWALL_SLANTED,
1342 static int ep_slippery_num = SIZEOF_ARRAY_INT(ep_slippery);
1344 static int ep_enemy[] =
1357 static int ep_enemy_num = SIZEOF_ARRAY_INT(ep_enemy);
1359 static int ep_mauer[] =
1387 EL_WALL_GROWING_ACTIVE,
1406 EL_SP_TERMINAL_ACTIVE,
1409 EL_INVISIBLE_STEELWALL,
1410 EL_INVISIBLE_STEELWALL_ACTIVE,
1412 EL_INVISIBLE_WALL_ACTIVE,
1413 EL_STEELWALL_SLANTED,
1418 EL_EMC_WALL_PILLAR_UPPER,
1419 EL_EMC_WALL_PILLAR_MIDDLE,
1420 EL_EMC_WALL_PILLAR_LOWER,
1427 static int ep_mauer_num = SIZEOF_ARRAY_INT(ep_mauer);
1429 static int ep_can_fall[] =
1444 EL_BD_MAGIC_WALL_FULL,
1455 static int ep_can_fall_num = SIZEOF_ARRAY_INT(ep_can_fall);
1457 static int ep_can_smash[] =
1488 static int ep_can_smash_num = SIZEOF_ARRAY_INT(ep_can_smash);
1490 static int ep_can_change[] =
1501 static int ep_can_change_num = SIZEOF_ARRAY_INT(ep_can_change);
1503 static int ep_can_move[] =
1523 static int ep_can_move_num = SIZEOF_ARRAY_INT(ep_can_move);
1525 static int ep_could_move[] =
1535 EL_BD_BUTTERFLY_RIGHT,
1537 EL_BD_BUTTERFLY_LEFT,
1538 EL_BD_BUTTERFLY_DOWN,
1539 EL_BD_FIREFLY_RIGHT,
1548 static int ep_could_move_num = SIZEOF_ARRAY_INT(ep_could_move);
1550 static int ep_dont_touch[] =
1557 static int ep_dont_touch_num = SIZEOF_ARRAY_INT(ep_dont_touch);
1559 static int ep_dont_go_to[] =
1573 EL_SP_BUGGY_BASE_ACTIVE,
1577 static int ep_dont_go_to_num = SIZEOF_ARRAY_INT(ep_dont_go_to);
1579 static int ep_mampf2[] =
1604 static int ep_mampf2_num = SIZEOF_ARRAY_INT(ep_mampf2);
1606 static int ep_bd_element[] =
1633 static int ep_bd_element_num = SIZEOF_ARRAY_INT(ep_bd_element);
1635 static int ep_sb_element[] =
1640 EL_SOKOBAN_FIELD_EMPTY,
1641 EL_SOKOBAN_FIELD_FULL,
1643 EL_INVISIBLE_STEELWALL
1645 static int ep_sb_element_num = SIZEOF_ARRAY_INT(ep_sb_element);
1647 static int ep_gem[] =
1656 static int ep_gem_num = SIZEOF_ARRAY_INT(ep_gem);
1658 static int ep_inactive[] =
1695 EL_INVISIBLE_STEELWALL,
1703 EL_WALL_EMERALD_YELLOW,
1708 EL_SOKOBAN_FIELD_EMPTY,
1709 EL_SOKOBAN_FIELD_FULL,
1710 EL_WALL_EMERALD_RED,
1711 EL_WALL_EMERALD_PURPLE,
1712 EL_ACIDPOOL_TOPLEFT,
1713 EL_ACIDPOOL_TOPRIGHT,
1714 EL_ACIDPOOL_BOTTOMLEFT,
1716 EL_ACIDPOOL_BOTTOMRIGHT,
1720 EL_BD_MAGIC_WALL_DEAD,
1721 EL_AMOEBA_TO_DIAMOND,
1754 EL_CONVEYOR_BELT1_SWITCH_LEFT,
1755 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
1756 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
1757 EL_CONVEYOR_BELT2_SWITCH_LEFT,
1758 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
1759 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
1760 EL_CONVEYOR_BELT3_SWITCH_LEFT,
1761 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
1762 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
1763 EL_CONVEYOR_BELT4_SWITCH_LEFT,
1764 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
1765 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
1766 EL_SIGN_EXCLAMATION,
1767 EL_SIGN_RADIOACTIVITY,
1778 EL_STEELWALL_SLANTED,
1783 EL_EMC_WALL_PILLAR_UPPER,
1784 EL_EMC_WALL_PILLAR_MIDDLE,
1785 EL_EMC_WALL_PILLAR_LOWER,
1792 static int ep_inactive_num = SIZEOF_ARRAY_INT(ep_inactive);
1794 static int ep_explosive[] =
1799 EL_DYNABOMB_PLAYER1_ACTIVE,
1800 EL_DYNABOMB_PLAYER2_ACTIVE,
1801 EL_DYNABOMB_PLAYER3_ACTIVE,
1802 EL_DYNABOMB_PLAYER4_ACTIVE,
1819 static int ep_explosive_num = SIZEOF_ARRAY_INT(ep_explosive);
1821 static int ep_mampf3[] =
1832 static int ep_mampf3_num = SIZEOF_ARRAY_INT(ep_mampf3);
1834 static int ep_pushable[] =
1841 EL_SOKOBAN_FIELD_FULL,
1851 static int ep_pushable_num = SIZEOF_ARRAY_INT(ep_pushable);
1853 static int ep_player[] =
1860 static int ep_player_num = SIZEOF_ARRAY_INT(ep_player);
1862 static int ep_has_content[] =
1870 static int ep_has_content_num = SIZEOF_ARRAY_INT(ep_has_content);
1872 static int ep_eatable[] =
1879 EL_INVISIBLE_SAND_ACTIVE
1881 static int ep_eatable_num = SIZEOF_ARRAY_INT(ep_eatable);
1883 static int ep_sp_element[] =
1926 /* additional elements that appeared in newer Supaplex levels */
1928 /* more than one murphy in a level results in an inactive clone */
1931 static int ep_sp_element_num = SIZEOF_ARRAY_INT(ep_sp_element);
1933 static int ep_quick_gate[] =
1957 static int ep_quick_gate_num = SIZEOF_ARRAY_INT(ep_quick_gate);
1959 static int ep_over_player[] =
1975 EL_TUBE_VERTICAL_LEFT,
1976 EL_TUBE_VERTICAL_RIGHT,
1977 EL_TUBE_HORIZONTAL_UP,
1978 EL_TUBE_HORIZONTAL_DOWN,
1984 static int ep_over_player_num = SIZEOF_ARRAY_INT(ep_over_player);
1986 static int ep_active_bomb[] =
1989 EL_DYNABOMB_PLAYER1_ACTIVE,
1990 EL_DYNABOMB_PLAYER2_ACTIVE,
1991 EL_DYNABOMB_PLAYER3_ACTIVE,
1992 EL_DYNABOMB_PLAYER4_ACTIVE
1994 static int ep_active_bomb_num = SIZEOF_ARRAY_INT(ep_active_bomb);
1996 static int ep_belt[] =
1998 EL_CONVEYOR_BELT1_LEFT,
1999 EL_CONVEYOR_BELT1_MIDDLE,
2000 EL_CONVEYOR_BELT1_RIGHT,
2001 EL_CONVEYOR_BELT2_LEFT,
2002 EL_CONVEYOR_BELT2_MIDDLE,
2003 EL_CONVEYOR_BELT2_RIGHT,
2004 EL_CONVEYOR_BELT3_LEFT,
2005 EL_CONVEYOR_BELT3_MIDDLE,
2006 EL_CONVEYOR_BELT3_RIGHT,
2007 EL_CONVEYOR_BELT4_LEFT,
2008 EL_CONVEYOR_BELT4_MIDDLE,
2009 EL_CONVEYOR_BELT4_RIGHT,
2011 static int ep_belt_num = SIZEOF_ARRAY_INT(ep_belt);
2013 static int ep_belt_active[] =
2015 EL_CONVEYOR_BELT1_LEFT_ACTIVE,
2016 EL_CONVEYOR_BELT1_MIDDLE_ACTIVE,
2017 EL_CONVEYOR_BELT1_RIGHT_ACTIVE,
2018 EL_CONVEYOR_BELT2_LEFT_ACTIVE,
2019 EL_CONVEYOR_BELT2_MIDDLE_ACTIVE,
2020 EL_CONVEYOR_BELT2_RIGHT_ACTIVE,
2021 EL_CONVEYOR_BELT3_LEFT_ACTIVE,
2022 EL_CONVEYOR_BELT3_MIDDLE_ACTIVE,
2023 EL_CONVEYOR_BELT3_RIGHT_ACTIVE,
2024 EL_CONVEYOR_BELT4_LEFT_ACTIVE,
2025 EL_CONVEYOR_BELT4_MIDDLE_ACTIVE,
2026 EL_CONVEYOR_BELT4_RIGHT_ACTIVE,
2028 static int ep_belt_active_num = SIZEOF_ARRAY_INT(ep_belt_active);
2030 static int ep_belt_switch[] =
2032 EL_CONVEYOR_BELT1_SWITCH_LEFT,
2033 EL_CONVEYOR_BELT1_SWITCH_MIDDLE,
2034 EL_CONVEYOR_BELT1_SWITCH_RIGHT,
2035 EL_CONVEYOR_BELT2_SWITCH_LEFT,
2036 EL_CONVEYOR_BELT2_SWITCH_MIDDLE,
2037 EL_CONVEYOR_BELT2_SWITCH_RIGHT,
2038 EL_CONVEYOR_BELT3_SWITCH_LEFT,
2039 EL_CONVEYOR_BELT3_SWITCH_MIDDLE,
2040 EL_CONVEYOR_BELT3_SWITCH_RIGHT,
2041 EL_CONVEYOR_BELT4_SWITCH_LEFT,
2042 EL_CONVEYOR_BELT4_SWITCH_MIDDLE,
2043 EL_CONVEYOR_BELT4_SWITCH_RIGHT,
2045 static int ep_belt_switch_num = SIZEOF_ARRAY_INT(ep_belt_switch);
2047 static int ep_tube[] =
2052 EL_TUBE_VERTICAL_LEFT,
2053 EL_TUBE_VERTICAL_RIGHT,
2054 EL_TUBE_HORIZONTAL_UP,
2055 EL_TUBE_HORIZONTAL_DOWN,
2061 static int ep_tube_num = SIZEOF_ARRAY_INT(ep_tube);
2063 static long ep1_bit[] =
2097 static long ep2_bit[] =
2104 static int *ep1_array[] =
2138 static int *ep2_array[] =
2145 static int *ep1_num[] =
2172 &ep_has_content_num,
2176 &ep_over_player_num,
2179 static int *ep2_num[] =
2182 &ep_belt_active_num,
2183 &ep_belt_switch_num,
2186 static int num_properties1 = SIZEOF_ARRAY(ep1_num, int *);
2187 static int num_properties2 = SIZEOF_ARRAY(ep2_num, int *);
2189 for (i=0; i<MAX_ELEMENTS; i++)
2191 Elementeigenschaften1[i] = 0;
2192 Elementeigenschaften2[i] = 0;
2195 for (i=0; i<num_properties1; i++)
2196 for (j=0; j<*(ep1_num[i]); j++)
2197 Elementeigenschaften1[(ep1_array[i])[j]] |= ep1_bit[i];
2198 for (i=0; i<num_properties2; i++)
2199 for (j=0; j<*(ep2_num[i]); j++)
2200 Elementeigenschaften2[(ep2_array[i])[j]] |= ep2_bit[i];
2202 for (i=EL_CHAR_START; i<=EL_CHAR_END; i++)
2203 Elementeigenschaften1[i] |= (EP_BIT_CHAR | EP_BIT_INACTIVE);
2206 void Execute_Command(char *command)
2208 if (strcmp(command, "print graphicsinfo.conf") == 0)
2212 printf("# You can configure additional/alternative image files here.\n");
2213 printf("# (The images below are default and therefore commented out.)\n");
2215 printf("%s\n", getFormattedSetupEntry("name", "Classic Graphics"));
2217 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2220 for (i=0; image_config[i].token != NULL; i++)
2222 getFormattedSetupEntry(image_config[i].token,
2223 image_config[i].value));
2227 else if (strcmp(command, "print soundsinfo.conf") == 0)
2231 printf("# You can configure additional/alternative sound files here.\n");
2232 printf("# (The sounds below are default and therefore commented out.)\n");
2234 printf("%s\n", getFormattedSetupEntry("name", "Classic Sounds"));
2236 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2239 for (i=0; sound_config[i].token != NULL; i++)
2241 getFormattedSetupEntry(sound_config[i].token,
2242 sound_config[i].value));
2246 else if (strcmp(command, "print musicinfo.conf") == 0)
2248 printf("# (Currently only \"name\" and \"sort_priority\" recognized.)\n");
2250 printf("%s\n", getFormattedSetupEntry("name", "Classic Music"));
2252 printf("%s\n", getFormattedSetupEntry("sort_priority", "100"));
2256 else if (strncmp(command, "dump tape ", 10) == 0)
2258 char *filename = &command[10];
2260 if (access(filename, F_OK) != 0)
2261 Error(ERR_EXIT, "cannot open file '%s'", filename);
2263 LoadTapeFromFilename(filename);
2268 else if (strncmp(command, "autoplay ", 9) == 0)
2270 char *str_copy = getStringCopy(&command[9]);
2271 char *str_ptr = strchr(str_copy, ' ');
2273 global.autoplay_leveldir = str_copy;
2274 global.autoplay_level_nr = -1;
2276 if (str_ptr != NULL)
2278 *str_ptr++ = '\0'; /* terminate leveldir string */
2279 global.autoplay_level_nr = atoi(str_ptr); /* get level_nr value */
2284 Error(ERR_EXIT_HELP, "unrecognized command '%s'", command);
2288 void CloseAllAndExit(int exit_value)
2293 CloseAudio(); /* called after freeing sounds (needed for SDL) */
2296 FreeTileClipmasks();
2298 if (bitmap_font_initial)
2299 FreeBitmap(bitmap_font_initial);
2301 CloseVideoDisplay();
2302 ClosePlatformDependantStuff();