X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=021dfcdc3fc046691115548736f33eff5a07d4d8;hb=de580a24cb58b43281f0b2af3d4d6079d78fcb5d;hp=dbbdf0c9d6344e4795ab7032af987ccda8605871;hpb=6d73c8c86a15e02051dfba65e436d38e4ebc3a36;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index dbbdf0c9..021dfcdc 100644 --- a/src/screens.c +++ b/src/screens.c @@ -131,8 +131,11 @@ #define MENU_CHOOSE_TREE_FONT(x) (FONT_TEXT_1 + (x)) #define MENU_CHOOSE_TREE_COLOR(ti, a) TREE_COLOR(ti, a) -#define TEXT_NEXT_PAGE "Press any key or button for next page" +#define TEXT_MAIN_MENU "Press any key or button for main menu" #define TEXT_INFO_MENU "Press any key or button for info menu" +#define TEXT_NEXT_PAGE "Press any key or button for next page" +#define TEXT_NEXT_MENU (info_screens_from_main ? \ + TEXT_MAIN_MENU : TEXT_INFO_MENU) // for input setup functions #define SETUPINPUT_SCREEN_POS_START 0 @@ -318,6 +321,8 @@ static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS]; static int info_mode = INFO_MODE_MAIN; static int setup_mode = SETUP_MODE_MAIN; +static boolean info_screens_from_main = FALSE; + static TreeInfo *window_sizes = NULL; static TreeInfo *window_size_current = NULL; @@ -2537,6 +2542,18 @@ static void DrawInfoScreen_Main(void) int fade_mask = REDRAW_FIELD; int i; + // (needed after displaying info sub-screens directly from main menu) + if (info_screens_from_main) + { + info_screens_from_main = FALSE; + + SetGameStatus(GAME_MODE_MAIN); + + DrawMainMenu(); + + return; + } + if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; @@ -2955,7 +2972,7 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error) DrawTextSCentered(ystart1, font_title, text_title); DrawTextSCentered(ystart2, font_error, text_error); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); FadeIn(REDRAW_FIELD); } @@ -3275,7 +3292,7 @@ void HandleInfoScreen_Music(int dx, int dy, int button) DrawHeadline(); DrawTextSCentered(ystart, font_title, "No music info for this level set."); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); return; } @@ -3574,7 +3591,7 @@ static void DrawInfoScreen_Version(void) DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_audiodriver); DrawTextF(xstart3, ystart, font_text, "%s", driver_name); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); FadeIn(REDRAW_FIELD); } @@ -3695,7 +3712,7 @@ static void DrawInfoScreen_GenericScreen(int screen_nr, int num_screens, } boolean last_screen = (screen_nr == num_screens - 1); - char *text_foot = (last_screen ? TEXT_INFO_MENU : TEXT_NEXT_PAGE); + char *text_foot = (last_screen ? TEXT_NEXT_MENU : TEXT_NEXT_PAGE); DrawTextSCentered(ybottom, font_foot, text_foot); } @@ -3775,7 +3792,7 @@ void HandleInfoScreen_Generic(int dx, int dy, int button) DrawHeadline(); DrawTextSCentered(ystart, font_title, text_no_info); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); return; } @@ -3846,6 +3863,43 @@ static void DrawInfoScreen(void) PlayMenuSoundsAndMusic(); } +void DrawInfoScreen_FromMainMenu(int nr) +{ + int fade_mask = REDRAW_FIELD; + + if (nr < INFO_MODE_MAIN || nr >= MAX_INFO_MODES) + return; + + CloseDoor(DOOR_CLOSE_2); + + SetGameStatus(GAME_MODE_INFO); + + info_mode = nr; + info_screens_from_main = TRUE; + + if (redraw_mask & REDRAW_ALL) + fade_mask = REDRAW_ALL; + + if (CheckFadeAll()) + fade_mask = REDRAW_ALL; + + UnmapAllGadgets(); + FadeMenuSoundsAndMusic(); + + FadeSetEnterScreen(); + + FadeOut(fade_mask); + + FadeSkipNextFadeOut(); + + // needed if different viewport properties defined for info screen + ChangeViewportPropertiesIfNeeded(); + + SetMainBackgroundImage(IMG_BACKGROUND_INFO); + + DrawInfoScreen(); +} + void HandleInfoScreen(int mx, int my, int dx, int dy, int button) { if (info_mode == INFO_MODE_TITLE) @@ -4486,7 +4540,7 @@ static void drawChooseTreeScreen_Scores_NotAvailable(void) char *text_info = "HighScores of Level %d"; char *text_title = "Score information:"; char *text_error = "No scores for this level."; - char *text_foot = "Press any key or button for main menu"; + char *text_foot = TEXT_MAIN_MENU; int font_info = FONT_TITLE_2; int font_title = FONT_INITIAL_3; int font_error = FONT_INITIAL_4;