[Scummvm-git-logs] scummvm master -> 3bc4378e250302064d7aadf1c722d7c248fca848
sluicebox
noreply at scummvm.org
Fri Jul 5 21:43:56 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:
3bc4378e25 SCI: Fix SCI1.1 scaling inaccuracies
Commit: 3bc4378e250302064d7aadf1c722d7c248fca848
https://github.com/scummvm/scummvm/commit/3bc4378e250302064d7aadf1c722d7c248fca848
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-07-05T14:39:36-07:00
Commit Message:
SCI: Fix SCI1.1 scaling inaccuracies
Fixes the pigeon flight in Pepper's Adventures in Time.
The pigeon view is scaled down to one pixel but the scaling code was
incorrectly producing an empty table for certain inputs. Other scaling
inaccuracies were identified and fixed too.
Fixes bug #15222
Changed paths:
engines/sci/graphics/paint16.cpp
engines/sci/graphics/view.cpp
diff --git a/engines/sci/graphics/paint16.cpp b/engines/sci/graphics/paint16.cpp
index a86e03e22e9..2518f072c62 100644
--- a/engines/sci/graphics/paint16.cpp
+++ b/engines/sci/graphics/paint16.cpp
@@ -110,12 +110,12 @@ void GfxPaint16::drawCelAndShow(GuiResourceId viewId, int16 loopNo, int16 celNo,
}
}
-// This version of drawCel is not supposed to call BitsShow()!
+// This version of drawCel is not supposed to call bitsShow()!
void GfxPaint16::drawCel(GuiResourceId viewId, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, uint16 scaleSignal) {
drawCel(_cache->getView(viewId), loopNo, celNo, celRect, priority, paletteNo, scaleX, scaleY, scaleSignal);
}
-// This version of drawCel is not supposed to call BitsShow()!
+// This version of drawCel is not supposed to call bitsShow()!
void GfxPaint16::drawCel(GfxView *view, int16 loopNo, int16 celNo, const Common::Rect &celRect, byte priority, uint16 paletteNo, uint16 scaleX, uint16 scaleY, uint16 scaleSignal) {
Common::Rect clipRect = celRect;
clipRect.clip(_ports->_curPort->rect);
diff --git a/engines/sci/graphics/view.cpp b/engines/sci/graphics/view.cpp
index 3f7a28a1c5e..96a49f18fa7 100644
--- a/engines/sci/graphics/view.cpp
+++ b/engines/sci/graphics/view.cpp
@@ -899,17 +899,39 @@ void GfxView::createScalingTable(Common::Array<uint16> &table, int16 celSize, ui
const int16 clippedScaledSize = CLIP<int16>(scaledSize, 0, maxSize);
const int16 stepCount = scaledSize - 1;
- if (stepCount <= 0) {
+ if (clippedScaledSize <= 0) {
table.clear();
return;
}
- uint32 acc;
- uint32 inc = ((celSize - 1) << 16) / stepCount;
- if ((inc & 0xffff8000) == 0) {
- acc = 0x8000;
+ // SSCI used the mirror flag when creating the scaling table by swapping start and end.
+ // We don't do this because we reverse the cel's bitmap in memory before drawing.
+ const int16 start = 0;
+ const int16 end = (celSize - 1);
+
+ int32 acc;
+ int32 inc;
+ bool negative = false;
+ if (stepCount == 0) {
+ acc = start << 16;
+ inc = 0;
} else {
- acc = inc & 0xffff;
+ acc = start << 16;
+ inc = end << 16;
+ inc -= acc;
+ inc /= stepCount;
+ if (inc < 0) {
+ inc = -inc;
+ negative = true;
+ }
+ if ((inc & 0xffff8000) == 0) {
+ acc = (acc & 0xffff0000) | 0x8000;
+ } else {
+ acc = (acc & 0xffff0000) | (inc & 0xffff);
+ }
+ }
+ if (negative) {
+ inc = -inc;
}
table.resize(clippedScaledSize);
More information about the Scummvm-git-logs
mailing list