From 55f1bbd47db843475a741dcb3294f731157b2731 Mon Sep 17 00:00:00 2001 From: athrxx Date: Wed, 1 May 2024 15:09:32 +0200 Subject: [PATCH] SCUMM: (FM-Towns) - add menu option to force 640 x 480 mode English versions usually run in a 320 x 240 resolution in ScummVM. The original interpreter uses 640 x 480. It has a unique pause/restart banner that we cannot display in 320 x 240. So that is really the only reason for adding this option. --- engines/scumm/charset.cpp | 2 +- engines/scumm/input.cpp | 2 +- engines/scumm/metaengine.cpp | 12 ++++++++++++ engines/scumm/saveload.cpp | 2 +- engines/scumm/scumm.cpp | 19 +++++++++++-------- engines/scumm/scumm.h | 1 + 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp index e2c113d774a..6aa3ec9e3fd 100644 --- a/engines/scumm/charset.cpp +++ b/engines/scumm/charset.cpp @@ -1485,7 +1485,7 @@ void CharsetRendererTownsV3::drawBits1(Graphics::Surface &dest, int x, int y, co return; } #endif - bool scale2x = ((&dest == &_vm->_textSurface) && (_vm->_textSurfaceMultiplier == 2) && !(_sjisCurChar >= 256 && _vm->_useCJKMode)); + bool scale2x = (_vm->_textSurfaceMultiplier == 2 && !(_sjisCurChar >= 256 && _vm->_useCJKMode) && (&dest == &_vm->_textSurface || &dest == &_vm->_virtscr[kBannerVirtScreen])); #endif byte bits = 0; diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index be8abdcc90a..28c1938b89d 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -244,7 +244,7 @@ void ScummEngine::parseEvent(Common::Event event) { _mouse.y = _mouse.y * 4 / 7; } - } else if (_macScreen || (_useCJKMode && _textSurfaceMultiplier == 2) || _renderMode == Common::kRenderCGA_BW || _enableEGADithering) { + } else if (_textSurfaceMultiplier == 2 || _renderMode == Common::kRenderCGA_BW || _enableEGADithering) { _mouse.x >>= 1; _mouse.y >>= 1; } diff --git a/engines/scumm/metaengine.cpp b/engines/scumm/metaengine.cpp index 59c10742881..17fa8cad4ff 100644 --- a/engines/scumm/metaengine.cpp +++ b/engines/scumm/metaengine.cpp @@ -656,6 +656,14 @@ static const ExtraGuiOption fmtownsTrimTo200 = { 0 }; +static const ExtraGuiOption fmtownsForceHiResMode = { + _s("Run in original 640 x 480 resolution"), + _s("This allows more accurate pause/restart banners, but might impact performance or shader/scaler usage."), + "force_fmtowns_hires_mode", + false, + 0, + 0}; + static const ExtraGuiOption macV3LowQualityMusic = { _s("Play simplified music"), _s("This music was intended for low-end Macs, and uses only one channel."), @@ -769,6 +777,10 @@ const ExtraGuiOptions ScummMetaEngine::getExtraGuiOptions(const Common::String & options.push_back(semiSmoothScrolling); if (guiOptions.contains(GUIO_TRIM_FMTOWNS_TO_200_PIXELS)) options.push_back(fmtownsTrimTo200); +#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE + if (platform == Common::kPlatformFMTowns && Common::parseLanguage(language) != Common::JA_JPN) + options.push_back(fmtownsForceHiResMode); +#endif } // The Steam Mac versions of Loom and Indy 3 are more akin to the VGA diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp index 66eeadfdc4e..2c0c2cd0693 100644 --- a/engines/scumm/saveload.cpp +++ b/engines/scumm/saveload.cpp @@ -1674,7 +1674,7 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) { x *= 2; x += (kHercWidth - _screenWidth * 2) / 2; y = y * 7 / 4; - } else if (_macScreen || (_useCJKMode && _textSurfaceMultiplier == 2) || _renderMode == Common::kRenderCGA_BW || _enableEGADithering) { + } else if (_textSurfaceMultiplier == 2 || _renderMode == Common::kRenderCGA_BW || _enableEGADithering) { x *= 2; y *= 2; } diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp index 8adbd9f9f0f..f37a7142e23 100644 --- a/engines/scumm/scumm.cpp +++ b/engines/scumm/scumm.cpp @@ -367,6 +367,9 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr) #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE if (_game.platform == Common::kPlatformFMTowns) { + ConfMan.registerDefault("force_fmtowns_hires_mode", false); + if (ConfMan.hasKey("force_fmtowns_hires_mode")) + _forceFMTownsHiResMode = ConfMan.getBool("force_fmtowns_hires_mode"); ConfMan.registerDefault("smooth_scroll", true); if (ConfMan.hasKey("smooth_scroll")) _enableSmoothScrolling = ConfMan.getBool("smooth_scroll"); @@ -1149,6 +1152,11 @@ Common::Error ScummEngine::init() { // Load it earlier so _useCJKMode variable could be set loadCJKFont(); +#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE + if (_game.platform == Common::kPlatformFMTowns && _forceFMTownsHiResMode) + _textSurfaceMultiplier = 2; +#endif + Common::Path macResourceFile; if (_game.platform == Common::kPlatformMacintosh) { @@ -1256,14 +1264,9 @@ Common::Error ScummEngine::init() { } else if (_renderMode == Common::kRenderCGA_BW || (_renderMode == Common::kRenderEGA && _supportsEGADithering)) { initGraphics(_screenWidth * 2, _screenHeight * 2); } else { - int screenWidth = _screenWidth; - int screenHeight = _screenHeight; - if (_useCJKMode || _macScreen) { - // CJK FT and DIG use usual NUT fonts, not FM-TOWNS ROM, so - // there is no text surface for them. This takes that into account - screenWidth *= _textSurfaceMultiplier; - screenHeight *= _textSurfaceMultiplier; - } + int screenWidth = _screenWidth * _textSurfaceMultiplier; + int screenHeight = _screenHeight * _textSurfaceMultiplier; + if (_game.features & GF_16BIT_COLOR #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE || _game.platform == Common::kPlatformFMTowns diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h index bb020fd4d3a..7d13ec783b5 100644 --- a/engines/scumm/scumm.h +++ b/engines/scumm/scumm.h @@ -1893,6 +1893,7 @@ protected: int _refreshArrayPos = 0; bool _refreshNeedCatchUp = false; bool _enableSmoothScrolling = false; + bool _forceFMTownsHiResMode = false; uint32 _scrollTimer = 0; uint32 _scrollDestOffset = 0; uint16 _scrollFeedStrips[3];