fixed hierarchical definitions for title screen transitions
authorHolger Schemel <info@artsoft.org>
Mon, 21 Dec 2015 01:25:00 +0000 (02:25 +0100)
committerHolger Schemel <info@artsoft.org>
Mon, 21 Dec 2015 01:25:00 +0000 (02:25 +0100)
build-scripts/create_element_defs.pl
src/conf_gfx.c
src/files.c
src/main.c
src/main.h
src/screens.c

index c8a6cd0676a317130aa8b7a3b21454a0abec9bf1..c1da1dafea8bbbd6e9a5130be151d9a328faf7d9 100755 (executable)
@@ -2362,10 +2362,13 @@ sub print_image_config_vars
            $var =~ s/^\[player\]\./game.player_/;
            $var =~ s/^\[title_initial\]/title_initial_default/;
            $var =~ s/^\[title\]/title_default/;
+           $var =~ s/^\[titlescreen_initial\]/titlescreen_initial_default/;
+           $var =~ s/^\[titlescreen\]/titlescreen_default/;
            $var =~ s/^\[titlemessage_initial\]/titlemessage_initial_default/;
            $var =~ s/^\[titlemessage\]/titlemessage_default/;
 
-           if ($var =~ /^titlemessage.*(\d)/ ||
+           if ($var =~ /^titlescreen.*(\d)/ ||
+               $var =~ /^titlemessage.*(\d)/ ||
                $var =~ /^game.panel.key_(\d)/ ||
                $var =~ /^game.panel.inventory_first_(\d)/ ||
                $var =~ /^game.panel.inventory_last_(\d)/ ||
@@ -2424,6 +2427,15 @@ sub print_image_config_vars
            }
 
            print_image_config_var_entry("\"$token\"", "&$var");
+
+           if ($var =~ /^(titlescreen.*)\[\d\]/ ||
+               $var =~ /^(titlemessage.*)\[\d\]/)
+           {
+               my $prefix = $1;
+               $var =~ s/^$prefix/${prefix}_first/;
+
+               print_image_config_var_entry("\"$token\"", "&$var");
+           }
        }
     }
 
index fa001bdba47c1ab1bb5869ef3cae26d11023ddf6..4766b3fd5aa56cedba3442383af626df8560e9fb 100644 (file)
@@ -5894,6 +5894,68 @@ struct ConfigInfo image_config[] =
   { "[title].post_delay",                      "250"                   },
   { "[title].auto_delay",                      "-1"                    },
 
