mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 19:54:03 +00:00
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.
This commit is contained in:
parent
3bc4378e25
commit
9f6b266049
@ -433,8 +433,8 @@ void GfxView::getCelScaledRect(int16 loopNo, int16 celNo, int16 x, int16 y, int1
|
|||||||
const CelInfo *celInfo = getCelInfo(loopNo, celNo);
|
const CelInfo *celInfo = getCelInfo(loopNo, celNo);
|
||||||
|
|
||||||
// Scaling displaceX/Y, Width/Height
|
// Scaling displaceX/Y, Width/Height
|
||||||
int16 scaledDisplaceX = (celInfo->displaceX * scaleX) >> 7;
|
int16 scaledDisplaceX = (celInfo->displaceX * scaleX) / 128;
|
||||||
int16 scaledDisplaceY = (celInfo->displaceY * scaleY) >> 7;
|
int16 scaledDisplaceY = (celInfo->displaceY * scaleY) / 128;
|
||||||
int16 scaledWidth = (celInfo->width * scaleX) >> 7;
|
int16 scaledWidth = (celInfo->width * scaleX) >> 7;
|
||||||
int16 scaledHeight = (celInfo->height * scaleY) >> 7;
|
int16 scaledHeight = (celInfo->height * scaleY) >> 7;
|
||||||
scaledWidth = CLIP<int16>(scaledWidth, 0, _screen->getWidth());
|
scaledWidth = CLIP<int16>(scaledWidth, 0, _screen->getWidth());
|
||||||
|
Loading…
Reference in New Issue
Block a user