rnd-20070401-1-src
authorHolger Schemel <info@artsoft.org>
Sun, 1 Apr 2007 00:38:14 +0000 (02:38 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:55:16 +0000 (10:55 +0200)
* improved menu fading, adding separate fading definitions for entering
  and leaving a "content" screen (in general), and optional definitions
  for the special "content" screens SCORES, EDITOR, INFO and PLAYING

ChangeLog
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/files.c
src/game.c
src/init.c
src/main.h
src/screens.c
src/tools.c
src/tools.h

index e2d1bbe878d66b6f341a91ed6cfc455549c0ab4f..600e1c0757dd7e960e02854569f3d72ecb023e37 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-31
+       * improved menu fading, adding separate fading definitions for entering
+         and leaving a "content" screen (in general), and optional definitions
+         for the special "content" screens SCORES, EDITOR, INFO and PLAYING
+
 2007-03-30
        * added (currently invisible) setup option to define scroll delay value
        * fixed small bug in priority handling when auto-detecting level start
index c61b062cfc3bafca7c51d567426da36831092b99..c7469e7e174838b4e0dfa007890f66f4a6acaecb 100644 (file)
@@ -5228,9 +5228,36 @@ struct ConfigInfo image_config[] =
   { "menu.leave_menu.fade_mode",               "none"                  },
   { "menu.leave_menu.fade_delay",              "250"                   },
   { "menu.leave_menu.post_delay",              "125"                   },
-  { "menu.start_item.fade_mode",               "fade"                  },
-  { "menu.start_item.fade_delay",              "250"                   },
-  { "menu.start_item.post_delay",              "125"                   },
+  { "menu.enter_screen.fade_mode",             "fade"                  },
+  { "menu.enter_screen.fade_delay",            "250"                   },
+  { "menu.enter_screen.post_delay",            "125"                   },
+  { "menu.leave_screen.fade_mode",             "fade"                  },
+  { "menu.leave_screen.fade_delay",            "250"                   },
+  { "menu.leave_screen.post_delay",            "125"                   },
+  { "menu.enter_screen.SCORES.fade_mode",      ARG_DEFAULT             },
+  { "menu.enter_screen.SCORES.fade_delay",     ARG_DEFAULT             },
+  { "menu.enter_screen.SCORES.post_delay",     ARG_DEFAULT             },
+  { "menu.enter_screen.EDITOR.fade_mode",      ARG_DEFAULT             },
+  { "menu.enter_screen.EDITOR.fade_delay",     ARG_DEFAULT             },
+  { "menu.enter_screen.EDITOR.post_delay",     ARG_DEFAULT             },
+  { "menu.enter_screen.INFO.fade_mode",                ARG_DEFAULT             },
+  { "menu.enter_screen.INFO.fade_delay",       ARG_DEFAULT             },
+  { "menu.enter_screen.INFO.post_delay",       ARG_DEFAULT             },
+  { "menu.enter_screen.PLAYING.fade_mode",     ARG_DEFAULT             },
+  { "menu.enter_screen.PLAYING.fade_delay",    ARG_DEFAULT             },
+  { "menu.enter_screen.PLAYING.post_delay",    ARG_DEFAULT             },
+  { "menu.leave_screen.SCORES.fade_mode",      ARG_DEFAULT             },
+  { "menu.leave_screen.SCORES.fade_delay",     ARG_DEFAULT             },
+  { "menu.leave_screen.SCORES.post_delay",     ARG_DEFAULT             },
+  { "menu.leave_screen.EDITOR.fade_mode",      ARG_DEFAULT             },
+  { "menu.leave_screen.EDITOR.fade_delay",     ARG_DEFAULT             },
+  { "menu.leave_screen.EDITOR.post_delay",     ARG_DEFAULT             },
+  { "menu.leave_screen.INFO.fade_mode",                ARG_DEFAULT             },
+  { "menu.leave_screen.INFO.fade_delay",       ARG_DEFAULT             },
+  { "menu.leave_screen.INFO.post_delay",       ARG_DEFAULT             },
+  { "menu.leave_screen.PLAYING.fade_mode",     ARG_DEFAULT             },
+  { "menu.leave_screen.PLAYING.fade_delay",    ARG_DEFAULT             },
+  { "menu.leave_screen.PLAYING.post_delay",    ARG_DEFAULT             },
 
   { "menu.draw_xoffset",                       "0"                     },
   { "menu.draw_yoffset",                       "0"                     },
index 45ad7dc98ff699b510bb4479bf48db74da9ed4c8..38ab1c563d3457ec5b791e62a39c682c97f6e277 100644 (file)
@@ -985,16 +985,124 @@ struct TokenIntPtrInfo image_config_vars[] =
     &menu.leave_menu.post_delay
   },
   {
-    "menu.start_item.fade_mode",
-    &menu.start_item.fade_mode
+    "menu.enter_screen.fade_mode",
+    &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].fade_mode
   },
   {
-    "menu.start_item.fade_delay",
-    &menu.start_item.fade_delay
+    "menu.enter_screen.fade_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].fade_delay
   },
   {
-    "menu.start_item.post_delay",
-    &menu.start_item.post_delay
+    "menu.enter_screen.post_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].post_delay
+  },
+  {
+    "menu.leave_screen.fade_mode",
+    &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].fade_mode
+  },
+  {
+    "menu.leave_screen.fade_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].fade_delay
+  },
+  {
+    "menu.leave_screen.post_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].post_delay
+  },
+  {
+    "menu.enter_screen.SCORES.fade_mode",
+    &menu.enter_screen[GFX_SPECIAL_ARG_SCORES].fade_mode
+  },
+  {
+    "menu.enter_screen.SCORES.fade_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_SCORES].fade_delay
+  },
+  {
+    "menu.enter_screen.SCORES.post_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_SCORES].post_delay
+  },
+  {
+    "menu.enter_screen.EDITOR.fade_mode",
+    &menu.enter_screen[GFX_SPECIAL_ARG_EDITOR].fade_mode
+  },
+  {
+    "menu.enter_screen.EDITOR.fade_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_EDITOR].fade_delay
+  },
+  {
+    "menu.enter_screen.EDITOR.post_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_EDITOR].post_delay
+  },
+  {
+    "menu.enter_screen.INFO.fade_mode",
+    &menu.enter_screen[GFX_SPECIAL_ARG_INFO].fade_mode
+  },
+  {
+    "menu.enter_screen.INFO.fade_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_INFO].fade_delay
+  },
+  {
+    "menu.enter_screen.INFO.post_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_INFO].post_delay
+  },
+  {
+    "menu.enter_screen.PLAYING.fade_mode",
+    &menu.enter_screen[GFX_SPECIAL_ARG_PLAYING].fade_mode
+  },
+  {
+    "menu.enter_screen.PLAYING.fade_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_PLAYING].fade_delay
+  },
+  {
+    "menu.enter_screen.PLAYING.post_delay",
+    &menu.enter_screen[GFX_SPECIAL_ARG_PLAYING].post_delay
+  },
+  {
+    "menu.leave_screen.SCORES.fade_mode",
+    &menu.leave_screen[GFX_SPECIAL_ARG_SCORES].fade_mode
+  },
+  {
+    "menu.leave_screen.SCORES.fade_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_SCORES].fade_delay
+  },
+  {
+    "menu.leave_screen.SCORES.post_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_SCORES].post_delay
+  },
+  {
+    "menu.leave_screen.EDITOR.fade_mode",
+    &menu.leave_screen[GFX_SPECIAL_ARG_EDITOR].fade_mode
+  },
+  {
+    "menu.leave_screen.EDITOR.fade_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_EDITOR].fade_delay
+  },
+  {
+    "menu.leave_screen.EDITOR.post_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_EDITOR].post_delay
+  },
+  {
+    "menu.leave_screen.INFO.fade_mode",
+    &menu.leave_screen[GFX_SPECIAL_ARG_INFO].fade_mode
+  },
+  {
+    "menu.leave_screen.INFO.fade_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_INFO].fade_delay
+  },
+  {
+    "menu.leave_screen.INFO.post_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_INFO].post_delay
+  },
+  {
+    "menu.leave_screen.PLAYING.fade_mode",
+    &menu.leave_screen[GFX_SPECIAL_ARG_PLAYING].fade_mode
+  },
+  {
+    "menu.leave_screen.PLAYING.fade_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_PLAYING].fade_delay
+  },
+  {
+    "menu.leave_screen.PLAYING.post_delay",
+    &menu.leave_screen[GFX_SPECIAL_ARG_PLAYING].post_delay
   },
   {
     "menu.draw_xoffset",
index dc36ba0e2aa4c8bbcc5d917152b77a34aeb83bf7..0fdcfe7f0776c3ca8e018c5000a5ddc9cec34443 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2007-03-31 01:45"
+#define COMPILE_DATE_STRING "2007-04-01 02:29"
index 0ebccb98e79b10bcc08b6604c9b5e913354d5d13..cb57311a3e10dcd2bccbe551fcd9d90c2b675181 100644 (file)
@@ -8422,6 +8422,43 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename)
       menu.draw_yoffset_info[i] = get_integer_from_string(value_2);
   }
 
