From: Holger Schemel Date: Fri, 3 Nov 2017 13:39:54 +0000 (+0100) Subject: fixed fading complete screen if playfield viewport has changed X-Git-Tag: 4.1.0.0~72 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=5c6c42f1ed5cf72421e5a91c903b9c67584399f1;p=rocksndiamonds.git fixed fading complete screen if playfield viewport has changed --- diff --git a/src/editor.c b/src/editor.c index fb40606a..5f9b2b9d 100644 --- a/src/editor.c +++ b/src/editor.c @@ -8264,7 +8264,7 @@ void DrawLevelEd() FadeSoundsAndMusic(); - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; FadeOut(fade_mask); diff --git a/src/game.c b/src/game.c index 76f34899..1de51be5 100644 --- a/src/game.c +++ b/src/game.c @@ -3298,7 +3298,7 @@ void InitGame() else FadeSetEnterScreen(); - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; FadeLevelSoundsAndMusic(); diff --git a/src/screens.c b/src/screens.c index 7513842e..9c02fc9e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1486,7 +1486,7 @@ void DrawMainMenu() if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; FadeOut(fade_mask); @@ -2186,7 +2186,7 @@ static void DrawInfoScreen_Main() if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); @@ -3838,7 +3838,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr) { int fade_mask = REDRAW_FIELD; - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; if (strEqual((*ti_ptr)->subdir, STRING_TOP_DIRECTORY)) @@ -4357,7 +4357,7 @@ void DrawHallOfFame(int highlight_position) { int fade_mask = REDRAW_FIELD; - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); @@ -6010,7 +6010,7 @@ static void DrawSetupScreen_Generic() char *title_string = NULL; int i; - if (CheckIfGlobalBorderHasChanged()) + if (CheckIfGlobalBorderOrPlayfieldViewportHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); diff --git a/src/tools.c b/src/tools.c index b87d7201..2838908d 100644 --- a/src/tools.c +++ b/src/tools.c @@ -8973,6 +8973,31 @@ void ResetFontStatus() SetFontStatus(-1); } +boolean CheckIfPlayfieldViewportHasChanged() +{ + // if game status has not changed, playfield viewport has not changed either + if (game_status == game_status_last) + return FALSE; + + // check if playfield viewport has changed with current game status + struct RectWithBorder *vp_playfield = &viewport.playfield[game_status]; + int new_real_sx = vp_playfield->x; + int new_real_sy = vp_playfield->y; + int new_full_sxsize = vp_playfield->width; + int new_full_sysize = vp_playfield->height; + + return (new_real_sx != REAL_SX || + new_real_sy != REAL_SY || + new_full_sxsize != FULL_SXSIZE || + new_full_sysize != FULL_SYSIZE); +} + +boolean CheckIfGlobalBorderOrPlayfieldViewportHasChanged() +{ + return (CheckIfGlobalBorderHasChanged() || + CheckIfPlayfieldViewportHasChanged()); +} + void ChangeViewportPropertiesIfNeeded() { boolean use_mini_tilesize = (level.game_engine_type == GAME_ENGINE_TYPE_MM ? diff --git a/src/tools.h b/src/tools.h index 794cc085..2efb705d 100644 --- a/src/tools.h +++ b/src/tools.h @@ -276,4 +276,7 @@ void ResetFontStatus(); void ToggleFullscreenOrChangeWindowScalingIfNeeded(); void ChangeViewportPropertiesIfNeeded(); +boolean CheckIfPlayfieldViewportHasChanged(); +boolean CheckIfGlobalBorderOrPlayfieldViewportHasChanged(); + #endif /* TOOLS_H */