From 61a2ef633881ce5e865c8747f6393700c870f675 Mon Sep 17 00:00:00 2001
From: Holger Schemel <info@artsoft.org>
Date: Mon, 9 May 2016 23:10:32 +0200
Subject: [PATCH] fixed default screen fading for the first title screen

---
 build-scripts/create_element_defs.pl |  4 +++-
 src/files.c                          | 34 ++++++++++++++++++++++++++++
 src/main.c                           | 14 ++++++++----
 src/main.h                           | 14 ++++++++----
 4 files changed, 57 insertions(+), 9 deletions(-)

diff --git a/build-scripts/create_element_defs.pl b/build-scripts/create_element_defs.pl
index c1da1daf..db4d42a9 100755
--- a/build-scripts/create_element_defs.pl
+++ b/build-scripts/create_element_defs.pl
@@ -2428,7 +2428,9 @@ sub print_image_config_vars
 
 	    print_image_config_var_entry("\"$token\"", "&$var");
 
-	    if ($var =~ /^(titlescreen.*)\[\d\]/ ||
+	    if ($var =~ /^(title)_default/ ||
+		$var =~ /^(title_initial)_default/ ||
+		$var =~ /^(titlescreen.*)\[\d\]/ ||
 		$var =~ /^(titlemessage.*)\[\d\]/)
 	    {
 		my $prefix = $1;
diff --git a/src/files.c b/src/files.c
index ebf045cb..edc1358e 100644
--- a/src/files.c
+++ b/src/files.c
@@ -8764,6 +8764,31 @@ 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_first_default.fade_mode  =
+    title_initial_first_default.fade_mode;
+  titlescreen_initial_first_default.fade_delay =
+    title_initial_first_default.fade_delay;
+  titlescreen_initial_first_default.post_delay =
+    title_initial_first_default.post_delay;
+  titlescreen_initial_first_default.auto_delay =
+    title_initial_first_default.auto_delay;
+  titlescreen_first_default.fade_mode  = title_first_default.fade_mode;
+  titlescreen_first_default.fade_delay = title_first_default.fade_delay;
+  titlescreen_first_default.post_delay = title_first_default.post_delay;
+  titlescreen_first_default.auto_delay = title_first_default.auto_delay;
+  titlemessage_initial_first_default.fade_mode  =
+    title_initial_first_default.fade_mode;
+  titlemessage_initial_first_default.fade_delay =
+    title_initial_first_default.fade_delay;
+  titlemessage_initial_first_default.post_delay =
+    title_initial_first_default.post_delay;
+  titlemessage_initial_first_default.auto_delay =
+    title_initial_first_default.auto_delay;
+  titlemessage_first_default.fade_mode  = title_first_default.fade_mode;
+  titlemessage_first_default.fade_delay = title_first_default.fade_delay;
+  titlemessage_first_default.post_delay = title_first_default.post_delay;
+  titlemessage_first_default.auto_delay = title_first_default.auto_delay;
+
   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;
@@ -8785,6 +8810,11 @@ 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_first[i] = titlescreen_initial_first_default;
+    titlescreen_first[i] = titlescreen_first_default;
+    titlemessage_initial_first[i] = titlemessage_initial_first_default;
+    titlemessage_first[i] = titlemessage_first_default;
+
     titlescreen_initial[i] = titlescreen_initial_default;
     titlescreen[i] = titlescreen_default;
     titlemessage_initial[i] = titlemessage_initial_default;
@@ -8894,6 +8924,10 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
   }
   title_info[] =
   {
+    /* initialize first titles from "enter screen" definitions, if defined */
+    { &title_initial_first_default,	"menu.enter_screen.TITLE"	},
+    { &title_first_default,		"menu.enter_screen.TITLE"	},
+
     /* initialize title screens from "next screen" definitions, if defined */
     { &title_initial_default,		"menu.next_screen.TITLE"	},
     { &title_default,			"menu.next_screen.TITLE"	},
diff --git a/src/main.c b/src/main.c
index 6d76bbc6..4d2707e9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -143,19 +143,25 @@ struct GlobalInfo	global;
 struct BorderInfo	border;
 struct ViewportInfo	viewport;
 struct TitleFadingInfo	fading;
+struct TitleFadingInfo	title_initial_first_default;
 struct TitleFadingInfo	title_initial_default;
+struct TitleFadingInfo	title_first_default;
 struct TitleFadingInfo	title_default;
-struct TitleMessageInfo	titlescreen_initial_default;
+struct TitleMessageInfo	titlescreen_initial_first_default;
 struct TitleMessageInfo	titlescreen_initial_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo	titlescreen_initial_default;
 struct TitleMessageInfo	titlescreen_initial[MAX_NUM_TITLE_IMAGES];
-struct TitleMessageInfo	titlescreen_default;
+struct TitleMessageInfo	titlescreen_first_default;
 struct TitleMessageInfo	titlescreen_first[MAX_NUM_TITLE_IMAGES];
+struct TitleMessageInfo	titlescreen_default;
 struct TitleMessageInfo	titlescreen[MAX_NUM_TITLE_IMAGES];
-struct TitleMessageInfo	titlemessage_initial_default;
+struct TitleMessageInfo	titlemessage_initial_first_default;
 struct TitleMessageInfo	titlemessage_initial_first[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo	titlemessage_initial_default;
 struct TitleMessageInfo	titlemessage_initial[MAX_NUM_TITLE_MESSAGES];
-struct TitleMessageInfo	titlemessage_default;
+struct TitleMessageInfo	titlemessage_first_default;
 struct TitleMessageInfo	titlemessage_first[MAX_NUM_TITLE_MESSAGES];
+struct TitleMessageInfo	titlemessage_default;
 struct TitleMessageInfo	titlemessage[MAX_NUM_TITLE_MESSAGES];
 struct TitleMessageInfo	readme;
 struct InitInfo		init, init_last;
diff --git a/src/main.h b/src/main.h
index 6dfbd90e..2478a9d0 100644
--- a/src/main.h
+++ b/src/main.h
@@ -3082,19 +3082,25 @@ extern struct BorderInfo	border;
 extern struct ViewportInfo	viewport;
 extern struct TitleFadingInfo	fading;
 extern struct TitleFadingInfo	fading_none;
+extern struct TitleFadingInfo	title_initial_first_default;
 extern struct TitleFadingInfo	title_initial_default;
+extern struct TitleFadingInfo	title_first_default;
 extern struct TitleFadingInfo	title_default;
-extern struct TitleMessageInfo	titlescreen_initial_default;
+extern struct TitleMessageInfo	titlescreen_initial_first_default;
 extern struct TitleMessageInfo	titlescreen_initial_first[];
+extern struct TitleMessageInfo	titlescreen_initial_default;
 extern struct TitleMessageInfo	titlescreen_initial[];
-extern struct TitleMessageInfo	titlescreen_default;
+extern struct TitleMessageInfo	titlescreen_first_default;
 extern struct TitleMessageInfo	titlescreen_first[];
+extern struct TitleMessageInfo	titlescreen_default;
 extern struct TitleMessageInfo	titlescreen[];
-extern struct TitleMessageInfo	titlemessage_initial_default;
+extern struct TitleMessageInfo	titlemessage_initial_first_default;
 extern struct TitleMessageInfo	titlemessage_initial_first[];
+extern struct TitleMessageInfo	titlemessage_initial_default;
 extern struct TitleMessageInfo	titlemessage_initial[];
-extern struct TitleMessageInfo	titlemessage_default;
+extern struct TitleMessageInfo	titlemessage_first_default;
 extern struct TitleMessageInfo	titlemessage_first[];
+extern struct TitleMessageInfo	titlemessage_default;
 extern struct TitleMessageInfo	titlemessage[];
 extern struct TitleMessageInfo	readme;
 extern struct InitInfo		init, init_last;
-- 
2.34.1