+  /* special case: initialize with default values that may be overwritten */
+  /* (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz") */
+  for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
+  {
+    char *token_1 = "menu.enter_screen.fade_mode";
+    char *token_2 = "menu.enter_screen.fade_delay";
+    char *token_3 = "menu.enter_screen.post_delay";
+    char *token_4 = "menu.leave_screen.fade_mode";
+    char *token_5 = "menu.leave_screen.fade_delay";
+    char *token_6 = "menu.leave_screen.post_delay";
+    char *value_1 = getHashEntry(setup_file_hash, token_1);
+    char *value_2 = getHashEntry(setup_file_hash, token_2);
+    char *value_3 = getHashEntry(setup_file_hash, token_3);
+    char *value_4 = getHashEntry(setup_file_hash, token_4);
+    char *value_5 = getHashEntry(setup_file_hash, token_5);
+    char *value_6 = getHashEntry(setup_file_hash, token_6);
+
+    if (value_1 != NULL)
+      menu.enter_screen[i].fade_mode = get_token_parameter_value(token_1,
+                                                                value_1);
+    if (value_2 != NULL)
+      menu.enter_screen[i].fade_delay = get_token_parameter_value(token_2,
+                                                                 value_2);
+    if (value_3 != NULL)
+      menu.enter_screen[i].post_delay = get_token_parameter_value(token_3,
+                                                                 value_3);
+    if (value_4 != NULL)
+      menu.leave_screen[i].fade_mode = get_token_parameter_value(token_4,
+                                                                value_4);
+    if (value_5 != NULL)
+      menu.leave_screen[i].fade_delay = get_token_parameter_value(token_5,
+                                                                 value_5);
+    if (value_6 != NULL)
+      menu.leave_screen[i].post_delay = get_token_parameter_value(token_6,
+                                                                 value_6);
+  }
+
   /* special case: initialize with default values that may be overwritten */
   /* (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") */
   for (i = 0; titlemessage_arrays[i].array != NULL; i++)
