From: Holger Schemel Date: Fri, 24 May 2019 18:46:20 +0000 (+0200) Subject: added new screen fading option ".auto_delay_unit" (currently not used) X-Git-Tag: 4.1.4.0~38 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=2965766321c0bc9b8985b3760a624ea9ef8e44e5;p=rocksndiamonds.git added new screen fading option ".auto_delay_unit" (currently not used) This new option will be used to be able to configure the existing option ".auto_delay" (the time delay after which a title screen will be automatically faded to the next screen) to use video frames instead of milliseconds. This can be useful to synchronize global animations on title screens with the automatic screen fade delay (which may be inaccurate if using milliseconds for fading, while global animations always use video frames for configuring animation delay). --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index bc6e1e5e..5075ee37 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -75,6 +75,7 @@ struct ConfigTypeInfo image_config_suffix[] = { ".fade_delay", ARG_UNDEFINED, TYPE_INTEGER }, { ".post_delay", ARG_UNDEFINED, TYPE_INTEGER }, { ".auto_delay", ARG_UNDEFINED, TYPE_INTEGER }, + { ".auto_delay_unit", ARG_UNDEFINED, TYPE_INTEGER }, { ".align", ARG_UNDEFINED, TYPE_INTEGER }, { ".valign", ARG_UNDEFINED, TYPE_INTEGER }, { ".sort_priority", ARG_UNDEFINED, TYPE_INTEGER }, @@ -7333,72 +7334,86 @@ struct ConfigInfo image_config[] = { "[title_initial].fade_delay", "500" }, { "[title_initial].post_delay", "250" }, { "[title_initial].auto_delay", "-1" }, + { "[title_initial].auto_delay_unit", "ms" }, { "[title].fade_mode", "fade" }, { "[title].fade_delay", "500" }, { "[title].post_delay", "250" }, { "[title].auto_delay", "-1" }, + { "[title].auto_delay_unit", "ms" }, { "[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_initial].auto_delay_unit", 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].auto_delay_unit", 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_1.auto_delay_unit", 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_2.auto_delay_unit", 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_3.auto_delay_unit", 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_4.auto_delay_unit", 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_initial_5.auto_delay_unit", 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_1.auto_delay_unit", 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_2.auto_delay_unit", 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_3.auto_delay_unit", 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_4.auto_delay_unit", 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 }, + { "titlescreen_5.auto_delay_unit", ARG_DEFAULT }, { "[titlemessage_initial].x", "-1" }, { "[titlemessage_initial].y", "-1" }, @@ -7417,6 +7432,7 @@ struct ConfigInfo image_config[] = { "[titlemessage_initial].fade_delay", ARG_DEFAULT }, { "[titlemessage_initial].post_delay", ARG_DEFAULT }, { "[titlemessage_initial].auto_delay", ARG_DEFAULT }, + { "[titlemessage_initial].auto_delay_unit", ARG_DEFAULT }, { "[titlemessage].x", "-1" }, { "[titlemessage].y", "-1" }, { "[titlemessage].width", "-1" }, @@ -7434,6 +7450,7 @@ struct ConfigInfo image_config[] = { "[titlemessage].fade_delay", ARG_DEFAULT }, { "[titlemessage].post_delay", ARG_DEFAULT }, { "[titlemessage].auto_delay", ARG_DEFAULT }, + { "[titlemessage].auto_delay_unit", ARG_DEFAULT }, { "titlemessage_initial_1.x", ARG_DEFAULT }, { "titlemessage_initial_1.y", ARG_DEFAULT }, @@ -7452,6 +7469,7 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_1.fade_delay", ARG_DEFAULT }, { "titlemessage_initial_1.post_delay", ARG_DEFAULT }, { "titlemessage_initial_1.auto_delay", ARG_DEFAULT }, + { "titlemessage_initial_1.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_initial_2.x", ARG_DEFAULT }, { "titlemessage_initial_2.y", ARG_DEFAULT }, { "titlemessage_initial_2.width", ARG_DEFAULT }, @@ -7469,6 +7487,7 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_2.fade_delay", ARG_DEFAULT }, { "titlemessage_initial_2.post_delay", ARG_DEFAULT }, { "titlemessage_initial_2.auto_delay", ARG_DEFAULT }, + { "titlemessage_initial_2.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_initial_3.x", ARG_DEFAULT }, { "titlemessage_initial_3.y", ARG_DEFAULT }, { "titlemessage_initial_3.width", ARG_DEFAULT }, @@ -7486,6 +7505,7 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_3.fade_delay", ARG_DEFAULT }, { "titlemessage_initial_3.post_delay", ARG_DEFAULT }, { "titlemessage_initial_3.auto_delay", ARG_DEFAULT }, + { "titlemessage_initial_3.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_initial_4.x", ARG_DEFAULT }, { "titlemessage_initial_4.y", ARG_DEFAULT }, { "titlemessage_initial_4.width", ARG_DEFAULT }, @@ -7503,6 +7523,7 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_4.fade_delay", ARG_DEFAULT }, { "titlemessage_initial_4.post_delay", ARG_DEFAULT }, { "titlemessage_initial_4.auto_delay", ARG_DEFAULT }, + { "titlemessage_initial_4.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_initial_5.x", ARG_DEFAULT }, { "titlemessage_initial_5.y", ARG_DEFAULT }, { "titlemessage_initial_5.width", ARG_DEFAULT }, @@ -7520,6 +7541,7 @@ struct ConfigInfo image_config[] = { "titlemessage_initial_5.fade_delay", ARG_DEFAULT }, { "titlemessage_initial_5.post_delay", ARG_DEFAULT }, { "titlemessage_initial_5.auto_delay", ARG_DEFAULT }, + { "titlemessage_initial_5.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_1.x", ARG_DEFAULT }, { "titlemessage_1.y", ARG_DEFAULT }, { "titlemessage_1.width", ARG_DEFAULT }, @@ -7537,6 +7559,7 @@ struct ConfigInfo image_config[] = { "titlemessage_1.fade_delay", ARG_DEFAULT }, { "titlemessage_1.post_delay", ARG_DEFAULT }, { "titlemessage_1.auto_delay", ARG_DEFAULT }, + { "titlemessage_1.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_2.x", ARG_DEFAULT }, { "titlemessage_2.y", ARG_DEFAULT }, { "titlemessage_2.width", ARG_DEFAULT }, @@ -7554,6 +7577,7 @@ struct ConfigInfo image_config[] = { "titlemessage_2.fade_delay", ARG_DEFAULT }, { "titlemessage_2.post_delay", ARG_DEFAULT }, { "titlemessage_2.auto_delay", ARG_DEFAULT }, + { "titlemessage_2.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_3.x", ARG_DEFAULT }, { "titlemessage_3.y", ARG_DEFAULT }, { "titlemessage_3.width", ARG_DEFAULT }, @@ -7571,6 +7595,7 @@ struct ConfigInfo image_config[] = { "titlemessage_3.fade_delay", ARG_DEFAULT }, { "titlemessage_3.post_delay", ARG_DEFAULT }, { "titlemessage_3.auto_delay", ARG_DEFAULT }, + { "titlemessage_3.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_4.x", ARG_DEFAULT }, { "titlemessage_4.y", ARG_DEFAULT }, { "titlemessage_4.width", ARG_DEFAULT }, @@ -7588,6 +7613,7 @@ struct ConfigInfo image_config[] = { "titlemessage_4.fade_delay", ARG_DEFAULT }, { "titlemessage_4.post_delay", ARG_DEFAULT }, { "titlemessage_4.auto_delay", ARG_DEFAULT }, + { "titlemessage_4.auto_delay_unit", ARG_DEFAULT }, { "titlemessage_5.x", ARG_DEFAULT }, { "titlemessage_5.y", ARG_DEFAULT }, { "titlemessage_5.width", ARG_DEFAULT }, @@ -7605,6 +7631,7 @@ struct ConfigInfo image_config[] = { "titlemessage_5.fade_delay", ARG_DEFAULT }, { "titlemessage_5.post_delay", ARG_DEFAULT }, { "titlemessage_5.auto_delay", ARG_DEFAULT }, + { "titlemessage_5.auto_delay_unit", ARG_DEFAULT }, { "readme.x", "-1" }, { "readme.y", "-1" }, @@ -7659,6 +7686,7 @@ struct ConfigInfo image_config[] = { "menu.enter_screen.TITLE.fade_delay", "500" }, { "menu.enter_screen.TITLE.post_delay", "250" }, { "menu.enter_screen.TITLE.auto_delay", "-1" }, + { "menu.enter_screen.TITLE.auto_delay_unit", "-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 }, @@ -7675,6 +7703,7 @@ struct ConfigInfo image_config[] = { "menu.leave_screen.TITLE.fade_delay", "500" }, { "menu.leave_screen.TITLE.post_delay", "250" }, { "menu.leave_screen.TITLE.auto_delay", "-1" }, + { "menu.leave_screen.TITLE.auto_delay_unit", "-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 }, @@ -7691,6 +7720,7 @@ struct ConfigInfo image_config[] = { "menu.next_screen.TITLE.fade_delay", "500" }, { "menu.next_screen.TITLE.post_delay", "250" }, { "menu.next_screen.TITLE.auto_delay", "-1" }, + { "menu.next_screen.TITLE.auto_delay_unit", "-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 }, diff --git a/src/files.c b/src/files.c index cf3c80a9..16b21791 100644 --- a/src/files.c +++ b/src/files.c @@ -10331,6 +10331,12 @@ int get_parameter_value(char *value_raw, char *suffix, int type) string_has_parameter(value, "curtain") ? FADE_MODE_CURTAIN : FADE_MODE_DEFAULT); } + else if (strEqual(suffix, ".auto_delay_unit")) + { + result = (string_has_parameter(value, "ms") ? AUTO_DELAY_UNIT_MS : + string_has_parameter(value, "frames") ? AUTO_DELAY_UNIT_FRAMES : + AUTO_DELAY_UNIT_DEFAULT); + } else if (strPrefix(suffix, ".font")) // (may also be ".font_xyz") { result = gfx.get_font_from_token_function(value); @@ -10397,10 +10403,14 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void) title_initial_first_default.post_delay; titlescreen_initial_first_default.auto_delay = title_initial_first_default.auto_delay; + titlescreen_initial_first_default.auto_delay_unit = + title_initial_first_default.auto_delay_unit; 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; + titlescreen_first_default.auto_delay_unit = + title_first_default.auto_delay_unit; titlemessage_initial_first_default.fade_mode = title_initial_first_default.fade_mode; titlemessage_initial_first_default.fade_delay = @@ -10409,27 +10419,36 @@ static void InitMenuDesignSettings_SpecialPreProcessing(void) title_initial_first_default.post_delay; titlemessage_initial_first_default.auto_delay = title_initial_first_default.auto_delay; + titlemessage_initial_first_default.auto_delay_unit = + title_initial_first_default.auto_delay_unit; 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; + titlemessage_first_default.auto_delay_unit = + title_first_default.auto_delay_unit; 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_initial_default.auto_delay_unit = + title_initial_default.auto_delay_unit; 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; + titlescreen_default.auto_delay_unit = title_default.auto_delay_unit; 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; - titlemessage_initial_default.auto_delay = title_initial_default.auto_delay; + titlemessage_initial_default.auto_delay_unit = + title_initial_default.auto_delay_unit; titlemessage_default.fade_mode = title_default.fade_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; + titlemessage_default.auto_delay_unit = title_default.auto_delay_unit; // special case: initialize "ARG_DEFAULT" values in static default config // (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") @@ -10818,6 +10837,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) { TYPE_INTEGER, &tfi.fade_delay, ".fade_delay" }, { TYPE_INTEGER, &tfi.post_delay, ".post_delay" }, { TYPE_INTEGER, &tfi.auto_delay, ".auto_delay" }, + { TYPE_INTEGER, &tfi.auto_delay_unit, ".auto_delay_unit" }, { -1, NULL, NULL } }; @@ -10840,6 +10860,7 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) { TYPE_INTEGER, &tmi.fade_delay, ".fade_delay" }, { TYPE_INTEGER, &tmi.post_delay, ".post_delay" }, { TYPE_INTEGER, &tmi.auto_delay, ".auto_delay" }, + { TYPE_INTEGER, &tmi.auto_delay_unit, ".auto_delay_unit" }, { -1, NULL, NULL } }; diff --git a/src/init.c b/src/init.c index 1d4243db..eb18b6da 100644 --- a/src/init.c +++ b/src/init.c @@ -1314,6 +1314,7 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->fade_delay = -1; g->post_delay = -1; g->auto_delay = -1; + g->auto_delay_unit = AUTO_DELAY_UNIT_DEFAULT; g->align = ALIGN_CENTER; // default for title screens g->valign = VALIGN_MIDDLE; // default for title screens g->sort_priority = 0; // default for title screens @@ -1581,6 +1582,8 @@ static void set_graphic_parameters_ext(int graphic, int *parameter, g->post_delay = parameter[GFX_ARG_POST_DELAY]; if (parameter[GFX_ARG_AUTO_DELAY] != ARG_UNDEFINED_VALUE) g->auto_delay = parameter[GFX_ARG_AUTO_DELAY]; + if (parameter[GFX_ARG_AUTO_DELAY_UNIT] != ARG_UNDEFINED_VALUE) + g->auto_delay_unit = parameter[GFX_ARG_AUTO_DELAY_UNIT]; if (parameter[GFX_ARG_ALIGN] != ARG_UNDEFINED_VALUE) g->align = parameter[GFX_ARG_ALIGN]; if (parameter[GFX_ARG_VALIGN] != ARG_UNDEFINED_VALUE) diff --git a/src/libgame/system.h b/src/libgame/system.h index 4c0081e5..d07e0e1d 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -410,6 +410,11 @@ #define FADE_MODE_DEFAULT FADE_MODE_FADE +#define AUTO_DELAY_UNIT_MS 0 +#define AUTO_DELAY_UNIT_FRAMES 1 + +#define AUTO_DELAY_UNIT_DEFAULT AUTO_DELAY_UNIT_MS + // values for toon positions #define POS_UNDEFINED -1 #define POS_LEFT 0 diff --git a/src/main.h b/src/main.h index a13ef6ba..218e2624 100644 --- a/src/main.h +++ b/src/main.h @@ -2389,6 +2389,7 @@ enum GFX_ARG_FADE_DELAY, GFX_ARG_POST_DELAY, GFX_ARG_AUTO_DELAY, + GFX_ARG_AUTO_DELAY_UNIT, GFX_ARG_ALIGN, GFX_ARG_VALIGN, GFX_ARG_SORT_PRIORITY, @@ -2724,6 +2725,7 @@ struct TitleFadingInfo int fade_delay; int post_delay; int auto_delay; + int auto_delay_unit; }; struct TitleMessageInfo @@ -2742,6 +2744,7 @@ struct TitleMessageInfo int fade_delay; int post_delay; int auto_delay; + int auto_delay_unit; }; struct InitInfo @@ -3496,6 +3499,7 @@ struct GraphicInfo int fade_delay; // optional setting for drawing title screens int post_delay; // optional setting for drawing title screens int auto_delay; // optional setting for drawing title screens + int auto_delay_unit; // optional setting for drawing title screens int align, valign; // optional setting for drawing title screens int sort_priority; // optional setting for drawing title screens diff --git a/src/screens.c b/src/screens.c index dd7f2b4b..933be2a1 100644 --- a/src/screens.c +++ b/src/screens.c @@ -988,6 +988,7 @@ static struct TitleFadingInfo getTitleFading(struct TitleControlInfo *tci) ti.fade_delay = tmi.fade_delay; ti.post_delay = tmi.post_delay; ti.auto_delay = tmi.auto_delay; + ti.auto_delay_unit = tmi.auto_delay_unit; return ti; }