aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/engine
diff options
context:
space:
mode:
authorColin Snover2017-09-29 14:57:22 -0500
committerColin Snover2017-09-29 19:56:24 -0500
commit3cdf26b355d5d0c387858bd85e546d6fff549dd4 (patch)
tree0e88ca1a1a71f8fec9eea8472137e8c9c57aa5be /engines/sci/engine
parenta99c6774ffd3b7686db63b3b66696bb290465e82 (diff)
downloadscummvm-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/engine')
-rw-r--r--engines/sci/engine/kgraphics32.cpp19
-rw-r--r--engines/sci/engine/script_patches.cpp20
2 files changed, 15 insertions, 24 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 },