@@ -8502,6 +8539,14 @@ void LoadSpecialMenuDesignSettings()
     titlemessage[i] = titlemessage_default;
   }
 
+  /* special case: initialize "ARG_DEFAULT" values in static default config */
+  /* (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz") */
+  for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
+  {
+    menu.enter_screen[i] = menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT];
+    menu.leave_screen[i] = menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT];
+  }
+
   if (!SETUP_OVERRIDE_ARTWORK(setup, ARTWORK_TYPE_GRAPHICS))
   {
     /* first look for special settings configured in level series config */
index d580212fd8e725218ce9cb3cdc68ceff033ecbbc..3dec37b723f7d2509dc8ba8ed179685ee1c7fcd5 100644 (file)
@@ -3490,7 +3490,7 @@ void InitGame()
   if (level_editor_test_game)
     FadeSkipNextFadeIn();
   else
-    FadeSetStartItem();
+    FadeSetEnterScreen();
 #else
   if (level_editor_test_game)
     fading = fading_none;
index a6f67bcd7854ac22f7e7776b85e1e972d042e766..08177e1b3cd22e520f2451d5649d1702d0b7e05c 100644 (file)
@@ -5121,7 +5121,7 @@ void ReloadCustomArtwork(int force_reload)
 
 #if 1
 #if 1
-    FadeSetStartItem();
+    FadeSetEnterScreen();
     // FadeSkipNextFadeOut();
     // FadeSetDisabled();
 #else
@@ -5214,8 +5214,10 @@ void OpenAll()
     return;
   }
 
+  game_status = GAME_MODE_MAIN;
+
 #if 1
-  FadeSetStartItem();
+  FadeSetEnterScreen();
   if (!(fading.fade_mode & FADE_TYPE_TRANSFORM))
     FadeSkipNextFadeOut();
   // FadeSetDisabled();
@@ -5223,8 +5225,6 @@ void OpenAll()
   fading = fading_none;
 #endif
 
-  game_status = GAME_MODE_MAIN;
-
   DrawMainMenu();
 
   InitNetworkServer();
index e3fd05b5cb3277de9028bdcecb5681ba2e9d9aa8..eb8e2611639f1f36469340ce0ae20b39ce8f2ab5 100644 (file)
@@ -2091,7 +2091,8 @@ struct MenuInfo
 
   struct TitleFadingInfo enter_menu;
   struct TitleFadingInfo leave_menu;
-  struct TitleFadingInfo start_item;
+  struct TitleFadingInfo enter_screen[NUM_SPECIAL_GFX_ARGS];
+  struct TitleFadingInfo leave_screen[NUM_SPECIAL_GFX_ARGS];
 
   int sound[NUM_SPECIAL_GFX_ARGS];
   int music[NUM_SPECIAL_GFX_ARGS];
index 5e1a17e3b6014583a1f524c2db862ab6ed64bc44..2577e79a81639b6aafae989beb4e715c62d4a44b 100644 (file)
@@ -1258,6 +1258,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading)
         redraw_mask == REDRAW_ALL);
 #endif
 
