[Scummvm-git-logs] scummvm master -> 7afd1055627157fa585565e581d288a4cb152bbd

athrxx athrxx at scummvm.org
Sun Aug 1 14:12:04 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

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


Commit: 7afd1055627157fa585565e581d288a4cb152bbd
    https://github.com/scummvm/scummvm/commit/7afd1055627157fa585565e581d288a4cb152bbd
Author: athrxx (athrxx at scummvm.org)
Date: 2021-08-01T16:10:42+02:00

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

Changed paths:
    engines/scumm/detection.cpp
    engines/scumm/gfx.cpp
    engines/scumm/gfx_towns.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h


diff --git a/engines/scumm/detection.cpp b/engines/scumm/detection.cpp
index cc54aa769f..c57ad166b0 100644
--- a/engines/scumm/detection.cpp
+++ b/engines/scumm/detection.cpp
@@ -200,6 +200,13 @@ static const ExtraGuiOption macV3LowQualityMusic = {
 	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 {
 	ExtraGuiOptions options;
 	// Query the GUI options
@@ -215,8 +222,10 @@ const ExtraGuiOptions ScummMetaEngineDetection::getExtraGuiOptions(const Common:
 	if (target.empty() || platform == Common::kPlatformNES) {
 		options.push_back(mmnesObjectLabelsOption);
 	}
-	if (target.empty() || (platform == Common::kPlatformFMTowns && guiOptions.contains(GUIO_TRIM_FMTOWNS_TO_200_PIXELS))) {
-		options.push_back(fmtownsTrimTo200);
+	if (target.empty() || platform == Common::kPlatformFMTowns) {
+		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,
 	// 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")) {
 		options.push_back(macV3LowQualityMusic);
 	}
+
 	return options;
 }
 
diff --git a/engines/scumm/gfx.cpp b/engines/scumm/gfx.cpp
index aef45c44e6..5d42285550 100644
--- a/engines/scumm/gfx.cpp
+++ b/engines/scumm/gfx.cpp
@@ -4095,7 +4095,7 @@ void ScummEngine::dissolveEffect(int width, int height) {
 void ScummEngine::scrollEffect(int dir) {
 #ifndef DISABLE_TOWNS_DUAL_LAYER_MODE
 	// 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);
 		return;
 	}
diff --git a/engines/scumm/gfx_towns.cpp b/engines/scumm/gfx_towns.cpp
index 2266970d44..5b5e033646 100644
--- a/engines/scumm/gfx_towns.cpp
+++ b/engines/scumm/gfx_towns.cpp
@@ -155,7 +155,7 @@ void ScummEngine::towns_clearStrip(int strip) {
 }
 
 void ScummEngine::requestScroll(int dir) {
-	if (_game.platform == Common::kPlatformFMTowns && !_fastMode) {
+	if (_enableSmoothScrolling && !_fastMode) {
 		int lw = _townsScreen->getLayerWidth(0);
 		// Wait for opposite direction scroll to finish.
 		towns_waitForScroll(-dir);
@@ -197,17 +197,19 @@ void ScummEngine::towns_updateGfx() {
 			dur += _refreshDuration[i];
 		_refreshNeedCatchUp = (dur / ARRAYSIZE(_refreshDuration)) > (1000 / 60);
 	}
-	
-	while (_scrollTimer <= cur) {
-		if (!_scrollTimer)
-			_scrollTimer = cur;
-		_scrollTimer += 1000 / 60;
-		_townsScreen->scrollLayers(1, _scrollRequest);
-		if (_townsScreen->isScrolling(0))
-			_scrollDeltaAdjust++;
-		_scrollRequest = 0;
-		if (!_refreshNeedCatchUp)
-			break;
+
+	if (_enableSmoothScrolling) {
+		while (_scrollTimer <= cur) {
+			if (!_scrollTimer)
+				_scrollTimer = cur;
+			_scrollTimer += 1000 / 60;
+			_townsScreen->scrollLayers(1, _scrollRequest);
+			if (_townsScreen->isScrolling(0))
+				_scrollDeltaAdjust++;
+			_scrollRequest = 0;
+			if (!_refreshNeedCatchUp)
+				break;
+		}
 	}
 
 	_townsScreen->update();
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index b40ab9ef38..97e626a6ac 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -286,6 +286,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 	_scrollRequest = _scrollDeltaAdjust = 0;
 	_scrollDestOffset = _scrollTimer = 0;
 	_refreshNeedCatchUp = false;
+	_enableSmoothScrolling = (_game.platform == Common::kPlatformFMTowns);
 	memset(_refreshDuration, 0, sizeof(_refreshDuration));
 	_refreshArrayPos = 0;
 #ifdef USE_RGB_COLOR
@@ -594,6 +595,12 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
 		_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;
 	uint8 sizeMult = _bytesPerPixel;
 
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 07e6ee5ee6..3a94797583 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -1388,6 +1388,7 @@ protected:
 	int _refreshDuration[20];
 	int _refreshArrayPos;
 	bool _refreshNeedCatchUp;
+	bool _enableSmoothScrolling;
 	uint32 _scrollTimer;
 	uint32 _scrollDestOffset;
 	uint16 _scrollFeedStrips[3];




More information about the Scummvm-git-logs mailing list