diff options
-rw-r--r-- | engines/sci/engine/kgraphics32.cpp | 19 | ||||
-rw-r--r-- | engines/sci/engine/script_patches.cpp | 20 | ||||
-rw-r--r-- | engines/sci/graphics/frameout.cpp | 4 | ||||
-rw-r--r-- | engines/sci/graphics/screen_item32.cpp | 34 |
4 files changed, 41 insertions, 36 deletions
diff --git a/engines/sci/engine/kgraphics32.cpp b/engines/sci/engine/kgraphics32.cpp index c07282f53e..e75f563efb 100644 --- a/engines/sci/engine/kgraphics32.cpp +++ b/engines/sci/engine/kgraphics32.cpp @@ -75,8 +75,11 @@ reg_t kBaseSetter32(EngineState *s, int argc, reg_t *argv) { CelObjView celObj(viewId, loopNo, celNo); - const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; - const Ratio scaleX(scriptWidth, celObj._xResolution); + Ratio scaleX; + if (getSciVersion() < SCI_VERSION_3) { + const int16 scriptWidth = g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth; + scaleX = Ratio(scriptWidth, celObj._xResolution); + } int16 brLeft; @@ -414,7 +417,11 @@ reg_t kCelHigh32(EngineState *s, int argc, reg_t *argv) { int16 loopNo = argv[1].toSint16(); int16 celNo = argv[2].toSint16(); CelObjView celObj(resourceId, loopNo, celNo); - return make_reg(0, mulru(celObj._height, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, celObj._yResolution))); + int16 height = celObj._height; + if (getSciVersion() < SCI_VERSION_3) { + height = mulru(height, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptHeight, celObj._yResolution)); + } + return make_reg(0, height); } reg_t kCelWide32(EngineState *s, int argc, reg_t *argv) { @@ -422,7 +429,11 @@ reg_t kCelWide32(EngineState *s, int argc, reg_t *argv) { int16 loopNo = argv[1].toSint16(); int16 celNo = argv[2].toSint16(); CelObjView celObj(resourceId, loopNo, celNo); - return make_reg(0, mulru(celObj._width, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, celObj._xResolution))); + int16 width = celObj._width; + if (getSciVersion() < SCI_VERSION_3) { + width = mulru(width, Ratio(g_sci->_gfxFrameout->getCurrentBuffer().scriptWidth, celObj._xResolution)); + } + return make_reg(0, width); } // Used by Shivers 1, room 23601 to determine what blocks on the red door diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index 8bfd1d1732..a8be13edd9 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -6382,25 +6382,6 @@ static const uint16 ramaBenchmarkPatch[] = { PATCH_END }; -// RAMA initialises the font system with an incorrect text resolution (it uses -// the resolution from Phant1) which causes text to be scaled incorrectly. -static const uint16 ramaTextResolutionSignature[] = { - 0x39, 0x03, // pushi 3 - 0x78, // push1 - SIG_MAGICDWORD, - 0x38, SIG_UINT16(0x276), // pushi 630 - 0x38, SIG_UINT16(0x1c2), // pushi 450 - 0x43, 0x49, SIG_UINT16(0x06), // callk Font, 6 - SIG_END -}; - -static const uint16 ramaTextResolutionPatch[] = { - PATCH_ADDTOOFFSET(+3), // pushi 3, push1 - 0x38, PATCH_UINT16(0x280), // pushi 640 - 0x38, PATCH_UINT16(0x1e0), // pushi 480 - PATCH_END -}; - // RAMA uses a custom save game format that game scripts read and write // manually. The save game format serialises object references, which in the // original engine could be done just by writing int16s (since object references @@ -6474,7 +6455,6 @@ static const uint16 ramaChangeDirPatch[] = { }; static const SciScriptPatcherEntry ramaSignatures[] = { - { true, 0, "fix bad text resolution", 1, ramaTextResolutionSignature, ramaTextResolutionPatch }, { true, 55, "fix bad DocReader::init priority calculation", 1, ramaDocReaderInitSignature, ramaDocReaderInitPatch }, { true, 85, "fix SaveManager to use normal readWord calls", 1, ramaSerializeRegTSignature1, ramaSerializeRegTPatch1 }, { true, 64908, "disable video benchmarking", 1, ramaBenchmarkSignature, ramaBenchmarkPatch }, 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(); |