+  FadeSetLeaveScreen();
+
 #if 1
   FadeOut(redraw_mask);
 #endif
@@ -1710,7 +1712,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
       FadeOut(REDRAW_FIELD);
 #endif
 
-      FadeSetStartItem();
+      FadeSetEnterScreen();
 
       info_mode = INFO_MODE_MAIN;
       DrawAndFadeInInfoScreen(REDRAW_FIELD);
@@ -2001,7 +2003,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button)
 
        game_status = GAME_MODE_EDITOR;
 
-       FadeSetStartItem();
+       FadeSetEnterScreen();
 
        DrawLevelEd();
       }
@@ -2178,7 +2180,7 @@ static int num_info_info;
 static void execInfoTitleScreen()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_TITLE;
@@ -2188,7 +2190,7 @@ static void execInfoTitleScreen()
 static void execInfoElements()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_ELEMENTS;
@@ -2198,7 +2200,7 @@ static void execInfoElements()
 static void execInfoMusic()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_MUSIC;
@@ -2208,7 +2210,7 @@ static void execInfoMusic()
 static void execInfoCredits()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_CREDITS;
@@ -2218,7 +2220,7 @@ static void execInfoCredits()
 static void execInfoProgram()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_PROGRAM;
@@ -2228,7 +2230,7 @@ static void execInfoProgram()
 static void execInfoVersion()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_VERSION;
@@ -2238,7 +2240,7 @@ static void execInfoVersion()
 static void execInfoLevelSet()
 {
 #if 0
-  FadeSetStartItem();
+  FadeSetEnterScreen();
 #endif
 
   info_mode = INFO_MODE_LEVELSET;
@@ -2299,6 +2301,8 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading)
   /* (needed after displaying title screens which disable auto repeat) */
   KeyboardAutoRepeatOn();
 
+  FadeSetLeaveScreen();
+
 #if 1
   FadeOut(redraw_mask);
 #endif
@@ -4089,7 +4093,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button,
       }
       else
       {
-       FadeSetStartItem();
+       FadeSetEnterScreen();
 
        node_cursor->cl_first = ti->cl_first;
        node_cursor->cl_cursor = ti->cl_cursor;
@@ -4159,7 +4163,9 @@ void DrawHallOfFame(int highlight_position)
   if (highlight_position < 0) 
     LoadScore(level_nr);
 
-  FadeSetStartItem();
+  FadeSetEnterScreen();
+
+  // printf("::: %d: %d\n", game_status, menu.enter_screen[game_status]);
 
 #if 1
   FadeOut(REDRAW_FIELD);
index ba774925f95d7128c5a3c9c8be3f48cbdf8b9aa8..9530644e204d1787fbe18e240867c44b5923b7e9 100644 (file)
@@ -662,25 +662,46 @@ void FadeCrossSaveBackbuffer()
   BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0);
 }
 
+static void FadeSetLeaveNext(struct TitleFadingInfo fading_leave, boolean set)
+{
+  static struct TitleFadingInfo fading_leave_stored;
+
+  if (set)
+    fading_leave_stored = fading_leave;
+  else
+    fading = fading_leave_stored;
+}
+
 void FadeSetEnterMenu()
 {
   fading = menu.enter_menu;
+
+  FadeSetLeaveNext(fading, TRUE);      /* (keep same fade mode) */
 }
 
 void FadeSetLeaveMenu()
 {
   fading = menu.leave_menu;
+
+  FadeSetLeaveNext(fading, TRUE);      /* (keep same fade mode) */
+}
+
+void FadeSetEnterScreen()
+{
+  fading = menu.enter_screen[game_status];
+
+  FadeSetLeaveNext(menu.leave_screen[game_status], TRUE);      /* store */
 }
 
-void FadeSetStartItem()
+void FadeSetLeaveScreen()
 {
-  fading = menu.start_item;
+  FadeSetLeaveNext(menu.leave_screen[game_status], FALSE);     /* recall */
 }
 
 void FadeSetFromType(int type)
 {
   if (type & TYPE_ENTER_SCREEN)
-    FadeSetStartItem();
+    FadeSetEnterScreen();
   else if (type & TYPE_ENTER)
     FadeSetEnterMenu();
   else if (type & TYPE_LEAVE)
index fa67ae23308a610a25a2d630fc92f1338b3ccdeb..2e0762cc2c89ab4ec3a8852a5789cf56d7d63257 100644 (file)
@@ -80,7 +80,8 @@ void FadeCross(int);
 void FadeCrossSaveBackbuffer();
 void FadeSetEnterMenu();
 void FadeSetLeaveMenu();
-void FadeSetStartItem();
+void FadeSetEnterScreen();
+void FadeSetLeaveScreen();
 void FadeSetFromType(int);
 void FadeSetDisabled();
 void FadeSkipNextFadeIn();