From 11bf8833dfcf24b05ae54d8173838b3c6b593d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torbj=C3=B6rn=20Andersson?= Date: Mon, 18 Oct 2021 20:56:43 +0200 Subject: [PATCH] SCUMM: Add setting for correct font spacing in Indy 3 Mac For all the purists out there (I know there is at least one), the default behavior is to try and emulate the original's slightly broken font spacing. Even though I prefer correct spacing myself. --- engines/scumm/charset.cpp | 5 +++-- engines/scumm/charset.h | 4 +++- engines/scumm/detection.cpp | 30 +++++++++++++++++++++++++++--- engines/scumm/scumm.cpp | 7 ++++--- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index 03c2bd46ed1..df74b730e50 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1502,9 +1502,10 @@ void CharsetRendererPCE::setDrawCharIntern(uint16 chr) { } #endif -CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fontFile) +CharsetRendererMac::CharsetRendererMac(ScummEngine *vm, const Common::String &fontFile, bool correctFontSpacing) : CharsetRendererCommon(vm) { + _correctFontSpacing = correctFontSpacing; _pad = false; _glyphSurface = NULL; @@ -1773,7 +1774,7 @@ void CharsetRendererMac::printChar(int chr, bool ignoreCharsetMask) { // the width of a string (e.g. to center text on screen). It is, // however, used for things like the Grail Diary. - if (_vm->_game.id == GID_INDY3 && !drawToTextBox && (width & 1)) + if (!_correctFontSpacing && !drawToTextBox && (width & 1)) width++; if (enableShadow) { diff --git a/engines/scumm/charset.h b/engines/scumm/charset.h index 500af1924f1..20573cf1e23 100644 --- a/engines/scumm/charset.h +++ b/engines/scumm/charset.h @@ -278,9 +278,11 @@ public: class CharsetRendererMac : public CharsetRendererCommon { protected: Graphics::MacFONTFont _macFonts[2]; + bool _correctFontSpacing; bool _pad; int _lastTop; + int getDrawWidthIntern(uint16 chr); void printCharInternal(int chr, int color, bool shadow, int x, int y); @@ -292,7 +294,7 @@ protected: Graphics::Surface *_glyphSurface; public: - CharsetRendererMac(ScummEngine *vm, const Common::String &fontFile); + CharsetRendererMac(ScummEngine *vm, const Common::String &fontFile, bool correctFontSpacing); ~CharsetRendererMac() override; void setCurID(int32 id) override; diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp index c57ad166b0e..d60be3d9636 100644 --- a/engines/scumm/detection.cpp +++ b/engines/scumm/detection.cpp @@ -200,6 +200,13 @@ static const ExtraGuiOption macV3LowQualityMusic = { false }; +static const ExtraGuiOption macV3CorrectFontSpacing = { + _s("Use correct font spacing"), + _s("Draw text with correct font spacing. This arguably looks better, but doesn't match the original behavior."), + "mac_v3_correct_font_spacing", + false +}; + static const ExtraGuiOption smoothScrolling = { _s("Enable smooth scrolling"), _s("(instead of the normal 8-pixels steps scrolling)"), @@ -227,13 +234,30 @@ const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common: if (guiOptions.contains(GUIO_TRIM_FMTOWNS_TO_200_PIXELS)) options.push_back(fmtownsTrimTo200); } - // The Steam Mac version of Loom is more akin to the VGA DOS version, - // and that's how ScummVM usually sees it. But that rebranding does not - // happen until later. + + // The Steam Mac versions of Loom and Indy 3 are more akin to the VGA + // DOS versions, and that's how ScummVM usually sees them. But that + // rebranding does not happen until later. + + // The low quality music in Loom was probably intended for low-end + // Macs. It plays only one channel, instead of three. + if (target.empty() || (gameid == "loom" && platform == Common::kPlatformMacintosh && extra != "Steam")) { options.push_back(macV3LowQualityMusic); } + // The original Macintosh interpreter didn't use the correct spacing + // between characters for some of the text, e.g. the Grail Diary. This + // appears to have been because of rounding errors, and was apparently + // fixed in Loom. Enabling this setting allows ScummVM to draw the + // text more correctly, at the cost of not matching the original quite + // as well. (At the time of writing, there are still cases, at least in + // Loom, where text isn't correctly positioned.) + + if (target.empty() || (gameid == "indy3" && platform == Common::kPlatformMacintosh && extra != "Steam")) { + options.push_back(macV3CorrectFontSpacing); + } + return options; } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 520f9e0c70e..b8ef76d6ec9 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -1661,9 +1661,10 @@ void ScummEngine::setupCharsetRenderer(const Common::String &macFontFile) { #endif if (_game.platform == Common::kPlatformFMTowns) _charset = new CharsetRendererTownsV3(this); - else if (_game.platform == Common::kPlatformMacintosh && !macFontFile.empty()) - _charset = new CharsetRendererMac(this, macFontFile); - else + else if (_game.platform == Common::kPlatformMacintosh && !macFontFile.empty()) { + bool correctFontSpacing = _game.id == GID_LOOM || ConfMan.getBool("mac_v3_correct_font_spacing"); + _charset = new CharsetRendererMac(this, macFontFile, correctFontSpacing); + } else _charset = new CharsetRendererV3(this); #ifdef ENABLE_SCUMM_7_8 } else if (_game.version == 8) {