rnd-20070428-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 28 Apr 2007 02:11:11 +0000 (04:11 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:55:50 +0000 (10:55 +0200)
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/init.c
src/main.c
src/main.h
src/screens.c
src/tools.c
src/tools.h

index 139b61b413c97549e0d113821ad3a01fec8fb904..908700cd252ea18e29bd7cd37c935a1b82db700c 100644 (file)
@@ -5289,16 +5289,19 @@ struct ConfigInfo image_config[] =
   { "init.busy.align",                         "center"                },
   { "init.busy.valign",                                "middle"                },
 
-  { "menu.enter_menu.fade_mode",               "none"                  },
+  { "menu.enter_menu.fade_mode",               "crossfade"             },
   { "menu.enter_menu.fade_delay",              "250"                   },
   { "menu.enter_menu.post_delay",              "125"                   },
-  { "menu.leave_menu.fade_mode",               "none"                  },
+  { "menu.leave_menu.fade_mode",               "crossfade"             },
   { "menu.leave_menu.fade_delay",              "250"                   },
   { "menu.leave_menu.post_delay",              "125"                   },
-  { "menu.enter_screen.fade_mode",             "fade"                  },
+  { "menu.enter_screen.fade_mode",             "crossfade"             },
   { "menu.enter_screen.fade_delay",            "250"                   },
   { "menu.enter_screen.post_delay",            "125"                   },
-  { "menu.leave_screen.fade_mode",             "fade"                  },
+  { "menu.next_screen.fade_mode",              "crossfade"             },
+  { "menu.next_screen.fade_delay",             "250"                   },
+  { "menu.next_screen.post_delay",             "125"                   },
+  { "menu.leave_screen.fade_mode",             "crossfade"             },
   { "menu.leave_screen.fade_delay",            "250"                   },
   { "menu.leave_screen.post_delay",            "125"                   },
   { "menu.enter_screen.SCORES.fade_mode",      ARG_DEFAULT             },
index 8afe89ad3ffcdf66c8cdaa45d3e65fabcebd0485..4a6389ad826491c77359b4429925038f8c73162b 100644 (file)
@@ -1016,6 +1016,18 @@ struct TokenIntPtrInfo image_config_vars[] =
     "menu.enter_screen.post_delay",
     &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].post_delay
   },
+  {
+    "menu.next_screen.fade_mode",
+    &menu.next_screen.fade_mode
+  },
+  {
+    "menu.next_screen.fade_delay",
+    &menu.next_screen.fade_delay
+  },
+  {
+    "menu.next_screen.post_delay",
+    &menu.next_screen.post_delay
+  },
   {
     "menu.leave_screen.fade_mode",
     &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].fade_mode
index 7d91c5cef6e92187ad4afbd10a71b2f424c674e6..655a6ba8949d5d83cf2f2b543f581f3736168ab5 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-04-27 20:23"
+#define COMPILE_DATE_STRING "2007-04-28 04:06"
index 7a70610eda39e90583ff2840afe54990699eacd3..9ecc59c389c35275d42875619ffd33f0b7e16239 100644 (file)
@@ -39,7 +39,7 @@
 #define CONFIG_TOKEN_GLOBAL_BUSY               "global.busy"
 
 #define DEBUG_PRINT_INIT_TIMESTAMPS            TRUE
-#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH      3
+#define DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH      1
 
 
 static struct FontBitmapInfo font_initial[NUM_INITIAL_FONTS];
@@ -89,48 +89,72 @@ static int copy_properties[][5] =
 };
 
 
-static void print_init_timestamp(char *message)
+static void print_timestamp_ext(char *message, char *mode)
 {
 #if DEBUG
 #if DEBUG_PRINT_INIT_TIMESTAMPS
+  static char *debug_message = NULL;
   static char *last_message = NULL;
   static int counter_nr = 0;
   int max_depth = DEBUG_PRINT_INIT_TIMESTAMPS_DEPTH;
 
-  if (strPrefix(message, "INIT"))
+  checked_free(debug_message);
+  debug_message = getStringCat3(mode, " ", message);
+
+  if (strEqual(mode, "INIT"))
   {
+    debug_print_timestamp(counter_nr, NULL);
+
     if (counter_nr + 1 < max_depth)
-    {
-      debug_print_timestamp(counter_nr, NULL);
-      debug_print_timestamp(counter_nr, message);
-    }
+      debug_print_timestamp(counter_nr, debug_message);
 
     counter_nr++;
 
     debug_print_timestamp(counter_nr, NULL);
   }
-  else if (strPrefix(message, "DONE"))
+  else if (strEqual(mode, "DONE"))
   {
     counter_nr--;
 
     if (counter_nr + 1 < max_depth ||
        (counter_nr == 0 && max_depth == 1))
     {
-      last_message = &message[4];
+      last_message = message;
+
+      if (counter_nr == 0 && max_depth == 1)
+      {
+       checked_free(debug_message);
+       debug_message = getStringCat3("TIME", " ", message);
+      }
 
-      debug_print_timestamp(counter_nr, message);
+      debug_print_timestamp(counter_nr, debug_message);
     }
   }
-  else if (!strPrefix(message, "TIME") ||
-          !strSuffix(message, last_message))
+  else if (!strEqual(mode, "TIME") ||
+          !strEqual(message, last_message))
   {
     if (counter_nr < max_depth)
-      debug_print_timestamp(counter_nr, message);
+      debug_print_timestamp(counter_nr, debug_message);
   }
 #endif
 #endif
 }
 
