From: Holger Schemel Date: Mon, 19 Mar 2007 23:19:15 +0000 (+0100) Subject: rnd-20070320-1-src X-Git-Tag: 3.2.4^2~62 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=83542c237bd00dad76dcd103e0343d648418e765;p=rocksndiamonds.git rnd-20070320-1-src * fading settings of "[titlemessage_initial]" and "[titlemessage]" set to "[DEFAULT]" in static configuration (set from "[title_initial]" and "[title]") * improved title fading, allowing fading animation types "none", "fade" and "crossfade" (including cross-fading of last title to main menu) --- diff --git a/ChangeLog b/ChangeLog index c1cd0dcf..cc9c815a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,11 @@ 2007-03-19 * titlemessage_initial_x and titlemessage_x set to "[DEFAULT]" in static configuration (set from "[titlemessage_initial]" and "[titlemessage]") + * fading settings of "[titlemessage_initial]" and "[titlemessage]" set + to "[DEFAULT]" in static configuration (set from "[title_initial]" and + "[title]") + * improved title fading, allowing fading animation types "none", "fade" + and "crossfade" (including cross-fading of last title to main menu) 2007-03-18 * added configurability of graphics, sounds and music for title screens, diff --git a/src/conf_gfx.c b/src/conf_gfx.c index c98d0601..cb7bcc17 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4980,6 +4980,15 @@ struct ConfigInfo image_config[] = /* keyword to start parser: "CONFIG_VARS_START" <-- do not change! */ + { "[title_initial].anim_mode", "fade" }, + { "[title_initial].fade_delay", "500" }, + { "[title_initial].post_delay", "250" }, + { "[title_initial].auto_delay", "-1" }, + { "[title].anim_mode", "fade" }, + { "[title].fade_delay", "500" }, + { "[title].post_delay", "250" }, + { "[title].auto_delay", "-1" }, + { "[titlemessage_initial].x", "336" }, { "[titlemessage_initial].y", "280" }, { "[titlemessage_initial].width", "640" }, @@ -4993,6 +5002,10 @@ struct ConfigInfo image_config[] = { "[titlemessage_initial].centered", "false" }, { "[titlemessage_initial].parse_comments", "false" }, { "[titlemessage_initial].sort_priority", "0" }, + { "[titlemessage_initial].anim_mode", ARG_DEFAULT }, + { "[titlemessage_initial].fade_delay", ARG_DEFAULT }, + { "[titlemessage_initial].post_delay", ARG_DEFAULT }, + { "[titlemessage_initial].auto_delay", ARG_DEFAULT }, { "[titlemessage].x", "336" }, { "[titlemessage].y", "280" }, { "[titlemessage].width", "640" }, @@ -5006,6 +5019,10 @@ struct ConfigInfo image_config[] = { "[titlemessage].centered", "false" }, { "[titlemessage].parse_comments", "false" }, { "[titlemessage].sort_priority", "0" }, + { "[titlemessage].anim_mode", ARG_DEFAULT }, + { "[titlemessage].fade_delay", ARG_DEFAULT }, + { "[titlemessage].post_delay", ARG_DEFAULT }, + { "[titlemessage].auto_delay", ARG_DEFAULT }, { "titlemessage_initial_1.x", ARG_DEFAULT }, { "titlemessage_initial_1.y", ARG_DEFAULT }, @@ -5020,6 +5037,10 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_1.centered", ARG_DEFAULT }, { "titlemessage_initial_1.parse_comments", ARG_DEFAULT }, { "titlemessage_initial_1.sort_priority", ARG_DEFAULT }, + { "titlemessage_initial_1.anim_mode", ARG_DEFAULT }, + { "titlemessage_initial_1.fade_delay", ARG_DEFAULT }, + { "titlemessage_initial_1.post_delay", ARG_DEFAULT }, + { "titlemessage_initial_1.auto_delay", ARG_DEFAULT }, { "titlemessage_initial_2.x", ARG_DEFAULT }, { "titlemessage_initial_2.y", ARG_DEFAULT }, { "titlemessage_initial_2.width", ARG_DEFAULT }, @@ -5033,6 +5054,10 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_2.centered", ARG_DEFAULT }, { "titlemessage_initial_2.parse_comments", ARG_DEFAULT }, { "titlemessage_initial_2.sort_priority", ARG_DEFAULT }, + { "titlemessage_initial_2.anim_mode", ARG_DEFAULT }, + { "titlemessage_initial_2.fade_delay", ARG_DEFAULT }, + { "titlemessage_initial_2.post_delay", ARG_DEFAULT }, + { "titlemessage_initial_2.auto_delay", ARG_DEFAULT }, { "titlemessage_initial_3.x", ARG_DEFAULT }, { "titlemessage_initial_3.y", ARG_DEFAULT }, { "titlemessage_initial_3.width", ARG_DEFAULT }, @@ -5046,6 +5071,10 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_3.centered", ARG_DEFAULT }, { "titlemessage_initial_3.parse_comments", ARG_DEFAULT }, { "titlemessage_initial_3.sort_priority", ARG_DEFAULT }, + { "titlemessage_initial_3.anim_mode", ARG_DEFAULT }, + { "titlemessage_initial_3.fade_delay", ARG_DEFAULT }, + { "titlemessage_initial_3.post_delay", ARG_DEFAULT }, + { "titlemessage_initial_3.auto_delay", ARG_DEFAULT }, { "titlemessage_initial_4.x", ARG_DEFAULT }, { "titlemessage_initial_4.y", ARG_DEFAULT }, { "titlemessage_initial_4.width", ARG_DEFAULT }, @@ -5059,6 +5088,10 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_4.centered", ARG_DEFAULT }, { "titlemessage_initial_4.parse_comments", ARG_DEFAULT }, { "titlemessage_initial_4.sort_priority", ARG_DEFAULT }, + { "titlemessage_initial_4.anim_mode", ARG_DEFAULT }, + { "titlemessage_initial_4.fade_delay", ARG_DEFAULT }, + { "titlemessage_initial_4.post_delay", ARG_DEFAULT }, + { "titlemessage_initial_4.auto_delay", ARG_DEFAULT }, { "titlemessage_initial_5.x", ARG_DEFAULT }, { "titlemessage_initial_5.y", ARG_DEFAULT }, { "titlemessage_initial_5.width", ARG_DEFAULT }, @@ -5072,6 +5105,10 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_5.centered", ARG_DEFAULT }, { "titlemessage_initial_5.parse_comments", ARG_DEFAULT }, { "titlemessage_initial_5.sort_priority", ARG_DEFAULT }, + { "titlemessage_initial_5.anim_mode", ARG_DEFAULT }, + { "titlemessage_initial_5.fade_delay", ARG_DEFAULT }, + { "titlemessage_initial_5.post_delay", ARG_DEFAULT }, + { "titlemessage_initial_5.auto_delay", ARG_DEFAULT }, { "titlemessage_1.x", ARG_DEFAULT }, { "titlemessage_1.y", ARG_DEFAULT }, { "titlemessage_1.width", ARG_DEFAULT }, @@ -5085,6 +5122,10 @@ struct ConfigInfo image_config[] = { "titlemessage_1.centered", ARG_DEFAULT }, { "titlemessage_1.parse_comments", ARG_DEFAULT }, { "titlemessage_1.sort_priority", ARG_DEFAULT }, + { "titlemessage_1.anim_mode", ARG_DEFAULT }, + { "titlemessage_1.fade_delay", ARG_DEFAULT }, + { "titlemessage_1.post_delay", ARG_DEFAULT }, + { "titlemessage_1.auto_delay", ARG_DEFAULT }, { "titlemessage_2.x", ARG_DEFAULT }, { "titlemessage_2.y", ARG_DEFAULT }, { "titlemessage_2.width", ARG_DEFAULT }, @@ -5098,6 +5139,10 @@ struct ConfigInfo image_config[] = { "titlemessage_2.centered", ARG_DEFAULT }, { "titlemessage_2.parse_comments", ARG_DEFAULT }, { "titlemessage_2.sort_priority", ARG_DEFAULT }, + { "titlemessage_2.anim_mode", ARG_DEFAULT }, + { "titlemessage_2.fade_delay", ARG_DEFAULT }, + { "titlemessage_2.post_delay", ARG_DEFAULT }, + { "titlemessage_2.auto_delay", ARG_DEFAULT }, { "titlemessage_3.x", ARG_DEFAULT }, { "titlemessage_3.y", ARG_DEFAULT }, { "titlemessage_3.width", ARG_DEFAULT }, @@ -5111,6 +5156,10 @@ struct ConfigInfo image_config[] = { "titlemessage_3.centered", ARG_DEFAULT }, { "titlemessage_3.parse_comments", ARG_DEFAULT }, { "titlemessage_3.sort_priority", ARG_DEFAULT }, + { "titlemessage_3.anim_mode", ARG_DEFAULT }, + { "titlemessage_3.fade_delay", ARG_DEFAULT }, + { "titlemessage_3.post_delay", ARG_DEFAULT }, + { "titlemessage_3.auto_delay", ARG_DEFAULT }, { "titlemessage_4.x", ARG_DEFAULT }, { "titlemessage_4.y", ARG_DEFAULT }, { "titlemessage_4.width", ARG_DEFAULT }, @@ -5124,6 +5173,10 @@ struct ConfigInfo image_config[] = { "titlemessage_4.centered", ARG_DEFAULT }, { "titlemessage_4.parse_comments", ARG_DEFAULT }, { "titlemessage_4.sort_priority", ARG_DEFAULT }, + { "titlemessage_4.anim_mode", ARG_DEFAULT }, + { "titlemessage_4.fade_delay", ARG_DEFAULT }, + { "titlemessage_4.post_delay", ARG_DEFAULT }, + { "titlemessage_4.auto_delay", ARG_DEFAULT }, { "titlemessage_5.x", ARG_DEFAULT }, { "titlemessage_5.y", ARG_DEFAULT }, { "titlemessage_5.width", ARG_DEFAULT }, @@ -5137,6 +5190,10 @@ struct ConfigInfo image_config[] = { "titlemessage_5.centered", ARG_DEFAULT }, { "titlemessage_5.parse_comments", ARG_DEFAULT }, { "titlemessage_5.sort_priority", ARG_DEFAULT }, + { "titlemessage_5.anim_mode", ARG_DEFAULT }, + { "titlemessage_5.fade_delay", ARG_DEFAULT }, + { "titlemessage_5.post_delay", ARG_DEFAULT }, + { "titlemessage_5.auto_delay", ARG_DEFAULT }, { "readme.x", "272" }, { "readme.y", "150" }, @@ -5164,9 +5221,11 @@ struct ConfigInfo image_config[] = { "border.draw_masked.PLAYING", "false" }, { "border.draw_masked.DOOR", "false" }, - { "title.fade_delay", "500" }, - { "title.post_delay", "250" }, - { "title.auto_delay", "-1" }, +#if 0 + { "[title].fade_delay", "500" }, + { "[title].post_delay", "250" }, + { "[title].auto_delay", "-1" }, +#endif { "menu.fade_delay", "250" }, { "menu.post_delay", "125" }, @@ -5407,7 +5466,7 @@ struct ConfigInfo image_config[] = { "game.panel.gems.x", "50" }, { "game.panel.gems.y", "54" }, { "game.panel.gems.align", "center" }, - { "game.panel.gems.valign", "top" }, + { "game.panel.gems.valign", "top" }, { "game.panel.gems.chars", "3" }, { "game.panel.gems.font", "font.text_2" }, diff --git a/src/conf_var.c b/src/conf_var.c index ae8fefb7..c51af90a 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -20,6 +20,38 @@ struct TokenIntPtrInfo image_config_vars[] = { + { + "[title_initial].anim_mode", + &title_initial_default.anim_mode + }, + { + "[title_initial].fade_delay", + &title_initial_default.fade_delay + }, + { + "[title_initial].post_delay", + &title_initial_default.post_delay + }, + { + "[title_initial].auto_delay", + &title_initial_default.auto_delay + }, + { + "[title].anim_mode", + &title_default.anim_mode + }, + { + "[title].fade_delay", + &title_default.fade_delay + }, + { + "[title].post_delay", + &title_default.post_delay + }, + { + "[title].auto_delay", + &title_default.auto_delay + }, { "[titlemessage_initial].x", &titlemessage_initial_default.x @@ -72,6 +104,22 @@ struct TokenIntPtrInfo image_config_vars[] = "[titlemessage_initial].sort_priority", &titlemessage_initial_default.sort_priority }, + { + "[titlemessage_initial].anim_mode", + &titlemessage_initial_default.anim_mode + }, + { + "[titlemessage_initial].fade_delay", + &titlemessage_initial_default.fade_delay + }, + { + "[titlemessage_initial].post_delay", + &titlemessage_initial_default.post_delay + }, + { + "[titlemessage_initial].auto_delay", + &titlemessage_initial_default.auto_delay + }, { "[titlemessage].x", &titlemessage_default.x @@ -124,6 +172,22 @@ struct TokenIntPtrInfo image_config_vars[] = "[titlemessage].sort_priority", &titlemessage_default.sort_priority }, + { + "[titlemessage].anim_mode", + &titlemessage_default.anim_mode + }, + { + "[titlemessage].fade_delay", + &titlemessage_default.fade_delay + }, + { + "[titlemessage].post_delay", + &titlemessage_default.post_delay + }, + { + "[titlemessage].auto_delay", + &titlemessage_default.auto_delay + }, { "titlemessage_initial_1.x", &titlemessage_initial[0].x @@ -176,6 +240,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_initial_1.sort_priority", &titlemessage_initial[0].sort_priority }, + { + "titlemessage_initial_1.anim_mode", + &titlemessage_initial[0].anim_mode + }, + { + "titlemessage_initial_1.fade_delay", + &titlemessage_initial[0].fade_delay + }, + { + "titlemessage_initial_1.post_delay", + &titlemessage_initial[0].post_delay + }, + { + "titlemessage_initial_1.auto_delay", + &titlemessage_initial[0].auto_delay + }, { "titlemessage_initial_2.x", &titlemessage_initial[1].x @@ -228,6 +308,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_initial_2.sort_priority", &titlemessage_initial[1].sort_priority }, + { + "titlemessage_initial_2.anim_mode", + &titlemessage_initial[1].anim_mode + }, + { + "titlemessage_initial_2.fade_delay", + &titlemessage_initial[1].fade_delay + }, + { + "titlemessage_initial_2.post_delay", + &titlemessage_initial[1].post_delay + }, + { + "titlemessage_initial_2.auto_delay", + &titlemessage_initial[1].auto_delay + }, { "titlemessage_initial_3.x", &titlemessage_initial[2].x @@ -280,6 +376,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_initial_3.sort_priority", &titlemessage_initial[2].sort_priority }, + { + "titlemessage_initial_3.anim_mode", + &titlemessage_initial[2].anim_mode + }, + { + "titlemessage_initial_3.fade_delay", + &titlemessage_initial[2].fade_delay + }, + { + "titlemessage_initial_3.post_delay", + &titlemessage_initial[2].post_delay + }, + { + "titlemessage_initial_3.auto_delay", + &titlemessage_initial[2].auto_delay + }, { "titlemessage_initial_4.x", &titlemessage_initial[3].x @@ -332,6 +444,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_initial_4.sort_priority", &titlemessage_initial[3].sort_priority }, + { + "titlemessage_initial_4.anim_mode", + &titlemessage_initial[3].anim_mode + }, + { + "titlemessage_initial_4.fade_delay", + &titlemessage_initial[3].fade_delay + }, + { + "titlemessage_initial_4.post_delay", + &titlemessage_initial[3].post_delay + }, + { + "titlemessage_initial_4.auto_delay", + &titlemessage_initial[3].auto_delay + }, { "titlemessage_initial_5.x", &titlemessage_initial[4].x @@ -384,6 +512,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_initial_5.sort_priority", &titlemessage_initial[4].sort_priority }, + { + "titlemessage_initial_5.anim_mode", + &titlemessage_initial[4].anim_mode + }, + { + "titlemessage_initial_5.fade_delay", + &titlemessage_initial[4].fade_delay + }, + { + "titlemessage_initial_5.post_delay", + &titlemessage_initial[4].post_delay + }, + { + "titlemessage_initial_5.auto_delay", + &titlemessage_initial[4].auto_delay + }, { "titlemessage_1.x", &titlemessage[0].x @@ -436,6 +580,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_1.sort_priority", &titlemessage[0].sort_priority }, + { + "titlemessage_1.anim_mode", + &titlemessage[0].anim_mode + }, + { + "titlemessage_1.fade_delay", + &titlemessage[0].fade_delay + }, + { + "titlemessage_1.post_delay", + &titlemessage[0].post_delay + }, + { + "titlemessage_1.auto_delay", + &titlemessage[0].auto_delay + }, { "titlemessage_2.x", &titlemessage[1].x @@ -488,6 +648,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_2.sort_priority", &titlemessage[1].sort_priority }, + { + "titlemessage_2.anim_mode", + &titlemessage[1].anim_mode + }, + { + "titlemessage_2.fade_delay", + &titlemessage[1].fade_delay + }, + { + "titlemessage_2.post_delay", + &titlemessage[1].post_delay + }, + { + "titlemessage_2.auto_delay", + &titlemessage[1].auto_delay + }, { "titlemessage_3.x", &titlemessage[2].x @@ -540,6 +716,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_3.sort_priority", &titlemessage[2].sort_priority }, + { + "titlemessage_3.anim_mode", + &titlemessage[2].anim_mode + }, + { + "titlemessage_3.fade_delay", + &titlemessage[2].fade_delay + }, + { + "titlemessage_3.post_delay", + &titlemessage[2].post_delay + }, + { + "titlemessage_3.auto_delay", + &titlemessage[2].auto_delay + }, { "titlemessage_4.x", &titlemessage[3].x @@ -592,6 +784,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_4.sort_priority", &titlemessage[3].sort_priority }, + { + "titlemessage_4.anim_mode", + &titlemessage[3].anim_mode + }, + { + "titlemessage_4.fade_delay", + &titlemessage[3].fade_delay + }, + { + "titlemessage_4.post_delay", + &titlemessage[3].post_delay + }, + { + "titlemessage_4.auto_delay", + &titlemessage[3].auto_delay + }, { "titlemessage_5.x", &titlemessage[4].x @@ -644,6 +852,22 @@ struct TokenIntPtrInfo image_config_vars[] = "titlemessage_5.sort_priority", &titlemessage[4].sort_priority }, + { + "titlemessage_5.anim_mode", + &titlemessage[4].anim_mode + }, + { + "titlemessage_5.fade_delay", + &titlemessage[4].fade_delay + }, + { + "titlemessage_5.post_delay", + &titlemessage[4].post_delay + }, + { + "titlemessage_5.auto_delay", + &titlemessage[4].auto_delay + }, { "readme.x", &readme.x @@ -737,16 +961,16 @@ struct TokenIntPtrInfo image_config_vars[] = &border.draw_masked[GFX_SPECIAL_ARG_DOOR] }, { - "title.fade_delay", - &title.fade_delay + "[title].fade_delay", + &title_default.fade_delay }, { - "title.post_delay", - &title.post_delay + "[title].post_delay", + &title_default.post_delay }, { - "title.auto_delay", - &title.auto_delay + "[title].auto_delay", + &title_default.auto_delay }, { "menu.fade_delay", diff --git a/src/conftime.h b/src/conftime.h index 07f70bb8..7c057e9d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-03-19 15:16" +#define COMPILE_DATE_STRING "2007-03-20 00:07" diff --git a/src/files.c b/src/files.c index 501339f1..f41465f4 100644 --- a/src/files.c +++ b/src/files.c @@ -8339,6 +8339,10 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) { TYPE_BOOLEAN, &tmi.centered, ".centered" }, { TYPE_BOOLEAN, &tmi.parse_comments, ".parse_comments" }, { TYPE_INTEGER, &tmi.sort_priority, ".sort_priority" }, + { TYPE_INTEGER, &tmi.anim_mode, ".anim_mode" }, + { TYPE_INTEGER, &tmi.fade_delay, ".fade_delay" }, + { TYPE_INTEGER, &tmi.post_delay, ".post_delay" }, + { TYPE_INTEGER, &tmi.auto_delay, ".auto_delay" }, { -1, NULL, NULL } }; @@ -8364,7 +8368,10 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) if ((setup_file_hash = loadSetupFileHash(filename)) == NULL) return; + /* the following initializes hierarchical values from dynamic configuration */ + /* special case: initialize with default values that may be overwritten */ + /* (e.g., init "menu.draw_xoffset.INFO" from "menu.draw_xoffset") */ for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) { char *value_1 = getHashEntry(setup_file_hash, "menu.draw_xoffset"); @@ -8380,6 +8387,7 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) } /* special case: initialize with default values that may be overwritten */ + /* (eg, init "menu.draw_xoffset.INFO[MUSIC]" from "menu.draw_xoffset.INFO") */ for (i = 0; i < NUM_SPECIAL_GFX_INFO_ARGS; i++) { char *value_1 = getHashEntry(setup_file_hash, "menu.draw_xoffset.INFO"); @@ -8392,6 +8400,7 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) } /* special case: initialize with default values that may be overwritten */ + /* (e.g., init "titlemessage_1.anim_mode" from "[titlemessage].anim_mode") */ for (i = 0; titlemessage_arrays[i].array != NULL; i++) { struct TitleMessageInfo *array = titlemessage_arrays[i].array; @@ -8449,7 +8458,21 @@ void LoadSpecialMenuDesignSettings() get_token_parameter_value(image_config_vars[i].token, image_config[j].value); - /* special case: initialize with default values that may be overwritten */ + /* the following initializes hierarchical values from static configuration */ + + /* special case: initialize "ARG_DEFAULT" values in static default config */ + /* (e.g., initialize "[titlemessage].anim_mode" from "[title].anim_mode") */ + titlemessage_initial_default.anim_mode = title_initial_default.anim_mode; + titlemessage_initial_default.fade_delay = title_initial_default.fade_delay; + titlemessage_initial_default.post_delay = title_initial_default.post_delay; + titlemessage_initial_default.auto_delay = title_initial_default.auto_delay; + titlemessage_default.anim_mode = title_default.anim_mode; + titlemessage_default.fade_delay = title_default.fade_delay; + titlemessage_default.post_delay = title_default.post_delay; + titlemessage_default.auto_delay = title_default.auto_delay; + + /* special case: initialize "ARG_DEFAULT" values in static default config */ + /* (e.g., init "titlemessage_1.anim_mode" from "[titlemessage].anim_mode") */ for (i = 0; i < MAX_NUM_TITLE_MESSAGES; i++) { titlemessage_initial[i] = titlemessage_initial_default; diff --git a/src/main.c b/src/main.c index 4640ac83..7199ab7d 100644 --- a/src/main.c +++ b/src/main.c @@ -106,6 +106,8 @@ struct SetupInfo setup; struct GameInfo game; struct GlobalInfo global; struct BorderInfo border; +struct TitleInfo title_initial_default; +struct TitleInfo title_default; struct TitleInfo title; struct TitleMessageInfo titlemessage_initial_default; struct TitleMessageInfo titlemessage_initial[MAX_NUM_TITLE_MESSAGES]; diff --git a/src/main.h b/src/main.h index ea9c3345..eb8ebd31 100644 --- a/src/main.h +++ b/src/main.h @@ -2049,13 +2049,10 @@ struct MenuMainInfo struct TitleInfo { + int anim_mode; int fade_delay; int post_delay; int auto_delay; - - int fade_delay_final; - int post_delay_final; - int auto_delay_final; }; struct TitleMessageInfo @@ -2069,6 +2066,11 @@ struct TitleMessageInfo boolean centered; boolean parse_comments; int sort_priority; + + int anim_mode; + int fade_delay; + int post_delay; + int auto_delay; }; struct MenuInfo @@ -2684,6 +2686,8 @@ extern struct HiScore highscore[]; extern struct TapeInfo tape; extern struct GlobalInfo global; extern struct BorderInfo border; +extern struct TitleInfo title_initial_default; +extern struct TitleInfo title_default; extern struct TitleInfo title; extern struct TitleMessageInfo titlemessage_initial_default; extern struct TitleMessageInfo titlemessage_initial[]; diff --git a/src/screens.c b/src/screens.c index 16f8a580..6f994a53 100644 --- a/src/screens.c +++ b/src/screens.c @@ -257,7 +257,6 @@ struct TitleControlInfo struct TitleControlInfo title_controls[MAX_NUM_TITLE_SCREENS]; - /* main menu display and control definitions */ #define MAIN_CONTROL_NAME 0 @@ -540,8 +539,11 @@ static int getTitleBackground(int nr, boolean initial, boolean is_image) return IMG_UNDEFINED; } -static int getTitleSound(int nr, boolean initial, boolean is_image) +static int getTitleSound(struct TitleControlInfo *tci) { + boolean is_image = tci->is_image; + int initial = tci->initial; + int nr = tci->local_nr; int mode = (initial ? GAME_MODE_TITLE_INITIAL : GAME_MODE_TITLE); int base = (is_image ? (initial ? SND_BACKGROUND_TITLESCREEN_INITIAL_1 : @@ -567,8 +569,11 @@ static int getTitleSound(int nr, boolean initial, boolean is_image) return SND_UNDEFINED; } -static int getTitleMusic(int nr, boolean initial, boolean is_image) +static int getTitleMusic(struct TitleControlInfo *tci) { + boolean is_image = tci->is_image; + int initial = tci->initial; + int nr = tci->local_nr; int mode = (initial ? GAME_MODE_TITLE_INITIAL : GAME_MODE_TITLE); int base = (is_image ? (initial ? MUS_BACKGROUND_TITLESCREEN_INITIAL_1 : @@ -594,6 +599,54 @@ static int getTitleMusic(int nr, boolean initial, boolean is_image) return MUS_UNDEFINED; } +static struct TitleInfo getTitleFading(struct TitleControlInfo *tci) +{ + boolean is_image = tci->is_image; + int initial = tci->initial; + int nr = tci->local_nr; + struct TitleInfo 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].anim_mode != ANIM_DEFAULT) + ti.anim_mode = graphic_info[graphic].anim_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.anim_mode = titlemessage_initial[nr].anim_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.anim_mode = titlemessage[nr].anim_mode; + ti.fade_delay = titlemessage[nr].fade_delay; + ti.post_delay = titlemessage[nr].post_delay; + ti.auto_delay = titlemessage[nr].auto_delay; + } + } + + if (ti.anim_mode == ANIM_NONE) + ti.fade_delay = ti.post_delay = 0; + + return ti; +} + static int compareTitleControlInfo(const void *object1, const void *object2) { const struct TitleControlInfo *tci1 = (struct TitleControlInfo *)object1; @@ -1043,17 +1096,28 @@ void DrawTitleScreenImage(int nr, boolean initial) redraw_mask = REDRAW_ALL; /* reset fading control values to default config settings */ +#if 1 + +#if 0 + title = getTitleFading(nr, initial, TRUE); +#endif + +#else + title.fade_delay_final = title.fade_delay; title.post_delay_final = title.post_delay; title.auto_delay_final = title.auto_delay; /* override default settings with image config settings, if defined */ + if (graphic_info[graphic].anim_mode != ANIM_DEFAULT) + title.anim_mode = graphic_info[graphic].anim_mode; if (graphic_info[graphic].fade_delay > -1) - title.fade_delay_final = graphic_info[graphic].fade_delay; + title.fade_delay = graphic_info[graphic].fade_delay; if (graphic_info[graphic].post_delay > -1) - title.post_delay_final = graphic_info[graphic].post_delay; + title.post_delay = graphic_info[graphic].post_delay; if (graphic_info[graphic].auto_delay > -1) - title.auto_delay_final = graphic_info[graphic].auto_delay; + title.auto_delay = graphic_info[graphic].auto_delay; +#endif } void DrawTitleScreenMessage(int nr, boolean initial) @@ -1159,6 +1223,11 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) int i; #endif +#if 0 + /* !!! CHANGE THIS !!! */ + title = title_default; +#endif + UnmapAllGadgets(); FadeSoundsAndMusic(); @@ -1204,6 +1273,11 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) SetDrawtoField(DRAW_BACKBUFFER); #endif +#if 1 + if (levelset_has_changed) + title = title_default; +#endif + #if 1 if (CheckTitleScreen(levelset_has_changed)) { @@ -1334,10 +1408,23 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) DrawMaskedBorder(REDRAW_ALL); +#if 1 + if (!do_fading) + BackToFront(); + else if (title.anim_mode == ANIM_CROSSFADE) + FadeCross(redraw_mask); + else + FadeIn(redraw_mask); +#else if (do_fading) FadeIn(redraw_mask); else BackToFront(); +#endif + +#if 1 + title = title_default; +#endif SetMouseCursor(CURSOR_DEFAULT); @@ -1387,7 +1474,6 @@ static void gotoTopLevelDir() } #endif -#if 1 void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { static unsigned long title_delay = 0; @@ -1395,12 +1481,15 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) static int last_sound = -1, last_music = -1; boolean return_to_main_menu = FALSE; boolean use_fading_main_menu = TRUE; +#if 0 #if 1 boolean use_cross_fading = FALSE; #else boolean use_cross_fading = !show_title_initial; /* default */ +#endif #endif struct TitleControlInfo *tci; + struct TitleInfo title_fading_next; int sound, music; if (button == MB_MENU_INITIALIZE) @@ -1428,7 +1517,9 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) DrawInfoScreen_NotAvailable("Title screen information:", "No title screen for this level set."); - title.auto_delay_final = -1; + /* use default settings for fading, but always disable auto delay */ + title = title_default; + title.auto_delay = -1; return; } @@ -1439,21 +1530,15 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } if (tci->is_image) - { DrawTitleScreenImage(tci->local_nr, tci->initial); - } else - { DrawTitleScreenMessage(tci->local_nr, tci->initial); - title.fade_delay_final = title.fade_delay; - title.post_delay_final = title.post_delay; - title.auto_delay_final = -1; - } + title = getTitleFading(tci); #if 1 - sound = getTitleSound(tci->local_nr, tci->initial, tci->is_image); - music = getTitleMusic(tci->local_nr, tci->initial, tci->is_image); + sound = getTitleSound(tci); + music = getTitleMusic(tci); if (sound != last_sound) PlayMenuSoundExt(sound); @@ -1473,8 +1558,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) return; } - if (title.auto_delay_final > -1 && - DelayReached(&title_delay, title.auto_delay_final)) + if (title.auto_delay > -1 && DelayReached(&title_delay, title.auto_delay)) button = MB_MENU_CHOICE; if (button == MB_MENU_LEAVE) @@ -1484,7 +1568,9 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } else if (button == MB_MENU_CHOICE) { - int anim_mode; +#if 1 + boolean use_cross_fading = (title.anim_mode == ANIM_CROSSFADE); +#endif if (game_status == GAME_MODE_INFO && num_title_screens == 0) { @@ -1499,21 +1585,29 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_screen_nr++; tci = &title_controls[title_screen_nr]; - if (tci->is_image) - anim_mode = - graphic_info[getTitleScreenGraphic(tci->local_nr, - tci->initial)].anim_mode; - else - anim_mode = ANIM_FADE; /* ??? */ - - use_cross_fading = (anim_mode == ANIM_FADE ? FALSE : - anim_mode == ANIM_CROSSFADE ? TRUE : - use_cross_fading); - if (title_screen_nr < num_title_screens) { - sound = getTitleSound(tci->local_nr, tci->initial, tci->is_image); - music = getTitleMusic(tci->local_nr, tci->initial, tci->is_image); +#if 1 +#if 0 + boolean use_cross_fading = (title.anim_mode == ANIM_CROSSFADE); +#endif +#else + int anim_mode; + + if (tci->is_image) + anim_mode = + graphic_info[getTitleScreenGraphic(tci->local_nr, + tci->initial)].anim_mode; + else + anim_mode = ANIM_FADE; /* ??? */ + + use_cross_fading = (anim_mode == ANIM_FADE ? FALSE : + anim_mode == ANIM_CROSSFADE ? TRUE : + use_cross_fading); +#endif + + sound = getTitleSound(tci); + music = getTitleMusic(tci); if (sound == SND_UNDEFINED || sound != last_sound) FadeSounds(); @@ -1530,9 +1624,11 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) else DrawTitleScreenMessage(tci->local_nr, tci->initial); + title_fading_next = getTitleFading(tci); + #if 1 - sound = getTitleSound(tci->local_nr, tci->initial, tci->is_image); - music = getTitleMusic(tci->local_nr, tci->initial, tci->is_image); + sound = getTitleSound(tci); + music = getTitleMusic(tci); if (sound != last_sound) PlayMenuSoundExt(sound); @@ -1543,199 +1639,37 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) last_music = music; #endif + /* last screen already faded out, next screen has no animation */ + if (!use_cross_fading && title_fading_next.anim_mode == ANIM_NONE) + title = title_fading_next; + if (use_cross_fading) FadeCross(REDRAW_ALL); else FadeIn(REDRAW_ALL); + title = title_fading_next; + DelayReached(&title_delay, 0); /* reset delay counter */ } else { FadeSoundsAndMusic(); - FadeOut(REDRAW_ALL); - - return_to_main_menu = TRUE; - } - } - - if (return_to_main_menu) - { - RedrawBackground(); - - SetMouseCursor(CURSOR_DEFAULT); - - if (game_status == GAME_MODE_INFO) - { - OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - - info_mode = INFO_MODE_MAIN; - DrawInfoScreenExt(REDRAW_ALL, use_fading_main_menu); - } - else /* default: return to main menu */ - { - OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - - game_status = GAME_MODE_MAIN; - DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu); - } - } -} - -#else - -void HandleTitleScreen(int mx, int my, int dx, int dy, int button) -{ - static unsigned long title_delay = 0; - static int title_nr = 0; - static boolean showing_message = FALSE; - char *filename = getLevelSetMessageFilename(); - boolean return_to_main_menu = FALSE; - boolean use_fading_main_menu = TRUE; - boolean use_cross_fading = !show_title_initial; /* default */ - boolean no_title_info = (graphic_info[IMG_TITLESCREEN_1].bitmap == NULL && - getLevelSetMessageFilename(1, FALSE) == NULL); - - if (button == MB_MENU_INITIALIZE) - { - int last_game_status = game_status; /* save current game status */ - - title_delay = 0; - title_nr = 0; - showing_message = FALSE; - - if (show_title_initial && - graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap == NULL && - getLevelSetMessageFilename(1, TRUE) == NULL) - show_title_initial = FALSE; - - if (game_status == GAME_MODE_INFO) - { - if (no_title_info) +#if 1 { - DrawInfoScreen_NotAvailable("Title screen information:", - "No title screen for this level set."); - - title.auto_delay_final = -1; +#if 0 + boolean use_cross_fading = (title.anim_mode == ANIM_CROSSFADE); +#endif - return; + if (use_cross_fading) + FadeCrossSaveBackbuffer(); + else + FadeOut(REDRAW_ALL); } - - FadeSoundsAndMusic(); - - FadeOut(REDRAW_ALL); - } - - /* force TITLE music on title info screen */ - game_status = GAME_MODE_TITLE; - - PlayMenuSound(); - PlayMenuMusic(); - - game_status = last_game_status; /* restore current game status */ - - if (graphic_info[getTitleScreenGraphic(0, show_title_initial)].bitmap != NULL) - { - DrawTitleScreenImage(title_nr, show_title_initial); - } - else - { - DrawTitleScreenMessage(filename); - - showing_message = TRUE; - - title.fade_delay_final = title.fade_delay; - title.post_delay_final = title.post_delay; - title.auto_delay_final = -1; - } - - FadeIn(REDRAW_ALL); - - DelayReached(&title_delay, 0); /* reset delay counter */ - - return; - } - - if (title.auto_delay_final > -1 && - DelayReached(&title_delay, title.auto_delay_final)) - button = MB_MENU_CHOICE; - - if (button == MB_MENU_LEAVE) - { - return_to_main_menu = TRUE; - use_fading_main_menu = FALSE; - } - else if (button == MB_MENU_CHOICE) - { - int anim_mode; - - if (game_status == GAME_MODE_INFO && no_title_info) - { - FadeOut(REDRAW_FIELD); - - info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); - - return; - } - - title_nr++; - - if (show_title_initial && - (title_nr >= MAX_NUM_TITLE_IMAGES || - graphic_info[IMG_TITLESCREEN_INITIAL_1 + title_nr].bitmap == NULL)) - { - show_title_initial = FALSE; - - title_nr = 0; /* restart with title screens for current level set */ - } - - anim_mode = graphic_info[getTitleScreenGraphic(title_nr, show_title_initial)].anim_mode; - - use_cross_fading = (anim_mode == ANIM_FADE ? FALSE : - anim_mode == ANIM_CROSSFADE ? TRUE : - use_cross_fading); - - if (!use_cross_fading) - FadeOut(REDRAW_ALL); - - if (title_nr < MAX_NUM_TITLE_IMAGES && - graphic_info[getTitleScreenGraphic(title_nr, show_title_initial)].bitmap != NULL) - { - if (use_cross_fading) - FadeCrossSaveBackbuffer(); - - DrawTitleScreenImage(title_nr, show_title_initial); - - if (use_cross_fading) - FadeCross(REDRAW_ALL); - else - FadeIn(REDRAW_ALL); - - DelayReached(&title_delay, 0); /* reset delay counter */ - } - else if (!showing_message && filename != NULL) - { - if (use_cross_fading) - FadeCrossSaveBackbuffer(); - - DrawTitleScreenMessage(filename); - - if (use_cross_fading) - FadeCross(REDRAW_ALL); - else - FadeIn(REDRAW_ALL); - - DelayReached(&title_delay, 0); /* reset delay counter */ - - showing_message = TRUE; - } - else - { - FadeSoundsAndMusic(); - +#else FadeOut(REDRAW_ALL); +#endif return_to_main_menu = TRUE; } @@ -1743,10 +1677,10 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (return_to_main_menu) { - show_title_initial = FALSE; - RedrawBackground(); + SetMouseCursor(CURSOR_DEFAULT); + if (game_status == GAME_MODE_INFO) { OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); @@ -1763,7 +1697,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } } } -#endif void HandleMainMenu_SelectLevel(int step, int direction) { @@ -2206,10 +2139,19 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading) DrawMaskedBorder(REDRAW_ALL); +#if 1 + if (!do_fading) + BackToFront(); + else if (title.anim_mode == ANIM_CROSSFADE) + FadeCross(redraw_mask); + else + FadeIn(redraw_mask); +#else if (do_fading) FadeIn(redraw_mask); else BackToFront(); +#endif InitAnimation(); } diff --git a/src/tools.c b/src/tools.c index 1c261a00..c1509c1d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -545,8 +545,8 @@ void FadeExt(int fade_mask, int fade_mode) width = WIN_XSIZE; height = WIN_YSIZE; - fade_delay = title.fade_delay_final; - post_delay = (fade_mode == FADE_MODE_FADE_OUT ? title.post_delay_final : 0); + fade_delay = title.fade_delay; + post_delay = (fade_mode == FADE_MODE_FADE_OUT ? title.post_delay : 0); } redraw_mask |= fade_mask;