From: Holger Schemel Date: Mon, 3 Dec 2018 23:23:54 +0000 (+0100) Subject: changed fading complete screen only if all viewports have changed X-Git-Tag: 4.1.2.0~83 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=4002450137caf7133ae05ee9bf5302faac3d5040;p=rocksndiamonds.git changed fading complete screen only if all viewports have changed (... or if the global border has changed, of course) This change partially reverses the behaviour caused by commit 5c6c42f1 ("fixed fading complete screen if playfield viewport has changed"), which prevented partially fading screens that only partially changed. The main intention of this change is to make it possible that the tape recorder viewport, if unchanged, keeps being visible while fading the remaining parts of the screen (especially with artwork sets without global border graphics). However, if *all* viewports changed, the whole window will be faded. --- diff --git a/src/tools.c b/src/tools.c index 4023a34e..6522b8e7 100644 --- a/src/tools.c +++ b/src/tools.c @@ -9403,29 +9403,58 @@ void SetLevelSetInfo(char *identifier, int level_nr) levelset.level_nr = level_nr; } -boolean CheckIfPlayfieldViewportHasChanged(void) +boolean CheckIfAllViewportsHaveChanged(void) { - // if game status has not changed, playfield viewport has not changed either + // if game status has not changed, viewports have not changed either if (game_status == game_status_last) return FALSE; - // check if playfield viewport has changed with current game status + // check if all viewports have changed with current game status + struct RectWithBorder *vp_playfield = &viewport.playfield[game_status]; + struct RectWithBorder *vp_door_1 = &viewport.door_1[game_status]; + struct RectWithBorder *vp_door_2 = &viewport.door_2[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; + int new_dx = vp_door_1->x; + int new_dy = vp_door_1->y; + int new_dxsize = vp_door_1->width; + int new_dysize = vp_door_1->height; + int new_vx = vp_door_2->x; + int new_vy = vp_door_2->y; + int new_vxsize = vp_door_2->width; + int new_vysize = vp_door_2->height; + + boolean playfield_viewport_has_changed = + (new_real_sx != REAL_SX || + new_real_sy != REAL_SY || + new_full_sxsize != FULL_SXSIZE || + new_full_sysize != FULL_SYSIZE); + + boolean door_1_viewport_has_changed = + (new_dx != DX || + new_dy != DY || + new_dxsize != DXSIZE || + new_dysize != DYSIZE); + + boolean door_2_viewport_has_changed = + (new_vx != VX || + new_vy != VY || + new_vxsize != VXSIZE || + new_vysize != VYSIZE || + game_status_last == GAME_MODE_EDITOR); - return (new_real_sx != REAL_SX || - new_real_sy != REAL_SY || - new_full_sxsize != FULL_SXSIZE || - new_full_sysize != FULL_SYSIZE); + return (playfield_viewport_has_changed && + door_1_viewport_has_changed && + door_2_viewport_has_changed); } boolean CheckFadeAll(void) { return (CheckIfGlobalBorderHasChanged() || - CheckIfPlayfieldViewportHasChanged()); + CheckIfAllViewportsHaveChanged()); } void ChangeViewportPropertiesIfNeeded(void) diff --git a/src/tools.h b/src/tools.h index a9aedb23..a6a224f0 100644 --- a/src/tools.h +++ b/src/tools.h @@ -283,7 +283,7 @@ void SetLevelSetInfo(char *, int); void ToggleFullscreenOrChangeWindowScalingIfNeeded(void); void ChangeViewportPropertiesIfNeeded(void); -boolean CheckIfPlayfieldViewportHasChanged(void); +boolean CheckIfAllViewportsHaveChanged(void); boolean CheckFadeAll(void); #endif // TOOLS_H