[Scummvm-git-logs] scummvm master -> c4a317f616c05ec7ec50db21d350dab99b1c7ed4

AndywinXp noreply at scummvm.org
Wed Sep 28 21:11:17 UTC 2022


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:
c4a317f616 SCUMM: COMI: Fix crash caused by a regression in string_v7.cpp


Commit: c4a317f616c05ec7ec50db21d350dab99b1c7ed4
    https://github.com/scummvm/scummvm/commit/c4a317f616c05ec7ec50db21d350dab99b1c7ed4
Author: AndywinXp (andywinxp at gmail.com)
Date: 2022-09-28T23:10:15+02:00

Commit Message:
SCUMM: COMI: Fix crash caused by a regression in string_v7.cpp

Changed paths:
    engines/scumm/string_v7.cpp


diff --git a/engines/scumm/string_v7.cpp b/engines/scumm/string_v7.cpp
index b57c21b44c8..7f2ab34b930 100644
--- a/engines/scumm/string_v7.cpp
+++ b/engines/scumm/string_v7.cpp
@@ -517,9 +517,15 @@ void ScummEngine_v7::restoreBlastTextsRects() {
 		// a little bit differently on our end, so we need to account for this
 		// case manually.
 		if (camera._cur.x != camera._last.x) {
-			int diff = camera._cur.x - camera._last.x;
-			_blastTextQueue[i].rect.left -= diff;
-			_blastTextQueue[i].rect.right -= diff;
+			int rightDiff = _blastTextQueue[i].rect.right - (camera._cur.x - camera._last.x);
+			int leftDiff = _blastTextQueue[i].rect.left - (camera._cur.x - camera._last.x);
+
+			// The nominal calculations are meant to be used for camera movements
+			// inside the same room. If this is not true, we might end up with
+			// negative rect values, so in that case the worse that can happen
+			// it's just that the rect will be as large as the screen itself.
+			_blastTextQueue[i].rect.left = (leftDiff < 0) ? 0 : leftDiff;
+			_blastTextQueue[i].rect.right = (rightDiff < 0) ? _screenWidth : rightDiff;
 		}
 
 		restoreBackground(_blastTextQueue[i].rect);




More information about the Scummvm-git-logs mailing list