diff options
author | Colin Snover | 2017-09-29 14:57:22 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-29 19:56:24 -0500 |
commit | 3cdf26b355d5d0c387858bd85e546d6fff549dd4 (patch) | |
tree | 0e88ca1a1a71f8fec9eea8472137e8c9c57aa5be /engines/sci/graphics | |
parent | a99c6774ffd3b7686db63b3b66696bb290465e82 (diff) | |
download | scummvm-rg350-3cdf26b355d5d0c387858bd85e546d6fff549dd4.tar.gz scummvm-rg350-3cdf26b355d5d0c387858bd85e546d6fff549dd4.tar.bz2 scummvm-rg350-3cdf26b355d5d0c387858bd85e546d6fff549dd4.zip |
SCI32: Fix bad text rendering in RAMA
In SCI3, Sierra removed the ability of the main renderer to
automatically scale CelObjs with different source resolutions.
Instead, in SCI3, all CelObjs are treated as having the same
resolution as the screen (i.e. 640x480).
In all SCI3 games other than RAMA, keeping the code paths for
resolution-dependent scaling is not a problem because all the
assets and game code are correctly designed to use the same
640x480 resolution throughout. RAMA, on the other hand, was
written with the text subsystem set to a resolution of 630x450
(Phant1's screen resolution), and in SSCI, resolution-dependent
scaling code was not removed from the *text* subsystem. As a
result, RAMA's game scripts rely on the slightly larger scaled
dimensions coming out of the text system when determining the size
of screen items for rendering, and then also rely on the main
renderer ignoring the 630x450 resolution baked into the bitmaps
generated by the text subsystem when drawing them to the screen.
Diffstat (limited to 'engines/sci/graphics')
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/screen_item32.cpp | 34 |
2 files changed, 26 insertions, 12 deletions
diff --git a/engines/sci/graphics/frameout.cpp b/engines/sci/graphics/frameout.cpp index d3e08bf1c1..6ea4975ea8 100644 --- a/engines/sci/graphics/frameout.cpp +++ b/engines/sci/graphics/frameout.cpp @@ -1228,7 +1228,9 @@ bool GfxFrameout::isOnMe(const ScreenItem &screenItem, const Plane &plane, const scaledPosition.x -= screenItem._scaledPosition.x; scaledPosition.y -= screenItem._scaledPosition.y; - mulru(scaledPosition, Ratio(celObj._xResolution, _currentBuffer.screenWidth), Ratio(celObj._yResolution, _currentBuffer.screenHeight)); + if (getSciVersion() < SCI_VERSION_3) { + mulru(scaledPosition, Ratio(celObj._xResolution, _currentBuffer.screenWidth), Ratio(celObj._yResolution, _currentBuffer.screenHeight)); + } if (screenItem._scale.signal != kScaleSignalNone && screenItem._scale.x && screenItem._scale.y) { scaledPosition.x = scaledPosition.x * 128 / screenItem._scale.x; diff --git a/engines/sci/graphics/screen_item32.cpp b/engines/sci/graphics/screen_item32.cpp index 8e4f713eb6..5a35d30c54 100644 --- a/engines/sci/graphics/screen_item32.cpp +++ b/engines/sci/graphics/screen_item32.cpp @@ -297,8 +297,12 @@ void ScreenItem::calcRects(const Plane &plane) { if (scaleX.getNumerator() && scaleY.getNumerator()) { _screenItemRect = _insetRect; - const Ratio celToScreenX(screenWidth, celObj._xResolution); - const Ratio celToScreenY(screenHeight, celObj._yResolution); + Ratio celToScreenX; + Ratio celToScreenY; + if (getSciVersion() < SCI_VERSION_3) { + celToScreenX = Ratio(screenWidth, celObj._xResolution); + celToScreenY = Ratio(screenHeight, celObj._yResolution); + } // Cel may use a coordinate system that is not the same size as the // script coordinate system (usually this means high-resolution @@ -307,9 +311,11 @@ void ScreenItem::calcRects(const Plane &plane) { // high resolution coordinates if (_useInsetRect) { - const Ratio scriptToCelX(celObj._xResolution, scriptWidth); - const Ratio scriptToCelY(celObj._yResolution, scriptHeight); - mulru(_screenItemRect, scriptToCelX, scriptToCelY, 0); + if (getSciVersion() < SCI_VERSION_3) { + const Ratio scriptToCelX(celObj._xResolution, scriptWidth); + const Ratio scriptToCelY(celObj._yResolution, scriptHeight); + mulru(_screenItemRect, scriptToCelX, scriptToCelY, 0); + } if (_screenItemRect.intersects(celRect)) { _screenItemRect.clip(celRect); @@ -445,7 +451,7 @@ void ScreenItem::calcRects(const Plane &plane) { _scaledPosition.y += plane._gameRect.top; _screenItemRect.translate(plane._gameRect.left, plane._gameRect.top); - if (celObj._xResolution != screenWidth || celObj._yResolution != screenHeight) { + if (!celToScreenX.isOne() || !celToScreenY.isOne()) { mulru(_scaledPosition, celToScreenX, celToScreenY); mulru(_screenItemRect, celToScreenX, celToScreenY, 1); } @@ -626,9 +632,11 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const { // high resolution coordinates if (_useInsetRect) { - Ratio scriptToCelX(celObj._xResolution, scriptWidth); - Ratio scriptToCelY(celObj._yResolution, scriptHeight); - mulru(nsRect, scriptToCelX, scriptToCelY, 0); + if (getSciVersion() < SCI_VERSION_3) { + const Ratio scriptToCelX(celObj._xResolution, scriptWidth); + const Ratio scriptToCelY(celObj._yResolution, scriptHeight); + mulru(nsRect, scriptToCelX, scriptToCelY, 0); + } if (nsRect.intersects(celObjRect)) { nsRect.clip(celObjRect); @@ -668,8 +676,12 @@ Common::Rect ScreenItem::getNowSeenRect(const Plane &plane) const { } } - Ratio celToScriptX(scriptWidth, celObj._xResolution); - Ratio celToScriptY(scriptHeight, celObj._yResolution); + Ratio celToScriptX; + Ratio celToScriptY; + if (getSciVersion() < SCI_VERSION_3) { + celToScriptX = Ratio(scriptWidth, celObj._xResolution); + celToScriptY = Ratio(scriptHeight, celObj._yResolution); + } originX = (originX * scaleX * celToScriptX).toInt(); originY = (originY * scaleY * celToScriptY).toInt(); |