SCUMM: (FM-TOWNS) - add menu option to disable smooth scrolling

This commit is contained in:
athrxx 2021-08-01 15:47:35 +02:00
parent a19fe8643b
commit 7afd105562
5 changed files with 35 additions and 15 deletions

View file

@ -200,6 +200,13 @@ static const ExtraGuiOption macV3LowQualityMusic = {
false false
}; };
static const ExtraGuiOption smoothScrolling = {
_s("Enable smooth scrolling"),
_s("(instead of the normal 8-pixels steps scrolling)"),
"smooth_scroll",
true
};
const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common::String &target) const { const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common::String &target) const {
ExtraGuiOptions options; ExtraGuiOptions options;
// Query the GUI options // Query the GUI options
@ -215,8 +222,10 @@ const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common:
if (target.empty() || platform == Common::kPlatformNES) { if (target.empty() || platform == Common::kPlatformNES) {
options.push_back(mmnesObjectLabelsOption); options.push_back(mmnesObjectLabelsOption);
} }
if (target.empty() || (platform == Common::kPlatformFMTowns && guiOptions.contains(GUIO_TRIM_FMTOWNS_TO_200_PIXELS))) { if (target.empty() || platform == Common::kPlatformFMTowns) {
options.push_back(fmtownsTrimTo200); options.push_back(smoothScrolling);
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, // 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 // and that's how ScummVM usually sees it. But that rebranding does not
@ -224,6 +233,7 @@ const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common:
if (target.empty() || (gameid == "loom" && platform == Common::kPlatformMacintosh && extra != "Steam")) { if (target.empty() || (gameid == "loom" && platform == Common::kPlatformMacintosh && extra != "Steam")) {
options.push_back(macV3LowQualityMusic); options.push_back(macV3LowQualityMusic);
} }
return options; return options;
} }

View file

@ -4095,7 +4095,7 @@ void ScummEngine::dissolveEffect(int width, int height) {
void ScummEngine::scrollEffect(int dir) { void ScummEngine::scrollEffect(int dir) {
#ifndef DISABLE_TOWNS_DUAL_LAYER_MODE #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
// The FM-Towns versions use smooth scrolling here, but only for left and right. // The FM-Towns versions use smooth scrolling here, but only for left and right.
if (_game.platform == Common::kPlatformFMTowns && dir > 1) { if (_enableSmoothScrolling && dir > 1) {
towns_scriptScrollEffect((dir & 1) * 2 - 1); towns_scriptScrollEffect((dir & 1) * 2 - 1);
return; return;
} }

View file

@ -155,7 +155,7 @@ void ScummEngine::towns_clearStrip(int strip) {
} }
void ScummEngine::requestScroll(int dir) { void ScummEngine::requestScroll(int dir) {
if (_game.platform == Common::kPlatformFMTowns && !_fastMode) { if (_enableSmoothScrolling && !_fastMode) {
int lw = _townsScreen->getLayerWidth(0); int lw = _townsScreen->getLayerWidth(0);
// Wait for opposite direction scroll to finish. // Wait for opposite direction scroll to finish.
towns_waitForScroll(-dir); towns_waitForScroll(-dir);
@ -197,17 +197,19 @@ void ScummEngine::towns_updateGfx() {
dur += _refreshDuration[i]; dur += _refreshDuration[i];
_refreshNeedCatchUp = (dur / ARRAYSIZE(_refreshDuration)) > (1000 / 60); _refreshNeedCatchUp = (dur / ARRAYSIZE(_refreshDuration)) > (1000 / 60);
} }
while (_scrollTimer <= cur) { if (_enableSmoothScrolling) {
if (!_scrollTimer) while (_scrollTimer <= cur) {
_scrollTimer = cur; if (!_scrollTimer)
_scrollTimer += 1000 / 60; _scrollTimer = cur;
_townsScreen->scrollLayers(1, _scrollRequest); _scrollTimer += 1000 / 60;
if (_townsScreen->isScrolling(0)) _townsScreen->scrollLayers(1, _scrollRequest);
_scrollDeltaAdjust++; if (_townsScreen->isScrolling(0))
_scrollRequest = 0; _scrollDeltaAdjust++;
if (!_refreshNeedCatchUp) _scrollRequest = 0;
break; if (!_refreshNeedCatchUp)
break;
}
} }
_townsScreen->update(); _townsScreen->update();

View file

@ -286,6 +286,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_scrollRequest = _scrollDeltaAdjust = 0; _scrollRequest = _scrollDeltaAdjust = 0;
_scrollDestOffset = _scrollTimer = 0; _scrollDestOffset = _scrollTimer = 0;
_refreshNeedCatchUp = false; _refreshNeedCatchUp = false;
_enableSmoothScrolling = (_game.platform == Common::kPlatformFMTowns);
memset(_refreshDuration, 0, sizeof(_refreshDuration)); memset(_refreshDuration, 0, sizeof(_refreshDuration));
_refreshArrayPos = 0; _refreshArrayPos = 0;
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
@ -594,6 +595,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_screenHeight = 200; _screenHeight = 200;
} }
if (_game.platform == Common::kPlatformFMTowns) {
ConfMan.registerDefault("smooth_scroll", true);
if (ConfMan.hasKey("smooth_scroll"))
_enableSmoothScrolling = ConfMan.getBool("smooth_scroll");
}
_bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1; _bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1;
uint8 sizeMult = _bytesPerPixel; uint8 sizeMult = _bytesPerPixel;

View file

@ -1388,6 +1388,7 @@ protected:
int _refreshDuration[20]; int _refreshDuration[20];
int _refreshArrayPos; int _refreshArrayPos;
bool _refreshNeedCatchUp; bool _refreshNeedCatchUp;
bool _enableSmoothScrolling;
uint32 _scrollTimer; uint32 _scrollTimer;
uint32 _scrollDestOffset; uint32 _scrollDestOffset;
uint16 _scrollFeedStrips[3]; uint16 _scrollFeedStrips[3];