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

sluicebox noreply at scummvm.org
Fri Nov 4 04:06:45 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:
f779535e3e SCI: Fix vector pattern regression


Commit: f779535e3e9c4f9e89963fd26fd8d182aaa75f1c
    https://github.com/scummvm/scummvm/commit/f779535e3e9c4f9e89963fd26fd8d182aaa75f1c
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2022-11-03T21:06:06-07:00

Commit Message:
SCI: Fix vector pattern regression

Restores correct adjustments for vector patterns that extend past the
left or top picture edges. This was accidentally altered to occur
after the port adjustment in: 44b6050915ed6012f9e2e14c8ffa81d9e366529d

Fixes bug #13914 where the top of PQ2 room 1 was drawn out of bounds.

Changed paths:
    engines/sci/graphics/picture.cpp


diff --git a/engines/sci/graphics/picture.cpp b/engines/sci/graphics/picture.cpp
index 640271b9995..acfc267bbcc 100644
--- a/engines/sci/graphics/picture.cpp
+++ b/engines/sci/graphics/picture.cpp
@@ -1140,25 +1140,31 @@ void GfxPicture::vectorPatternTexturedCircle(Common::Rect box, Common::Rect clip
 void GfxPicture::vectorPattern(int16 x, int16 y, byte color, byte priority, byte control, byte code, byte texture) {
 	byte size = code & SCI_PATTERN_CODE_PENSIZE;
 
-	// The vector box is centered on x,y and one pixel wider than high
+	// The pattern box is centered on x,y and one pixel wider than high
 	Common::Rect box(x - size, y - size, x + size + 2, y + size + 1);
+
+	// Move the pattern box if it goes off of the left or top of the picture
+	if (box.left < 0) {
+		box.moveTo(0, box.top);
+	}
+	if (box.top < 0) {
+		box.moveTo(box.left, 0);
+	}
+
+	// Adjust the pattern box to the current port
 	_ports->offsetRect(box);
 
-	// Adjust the vector box's position if it goes off the screen.
+	// Move the pattern box if it goes off of the right or bottom of the screen.
 	// Although, if it goes off the right edge, leave the last column
 	// beyond the screen edge even though it won't get drawn.
 	// We also can't just clip the box to the screen here, because the
 	// texture and circle data can only be properly consumed by evaluating
 	// every pixel during drawing, even the pixels that are then skipped
 	// for being out of bounds. (Example: SQ3 picture 2)
-	if (box.left < 0) {
-		box.moveTo(0, box.top);
-	} else if (box.right >= _screen->getScriptWidth()) {
+	if (box.right >= _screen->getScriptWidth()) {
 		box.moveTo(_screen->getScriptWidth() - box.width() + 1, box.top);
 	}
-	if (box.top < 0) {
-		box.moveTo(box.left, 0);
-	} else if (box.bottom >= _screen->getScriptHeight()) {
+	if (box.bottom >= _screen->getScriptHeight()) {
 		box.moveTo(box.left, _screen->getScriptHeight() - box.height());
 	}
 	_screen->vectorAdjustCoordinate(&box.left, &box.top);




More information about the Scummvm-git-logs mailing list