From 7899cc1f1e0771635740fe752f32834af012fde7 Mon Sep 17 00:00:00 2001 From: Flugente Date: Thu, 18 Jun 2020 18:49:37 +0000 Subject: [PATCH] Fix: disabling cover display left coloured remnants outside the screen (by Asdow) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8825 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/DisplayCover.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Tactical/DisplayCover.cpp b/Tactical/DisplayCover.cpp index 710775bd..d70f1a34 100644 --- a/Tactical/DisplayCover.cpp +++ b/Tactical/DisplayCover.cpp @@ -416,6 +416,7 @@ void RemoveCoverObjectsFromViewArea() if ( gubDrawMode == DRAW_MODE_OFF && gNoRedraw ) return; + // Not needed for removing cover objects anymore, but this is the only place where we update the global gsMin & gsMaxCell variables and they're needed for adding cover objects. INT16 usTmp; GetScreenXYWorldCell( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, &gsMinCellX, &usTmp ); GetScreenXYWorldCell( gsVIEWPORT_END_X, gsVIEWPORT_END_Y, &gsMaxCellX, &usTmp ); @@ -429,14 +430,16 @@ void RemoveCoverObjectsFromViewArea() gsMinCellY = max( 0, gsMinCellY ); gsMaxCellY = min( COVER_Y_CELLS, gsMaxCellY ); + + // Go through the whole gCoverViewArea when removing cover objects. Otherwise we don't clean up tiles that are not in the viewport which results in an annoying visual bug. register INT32 ubX, ubY, ubZ; BOOLEAN fChanged = FALSE; - for ( ubX=gsMinCellX; ubX<=gsMaxCellX; ++ubX ) + for ( ubX = 0; ubX < COVER_X_CELLS; ++ubX ) { - for ( ubY=gsMinCellY; ubY<=gsMaxCellY; ++ubY ) + for ( ubY = 0; ubY < COVER_Y_CELLS; ++ubY ) { - for ( ubZ=0; ubZ