+static void print_timestamp_init(char *message)
+{
+  print_timestamp_ext(message, "INIT");
+}
+
+static void print_timestamp_time(char *message)
+{
+  print_timestamp_ext(message, "TIME");
+}
+
+static void print_timestamp_done(char *message)
+{
+  print_timestamp_ext(message, "DONE");
+}
+
 void DrawInitAnim()
 {
   struct GraphicInfo *graphic_info_last = graphic_info;
@@ -140,6 +164,9 @@ void DrawInitAnim()
   int sync_frame = FrameCounter;
   int x, y;
 
+  if (game_status != GAME_MODE_LOADING)
+    return;
+
   if (anim_initial.bitmap == NULL || window == NULL)
     return;
 
@@ -289,6 +316,7 @@ static int getFontBitmapID(int font_nr)
 {
   int special = -1;
 
+  /* (special case: do not use special font for GAME_MODE_LOADING) */
   if (game_status >= GAME_MODE_TITLE_INITIAL &&
       game_status <= GAME_MODE_PSEUDO_PREVIEW)
     special = game_status;
@@ -2343,36 +2371,36 @@ static void InitMusicInfo()
 
 static void ReinitializeGraphics()
 {
-  print_init_timestamp("INIT ReinitializeGraphics");
+  print_timestamp_init("ReinitializeGraphics");
 
   InitGraphicInfo();                   /* graphic properties mapping */
-  print_init_timestamp("TIME InitGraphicInfo");
+  print_timestamp_time("InitGraphicInfo");
   InitElementGraphicInfo();            /* element game graphic mapping */
-  print_init_timestamp("TIME InitElementGraphicInfo");
+  print_timestamp_time("InitElementGraphicInfo");
   InitElementSpecialGraphicInfo();     /* element special graphic mapping */
-  print_init_timestamp("TIME InitElementSpecialGraphicInfo");
+  print_timestamp_time("InitElementSpecialGraphicInfo");
 
   InitElementSmallImages();            /* scale elements to all needed sizes */
-  print_init_timestamp("TIME InitElementSmallImages");
+  print_timestamp_time("InitElementSmallImages");
   InitScaledImages();                  /* scale all other images, if needed */
-  print_init_timestamp("TIME InitScaledImages");
+  print_timestamp_time("InitScaledImages");
   InitFontGraphicInfo();               /* initialize text drawing functions */
-  print_init_timestamp("TIME InitFontGraphicInfo");
+  print_timestamp_time("InitFontGraphicInfo");
 
   InitGraphicInfo_EM();                        /* graphic mapping for EM engine */
-  print_init_timestamp("TIME InitGraphicInfo_EM");
+  print_timestamp_time("InitGraphicInfo_EM");
 
   SetMainBackgroundImage(IMG_BACKGROUND);
-  print_init_timestamp("TIME SetMainBackgroundImage");
+  print_timestamp_time("SetMainBackgroundImage");
   SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
-  print_init_timestamp("TIME SetDoorBackgroundImage");
+  print_timestamp_time("SetDoorBackgroundImage");
 
   InitGadgets();
-  print_init_timestamp("TIME InitGadgets");
+  print_timestamp_time("InitGadgets");
   InitToons();
-  print_init_timestamp("TIME InitToons");
+  print_timestamp_time("InitToons");
 
-  print_init_timestamp("DONE ReinitializeGraphics");
+  print_timestamp_done("ReinitializeGraphics");
 }
 
 static void ReinitializeSounds()
@@ -5517,7 +5545,7 @@ void InitLevelArtworkInfo()
 
 static void InitImages()
 {
-  print_init_timestamp("INIT InitImages");
+  print_timestamp_init("InitImages");
 
   setLevelArtworkDir(artwork.gfx_first);
 
@@ -5533,31 +5561,31 @@ static void InitImages()
   UPDATE_BUSY_STATE();
 
   ReloadCustomImages();
-  print_init_timestamp("TIME ReloadCustomImages");
+  print_timestamp_time("ReloadCustomImages");
 
   UPDATE_BUSY_STATE();
 
   LoadCustomElementDescriptions();
-  print_init_timestamp("TIME LoadCustomElementDescriptions");
+  print_timestamp_time("LoadCustomElementDescriptions");
 
   UPDATE_BUSY_STATE();
 
   LoadMenuDesignSettings();
-  print_init_timestamp("TIME LoadMenuDesignSettings");
+  print_timestamp_time("LoadMenuDesignSettings");
 
   UPDATE_BUSY_STATE();
 
   ReinitializeGraphics();
-  print_init_timestamp("TIME ReinitializeGraphics");
+  print_timestamp_time("ReinitializeGraphics");
 
   UPDATE_BUSY_STATE();
 
-  print_init_timestamp("DONE InitImages");
+  print_timestamp_done("InitImages");
 }
 
 static void InitSound(char *identifier)
 {
-  print_init_timestamp("INIT InitSound");
+  print_timestamp_init("InitSound");
 
   if (identifier == NULL)
     identifier = artwork.snd_current->identifier;
@@ -5566,17 +5594,17 @@ static void InitSound(char *identifier)
   setLevelArtworkDir(artwork.snd_first);
 
   InitReloadCustomSounds(identifier);
-  print_init_timestamp("TIME InitReloadCustomSounds");
+  print_timestamp_time("InitReloadCustomSounds");
 
   ReinitializeSounds();
-  print_init_timestamp("TIME ReinitializeSounds");
+  print_timestamp_time("ReinitializeSounds");
 
-  print_init_timestamp("DONE InitSound");
+  print_timestamp_done("InitSound");
 }
 
 static void InitMusic(char *identifier)
 {
-  print_init_timestamp("INIT InitMusic");
+  print_timestamp_init("InitMusic");
 
   if (identifier == NULL)
     identifier = artwork.mus_current->identifier;
@@ -5585,12 +5613,12 @@ static void InitMusic(char *identifier)
   setLevelArtworkDir(artwork.mus_first);
 
   InitReloadCustomMusic(identifier);
-  print_init_timestamp("TIME InitReloadCustomMusic");
+  print_timestamp_time("InitReloadCustomMusic");
 
   ReinitializeMusic();
-  print_init_timestamp("TIME ReinitializeMusic");
+  print_timestamp_time("ReinitializeMusic");
 
-  print_init_timestamp("DONE InitMusic");
+  print_timestamp_done("InitMusic");
 }
 
 void InitNetworkServer()
@@ -5731,6 +5759,7 @@ static char *getNewArtworkIdentifier(int type)
 
 void ReloadCustomArtwork(int force_reload)
 {
+  int last_game_status = game_status;  /* save current game status */
   char *gfx_new_identifier;
   char *snd_new_identifier;
   char *mus_new_identifier;
@@ -5752,10 +5781,24 @@ void ReloadCustomArtwork(int force_reload)
   if (!reload_needed)
     return;
 
-  print_init_timestamp("INIT ReloadCustomArtwork");
+  print_timestamp_init("ReloadCustomArtwork");
 
+  game_status = GAME_MODE_LOADING;
+
+  FadeOut(REDRAW_ALL);
+
+#if 1
+  ClearRectangle(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE);
+#else
   ClearRectangle(window, 0, 0, WIN_XSIZE, WIN_YSIZE);
-  print_init_timestamp("TIME ClearRectangle");
+#endif
+  print_timestamp_time("ClearRectangle");
+
+  printf("::: fading in ... %d\n", fading.fade_mode);
+
+  FadeIn(REDRAW_ALL);
+
+  printf("::: done\n");
 
   if (gfx_new_identifier != NULL || force_reload_gfx)
   {
@@ -5768,21 +5811,27 @@ void ReloadCustomArtwork(int force_reload)
 #endif
 
     InitImages();
-    print_init_timestamp("TIME InitImages");
+    print_timestamp_time("InitImages");
   }
 
   if (snd_new_identifier != NULL || force_reload_snd)
   {
     InitSound(snd_new_identifier);
-    print_init_timestamp("TIME InitSound");
+    print_timestamp_time("InitSound");
   }
 
   if (mus_new_identifier != NULL || force_reload_mus)
   {
     InitMusic(mus_new_identifier);
-    print_init_timestamp("TIME InitMusic");
+    print_timestamp_time("InitMusic");
   }
 
+  game_status = last_game_status;      /* restore current game status */
+
+  printf("::: FadeOut @ ReloadCustomArtwork ...\n");
+  FadeOut(REDRAW_ALL);
+  printf("::: FadeOut @ ReloadCustomArtwork done\n");
+
   RedrawBackground();
 
   /* force redraw of (open or closed) door graphics */
@@ -5792,7 +5841,7 @@ void ReloadCustomArtwork(int force_reload)
 #if 1
 #if 1
   FadeSetEnterScreen();
-  // FadeSkipNextFadeOut();
+  FadeSkipNextFadeOut();
   // FadeSetDisabled();
 #else
   FadeSkipNext();
@@ -5801,7 +5850,7 @@ void ReloadCustomArtwork(int force_reload)
   fading = fading_none;
 #endif
 
-  print_init_timestamp("DONE ReloadCustomArtwork");
+  print_timestamp_done("ReloadCustomArtwork");
 }
 
 void KeyboardAutoRepeatOffUnlessAutoplay()
@@ -5817,7 +5866,9 @@ void KeyboardAutoRepeatOffUnlessAutoplay()
 
 void OpenAll()
 {
-  print_init_timestamp("INIT OpenAll");
+  print_timestamp_init("OpenAll");
+
+  game_status = GAME_MODE_LOADING;
 
   InitGlobal();                        /* initialize some global variables */
 
@@ -5850,7 +5901,7 @@ void OpenAll()
 
   InitJoysticks();
 
-  print_init_timestamp("TIME [pre-video]");
+  print_timestamp_time("[pre-video]");
 
   InitVideoDisplay();
   InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);
@@ -5860,26 +5911,26 @@ void OpenAll()
   InitElementPropertiesStatic();
   InitElementPropertiesEngine(GAME_VERSION_ACTUAL);
 
-  print_init_timestamp("TIME [post-video]");
+  print_timestamp_time("[post-video]");
 
   InitGfx();
 
-  print_init_timestamp("TIME InitGfx");
+  print_timestamp_time("InitGfx");
 
   InitLevelInfo();
-  print_init_timestamp("TIME InitLevelInfo");
+  print_timestamp_time("InitLevelInfo");
 
   InitLevelArtworkInfo();
-  print_init_timestamp("TIME InitLevelArtworkInfo");
+  print_timestamp_time("InitLevelArtworkInfo");
 
   InitImages();                        /* needs to know current level directory */
-  print_init_timestamp("TIME InitImages");
+  print_timestamp_time("InitImages");
 
   InitSound(NULL);             /* needs to know current level directory */
-  print_init_timestamp("TIME InitSound");
+  print_timestamp_time("InitSound");
 
   InitMusic(NULL);             /* needs to know current level directory */
-  print_init_timestamp("TIME InitMusic");
+  print_timestamp_time("InitMusic");
 
   InitGfxBackground();
 
@@ -5909,9 +5960,9 @@ void OpenAll()
   fading = fading_none;
 #endif
 
-  print_init_timestamp("TIME [post-artwork]");
+  print_timestamp_time("[post-artwork]");
 
-  print_init_timestamp("DONE OpenAll");
+  print_timestamp_done("OpenAll");
 
   DrawMainMenu();
 
index 4971e8c7c13a25f3fc173df6417feb6c6d9925b0..971ba9db160aea7d629599cede581215487335ee 100644 (file)
@@ -5415,6 +5415,7 @@ struct ElementDirectionInfo element_direction_info[NUM_DIRECTIONS_FULL + 1] =
 struct SpecialSuffixInfo special_suffix_info[NUM_SPECIAL_GFX_ARGS + 1 + 1] =
 {
   { ".[DEFAULT]",              GFX_SPECIAL_ARG_DEFAULT,                },
+  { ".LOADING",                        GFX_SPECIAL_ARG_LOADING,                },
   { ".TITLE_INITIAL",          GFX_SPECIAL_ARG_TITLE_INITIAL,          },
   { ".TITLE",                  GFX_SPECIAL_ARG_TITLE,                  },
   { ".MAIN",                   GFX_SPECIAL_ARG_MAIN,                   },
index 7e5ff0dfd85576818dd1419700137c3e64623620..2866d903601970bb802d24762d3987058d733751 100644 (file)
 
 /* values for special image configuration suffixes (must match game mode) */
 #define GFX_SPECIAL_ARG_DEFAULT                0
-#define GFX_SPECIAL_ARG_TITLE_INITIAL  1
-#define GFX_SPECIAL_ARG_TITLE          2
-#define GFX_SPECIAL_ARG_MAIN           3
-#define GFX_SPECIAL_ARG_LEVELS         4
-#define GFX_SPECIAL_ARG_SCORES         5
-#define GFX_SPECIAL_ARG_EDITOR         6
-#define GFX_SPECIAL_ARG_INFO           7
-#define GFX_SPECIAL_ARG_SETUP          8
-#define GFX_SPECIAL_ARG_PLAYING                9
-#define GFX_SPECIAL_ARG_DOOR           10
-#define GFX_SPECIAL_ARG_PANEL          11
-#define GFX_SPECIAL_ARG_PREVIEW                12
-#define GFX_SPECIAL_ARG_CRUMBLED       13
-
-#define NUM_SPECIAL_GFX_ARGS           14
+#define GFX_SPECIAL_ARG_LOADING                1
+#define GFX_SPECIAL_ARG_TITLE_INITIAL  2
+#define GFX_SPECIAL_ARG_TITLE          3
+#define GFX_SPECIAL_ARG_MAIN           4
+#define GFX_SPECIAL_ARG_LEVELS         5
+#define GFX_SPECIAL_ARG_SCORES         6
+#define GFX_SPECIAL_ARG_EDITOR         7
+#define GFX_SPECIAL_ARG_INFO           8
+#define GFX_SPECIAL_ARG_SETUP          9
+#define GFX_SPECIAL_ARG_PLAYING                10
+#define GFX_SPECIAL_ARG_DOOR           11
+#define GFX_SPECIAL_ARG_PANEL          12
+#define GFX_SPECIAL_ARG_PREVIEW                13
+#define GFX_SPECIAL_ARG_CRUMBLED       14
+
+#define NUM_SPECIAL_GFX_ARGS           15
 
 /* these additional definitions are currently only used for draw offsets */
 #define GFX_SPECIAL_ARG_INFO_MAIN      0
 
 /* values for game_status (must match special image configuration suffixes) */
 #define GAME_MODE_DEFAULT              0
-#define GAME_MODE_TITLE_INITIAL                1
-#define GAME_MODE_TITLE                        2
-#define GAME_MODE_MAIN                 3
-#define GAME_MODE_LEVELS               4
-#define GAME_MODE_SCORES               5
-#define GAME_MODE_EDITOR               6
-#define GAME_MODE_INFO                 7
-#define GAME_MODE_SETUP                        8
-#define GAME_MODE_PLAYING              9
-#define GAME_MODE_PSEUDO_DOOR          10
-#define GAME_MODE_PSEUDO_PANEL         11
-#define GAME_MODE_PSEUDO_PREVIEW       12
-#define GAME_MODE_PSEUDO_CRUMBLED      13
+#define GAME_MODE_LOADING              1
+#define GAME_MODE_TITLE_INITIAL                2
+#define GAME_MODE_TITLE                        3
+#define GAME_MODE_MAIN                 4
+#define GAME_MODE_LEVELS               5
+#define GAME_MODE_SCORES               6
+#define GAME_MODE_EDITOR               7
+#define GAME_MODE_INFO                 8
+#define GAME_MODE_SETUP                        9
+#define GAME_MODE_PLAYING              10
+#define GAME_MODE_PSEUDO_DOOR          11
+#define GAME_MODE_PSEUDO_PANEL         12
+#define GAME_MODE_PSEUDO_PREVIEW       13
+#define GAME_MODE_PSEUDO_CRUMBLED      14
 
 /* there are no special config file suffixes for these modes */
-#define GAME_MODE_PSEUDO_TYPENAME      14
-#define GAME_MODE_QUIT                 15
+#define GAME_MODE_PSEUDO_TYPENAME      15
+#define GAME_MODE_QUIT                 16
 
 /* special definitions currently only used for custom artwork configuration */
 #define MUSIC_PREFIX_BACKGROUND                0
@@ -2152,6 +2154,7 @@ struct MenuInfo
   struct TitleFadingInfo leave_menu;
   struct TitleFadingInfo enter_screen[NUM_SPECIAL_GFX_ARGS];
   struct TitleFadingInfo leave_screen[NUM_SPECIAL_GFX_ARGS];
+  struct TitleFadingInfo next_screen;
 
   int sound[NUM_SPECIAL_GFX_ARGS];
   int music[NUM_SPECIAL_GFX_ARGS];
index 527fbd055ac26f701447e875973bb3fc041bd239..a29c3d65e8755d7a97410f19ce7763817f0af18d 100644 (file)
@@ -1280,39 +1280,6 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
 {
   static LevelDirTree *leveldir_last_valid = NULL;
   boolean levelset_has_changed = FALSE;
-#if 0
-  boolean local_team_mode = (!options.network && setup.team_mode);
-  char *name_text = (local_team_mode ? "Team:" : "Name:");
-  int name_width, level_width;
-#endif
-#if 0
-  int i;
-#endif
-
-#if 0
-  /* !!! CHANGE THIS !!! */
-  title = title_default;
-#endif
-
-#if 0
-  {
-    int graphicA = element_info[EL_EM_DYNAMITE_ACTIVE].special_graphic[GFX_SPECIAL_ARG_EDITOR];
-    int graphicB = element_info[EL_EM_DYNAMITE_ACTIVE].special_graphic[GFX_SPECIAL_ARG_PANEL];
-    int graphic1 = element_info[EL_CONVEYOR_BELT_1_MIDDLE].special_graphic[GFX_SPECIAL_ARG_EDITOR];
-    int graphic2 = element_info[EL_CONVEYOR_BELT_1_MIDDLE_ACTIVE].special_graphic[GFX_SPECIAL_ARG_EDITOR];
-
-    printf("::: %d [%d] -> %d, %d [%d, %d]\n",
-          graphicA, graphicB,
-          graphic_info[graphicA].src_x,
-          graphic_info[graphicA].src_y,
-          graphic1, graphic2);
-  }
-#endif
-
-#if 0
-  printf("::: %d, %d\n", fading.anim_mode == ANIM_CROSSFADE,
-        redraw_mask == REDRAW_ALL);
-#endif
 
   FadeSetLeaveScreen();
 
@@ -1343,12 +1310,12 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
     return;
   }
 
-#if 1
+#if 0
   FadeOut(redraw_mask);
-#endif
 
   /* needed if last screen was the editor screen */
   UndrawSpecialEditorDoor();
+#endif
 
   /* needed if last screen was the setup screen and fullscreen state changed */
   ToggleFullscreenIfNeeded();
@@ -1366,16 +1333,19 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
   /* needed if last screen (level choice) changed graphics, sounds or music */
   ReloadCustomArtwork(0);
 
-#if defined(TARGET_SDL)
-  SetDrawtoField(DRAW_BACKBUFFER);
+#if 1
+  printf("::: FadeOut @ DrawMainMenuExt ...\n");
+  FadeOut(redraw_mask);
+  printf("::: FadeOut @ DrawMainMenuExt done\n");
+
+  /* needed if last screen was the editor screen */
+  UndrawSpecialEditorDoor();
 #endif
 
-#if 0
-  if (levelset_has_changed)
-    fading = title_default;
+#if defined(TARGET_SDL)
+  SetDrawtoField(DRAW_BACKBUFFER);
 #endif
 
-#if 1
   if (CheckTitleScreen(levelset_has_changed))
   {
     game_status = GAME_MODE_TITLE;
@@ -1385,24 +1355,6 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
     return;
   }
 
-#else
-
-  if (setup.show_titlescreen &&
-      ((levelset_has_changed &&
-       (graphic_info[IMG_TITLESCREEN_1].bitmap != NULL ||
-        getLevelSetMessageFilename(1, FALSE) != NULL)) ||
-       (show_title_initial &&
-       (graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap != NULL ||
-        getLevelSetMessageFilename(1, TRUE) != NULL))))
-  {
-    game_status = GAME_MODE_TITLE;
-
-    DrawTitleScreen();
-
-    return;
-  }
-#endif
-
   /* level_nr may have been set to value over handicap with level editor */
   if (setup.handicap && level_nr > leveldir_current->handicap_level)
     level_nr = leveldir_current->handicap_level;
@@ -1418,97 +1370,19 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
 #if 1
   if (redraw_mask == REDRAW_ALL)
   {
-#if 0
-    int door_state = GetDoorState();
-#endif
+    // int door_state = GetDoorState();
 
     RedrawBackground();
 
     // OpenDoor(door_state | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-
-#if 0
-#if 1
-    OpenDoor(DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-#else
-    OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
-#endif
-#endif
   }
 #endif
 
   ClearWindow();
 
-#if 1
   InitializeMainControls();
 
-#if 1
   DrawCursorAndText_Main(-1, FALSE);
-#else
-  for (i = 0; main_controls[i].nr != -1; i++)
-  {
-    struct MenuPosInfo *pos_button = main_controls[i].pos_button;
-    struct MenuPosInfo *pos_text   = main_controls[i].pos_text;
-    struct MenuPosInfo *pos_input  = main_controls[i].pos_input;
-    char *text                     = main_controls[i].text;
-    char *input                    = main_controls[i].input;
-    int button_graphic             = main_controls[i].button_graphic;
-    int font_text                  = main_controls[i].font_text;
-    int font_input                 = main_controls[i].font_input;
-
-    if (pos_button != NULL)
-      DrawGraphicThruMaskExt(drawto, mSX + pos_button->x, mSY + pos_button->y,
-                            button_graphic, 0);
-
-    if (pos_text != NULL && text != NULL)
-      DrawText(mSX + pos_text->x, mSY + pos_text->y, text, font_text);
-
-    if (pos_input != NULL && input != NULL)
-      DrawText(mSX + pos_input->x, mSY + pos_input->y, input, font_input);
-  }
-#endif
-
-#else
-
-  DrawHeadline();
-
-  DrawText(mSX + 32, mSY + 2 * 32, name_text,       FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 3 * 32, "Levelset",      FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 4 * 32, "Hall Of Fame",  FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 5 * 32, "Level Creator", FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 6 * 32, "Info Screen",   FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 7 * 32, "Start Game",    FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 8 * 32, "Setup",         FONT_MENU_1);
-  DrawText(mSX + 32, mSY + 9 * 32, "Quit",          FONT_MENU_1);
-
-  /* calculated after (possible) reload of custom artwork */
-  name_width  = getTextWidth(name_text,  FONT_MENU_1);
-  level_width = 9 * 32;
-
-  DrawText(mSX + 32 + name_width, mSY + 2 * 32, setup.player_name,
-          FONT_INPUT_1);
-
-  DrawText(mSX + getCurrentLevelTextPos() * 32, mSY + 3 * 32,
-          int2str(level_nr, 3), FONT_VALUE_1);
-
-  {
-    int text_height = getFontHeight(FONT_TEXT_3);
-    int xpos = getLevelRangeTextPos() * 32 + 8;
-    int ypos2 = 3 * 32 + 16;
-    int ypos1 = ypos2 - text_height;
-
-    DrawTextF(mSX - SX + xpos, mSY - SY + ypos1, FONT_TEXT_3,
-             "%03d", leveldir_current->first_level);
-    DrawTextF(mSX - SX + xpos, mSY - SY + ypos2, FONT_TEXT_3,
-             "%03d", leveldir_current->last_level);
-  }
-
-  for (i = 0; i < 8; i++)
-    initCursor(i, (i == 1 || i == 4 || i == 6 ? IMG_MENU_BUTTON_ENTER_MENU :
-                  IMG_MENU_BUTTON));
-
-  DrawTextSCentered(326, FONT_TITLE_2, PROGRAM_GAME_BY_STRING);
-#endif
-
   DrawPreviewLevel(TRUE);
 
   HandleMainMenu(0, 0, 0, 0, MB_MENU_INITIALIZE);
@@ -1525,11 +1399,6 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
   FreeScreenGadgets();
   CreateScreenGadgets();
 
-#if 0
-  BlitBitmap(drawto, window, VX, VY, VXSIZE, VYSIZE, VX, VY);
-  Delay(3000);
-#endif
-
   /* map gadgets for main menu screen */
   MapTapeButtons();
   MapScreenMenuGadgets(SCREEN_MASK_MAIN);
@@ -1543,47 +1412,15 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
   {
     int door_state = GetDoorState();
 
+    // RedrawBackground();
+
     OpenDoor(door_state | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
   }
 #endif
 
-#if 0
- {
-   game_status = GAME_MODE_PSEUDO_PREVIEW;
-
-   DrawText(20, 400, "text_3.PREVIEW", FONT_TEXT_3);
-   DrawText(20, 420, "text_4.PREVIEW", FONT_TEXT_4);
-
-   game_status = GAME_MODE_MAIN;
-
-   DrawText(20, 440, "text_3.MAIN", FONT_TEXT_3);
-   DrawText(20, 460, "text_4.MAIN", FONT_TEXT_4);
- }
-#endif
-
-#if 1
   FadeIn(redraw_mask);
-#else
-#if 1
-  if (!do_fading)
-    BackToFront();
-  else if (fading.anim_mode == ANIM_CROSSFADE)
-    FadeCross(redraw_mask);
-  else
-    FadeIn(redraw_mask);
-#else
-  if (do_fading)
-    FadeIn(redraw_mask);
-  else
-    BackToFront();
-#endif
-#endif
 
-#if 1
   FadeSetEnterMenu();
-#else
-  fading = title_default;
-#endif
 
   SetMouseCursor(CURSOR_DEFAULT);
 
@@ -2376,6 +2213,7 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
   if (redraw_mask == REDRAW_ALL)
   {
     RedrawBackground();
+
     OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW);
   }
 #endif
@@ -2389,12 +2227,6 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
 
   for (i = 0; info_info[i].type != 0 && i < NUM_MENU_ENTRIES_ON_SCREEN; i++)
   {
-#if 0
-    int xpos = MENU_SCREEN_START_XPOS;
-    int ypos = MENU_SCREEN_START_YPOS + i;
-    int font_nr = FONT_MENU_1;
-#endif
-
     if (info_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
       initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
     else if (info_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
@@ -2402,11 +2234,7 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
     else if (info_info[i].type & ~TYPE_SKIP_ENTRY)
       initCursor(i, IMG_MENU_BUTTON);
 
-#if 1
     DrawCursorAndText_Info(i, FALSE);
-#else
-    DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr);
-#endif
 
     num_info_info++;
   }
@@ -2418,23 +2246,7 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
 
   DrawMaskedBorder(redraw_mask);
 
-#if 1
   FadeIn(redraw_mask);
-#else
-#if 1
-  if (!do_fading)
-    BackToFront();
-  else if (fading.anim_mode == ANIM_CROSSFADE)
-    FadeCross(redraw_mask);
-  else
-    FadeIn(redraw_mask);
-#else
-  if (do_fading)
-    FadeIn(redraw_mask);
-  else
-    BackToFront();
-#endif
-#endif
 
   InitAnimation();
 }
@@ -2454,11 +2266,7 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
       choice++;
     choice_store[info_mode] = choice;
 
-#if 1
     DrawCursorAndText_Info(choice, TRUE);
-#else
-    drawCursor(choice, TRUE);
-#endif
 
     return;
   }
@@ -2515,13 +2323,8 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
       {
        PlaySound(SND_MENU_ITEM_ACTIVATING);
 
-#if 1
        DrawCursorAndText_Info(choice, FALSE);
        DrawCursorAndText_Info(y, TRUE);
-#else
-       drawCursor(choice, FALSE);
-       drawCursor(y, TRUE);
-#endif
 
        choice = choice_store[info_mode] = y;
       }
@@ -2544,21 +2347,13 @@ void HandleInfoScreen_Main(int mx, int my, int dx, int dy, int button)
 
 void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
 {
-#if 1
   int ystart1 = mSY - SY + 100;
   int ystart2 = mSY - SY + 150;
   int ybottom = mSY - SY + SYSIZE - 20;
-#else
-  int ystart1 = 100;
-  int ystart2 = 150;
-  int ybottom = SYSIZE - 20;
-#endif
 
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_LEVELSET);
 
-#if 1
   FadeOut(REDRAW_FIELD);
-#endif
 
   ClearWindow();
   DrawHeadline();
@@ -2569,9 +2364,7 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error)
   DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for info menu");
 
-#if 1
   FadeIn(REDRAW_FIELD);
-#endif
 }
 
 void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init)
