X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=264617545eca10292faeeebe26e54864e5dcefcb;hb=c3fa9fcf03db2a48bbd8fa343b79a94c42d4cac3;hp=99dedcefa3c9d446f5538bf5e8b5aa5b73700da4;hpb=cc1d6b89872ea3d6ae3e53023653ab86dd76c2ea;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 99dedcef..26461754 100644 --- a/src/screens.c +++ b/src/screens.c @@ -174,10 +174,8 @@ static void HandleChooseTree(int, int, int, int, int, TreeInfo **); static void DrawChooseLevelSet(void); static void DrawChooseLevelNr(void); static void DrawInfoScreen(void); -static void DrawAndFadeInInfoScreen(int); static void DrawSetupScreen(void); -static void DrawInfoScreenExt(int, int); static void DrawInfoScreen_NotAvailable(char *, char *); static void DrawInfoScreen_HelpAnim(int, int, boolean); static void DrawInfoScreen_HelpText(int, int, int, int); @@ -1368,10 +1366,11 @@ boolean CheckTitleScreen(boolean levelset_has_changed) return (show_titlescreen && num_title_screens > 0); } -void DrawMainMenuExt(int fade_mask, boolean do_fading) +void DrawMainMenu() { static LevelDirTree *leveldir_last_valid = NULL; boolean levelset_has_changed = FALSE; + int fade_mask = REDRAW_FIELD; LimitScreenUpdates(FALSE); @@ -1417,32 +1416,22 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(0); -#if 1 /* needed if different viewport properties defined for menues */ ChangeViewportPropertiesIfNeeded(); -#endif if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; FadeOut(fade_mask); -#if 0 - /* needed if different viewport properties defined for menues */ - ChangeViewportPropertiesIfNeeded(); -#endif - /* needed if last screen was the editor screen */ UndrawSpecialEditorDoor(); SetDrawtoField(DRAW_BACKBUFFER); - /* reset drawing area change flag */ - DrawingAreaChanged(); - if (CheckTitleScreen(levelset_has_changed)) { game_status = GAME_MODE_TITLE; @@ -1465,7 +1454,7 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) SetMainBackgroundImage(IMG_BACKGROUND_MAIN); -#if 1 +#if 0 if (fade_mask == REDRAW_ALL) RedrawGlobalBorder(); #endif @@ -1502,11 +1491,6 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) DrawMaskedBorder(REDRAW_ALL); -#if 0 - if (redraw_mask & REDRAW_ALL) - fade_mask = REDRAW_ALL; -#endif - FadeIn(fade_mask); FadeSetEnterMenu(); @@ -1521,16 +1505,6 @@ void DrawMainMenuExt(int fade_mask, boolean do_fading) OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); } -void DrawAndFadeInMainMenu(int fade_mask) -{ - DrawMainMenuExt(fade_mask, TRUE); -} - -void DrawMainMenu() -{ - DrawMainMenuExt(REDRAW_ALL, FALSE); -} - static void gotoTopLevelDir() { /* move upwards until inside (but not above) top level directory */ @@ -1567,7 +1541,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) static int title_screen_nr = 0; static int last_sound = -1, last_music = -1; boolean return_to_main_menu = FALSE; - boolean use_fading_main_menu = TRUE; struct TitleControlInfo *tci; struct TitleFadingInfo fading_default; struct TitleFadingInfo fading_last = fading; @@ -1642,7 +1615,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (button == MB_MENU_LEAVE) { return_to_main_menu = TRUE; - use_fading_main_menu = FALSE; } else if (button == MB_MENU_CHOICE) { @@ -1651,7 +1623,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeSetEnterScreen(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); return; } @@ -1712,19 +1684,20 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) { SetMouseCursor(CURSOR_DEFAULT); + /* force full menu screen redraw after displaying title screens */ + redraw_mask = REDRAW_ALL; + if (game_status == GAME_MODE_INFO) { - int fade_mask = (num_title_screens == 0 ? REDRAW_FIELD : REDRAW_ALL); - info_mode = INFO_MODE_MAIN; - DrawInfoScreenExt(fade_mask, use_fading_main_menu); + DrawInfoScreen(); } else /* default: return to main menu */ { game_status = GAME_MODE_MAIN; - DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu); + DrawMainMenu(); } } } @@ -1904,13 +1877,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { game_status = GAME_MODE_SCORES; -#if 1 - /* required before door position may be changed in next step */ - CloseDoor(DOOR_CLOSE_ALL); -#endif - - ChangeViewportPropertiesIfNeeded(); - DrawHallOfFame(-1); } else if (pos == MAIN_CONTROL_EDITOR) @@ -2025,7 +1991,7 @@ static void execExitInfo() { game_status = GAME_MODE_MAIN; - DrawMainMenuExt(REDRAW_FIELD, FALSE); + DrawMainMenu(); } static struct TokenInfo info_info_main[] = @@ -2143,11 +2109,15 @@ static void drawMenuInfoList(int first_entry, int num_page_entries, } } -static void DrawInfoScreen_Main(int fade_mask, boolean do_fading) +static void DrawInfoScreen_Main() { + int fade_mask = REDRAW_FIELD; int i; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (redraw_mask & REDRAW_ALL) + fade_mask = REDRAW_ALL; + + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); @@ -2749,7 +2719,7 @@ void HandleInfoScreen_Elements(int button) FadeSoundsAndMusic(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); return; } @@ -2848,7 +2818,7 @@ void HandleInfoScreen_Music(int button) FadeSoundsAndMusic(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); return; } @@ -3152,7 +3122,7 @@ void HandleInfoScreen_Credits(int button) FadeSoundsAndMusic(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); return; } @@ -3231,7 +3201,7 @@ void HandleInfoScreen_Program(int button) FadeSoundsAndMusic(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); } else { @@ -3406,7 +3376,7 @@ void HandleInfoScreen_Version(int button) FadeSoundsAndMusic(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); } else { @@ -3494,7 +3464,7 @@ void HandleInfoScreen_LevelSet(int button) FadeSoundsAndMusic(); info_mode = INFO_MODE_MAIN; - DrawAndFadeInInfoScreen(REDRAW_FIELD); + DrawInfoScreen(); } else { @@ -3502,7 +3472,7 @@ void HandleInfoScreen_LevelSet(int button) } } -static void DrawInfoScreenExt(int fade_mask, boolean do_fading) +static void DrawInfoScreen() { SetMainBackgroundImage(IMG_BACKGROUND_INFO); @@ -3521,7 +3491,7 @@ static void DrawInfoScreenExt(int fade_mask, boolean do_fading) else if (info_mode == INFO_MODE_LEVELSET) DrawInfoScreen_LevelSet(); else - DrawInfoScreen_Main(fade_mask, do_fading); + DrawInfoScreen_Main(); if (info_mode != INFO_MODE_MAIN && info_mode != INFO_MODE_TITLE && @@ -3532,16 +3502,6 @@ static void DrawInfoScreenExt(int fade_mask, boolean do_fading) } } -void DrawAndFadeInInfoScreen(int fade_mask) -{ - DrawInfoScreenExt(fade_mask, TRUE); -} - -void DrawInfoScreen() -{ - DrawInfoScreenExt(REDRAW_FIELD, FALSE); -} - void HandleInfoScreen(int mx, int my, int dx, int dy, int button) { if (info_mode == INFO_MODE_TITLE) @@ -3652,13 +3612,16 @@ void HandleTypeName(int newxpos, Key key) static void DrawChooseTree(TreeInfo **ti_ptr) { - int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); + int fade_mask = REDRAW_FIELD; + + if (CheckIfGlobalBorderHasChanged()) + fade_mask = REDRAW_ALL; if (strEqual((*ti_ptr)->subdir, STRING_TOP_DIRECTORY)) { game_status = GAME_MODE_MAIN; - DrawMainMenuExt(REDRAW_FIELD, FALSE); + DrawMainMenu(); return; } @@ -3865,7 +3828,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, game_status = GAME_MODE_MAIN; - DrawMainMenuExt(REDRAW_FIELD, FALSE); + DrawMainMenu(); } return; @@ -4148,7 +4111,16 @@ void HandleChooseLevelNr(int mx, int my, int dx, int dy, int button) void DrawHallOfFame(int highlight_position) { - int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); + int fade_mask = REDRAW_FIELD; + + /* required before door position may be changed in next step */ + CloseDoor(DOOR_CLOSE_ALL); + + /* needed if different viewport properties defined for scores */ + ChangeViewportPropertiesIfNeeded(); + + if (CheckIfGlobalBorderHasChanged()) + fade_mask = REDRAW_ALL; UnmapAllGadgets(); FadeSoundsAndMusic(); @@ -4161,8 +4133,6 @@ void DrawHallOfFame(int highlight_position) SetDrawDeactivationMask(REDRAW_NONE); SetDrawBackgroundMask(REDRAW_FIELD); - CloseDoor(DOOR_CLOSE_ALL); - if (highlight_position < 0) LoadScore(level_nr); @@ -4278,7 +4248,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) game_status = GAME_MODE_MAIN; - DrawAndFadeInMainMenu(REDRAW_FIELD); + DrawMainMenu(); } if (game_status == GAME_MODE_SCORES) @@ -5268,7 +5238,7 @@ static void execExitSetup() { game_status = GAME_MODE_MAIN; - DrawMainMenuExt(REDRAW_FIELD, FALSE); + DrawMainMenu(); } static void execSaveAndExitSetup() @@ -5754,12 +5724,12 @@ static void changeSetupValue(int screen_pos, int setup_info_pos_raw, int dx) static void DrawSetupScreen_Generic() { - int fade_mask = (DrawingAreaChanged() ? REDRAW_ALL : REDRAW_FIELD); + int fade_mask = REDRAW_FIELD; boolean redraw_all = FALSE; char *title_string = NULL; int i; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets();