From cb81cac37a6a681c0ee295918e5ef919fbef1e90 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 20 Oct 2006 19:48:37 +0200 Subject: [PATCH] rnd-20061020-1-src * added configuration directives for control of title screens: - "title.fade_delay" for fading time - "title.post_delay" for pause between screens (when not crossfading) - "title.auto_delay" to automatically continue after some time these settings can each be overridden by specifying them with titles: - "titlescreen_initial_{1-5}.{fade_delay,post_delay,auto_delay}" - "titlescreen_{1-5}.{fade_delay,post_delay,auto_delay}" fading mode can also be specified: - "titlescreen_initial_{1-5}.anim_mode: {fade,crossfade} - "titlescreen_{1-5}.anim_mode: {fade,crossfade} default is using normal fading for menues and initial title screens, while using cross-fading for level set title screens --- ChangeLog | 14 +++++++++++++ src/conf_gfx.c | 15 ++++++++++---- src/conftime.h | 2 +- src/init.c | 11 ++++++++++ src/main.c | 13 ++++++++---- src/main.h | 21 ++++++++++++++++++- src/screens.c | 56 +++++++++++++++++++++++++++++--------------------- src/tools.c | 9 ++++++-- 8 files changed, 106 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf03757a..2613fd7f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-10-20 + * added configuration directives for control of title screens: + - "title.fade_delay" for fading time + - "title.post_delay" for pause between screens (when not crossfading) + - "title.auto_delay" to automatically continue after some time + these settings can each be overridden by specifying them with titles: + - "titlescreen_initial_{1-5}.{fade_delay,post_delay,auto_delay}" + - "titlescreen_{1-5}.{fade_delay,post_delay,auto_delay}" + fading mode can also be specified: + - "titlescreen_initial_{1-5}.anim_mode: {fade,crossfade} + - "titlescreen_{1-5}.anim_mode: {fade,crossfade} + default is using normal fading for menues and initial title screens, + while using cross-fading for level set title screens + 2006-10-18 * added configuration directives for the remaining main menu items diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 1427994e..33a58e24 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -60,6 +60,9 @@ struct ConfigTypeInfo image_config_suffix[] = { ".name", ARG_UNDEFINED, TYPE_STRING }, { ".scale_up_factor", ARG_UNDEFINED, TYPE_INTEGER }, { ".clone_from", ARG_UNDEFINED, TYPE_TOKEN }, + { ".fade_delay", ARG_UNDEFINED, TYPE_INTEGER }, + { ".post_delay", ARG_UNDEFINED, TYPE_INTEGER }, + { ".auto_delay", ARG_UNDEFINED, TYPE_INTEGER }, { NULL, NULL, 0 } }; @@ -4538,6 +4541,14 @@ 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" }, + + { "menu.fade_delay", "250" }, + { "menu.post_delay", "125" }, + { "menu.auto_delay", "-1" }, + { "menu.draw_xoffset", "0" }, { "menu.draw_yoffset", "0" }, { "menu.draw_xoffset.MAIN", "0" }, @@ -4570,10 +4581,6 @@ struct ConfigInfo image_config[] = { "menu.list_size.SCORES", "-1" }, { "menu.list_size.INFO", "-1" }, - { "menu.fade_delay", "250" }, - { "menu.post_delay", "125" }, - { "menu.auto_delay", "0" }, - { "main.button.name.x", "0" }, { "main.button.name.y", "64" }, { "main.button.levels.x", "0" }, diff --git a/src/conftime.h b/src/conftime.h index 66817545..98686142 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-10-19 19:44]" +#define COMPILE_DATE_STRING "[2006-10-20 19:44]" diff --git a/src/init.c b/src/init.c index b0d66991..7f29f4bd 100644 --- a/src/init.c +++ b/src/init.c @@ -970,6 +970,9 @@ static void set_graphic_parameters(int graphic) graphic_info[graphic].anim_delay_random = 0; graphic_info[graphic].post_delay_fixed = 0; graphic_info[graphic].post_delay_random = 0; + graphic_info[graphic].fade_delay = -1; + graphic_info[graphic].post_delay = -1; + graphic_info[graphic].auto_delay = -1; /* optional x and y tile position of animation frame sequence */ if (parameter[GFX_ARG_XPOS] != ARG_UNDEFINED_VALUE) @@ -1135,6 +1138,14 @@ static void set_graphic_parameters(int graphic) /* optional graphic for cloning all graphics settings */ if (parameter[GFX_ARG_CLONE_FROM] != ARG_UNDEFINED_VALUE) graphic_info[graphic].clone_from = parameter[GFX_ARG_CLONE_FROM]; + + /* optional settings for drawing title screens */ + if (parameter[GFX_ARG_FADE_DELAY] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].fade_delay = parameter[GFX_ARG_FADE_DELAY]; + if (parameter[GFX_ARG_POST_DELAY] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].post_delay = parameter[GFX_ARG_POST_DELAY]; + if (parameter[GFX_ARG_AUTO_DELAY] != ARG_UNDEFINED_VALUE) + graphic_info[graphic].auto_delay = parameter[GFX_ARG_AUTO_DELAY]; } static void set_cloned_graphic_parameters(int graphic) diff --git a/src/main.c b/src/main.c index e4d912ab..32d7fa7d 100644 --- a/src/main.c +++ b/src/main.c @@ -105,6 +105,7 @@ struct SetupInfo setup; struct GameInfo game; struct GlobalInfo global; struct BorderInfo border; +struct TitleInfo title; struct MenuInfo menu; struct DoorInfo door_1, door_2; struct PreviewInfo preview; @@ -4649,6 +4650,14 @@ struct TokenIntPtrInfo image_config_vars[] = { "border.draw_masked.PLAYING",&border.draw_masked[GFX_SPECIAL_ARG_PLAYING] }, { "border.draw_masked.DOOR", &border.draw_masked[GFX_SPECIAL_ARG_DOOR] }, + { "title.fade_delay", &title.fade_delay }, + { "title.post_delay", &title.post_delay }, + { "title.auto_delay", &title.auto_delay }, + + { "menu.fade_delay", &menu.fade_delay }, + { "menu.post_delay", &menu.post_delay }, + { "menu.auto_delay", &menu.auto_delay }, + { "menu.draw_xoffset", &menu.draw_xoffset[GFX_SPECIAL_ARG_DEFAULT] }, { "menu.draw_yoffset", &menu.draw_yoffset[GFX_SPECIAL_ARG_DEFAULT] }, { "menu.draw_xoffset.MAIN", &menu.draw_xoffset[GFX_SPECIAL_ARG_MAIN] }, @@ -4691,10 +4700,6 @@ struct TokenIntPtrInfo image_config_vars[] = { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] }, { "menu.list_size.INFO", &menu.list_size[GFX_SPECIAL_ARG_INFO] }, - { "menu.fade_delay", &menu.fade_delay }, - { "menu.post_delay", &menu.post_delay }, - { "menu.auto_delay", &menu.auto_delay }, - { "main.button.name.x", &menu.main.button.name.x }, { "main.button.name.y", &menu.main.button.name.y }, { "main.button.levels.x", &menu.main.button.levels.x }, diff --git a/src/main.h b/src/main.h index c7731723..bc912050 100644 --- a/src/main.h +++ b/src/main.h @@ -1651,8 +1651,11 @@ #define GFX_ARG_NAME 36 #define GFX_ARG_SCALE_UP_FACTOR 37 #define GFX_ARG_CLONE_FROM 38 +#define GFX_ARG_FADE_DELAY 39 +#define GFX_ARG_POST_DELAY 40 +#define GFX_ARG_AUTO_DELAY 41 -#define NUM_GFX_ARGS 39 +#define NUM_GFX_ARGS 42 /* values for sound configuration suffixes */ @@ -1902,6 +1905,17 @@ struct MenuMainInfo struct MenuMainInputInfo input; }; +struct TitleInfo +{ + int fade_delay; + int post_delay; + int auto_delay; + + int fade_delay_final; + int post_delay_final; + int auto_delay_final; +}; + struct MenuInfo { int draw_xoffset[NUM_SPECIAL_GFX_ARGS]; @@ -2345,6 +2359,10 @@ struct GraphicInfo int draw_masked; /* optional setting for drawing envelope gfx */ + 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 */ + #if defined(TARGET_X11_NATIVE_PERFORMANCE_WORKAROUND) Pixmap clip_mask; /* single-graphic-only clip mask for X11 */ GC clip_gc; /* single-graphic-only clip gc for X11 */ @@ -2503,6 +2521,7 @@ extern struct HiScore highscore[]; extern struct TapeInfo tape; extern struct GlobalInfo global; extern struct BorderInfo border; +extern struct TitleInfo title; extern struct MenuInfo menu; extern struct DoorInfo door_1, door_2; extern struct PreviewInfo preview; diff --git a/src/screens.c b/src/screens.c index 9c2ed1b1..dcfd35b8 100644 --- a/src/screens.c +++ b/src/screens.c @@ -644,6 +644,19 @@ void DrawTitleScreenImage(int nr) BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y); redraw_mask = REDRAW_ALL; + + /* reset fading control values to default config settings */ + 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].fade_delay > -1) + title.fade_delay_final = graphic_info[graphic].fade_delay; + if (graphic_info[graphic].post_delay > -1) + title.post_delay_final = graphic_info[graphic].post_delay; + if (graphic_info[graphic].auto_delay > -1) + title.auto_delay_final = graphic_info[graphic].auto_delay; } void DrawTitleScreen() @@ -888,7 +901,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) boolean return_to_main_menu = FALSE; boolean use_fading_main_menu = TRUE; boolean use_cross_fading = !show_titlescreen_initial; /* default */ - int auto_delay = menu.auto_delay; if (button == MB_MENU_INITIALIZE) { @@ -897,6 +909,10 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_delay = 0; title_nr = 0; + if (show_titlescreen_initial && + graphic_info[IMG_TITLESCREEN_INITIAL_1].bitmap == NULL) + show_titlescreen_initial = FALSE; + if (game_status == GAME_MODE_INFO) { if (graphic_info[IMG_TITLESCREEN_1].bitmap == NULL) @@ -929,11 +945,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) return; } - int anim_delay = graphic_info[getTitleScreenGraphic() + title_nr].anim_delay; - if (anim_delay > 1) - auto_delay = anim_delay; - - if (auto_delay > 0 && DelayReached(&title_delay, auto_delay)) + if (title.auto_delay_final > -1 && + DelayReached(&title_delay, title.auto_delay_final)) button = MB_MENU_CHOICE; if (button == MB_MENU_LEAVE) @@ -943,6 +956,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } else if (button == MB_MENU_CHOICE) { + int anim_mode; + if (game_status == GAME_MODE_INFO && graphic_info[IMG_TITLESCREEN_1].bitmap == NULL) { @@ -963,7 +978,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_nr = 0; /* restart with title screens for current level set */ } - int anim_mode = graphic_info[getTitleScreenGraphic() + title_nr].anim_mode; + anim_mode = graphic_info[getTitleScreenGraphic() + title_nr].anim_mode; use_cross_fading = (anim_mode == ANIM_FADE ? FALSE : anim_mode == ANIM_CROSSFADE ? TRUE : @@ -999,6 +1014,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (return_to_main_menu) { + show_titlescreen_initial = FALSE; + RedrawBackground(); if (game_status == GAME_MODE_INFO) @@ -1753,7 +1770,6 @@ void HandleInfoScreen_Elements(int button) static int num_pages; static int page; int anims_per_page = MAX_INFO_ELEMENTS_ON_SCREEN; - int button_released = !button; int i; if (button == MB_MENU_INITIALIZE) @@ -1761,6 +1777,7 @@ void HandleInfoScreen_Elements(int button) boolean new_element = TRUE; num_anims = 0; + for (i = 0; helpanim_info[i].element != HELPANIM_LIST_END; i++) { if (helpanim_info[i].element == HELPANIM_LIST_NEXT) @@ -1775,15 +1792,15 @@ void HandleInfoScreen_Elements(int button) num_pages = (num_anims + anims_per_page - 1) / anims_per_page; page = 0; } - else if (button == MB_MENU_LEAVE) + + if (button == MB_MENU_LEAVE) { info_mode = INFO_MODE_MAIN; DrawInfoScreen(); return; } - - if (button_released || button == MB_MENU_INITIALIZE) + else if (button == MB_MENU_CHOICE || button == MB_MENU_INITIALIZE) { if (button != MB_MENU_INITIALIZE) page++; @@ -1838,7 +1855,6 @@ void HandleInfoScreen_Music(int button) static struct MusicFileInfo *list = NULL; int ystart = 150, dy = 30; int ybottom = SYSIZE - 20; - int button_released = !button; if (button == MB_MENU_INITIALIZE) { @@ -1859,15 +1875,15 @@ void HandleInfoScreen_Music(int button) return; } } - else if (button == MB_MENU_LEAVE) + + if (button == MB_MENU_LEAVE) { info_mode = INFO_MODE_MAIN; DrawInfoScreen(); return; } - - if (button_released || button == MB_MENU_INITIALIZE) + else if (button == MB_MENU_CHOICE || button == MB_MENU_INITIALIZE) { int y = 0; @@ -2244,8 +2260,6 @@ void DrawInfoScreen_Program() void HandleInfoScreen_Program(int button) { - int button_released = !button; - if (button == MB_MENU_LEAVE) { info_mode = INFO_MODE_MAIN; @@ -2253,8 +2267,7 @@ void HandleInfoScreen_Program(int button) return; } - - if (button_released) + else if (button == MB_MENU_CHOICE) { FadeSoundsAndMusic(); FadeOut(REDRAW_FIELD); @@ -2307,8 +2320,6 @@ void DrawInfoScreen_LevelSet() void HandleInfoScreen_LevelSet(int button) { - int button_released = !button; - if (button == MB_MENU_LEAVE) { info_mode = INFO_MODE_MAIN; @@ -2316,8 +2327,7 @@ void HandleInfoScreen_LevelSet(int button) return; } - - if (button_released) + else if (button == MB_MENU_CHOICE) { FadeSoundsAndMusic(); FadeOut(REDRAW_FIELD); diff --git a/src/tools.c b/src/tools.c index f6441aa0..e46b0a6d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -533,9 +533,8 @@ void FadeExt(int fade_mask, int fade_mode) { void (*draw_border_function)(void) = NULL; Bitmap *bitmap = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_db_cross : NULL); - int fade_delay = menu.fade_delay; - int post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0); int x, y, width, height; + int fade_delay, post_delay; if (fade_mask & REDRAW_FIELD) { @@ -544,6 +543,9 @@ void FadeExt(int fade_mask, int fade_mode) width = FULL_SXSIZE; height = FULL_SYSIZE; + fade_delay = menu.fade_delay; + post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0); + draw_border_function = DrawMaskedBorder_FIELD; } else /* REDRAW_ALL */ @@ -552,6 +554,9 @@ void FadeExt(int fade_mask, int fade_mode) y = 0; 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); } redraw_mask |= fade_mask; -- 2.34.1