[Scummvm-git-logs] scummvm branch-2-6 -> 7e6c614bda0b55ad52fdfc9a8765745afb6d2fdd

eriktorbjorn noreply at scummvm.org
Mon Jun 6 10:39:16 UTC 2022


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:
7e6c614bda SCUMM: Fix mouse position after load for all rendering modes


Commit: 7e6c614bda0b55ad52fdfc9a8765745afb6d2fdd
    https://github.com/scummvm/scummvm/commit/7e6c614bda0b55ad52fdfc9a8765745afb6d2fdd
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2022-06-06T12:16:40+02:00

Commit Message:
SCUMM: Fix mouse position after load for all rendering modes

Since the saved mouse position uses game coordinates, any rendering mode
that causes the graphics to be rescaled will have to convert them to
screen coordinates before warping the mouse there. (The rendering mode
scalers are separate from the backend scalers.)

Changed paths:
    engines/scumm/saveload.cpp


diff --git a/engines/scumm/saveload.cpp b/engines/scumm/saveload.cpp
index 903af8499b8..df1ea1beb0d 100644
--- a/engines/scumm/saveload.cpp
+++ b/engines/scumm/saveload.cpp
@@ -1177,8 +1177,23 @@ void ScummEngine::saveLoadWithSerializer(Common::Serializer &s) {
 
 	// When loading, move the mouse to the saved mouse position.
 	if (s.isLoading() && s.getVersion() >= VER(20)) {
+		int x = _mouse.x;
+		int y = _mouse.y;
+
+		// Convert the mouse position, which uses game coordinates, to
+		// screen coordinates for the rendering modes that need it.
+
+		if (_renderMode == Common::kRenderHercA || _renderMode == Common::kRenderHercG) {
+			x *= 2;
+			x += (kHercWidth - _screenWidth * 2) / 2;
+			y = y * 7 / 4;
+		} else if (_macScreen || (_useCJKMode && _textSurfaceMultiplier == 2)) {
+			x *= 2;
+			y *= 2;
+		}
+
 		updateCursor();
-		_system->warpMouse(_mouse.x, _mouse.y);
+		_system->warpMouse(x, y);
 	}
 
 	// Before V61, we re-used the _haveMsg flag to handle "alternative" speech




More information about the Scummvm-git-logs mailing list