+  { "[titlescreen_initial].sort_priority",     "0"                     },
+  { "[titlescreen_initial].fade_mode",         ARG_DEFAULT             },
+  { "[titlescreen_initial].fade_delay",                ARG_DEFAULT             },
+  { "[titlescreen_initial].post_delay",                ARG_DEFAULT             },
+  { "[titlescreen_initial].auto_delay",                ARG_DEFAULT             },
+  { "[titlescreen].sort_priority",             "0"                     },
+  { "[titlescreen].fade_mode",                 ARG_DEFAULT             },
+  { "[titlescreen].fade_delay",                        ARG_DEFAULT             },
+  { "[titlescreen].post_delay",                        ARG_DEFAULT             },
+  { "[titlescreen].auto_delay",                        ARG_DEFAULT             },
+
+  { "titlescreen_initial_1.sort_priority",     ARG_DEFAULT             },
+  { "titlescreen_initial_1.fade_mode",         ARG_DEFAULT             },
+  { "titlescreen_initial_1.fade_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_1.post_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_1.auto_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_2.sort_priority",     ARG_DEFAULT             },
+  { "titlescreen_initial_2.fade_mode",         ARG_DEFAULT             },
+  { "titlescreen_initial_2.fade_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_2.post_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_2.auto_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_3.sort_priority",     ARG_DEFAULT             },
+  { "titlescreen_initial_3.fade_mode",         ARG_DEFAULT             },
+  { "titlescreen_initial_3.fade_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_3.post_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_3.auto_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_4.sort_priority",     ARG_DEFAULT             },
+  { "titlescreen_initial_4.fade_mode",         ARG_DEFAULT             },
+  { "titlescreen_initial_4.fade_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_4.post_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_4.auto_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_5.sort_priority",     ARG_DEFAULT             },
+  { "titlescreen_initial_5.fade_mode",         ARG_DEFAULT             },
+  { "titlescreen_initial_5.fade_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_5.post_delay",                ARG_DEFAULT             },
+  { "titlescreen_initial_5.auto_delay",                ARG_DEFAULT             },
+  { "titlescreen_1.sort_priority",             ARG_DEFAULT             },
+  { "titlescreen_1.fade_mode",                 ARG_DEFAULT             },
+  { "titlescreen_1.fade_delay",                        ARG_DEFAULT             },
+  { "titlescreen_1.post_delay",                        ARG_DEFAULT             },
+  { "titlescreen_1.auto_delay",                        ARG_DEFAULT             },
+  { "titlescreen_2.sort_priority",             ARG_DEFAULT             },
+  { "titlescreen_2.fade_mode",                 ARG_DEFAULT             },
+  { "titlescreen_2.fade_delay",                        ARG_DEFAULT             },
+  { "titlescreen_2.post_delay",                        ARG_DEFAULT             },
+  { "titlescreen_2.auto_delay",                        ARG_DEFAULT             },
+  { "titlescreen_3.sort_priority",             ARG_DEFAULT             },
+  { "titlescreen_3.fade_mode",                 ARG_DEFAULT             },
+  { "titlescreen_3.fade_delay",                        ARG_DEFAULT             },
+  { "titlescreen_3.post_delay",                        ARG_DEFAULT             },
+  { "titlescreen_3.auto_delay",                        ARG_DEFAULT             },
+  { "titlescreen_4.sort_priority",             ARG_DEFAULT             },
+  { "titlescreen_4.fade_mode",                 ARG_DEFAULT             },
+  { "titlescreen_4.fade_delay",                        ARG_DEFAULT             },
+  { "titlescreen_4.post_delay",                        ARG_DEFAULT             },
+  { "titlescreen_4.auto_delay",                        ARG_DEFAULT             },
+  { "titlescreen_5.sort_priority",             ARG_DEFAULT             },
+  { "titlescreen_5.fade_mode",                 ARG_DEFAULT             },
+  { "titlescreen_5.fade_delay",                        ARG_DEFAULT             },
+  { "titlescreen_5.post_delay",                        ARG_DEFAULT             },
+  { "titlescreen_5.auto_delay",                        ARG_DEFAULT             },
+
   { "[titlemessage_initial].x",                        "-1"                    },
   { "[titlemessage_initial].y",                        "-1"                    },
   { "[titlemessage_initial].width",            "-1"                    },
@@ -6152,6 +6214,7 @@ struct ConfigInfo image_config[] =
   { "menu.enter_screen.TITLE.fade_mode",       "fade"                  },
   { "menu.enter_screen.TITLE.fade_delay",      "500"                   },
   { "menu.enter_screen.TITLE.post_delay",      "250"                   },
+  { "menu.enter_screen.TITLE.auto_delay",      "-1"                    },
   { "menu.enter_screen.SCORES.fade_mode",      ARG_DEFAULT             },
   { "menu.enter_screen.SCORES.fade_delay",     ARG_DEFAULT             },
   { "menu.enter_screen.SCORES.post_delay",     ARG_DEFAULT             },
@@ -6167,6 +6230,7 @@ struct ConfigInfo image_config[] =
   { "menu.leave_screen.TITLE.fade_mode",       "fade"                  },
   { "menu.leave_screen.TITLE.fade_delay",      "500"                   },
   { "menu.leave_screen.TITLE.post_delay",      "250"                   },
+  { "menu.leave_screen.TITLE.auto_delay",      "-1"                    },
   { "menu.leave_screen.SCORES.fade_mode",      ARG_DEFAULT             },
   { "menu.leave_screen.SCORES.fade_delay",     ARG_DEFAULT             },
   { "menu.leave_screen.SCORES.post_delay",     ARG_DEFAULT             },
