[Scummvm-git-logs] scummvm master -> 9f6b266049f6cf2a62d9e23bc7457e781d74f5d0

sluicebox noreply at scummvm.org
Fri Jul 5 23:21:55 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:
9f6b266049 SCI: Fix SCI1.1 view displacement scaling


Commit: 9f6b266049f6cf2a62d9e23bc7457e781d74f5d0
    https://github.com/scummvm/scummvm/commit/9f6b266049f6cf2a62d9e23bc7457e781d74f5d0
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-07-05T16:21:20-07:00

Commit Message:
SCI: Fix SCI1.1 view displacement scaling

Fixes negative displacements being scaled to the wrong value, causing
views to be drawn at the wrong location.

Example: LB2 floppy Act 3 room 430 scaled O'Riley's x displacement
to -2 instead of -1, placing him one pixel too far to the left.

Confirmed in disassembly that this calculation is a signed divide
and not an unsigned shift.

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


diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 96a49f18fa7..c27f90a201e 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -433,8 +433,8 @@ void GfxView::getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int1
 	const CelInfo *celInfo = getCelInfo(loopNo, celNo);
 
 	// Scaling displaceX/Y, Width/Height
-	int16 scaledDisplaceX = (celInfo->displaceX * scaleX) >> 7;
-	int16 scaledDisplaceY = (celInfo->displaceY * scaleY) >> 7;
+	int16 scaledDisplaceX = (celInfo->displaceX * scaleX) / 128;
+	int16 scaledDisplaceY = (celInfo->displaceY * scaleY) / 128;
 	int16 scaledWidth = (celInfo->width * scaleX) >> 7;
 	int16 scaledHeight = (celInfo->height * scaleY) >> 7;
 	scaledWidth = CLIP<int16>(scaledWidth, 0, _screen->getWidth());




More information about the Scummvm-git-logs mailing list