[Scummvm-git-logs] scummvm master -> 1e1840c009545cb77672eac8de06de99fdea6358

AndywinXp noreply at scummvm.org
Thu Aug 8 19:28:28 UTC 2024


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1e1840c009 SCUMM: v1-4: Fix flashlights corners glitching on fast movements


Commit: 1e1840c009545cb77672eac8de06de99fdea6358
    https://github.com/scummvm/scummvm/commit/1e1840c009545cb77672eac8de06de99fdea6358
Author: AndywinXp (andywinxp at gmail.com)
Date: 2024-08-08T21:28:23+02:00

Commit Message:
SCUMM: v1-4: Fix flashlights corners glitching on fast movements

Changed paths:
    engines/scumm/gfx.cpp


diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index d176874b3f7..d91f9019551 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -1822,13 +1822,13 @@ void ScummEngine_v5::drawFlashlight() {
 
 	// Remove the flash light first if it was previously drawn
 	if (_flashlight.eraseFlag) {
-		markRectAsDirty(kMainVirtScreen, _flashlight.x, _flashlight.x + _flashlight.w,
-										_flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
-
 		if (_flashlight.buffer) {
 			fill(_flashlight.buffer, vs->pitch, blackColor, _flashlight.w, _flashlight.h, vs->format.bytesPerPixel);
 		}
 
+		markRectAsDirty(kMainVirtScreen, _flashlight.x, _flashlight.x + _flashlight.w,
+				_flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
+
 		_flashlight.eraseFlag = false;
 	}
 
@@ -1849,10 +1849,7 @@ void ScummEngine_v5::drawFlashlight() {
 	// - X position is a multiple of 8;
 	// - Y position is a multiple of 2.
 	//
-	// Failing to do so will create temporary glitches on the corners
-	// of the flashlight when attempting moving the mouse too fast...
-	// I'm not sure FM-Towns does this, so I'm leaving it off,
-	// which mean it will glitch just like with the old code...
+	// FM-Towns doesn't seem to do so...
 	if (_game.platform != Common::kPlatformFMTowns) {
 		x &= ~7;
 		y &= ~1;
@@ -2026,6 +2023,11 @@ void ScummEngine_v5::drawFlashlight() {
 		}
 	}
 
+	// Not in the original, but this avoids glitches on the borders of the flashlight, since
+	// otherwise the next rects refresh would have been on the next drawFlashlight() call...
+	markRectAsDirty(kMainVirtScreen, _flashlight.x, _flashlight.x + _flashlight.w,
+					_flashlight.y, _flashlight.y + _flashlight.h, USAGE_BIT_DIRTY);
+
 	_flashlight.eraseFlag = true;
 }
 




More information about the Scummvm-git-logs mailing list