@@ -6182,6 +6246,7 @@ struct ConfigInfo image_config[] =
   { "menu.next_screen.TITLE.fade_mode",                "fade"                  },
   { "menu.next_screen.TITLE.fade_delay",       "500"                   },
   { "menu.next_screen.TITLE.post_delay",       "250"                   },
+  { "menu.next_screen.TITLE.auto_delay",       "-1"                    },
   { "menu.next_screen.INFO.fade_mode",         ARG_DEFAULT             },
   { "menu.next_screen.INFO.fade_delay",                ARG_DEFAULT             },
   { "menu.next_screen.INFO.post_delay",                ARG_DEFAULT             },
index d1b60e47c704ccbaa6119f38035134a0c16404b9..f8b9e8b859c9fe94e2eb09f8a13c2f92e3ddfa31 100644 (file)
@@ -8757,6 +8757,14 @@ static void InitMenuDesignSettings_SpecialPreProcessing()
 
   /* special case: initialize "ARG_DEFAULT" values in static default config */
   /* (e.g., initialize "[titlemessage].fade_mode" from "[title].fade_mode") */
+  titlescreen_initial_default.fade_mode  = title_initial_default.fade_mode;
+  titlescreen_initial_default.fade_delay = title_initial_default.fade_delay;
+  titlescreen_initial_default.post_delay = title_initial_default.post_delay;
+  titlescreen_initial_default.auto_delay = title_initial_default.auto_delay;
+  titlescreen_default.fade_mode  = title_default.fade_mode;
+  titlescreen_default.fade_delay = title_default.fade_delay;
+  titlescreen_default.post_delay = title_default.post_delay;
+  titlescreen_default.auto_delay = title_default.auto_delay;
   titlemessage_initial_default.fade_mode  = title_initial_default.fade_mode;
   titlemessage_initial_default.fade_delay = title_initial_default.fade_delay;
   titlemessage_initial_default.post_delay = title_initial_default.post_delay;
@@ -8770,6 +8778,8 @@ static void InitMenuDesignSettings_SpecialPreProcessing()
   /* (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") */
   for (i = 0; i < MAX_NUM_TITLE_MESSAGES; i++)
   {
+    titlescreen_initial[i] = titlescreen_initial_default;
+    titlescreen[i] = titlescreen_default;
     titlemessage_initial[i] = titlemessage_initial_default;
     titlemessage[i] = titlemessage_default;
   }
@@ -8890,15 +8900,37 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
   }
   titlemessage_arrays[] =
   {
-    /* initialize title messages from "next screen" definitions, if defined */
+    /* initialize first titles from "enter screen" definitions, if defined */
+    { titlescreen_initial_first,       "menu.enter_screen.TITLE"       },
+    { titlescreen_first,               "menu.enter_screen.TITLE"       },
+    { titlemessage_initial_first,      "menu.enter_screen.TITLE"       },
+    { titlemessage_first,              "menu.enter_screen.TITLE"       },
+
+    /* initialize titles from "next screen" definitions, if defined */
+    { titlescreen_initial,             "menu.next_screen.TITLE"        },
+    { titlescreen,                     "menu.next_screen.TITLE"        },
     { titlemessage_initial,            "menu.next_screen.TITLE"        },
     { titlemessage,                    "menu.next_screen.TITLE"        },
 
-    /* overwrite title messages with title definitions, if defined */
+    /* overwrite titles with title definitions, if defined */
+    { titlescreen_initial_first,       "[title_initial]"               },
+    { titlescreen_first,               "[title]"                       },
+    { titlemessage_initial_first,      "[title_initial]"               },
+    { titlemessage_first,              "[title]"                       },
+
+    { titlescreen_initial,             "[title_initial]"               },
+    { titlescreen,                     "[title]"                       },
     { titlemessage_initial,            "[title_initial]"               },
     { titlemessage,                    "[title]"                       },
 
-    /* overwrite title messages with title message definitions, if defined */
+    /* overwrite titles with title screen/message definitions, if defined */
+    { titlescreen_initial_first,       "[titlescreen_initial]"         },
+    { titlescreen_first,               "[titlescreen]"                 },
+    { titlemessage_initial_first,      "[titlemessage_initial]"        },
+    { titlemessage_first,              "[titlemessage]"                },
+
+    { titlescreen_initial,             "[titlescreen_initial]"         },
+    { titlescreen,                     "[titlescreen]"                 },
     { titlemessage_initial,            "[titlemessage_initial]"        },
     { titlemessage,                    "[titlemessage]"                },
 
@@ -9112,7 +9144,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
 
        tfi = *info;
 
-       *(boolean *)title_tokens[j].value = (boolean)parameter_value;
+       *(int *)title_tokens[j].value = (int)parameter_value;
 
        *info = tfi;
       }