@@ -2704,11 +2497,7 @@ static char *getHelpText(int element, int action, int direction)
 
 void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos)
 {
-#if 1
   int font_nr = FONT_INFO_ELEMENTS;
-#else
-  int font_nr = FONT_LEVEL_NUMBER;
-#endif
   int font_width = getFontWidth(font_nr);
   int sx = mSX + MINI_TILEX + TILEX + MINI_TILEX;
   int sy = mSY + 65 + 2 * 32 + 1;
@@ -2736,14 +2525,9 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos)
   if (strlen(text) <= max_chars_per_line)      /* only one line of text */
     sy += getFontHeight(font_nr) / 2;
 
-#if 1
   DrawTextBuffer(sx, sy + ypos * ystep, text, font_nr,
                 max_chars_per_line, -1, max_lines_per_text, -1,
                 TRUE, FALSE, FALSE);
-#else
-  DrawTextWrapped(sx, sy + ypos * ystep, text, font_nr,
-                 max_chars_per_line, max_lines_per_text);
-#endif
 }
 
 void DrawInfoScreen_TitleScreen()
@@ -2760,18 +2544,14 @@ void DrawInfoScreen_Elements()
 {
   SetMainBackgroundImageIfDefined(IMG_BACKGROUND_INFO_ELEMENTS);
 
-#if 1
   FadeOut(REDRAW_FIELD);
-#endif
 
   LoadHelpAnimInfo();
   LoadHelpTextInfo();
 
   HandleInfoScreen_Elements(MB_MENU_INITIALIZE);
 
-#if 1
   FadeIn(REDRAW_FIELD);
-#endif
 
   InitAnimation();
 }
