From: Holger Schemel Date: Sun, 1 Apr 2007 00:38:14 +0000 (+0200) Subject: rnd-20070401-1-src X-Git-Tag: 3.2.4^2~50 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=585994e9f3f77300b730f790062010518f35a739;p=rocksndiamonds.git rnd-20070401-1-src * improved menu fading, adding separate fading definitions for entering and leaving a "content" screen (in general), and optional definitions for the special "content" screens SCORES, EDITOR, INFO and PLAYING --- diff --git a/ChangeLog b/ChangeLog index e2d1bbe8..600e1c07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-31 + * improved menu fading, adding separate fading definitions for entering + and leaving a "content" screen (in general), and optional definitions + for the special "content" screens SCORES, EDITOR, INFO and PLAYING + 2007-03-30 * added (currently invisible) setup option to define scroll delay value * fixed small bug in priority handling when auto-detecting level start diff --git a/src/conf_gfx.c b/src/conf_gfx.c index c61b062c..c7469e7e 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5228,9 +5228,36 @@ struct ConfigInfo image_config[] = { "menu.leave_menu.fade_mode", "none" }, { "menu.leave_menu.fade_delay", "250" }, { "menu.leave_menu.post_delay", "125" }, - { "menu.start_item.fade_mode", "fade" }, - { "menu.start_item.fade_delay", "250" }, - { "menu.start_item.post_delay", "125" }, + { "menu.enter_screen.fade_mode", "fade" }, + { "menu.enter_screen.fade_delay", "250" }, + { "menu.enter_screen.post_delay", "125" }, + { "menu.leave_screen.fade_mode", "fade" }, + { "menu.leave_screen.fade_delay", "250" }, + { "menu.leave_screen.post_delay", "125" }, + { "menu.enter_screen.SCORES.fade_mode", ARG_DEFAULT }, + { "menu.enter_screen.SCORES.fade_delay", ARG_DEFAULT }, + { "menu.enter_screen.SCORES.post_delay", ARG_DEFAULT }, + { "menu.enter_screen.EDITOR.fade_mode", ARG_DEFAULT }, + { "menu.enter_screen.EDITOR.fade_delay", ARG_DEFAULT }, + { "menu.enter_screen.EDITOR.post_delay", ARG_DEFAULT }, + { "menu.enter_screen.INFO.fade_mode", ARG_DEFAULT }, + { "menu.enter_screen.INFO.fade_delay", ARG_DEFAULT }, + { "menu.enter_screen.INFO.post_delay", ARG_DEFAULT }, + { "menu.enter_screen.PLAYING.fade_mode", ARG_DEFAULT }, + { "menu.enter_screen.PLAYING.fade_delay", ARG_DEFAULT }, + { "menu.enter_screen.PLAYING.post_delay", ARG_DEFAULT }, + { "menu.leave_screen.SCORES.fade_mode", ARG_DEFAULT }, + { "menu.leave_screen.SCORES.fade_delay", ARG_DEFAULT }, + { "menu.leave_screen.SCORES.post_delay", ARG_DEFAULT }, + { "menu.leave_screen.EDITOR.fade_mode", ARG_DEFAULT }, + { "menu.leave_screen.EDITOR.fade_delay", ARG_DEFAULT }, + { "menu.leave_screen.EDITOR.post_delay", ARG_DEFAULT }, + { "menu.leave_screen.INFO.fade_mode", ARG_DEFAULT }, + { "menu.leave_screen.INFO.fade_delay", ARG_DEFAULT }, + { "menu.leave_screen.INFO.post_delay", ARG_DEFAULT }, + { "menu.leave_screen.PLAYING.fade_mode", ARG_DEFAULT }, + { "menu.leave_screen.PLAYING.fade_delay", ARG_DEFAULT }, + { "menu.leave_screen.PLAYING.post_delay", ARG_DEFAULT }, { "menu.draw_xoffset", "0" }, { "menu.draw_yoffset", "0" }, diff --git a/src/conf_var.c b/src/conf_var.c index 45ad7dc9..38ab1c56 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -985,16 +985,124 @@ struct TokenIntPtrInfo image_config_vars[] = &menu.leave_menu.post_delay }, { - "menu.start_item.fade_mode", - &menu.start_item.fade_mode + "menu.enter_screen.fade_mode", + &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].fade_mode }, { - "menu.start_item.fade_delay", - &menu.start_item.fade_delay + "menu.enter_screen.fade_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].fade_delay }, { - "menu.start_item.post_delay", - &menu.start_item.post_delay + "menu.enter_screen.post_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT].post_delay + }, + { + "menu.leave_screen.fade_mode", + &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].fade_mode + }, + { + "menu.leave_screen.fade_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].fade_delay + }, + { + "menu.leave_screen.post_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT].post_delay + }, + { + "menu.enter_screen.SCORES.fade_mode", + &menu.enter_screen[GFX_SPECIAL_ARG_SCORES].fade_mode + }, + { + "menu.enter_screen.SCORES.fade_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_SCORES].fade_delay + }, + { + "menu.enter_screen.SCORES.post_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_SCORES].post_delay + }, + { + "menu.enter_screen.EDITOR.fade_mode", + &menu.enter_screen[GFX_SPECIAL_ARG_EDITOR].fade_mode + }, + { + "menu.enter_screen.EDITOR.fade_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_EDITOR].fade_delay + }, + { + "menu.enter_screen.EDITOR.post_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_EDITOR].post_delay + }, + { + "menu.enter_screen.INFO.fade_mode", + &menu.enter_screen[GFX_SPECIAL_ARG_INFO].fade_mode + }, + { + "menu.enter_screen.INFO.fade_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_INFO].fade_delay + }, + { + "menu.enter_screen.INFO.post_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_INFO].post_delay + }, + { + "menu.enter_screen.PLAYING.fade_mode", + &menu.enter_screen[GFX_SPECIAL_ARG_PLAYING].fade_mode + }, + { + "menu.enter_screen.PLAYING.fade_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_PLAYING].fade_delay + }, + { + "menu.enter_screen.PLAYING.post_delay", + &menu.enter_screen[GFX_SPECIAL_ARG_PLAYING].post_delay + }, + { + "menu.leave_screen.SCORES.fade_mode", + &menu.leave_screen[GFX_SPECIAL_ARG_SCORES].fade_mode + }, + { + "menu.leave_screen.SCORES.fade_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_SCORES].fade_delay + }, + { + "menu.leave_screen.SCORES.post_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_SCORES].post_delay + }, + { + "menu.leave_screen.EDITOR.fade_mode", + &menu.leave_screen[GFX_SPECIAL_ARG_EDITOR].fade_mode + }, + { + "menu.leave_screen.EDITOR.fade_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_EDITOR].fade_delay + }, + { + "menu.leave_screen.EDITOR.post_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_EDITOR].post_delay + }, + { + "menu.leave_screen.INFO.fade_mode", + &menu.leave_screen[GFX_SPECIAL_ARG_INFO].fade_mode + }, + { + "menu.leave_screen.INFO.fade_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_INFO].fade_delay + }, + { + "menu.leave_screen.INFO.post_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_INFO].post_delay + }, + { + "menu.leave_screen.PLAYING.fade_mode", + &menu.leave_screen[GFX_SPECIAL_ARG_PLAYING].fade_mode + }, + { + "menu.leave_screen.PLAYING.fade_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_PLAYING].fade_delay + }, + { + "menu.leave_screen.PLAYING.post_delay", + &menu.leave_screen[GFX_SPECIAL_ARG_PLAYING].post_delay }, { "menu.draw_xoffset", diff --git a/src/conftime.h b/src/conftime.h index dc36ba0e..0fdcfe7f 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2007-03-31 01:45" +#define COMPILE_DATE_STRING "2007-04-01 02:29" diff --git a/src/files.c b/src/files.c index 0ebccb98..cb57311a 100644 --- a/src/files.c +++ b/src/files.c @@ -8422,6 +8422,43 @@ static void LoadSpecialMenuDesignSettingsFromFilename(char *filename) menu.draw_yoffset_info[i] = get_integer_from_string(value_2); } + /* special case: initialize with default values that may be overwritten */ + /* (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz") */ + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) + { + char *token_1 = "menu.enter_screen.fade_mode"; + char *token_2 = "menu.enter_screen.fade_delay"; + char *token_3 = "menu.enter_screen.post_delay"; + char *token_4 = "menu.leave_screen.fade_mode"; + char *token_5 = "menu.leave_screen.fade_delay"; + char *token_6 = "menu.leave_screen.post_delay"; + char *value_1 = getHashEntry(setup_file_hash, token_1); + char *value_2 = getHashEntry(setup_file_hash, token_2); + char *value_3 = getHashEntry(setup_file_hash, token_3); + char *value_4 = getHashEntry(setup_file_hash, token_4); + char *value_5 = getHashEntry(setup_file_hash, token_5); + char *value_6 = getHashEntry(setup_file_hash, token_6); + + if (value_1 != NULL) + menu.enter_screen[i].fade_mode = get_token_parameter_value(token_1, + value_1); + if (value_2 != NULL) + menu.enter_screen[i].fade_delay = get_token_parameter_value(token_2, + value_2); + if (value_3 != NULL) + menu.enter_screen[i].post_delay = get_token_parameter_value(token_3, + value_3); + if (value_4 != NULL) + menu.leave_screen[i].fade_mode = get_token_parameter_value(token_4, + value_4); + if (value_5 != NULL) + menu.leave_screen[i].fade_delay = get_token_parameter_value(token_5, + value_5); + if (value_6 != NULL) + menu.leave_screen[i].post_delay = get_token_parameter_value(token_6, + value_6); + } + /* special case: initialize with default values that may be overwritten */ /* (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") */ for (i = 0; titlemessage_arrays[i].array != NULL; i++) @@ -8502,6 +8539,14 @@ void LoadSpecialMenuDesignSettings() titlemessage[i] = titlemessage_default; } + /* special case: initialize "ARG_DEFAULT" values in static default config */ + /* (eg, init "menu.enter_screen.SCORES.xyz" from "menu.enter_screen.xyz") */ + for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) + { + menu.enter_screen[i] = menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT]; + menu.leave_screen[i] = menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT]; + } + if (!SETUP_OVERRIDE_ARTWORK(setup, ARTWORK_TYPE_GRAPHICS)) { /* first look for special settings configured in level series config */ diff --git a/src/game.c b/src/game.c index d580212f..3dec37b7 100644 --- a/src/game.c +++ b/src/game.c @@ -3490,7 +3490,7 @@ void InitGame() if (level_editor_test_game) FadeSkipNextFadeIn(); else - FadeSetStartItem(); + FadeSetEnterScreen(); #else if (level_editor_test_game) fading = fading_none; diff --git a/src/init.c b/src/init.c index a6f67bcd..08177e1b 100644 --- a/src/init.c +++ b/src/init.c @@ -5121,7 +5121,7 @@ void ReloadCustomArtwork(int force_reload) #if 1 #if 1 - FadeSetStartItem(); + FadeSetEnterScreen(); // FadeSkipNextFadeOut(); // FadeSetDisabled(); #else @@ -5214,8 +5214,10 @@ void OpenAll() return; } + game_status = GAME_MODE_MAIN; + #if 1 - FadeSetStartItem(); + FadeSetEnterScreen(); if (!(fading.fade_mode & FADE_TYPE_TRANSFORM)) FadeSkipNextFadeOut(); // FadeSetDisabled(); @@ -5223,8 +5225,6 @@ void OpenAll() fading = fading_none; #endif - game_status = GAME_MODE_MAIN; - DrawMainMenu(); InitNetworkServer(); diff --git a/src/main.h b/src/main.h index e3fd05b5..eb8e2611 100644 --- a/src/main.h +++ b/src/main.h @@ -2091,7 +2091,8 @@ struct MenuInfo struct TitleFadingInfo enter_menu; struct TitleFadingInfo leave_menu; - struct TitleFadingInfo start_item; + struct TitleFadingInfo enter_screen[NUM_SPECIAL_GFX_ARGS]; + struct TitleFadingInfo leave_screen[NUM_SPECIAL_GFX_ARGS]; int sound[NUM_SPECIAL_GFX_ARGS]; int music[NUM_SPECIAL_GFX_ARGS]; diff --git a/src/screens.c b/src/screens.c index 5e1a17e3..2577e79a 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1258,6 +1258,8 @@ void DrawMainMenuExt(int redraw_mask, boolean do_fading) redraw_mask == REDRAW_ALL); #endif + FadeSetLeaveScreen(); + #if 1 FadeOut(redraw_mask); #endif @@ -1710,7 +1712,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeOut(REDRAW_FIELD); #endif - FadeSetStartItem(); + FadeSetEnterScreen(); info_mode = INFO_MODE_MAIN; DrawAndFadeInInfoScreen(REDRAW_FIELD); @@ -2001,7 +2003,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) game_status = GAME_MODE_EDITOR; - FadeSetStartItem(); + FadeSetEnterScreen(); DrawLevelEd(); } @@ -2178,7 +2180,7 @@ static int num_info_info; static void execInfoTitleScreen() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_TITLE; @@ -2188,7 +2190,7 @@ static void execInfoTitleScreen() static void execInfoElements() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_ELEMENTS; @@ -2198,7 +2200,7 @@ static void execInfoElements() static void execInfoMusic() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_MUSIC; @@ -2208,7 +2210,7 @@ static void execInfoMusic() static void execInfoCredits() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_CREDITS; @@ -2218,7 +2220,7 @@ static void execInfoCredits() static void execInfoProgram() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_PROGRAM; @@ -2228,7 +2230,7 @@ static void execInfoProgram() static void execInfoVersion() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_VERSION; @@ -2238,7 +2240,7 @@ static void execInfoVersion() static void execInfoLevelSet() { #if 0 - FadeSetStartItem(); + FadeSetEnterScreen(); #endif info_mode = INFO_MODE_LEVELSET; @@ -2299,6 +2301,8 @@ static void DrawInfoScreen_Main(int redraw_mask, boolean do_fading) /* (needed after displaying title screens which disable auto repeat) */ KeyboardAutoRepeatOn(); + FadeSetLeaveScreen(); + #if 1 FadeOut(redraw_mask); #endif @@ -4089,7 +4093,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, } else { - FadeSetStartItem(); + FadeSetEnterScreen(); node_cursor->cl_first = ti->cl_first; node_cursor->cl_cursor = ti->cl_cursor; @@ -4159,7 +4163,9 @@ void DrawHallOfFame(int highlight_position) if (highlight_position < 0) LoadScore(level_nr); - FadeSetStartItem(); + FadeSetEnterScreen(); + + // printf("::: %d: %d\n", game_status, menu.enter_screen[game_status]); #if 1 FadeOut(REDRAW_FIELD); diff --git a/src/tools.c b/src/tools.c index ba774925..9530644e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -662,25 +662,46 @@ void FadeCrossSaveBackbuffer() BlitBitmap(backbuffer, bitmap_db_cross, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); } +static void FadeSetLeaveNext(struct TitleFadingInfo fading_leave, boolean set) +{ + static struct TitleFadingInfo fading_leave_stored; + + if (set) + fading_leave_stored = fading_leave; + else + fading = fading_leave_stored; +} + void FadeSetEnterMenu() { fading = menu.enter_menu; + + FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */ } void FadeSetLeaveMenu() { fading = menu.leave_menu; + + FadeSetLeaveNext(fading, TRUE); /* (keep same fade mode) */ +} + +void FadeSetEnterScreen() +{ + fading = menu.enter_screen[game_status]; + + FadeSetLeaveNext(menu.leave_screen[game_status], TRUE); /* store */ } -void FadeSetStartItem() +void FadeSetLeaveScreen() { - fading = menu.start_item; + FadeSetLeaveNext(menu.leave_screen[game_status], FALSE); /* recall */ } void FadeSetFromType(int type) { if (type & TYPE_ENTER_SCREEN) - FadeSetStartItem(); + FadeSetEnterScreen(); else if (type & TYPE_ENTER) FadeSetEnterMenu(); else if (type & TYPE_LEAVE) diff --git a/src/tools.h b/src/tools.h index fa67ae23..2e0762cc 100644 --- a/src/tools.h +++ b/src/tools.h @@ -80,7 +80,8 @@ void FadeCross(int); void FadeCrossSaveBackbuffer(); void FadeSetEnterMenu(); void FadeSetLeaveMenu(); -void FadeSetStartItem(); +void FadeSetEnterScreen(); +void FadeSetLeaveScreen(); void FadeSetFromType(int); void FadeSetDisabled(); void FadeSkipNextFadeIn();