@@ -9142,9 +9174,9 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
          tmi = array[k];
 
          if (titlemessage_tokens[j].type == TYPE_INTEGER)
-           *(boolean *)titlemessage_tokens[j].value = (boolean)parameter_value;
-         else
            *(int     *)titlemessage_tokens[j].value = (int)parameter_value;
+         else
+           *(boolean *)titlemessage_tokens[j].value = (boolean)parameter_value;
 
          array[k] = tmi;
        }
index 44f6f3bea3a398bbcdc1317a97766ec502784143..9659af05c781dd6d8b7bf3b1559d403bda194658 100644 (file)
@@ -146,9 +146,17 @@ struct ViewportInfo        viewport;
 struct TitleFadingInfo fading;
 struct TitleFadingInfo title_initial_default;
 struct TitleFadingInfo title_default;
+struct TitleMessageInfo        titlescreen_initial_default;
+struct TitleMessageInfo        titlescreen_initial_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlescreen_initial[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlescreen_default;
+struct TitleMessageInfo        titlescreen_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo        titlescreen[MAX_NUM_TITLE_IMAGES];
 struct TitleMessageInfo        titlemessage_initial_default;
+struct TitleMessageInfo        titlemessage_initial_first[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        titlemessage_default;
+struct TitleMessageInfo        titlemessage_first[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        titlemessage[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo        readme;
 struct InitInfo                init, init_last;
index f2e9357031a3e330907ce4ee55d63893ff60548b..8b4948d7530be721eda7d145ee7e7b6c900b2cfb 100644 (file)
@@ -2990,9 +2990,17 @@ extern struct TitleFadingInfo    fading;
 extern struct TitleFadingInfo  fading_none;
 extern struct TitleFadingInfo  title_initial_default;
 extern struct TitleFadingInfo  title_default;
+extern struct TitleMessageInfo titlescreen_initial_default;
+extern struct TitleMessageInfo titlescreen_initial_first[];
+extern struct TitleMessageInfo titlescreen_initial[];
+extern struct TitleMessageInfo titlescreen_default;
+extern struct TitleMessageInfo titlescreen_first[];
+extern struct TitleMessageInfo titlescreen[];
 extern struct TitleMessageInfo titlemessage_initial_default;
+extern struct TitleMessageInfo titlemessage_initial_first[];
 extern struct TitleMessageInfo titlemessage_initial[];
 extern struct TitleMessageInfo titlemessage_default;
+extern struct TitleMessageInfo titlemessage_first[];
 extern struct TitleMessageInfo titlemessage[];
 extern struct TitleMessageInfo readme;
 extern struct InitInfo         init, init_last;
index 1f94c7850526b018393acae400a9c0b37980e86c..a9448442cefcc3ffb3e47c695885da6624a46849 100644 (file)
@@ -455,6 +455,7 @@ struct TitleControlInfo
 {
   boolean is_image;
   boolean initial;
+  boolean first;
   int local_nr;
   int sort_priority;
 };
@@ -803,44 +804,29 @@ static int getTitleMusic(struct TitleControlInfo *tci)
 static struct TitleFadingInfo getTitleFading(struct TitleControlInfo *tci)
 {
   boolean is_image = tci->is_image;
-  int initial = tci->initial;
+  boolean initial = tci->initial;
+  boolean first = tci->first;
   int nr = tci->local_nr;
+  struct TitleMessageInfo tmi;
   struct TitleFadingInfo ti;
 
-  if (is_image)
-  {
-    int graphic = getTitleScreenGraphic(nr, initial);
-
-    /* initialize fading control values to default title config settings */
-    ti = (initial ? title_initial_default : title_default);
-
-    /* override default settings with image config settings, if defined */
-    if (graphic_info[graphic].fade_mode != FADE_MODE_DEFAULT)
-      ti.fade_mode = graphic_info[graphic].fade_mode;
-    if (graphic_info[graphic].fade_delay > -1)
-      ti.fade_delay = graphic_info[graphic].fade_delay;
-    if (graphic_info[graphic].post_delay > -1)
-      ti.post_delay = graphic_info[graphic].post_delay;
-    if (graphic_info[graphic].auto_delay > -1)
-      ti.auto_delay = graphic_info[graphic].auto_delay;
-  }
-  else
-  {
-    if (initial)
-    {
-      ti.fade_mode  = titlemessage_initial[nr].fade_mode;
-      ti.fade_delay = titlemessage_initial[nr].fade_delay;
-      ti.post_delay = titlemessage_initial[nr].post_delay;
-      ti.auto_delay = titlemessage_initial[nr].auto_delay;
-    }
-    else
-    {
-      ti.fade_mode  = titlemessage[nr].fade_mode;
-      ti.fade_delay = titlemessage[nr].fade_delay;
-      ti.post_delay = titlemessage[nr].post_delay;
-      ti.auto_delay = titlemessage[nr].auto_delay;
-    }
-  }
+  tmi = (is_image ? (initial ? (first ?
+                               titlescreen_initial_first[nr] :
+                               titlescreen_initial[nr])
+                            : (first ?
+                               titlescreen_first[nr] :
+                               titlescreen[nr]))
+                 : (initial ? (first ?
+                               titlemessage_initial_first[nr] :
+                               titlemessage_initial[nr])
+                            : (first ?
+                               titlemessage_first[nr] :
+                               titlemessage[nr])));
+
+  ti.fade_mode  = tmi.fade_mode;
+  ti.fade_delay = tmi.fade_delay;
+  ti.post_delay = tmi.post_delay;
+  ti.auto_delay = tmi.auto_delay;
 
   return ti;
 }
@@ -872,6 +858,8 @@ static void InitializeTitleControlsExt_AddTitleInfo(boolean is_image,
   title_controls[num_title_screens].local_nr = nr;
   title_controls[num_title_screens].sort_priority = sort_priority;
 
+  title_controls[num_title_screens].first = FALSE;     /* will be set later */
+
   num_title_screens++;
 }
 
@@ -914,6 +902,9 @@ static void InitializeTitleControls(boolean show_title_initial)
   /* sort title screens according to sort_priority and title number */
   qsort(title_controls, num_title_screens, sizeof(struct TitleControlInfo),
        compareTitleControlInfo);
+
+  /* mark first title screen */
+  title_controls[0].first = TRUE;
 }
 
 static boolean visibleMenuPos(struct MenuPosInfo *pos)
@@ -1563,7 +1554,13 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
     last_sound = SND_UNDEFINED;
     last_music = MUS_UNDEFINED;
 
-    FadeSetEnterScreen();
+    if (num_title_screens != 0)
+    {
+      FadeSetEnterScreen();
+
+      /* use individual title fading instead of global "enter screen" fading */
+      fading = getTitleFading(tci);
+    }
 
     if (game_status_last_screen == GAME_MODE_INFO)
     {
@@ -1622,8 +1619,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button)
   {
     if (game_status_last_screen == GAME_MODE_INFO && num_title_screens == 0)
     {
-      FadeSetEnterScreen();
-
       game_status = GAME_MODE_INFO;
       info_mode = INFO_MODE_MAIN;