@@ -2828,23 +2608,34 @@ void HandleInfoScreen_Elements(int button)
     {
       FadeSoundsAndMusic();
 
-#if 0
-      FadeOut(REDRAW_FIELD);
-#endif
-
       info_mode = INFO_MODE_MAIN;
       DrawAndFadeInInfoScreen(REDRAW_FIELD);
 
       return;
     }
 
+#if 1
+    if (page > 0)
+      FadeSetNextScreen();
+#endif
+
+#if 1
+    if (button != MB_MENU_INITIALIZE)
+      FadeOut(REDRAW_FIELD);
+#else
     if (button != MB_MENU_INITIALIZE)
       FadeCrossSaveBackbuffer();
+#endif
 
     DrawInfoScreen_HelpAnim(page * anims_per_page, num_anims, TRUE);
 
+#if 1
+    if (button != MB_MENU_INITIALIZE)
+      FadeIn(REDRAW_FIELD);
+#else
     if (button != MB_MENU_INITIALIZE)
       FadeCross(REDRAW_FIELD);
+#endif
   }
   else
   {
@@ -2932,10 +2723,6 @@ void HandleInfoScreen_Music(int button)
     {
       FadeSoundsAndMusic();
 
-#if 0
-      FadeOut(REDRAW_FIELD);
-#endif
-
       info_mode = INFO_MODE_MAIN;
       DrawAndFadeInInfoScreen(REDRAW_FIELD);
 
@@ -2944,8 +2731,18 @@ void HandleInfoScreen_Music(int button)
 
     FadeSoundsAndMusic();
 
+#if 1
+    if (list != music_file_info)
+      FadeSetNextScreen();
+#endif
+
+#if 1
+    if (button != MB_MENU_INITIALIZE)
+      FadeOut(REDRAW_FIELD);
+#else
     if (button != MB_MENU_INITIALIZE)
       FadeCrossSaveBackbuffer();
+#endif
 
     ClearWindow();
     DrawHeadline();
@@ -3009,24 +2806,26 @@ void HandleInfoScreen_Music(int button)
     DrawTextSCentered(ybottom, FONT_TEXT_4,
                      "Press any key or button for next page");
 
+#if 1
+    if (button != MB_MENU_INITIALIZE)
+      FadeIn(REDRAW_FIELD);
+#else
     if (button != MB_MENU_INITIALIZE)
       FadeCross(REDRAW_FIELD);
+#endif
   }
 
   if (list != NULL && list->is_sound && sound_info[list->music].loop)
     PlaySoundLoop(list->music);
 }
 
-static boolean DrawInfoScreen_CreditsScreen(int screen_nr)
+static void DrawInfoScreen_CreditsScreen(int screen_nr)
 {
   int ystart1 = mSY - SY + 100;
   int ystart2 = mSY - SY + 150;
   int ybottom = mSY - SY + SYSIZE - 20;
   int ystep = 30;
 
-  if (screen_nr > 8)
-    return FALSE;
-
   ClearWindow();
   DrawHeadline();
 
@@ -3181,17 +2980,9 @@ static boolean DrawInfoScreen_CreditsScreen(int screen_nr)
     DrawTextSCentered(ystart2 + 4 * ystep, FONT_TEXT_3,
                      "since 1995");
   }
-#if 0
-  else
-  {
-    return FALSE;
-  }
-#endif
 
   DrawTextSCentered(ybottom, FONT_TEXT_4,
                    "Press any key or button for next page");
-
-  return TRUE;
 }
 
 void DrawInfoScreen_Credits()
@@ -3214,14 +3005,16 @@ void DrawInfoScreen_Credits()
 void HandleInfoScreen_Credits(int button)
 {
   static int screen_nr = 0;
+  int num_screens = 9;
 
   if (button == MB_MENU_INITIALIZE)
   {
     screen_nr = 0;
 
-    DrawInfoScreen_CreditsScreen(screen_nr);
+    // DrawInfoScreen_CreditsScreen(screen_nr);
   }
-  else if (button == MB_MENU_LEAVE)
+
+  if (button == MB_MENU_LEAVE)
   {
     PlaySound(SND_MENU_ITEM_SELECTING);
 
@@ -3230,33 +3023,47 @@ void HandleInfoScreen_Credits(int button)
 
     return;
   }
-  else if (button == MB_MENU_CHOICE)
+  else if (button == MB_MENU_CHOICE || button == MB_MENU_INITIALIZE)
   {
-    boolean show_screen;
+    if (button != MB_MENU_INITIALIZE)
+    {
+      PlaySound(SND_MENU_ITEM_SELECTING);
 
-    PlaySound(SND_MENU_ITEM_SELECTING);
+      screen_nr++;
+    }
 
-    screen_nr++;
+    if (screen_nr >= num_screens)
+    {
+      FadeSoundsAndMusic();
 
-    FadeCrossSaveBackbuffer();
+      info_mode = INFO_MODE_MAIN;
+      DrawAndFadeInInfoScreen(REDRAW_FIELD);
 
-    show_screen = DrawInfoScreen_CreditsScreen(screen_nr);
-  
-    if (show_screen)
-    {
-      FadeCross(REDRAW_FIELD);
+      return;
     }
-    else
-    {
-      FadeSoundsAndMusic();
 
-#if 0
+#if 1
+    if (screen_nr > 0)
+      FadeSetNextScreen();
+#endif
+
+#if 1
+    if (button != MB_MENU_INITIALIZE)
       FadeOut(REDRAW_FIELD);
+#else
+    if (button != MB_MENU_INITIALIZE)
+      FadeCrossSaveBackbuffer();
 #endif
 
-      info_mode = INFO_MODE_MAIN;
-      DrawAndFadeInInfoScreen(REDRAW_FIELD);
-    }
+    DrawInfoScreen_CreditsScreen(screen_nr);
+
+#if 1
+    if (button != MB_MENU_INITIALIZE)
+      FadeIn(REDRAW_FIELD);
+#else
+    if (button != MB_MENU_INITIALIZE)
+      FadeCross(REDRAW_FIELD);
+#endif
   }
   else
   {
@@ -5098,13 +4905,23 @@ static void DrawCursorAndText_Setup(int pos, boolean active)
 
 static void DrawSetupScreen_Generic()
 {
+  boolean redraw_all = FALSE;
   char *title_string = NULL;
   int i;
 
   UnmapAllGadgets();
   CloseDoor(DOOR_CLOSE_2);
 
+  if (redraw_mask & REDRAW_ALL)
+    redraw_all = TRUE;
+
+  printf("::: %s\n", (redraw_mask & REDRAW_FIELD ? "REDRAW_FIELD" :
+                     redraw_mask & REDRAW_ALL ? "REDRAW_ALL" :
+                     int2str(0, redraw_mask)));
+
 #if 1
+  FadeOut(redraw_mask);
+#else
   FadeOut(REDRAW_FIELD);
 #endif
 
@@ -5202,7 +5019,12 @@ static void DrawSetupScreen_Generic()
   HandleSetupScreen_Generic(0, 0, 0, 0, MB_MENU_INITIALIZE);
 #endif
 
+  if (redraw_all)
+    redraw_mask = REDRAW_ALL;
+
 #if 1
+  FadeIn(redraw_mask);
+#else
   FadeIn(REDRAW_FIELD);
 #endif
 
index 014ae9ce04297cce285466cf91b71c21c77ad9b4..63c29e6262030ae4f67591cc084c47970f711aeb 100644 (file)
@@ -448,111 +448,62 @@ void BackToFront()
   redraw_mask = REDRAW_NONE;
 }
 
-void FadeToFront()
+static void FadeCrossSaveBackbuffer()
 {
-#if 0
-  long fading_delay = 300;
+  BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
+}
+
+static void FadeExt(int fade_mask, int fade_mode, int fade_type)
+{
+  static int fade_type_skip = FADE_TYPE_NONE;
+  void (*draw_border_function)(void) = NULL;
+  Bitmap *bitmap = (fade_mode & FADE_TYPE_TRANSFORM ? bitmap_db_cross : NULL);
+  int x, y, width, height;
+  int fade_delay, post_delay;
 
-  if (setup.fading && (redraw_mask & REDRAW_FIELD))
+  if (fade_type == FADE_TYPE_FADE_OUT)
   {
+    if (fade_type_skip != FADE_TYPE_NONE)
+    {
+#if 1
+      printf("::: skipping %d ... [%d] (X)\n", fade_mode, fade_type_skip);
 #endif
 
-#if 0
-    int x,y;
-
-    ClearRectangle(window, REAL_SX,REAL_SY,FULL_SXSIZE,FULL_SYSIZE);
-    FlushDisplay();
+      /* skip all fade operations until specified fade operation */
+      if (fade_type & fade_type_skip)
+       fade_type_skip = FADE_TYPE_NONE;
 
-    for (i = 0; i < 2 * FULL_SYSIZE; i++)
-    {
-      for (y = 0; y < FULL_SYSIZE; y++)
-      {
-       BlitBitmap(backbuffer, window,
-                  REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
-      }
-      FlushDisplay();
-      Delay(10);
+      return;
     }
-#endif
-
-#if 0
-    for (i = 1; i < FULL_SYSIZE; i+=2)
-      BlitBitmap(backbuffer, window,
-                REAL_SX,REAL_SY+i, FULL_SXSIZE,1, REAL_SX,REAL_SY+i);
-    FlushDisplay();
-    Delay(fading_delay);
-#endif
 
-#if 0
-    SetClipOrigin(clip_gc[PIX_FADEMASK], 0, 0);
-    BlitBitmapMasked(backbuffer, window,
-                    REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
-                    REAL_SX,REAL_SY);
-    FlushDisplay();
-    Delay(fading_delay);
-
-    SetClipOrigin(clip_gc[PIX_FADEMASK], -1, -1);
-    BlitBitmapMasked(backbuffer, window,
-                    REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
-                    REAL_SX,REAL_SY);
-    FlushDisplay();
-    Delay(fading_delay);
-
-    SetClipOrigin(clip_gc[PIX_FADEMASK], 0, -1);
-    BlitBitmapMasked(backbuffer, window,
-                    REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
-                    REAL_SX,REAL_SY);
-    FlushDisplay();
-    Delay(fading_delay);
-
-    SetClipOrigin(clip_gc[PIX_FADEMASK], -1, 0);
-    BlitBitmapMasked(backbuffer, window,
-                    REAL_SX,REAL_SY, FULL_SXSIZE,FULL_SYSIZE,
-                    REAL_SX,REAL_SY);
-    FlushDisplay();
-    Delay(fading_delay);
+    if (fading.fade_mode & FADE_TYPE_TRANSFORM)
+      FadeCrossSaveBackbuffer();
 
-    redraw_mask &= ~REDRAW_MAIN;
+    return;
   }
-#endif
-
-  BackToFront();
-}
-
-void FadeExt(int fade_mask, int fade_mode)
-{
-  static int fade_mode_skip = FADE_MODE_NONE;
-  void (*draw_border_function)(void) = NULL;
-#if 0
-  Bitmap *bitmap = (fade_mode != FADE_MODE_FADE_IN ? bitmap_db_cross : NULL);
-#else
-  Bitmap *bitmap = (fade_mode & FADE_TYPE_TRANSFORM ? bitmap_db_cross : NULL);
-#endif
-  int x, y, width, height;
-  int fade_delay, post_delay;
 
   redraw_mask |= fade_mask;
 
-  if (fade_mode & FADE_TYPE_SKIP)
+  if (fade_type == FADE_TYPE_SKIP)
   {
-#if 0
-    printf("::: will skip %d ... [%d]\n", fade_mode, fade_mode_skip);
+#if 1
+    printf("::: will skip %d ... [%d]\n", fade_mode, fade_type_skip);
 #endif
 
-    fade_mode_skip = fade_mode;
+    fade_type_skip = fade_mode;
 
     return;
   }
 
-  if (fade_mode_skip & FADE_TYPE_SKIP)
+  if (fade_type_skip != FADE_TYPE_NONE)
   {
-#if 0
-    printf("::: skipping %d ... [%d]\n", fade_mode, fade_mode_skip);
+#if 1
+    printf("::: skipping %d ... [%d]\n", fade_mode, fade_type_skip);
 #endif
 
     /* skip all fade operations until specified fade operation */
-    if (fade_mode & fade_mode_skip)
-      fade_mode_skip = FADE_MODE_NONE;
+    if (fade_type & fade_type_skip)
+      fade_type_skip = FADE_TYPE_NONE;
 
     return;
   }
@@ -575,6 +526,12 @@ void FadeExt(int fade_mask, int fade_mode)
   }
 #endif
 
+  /* !!! what abount fade_mask == REDRAW_FIELD | REDRAW_ALL ??? !!! */
+
+#if 1
+  printf("::: NOW FADING %d ... [%d]\n", fade_mode, fade_type);
+#endif
+
   if (fade_mask & REDRAW_FIELD)
   {
     x = REAL_SX;
@@ -627,34 +584,13 @@ void FadeIn(int fade_mask)
   global.border_status = game_status;
 #endif
 
-#if 0
-  global.fading_status = game_status;
-
-  if (global.fading_type == TYPE_ENTER_MENU)
-    fading = menu.enter_menu;
-  else if (global.fading_type == TYPE_LEAVE_MENU)
-    fading = menu.leave_menu;
-  else if (global.fading_type == TYPE_ENTER_SCREEN)
-    fading = menu.enter_screen[global.fading_status];
-  else if (global.fading_type == TYPE_LEAVE_SCREEN)
-    fading = menu.leave_screen[global.fading_status];
-
-  printf("::: FadeIn: %s [0x%08x] [%d]\n",
-        global.fading_type == TYPE_ENTER_MENU ? "enter_menu" :
-        global.fading_type == TYPE_LEAVE_MENU ? "leave_menu" :
-        global.fading_type == TYPE_ENTER_SCREEN ? "enter_screen" :
-        global.fading_type == TYPE_LEAVE_SCREEN ? "leave_screen" : "(?)",
-        global.fading_type,
-        global.fading_status);
-#endif
-
 #if 1
   // printf("::: now fading in...\n");
 
   if (fading.fade_mode & FADE_TYPE_TRANSFORM)
-    FadeExt(fade_mask, fading.fade_mode);
+    FadeExt(fade_mask, fading.fade_mode, FADE_TYPE_FADE_IN);
   else
-    FadeExt(fade_mask, FADE_MODE_FADE_IN);
+    FadeExt(fade_mask, FADE_MODE_FADE_IN, FADE_TYPE_FADE_IN);
 #else
 #if 1
   if (fading.fade_mode == FADE_MODE_CROSSFADE)
@@ -669,32 +605,21 @@ void FadeIn(int fade_mask)
 
 void FadeOut(int fade_mask)
 {
-#if 0
-  if (global.fading_type == TYPE_ENTER_MENU)
-    fading = menu.enter_menu;
-  else if (global.fading_type == TYPE_LEAVE_MENU)
-    fading = menu.leave_menu;
-  else if (global.fading_type == TYPE_ENTER_SCREEN)
-    fading = menu.enter_screen[global.fading_status];
-  else if (global.fading_type == TYPE_LEAVE_SCREEN)
-    fading = menu.leave_screen[global.fading_status];
-
-  printf("::: FadeOut: %s [0x%08x] [%d]\n",
-        global.fading_type == TYPE_ENTER_MENU ? "enter_menu" :
-        global.fading_type == TYPE_LEAVE_MENU ? "leave_menu" :
-        global.fading_type == TYPE_ENTER_SCREEN ? "enter_screen" :
-        global.fading_type == TYPE_LEAVE_SCREEN ? "leave_screen" : "(?)",
-        global.fading_type,
-        global.fading_status);
-#endif
-
 #if 1
   // printf("::: fading.fade_mode == %d\n", fading.fade_mode);
 
+#if 1
+  if (fading.fade_mode & FADE_TYPE_TRANSFORM)
+    FadeExt(fade_mask, fading.fade_mode, FADE_TYPE_FADE_OUT);
+  else
+    FadeExt(fade_mask, FADE_MODE_FADE_OUT, FADE_TYPE_FADE_OUT);
+#else
   if (fading.fade_mode & FADE_TYPE_TRANSFORM)
     FadeCrossSaveBackbuffer();
   else
-    FadeExt(fade_mask, FADE_MODE_FADE_OUT);
+    FadeExt(fade_mask, FADE_MODE_FADE_OUT, FADE_TYPE_FADE_OUT);
+#endif
+
 #else
 #if 1
   if (fading.fade_mode == FADE_MODE_CROSSFADE)
@@ -711,41 +636,12 @@ void FadeOut(int fade_mask)
 #endif
 }
 
+#if 0
 void FadeCross(int fade_mask)
 {
   FadeExt(fade_mask, FADE_MODE_CROSSFADE);
 }
-
-void FadeCrossSaveBackbuffer()
-{
-  BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
-}
-
-#if 0
-void FadeSetEnterMenu()
-{
-  global.fading_type = TYPE_ENTER_MENU;
-}
-
-void FadeSetLeaveMenu()
-{
-  global.fading_type = TYPE_LEAVE_MENU;
-}
-
-void FadeSetEnterScreen()
-{
-  global.fading_type = TYPE_ENTER_SCREEN;
-}
-
-void FadeSetLeaveScreen()
-{
-  // global.fading_type = TYPE_LEAVE_SCREEN;
-
-  global.fading_type = (global.fading_type == TYPE_ENTER_SCREEN ?
-                       TYPE_LEAVE_SCREEN : TYPE_LEAVE_MENU);
-}
-
-#else
+#endif
 
 static void FadeSetLeaveNext(struct TitleFadingInfo fading_leave, boolean set)
 {
@@ -787,15 +683,19 @@ void FadeSetEnterScreen()
   printf("::: storing leave_screen[%d]\n", game_status);
 #endif
 
+  FadeSetLeaveNext(menu.leave_screen[game_status], TRUE);      /* store */
+}
+
+void FadeSetNextScreen()
+{
+  fading = menu.next_screen;
+
 #if 0
-  printf("::: - %d, %d / %d, %d\n",
-        menu.enter_screen[game_status].fade_mode,
-        menu.enter_screen[game_status].fade_delay,
-        menu.leave_screen[game_status].fade_mode,
-        menu.leave_screen[game_status].fade_delay);
+  printf("::: storing next_screen\n");
 #endif
 
-  FadeSetLeaveNext(menu.leave_screen[game_status], TRUE);      /* store */
+  // (do not overwrite fade mode set by FadeSetEnterScreen)
+  // FadeSetLeaveNext(fading, TRUE);   /* (keep same fade mode) */
 }
 
 void FadeSetLeaveScreen()
@@ -807,8 +707,6 @@ void FadeSetLeaveScreen()
   FadeSetLeaveNext(menu.leave_screen[game_status], FALSE);     /* recall */
 }
 
-#endif
-
 void FadeSetFromType(int type)
 {
   if (type & TYPE_ENTER_SCREEN)
@@ -828,12 +726,12 @@ void FadeSetDisabled()
 
 void FadeSkipNextFadeIn()
 {
-  FadeExt(0, FADE_MODE_SKIP_FADE_IN);
+  FadeExt(0, FADE_MODE_SKIP_FADE_IN, FADE_TYPE_SKIP);
 }
 
 void FadeSkipNextFadeOut()
 {
-  FadeExt(0, FADE_MODE_SKIP_FADE_OUT);
+  FadeExt(0, FADE_MODE_SKIP_FADE_OUT, FADE_TYPE_SKIP);
 }
 
 void SetWindowBackgroundImageIfDefined(int graphic)
index 08bc8c390cbe50580c0b7e8ff0f274febc8b375b..6e8e9a22fdf9beeaba4b423ac60338817d7dcc7f 100644 (file)
@@ -72,15 +72,13 @@ void DrawMaskedBorder(int);
 void SetDrawtoField(int);
 void RedrawPlayfield(boolean, int, int, int, int);
 void BackToFront();
-void FadeToFront();
 
 void FadeIn(int);
 void FadeOut(int);
-void FadeCross(int);
-void FadeCrossSaveBackbuffer();
 void FadeSetEnterMenu();
 void FadeSetLeaveMenu();
 void FadeSetEnterScreen();
+void FadeSetNextScreen();
 void FadeSetLeaveScreen();
 void FadeSetFromType(int);
 void FadeSetDisabled();