[Scummvm-git-logs] scummvm master -> c4476262022b077a69adc4dcd7fac4d9b7bd22b6

bluegr noreply at scummvm.org
Fri Apr 21 05:59:09 UTC 2023


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:
c447626202 DRASCULA: Track left mousebutton press


Commit: c4476262022b077a69adc4dcd7fac4d9b7bd22b6
    https://github.com/scummvm/scummvm/commit/c4476262022b077a69adc4dcd7fac4d9b7bd22b6
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-04-21T08:59:03+03:00

Commit Message:
DRASCULA: Track left mousebutton press

Tracks the status of LMB and avoids calling the delay
while the button is pressed. This prevents the generalized
"slowdown".

Fixes TRAC #3799

Changed paths:
    engines/drascula/drascula.cpp
    engines/drascula/drascula.h


diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp
index c02c3d587da..9d24c332274 100644
--- a/engines/drascula/drascula.cpp
+++ b/engines/drascula/drascula.cpp
@@ -402,6 +402,7 @@ bool DrasculaEngine::runCurrentChapter() {
 	int framesWithoutAction = 0;
 
 	_rightMouseButton = 0;
+	_leftMouseButtonHeld = false;
 
 	previousMusic = -1;
 
@@ -629,15 +630,21 @@ bool DrasculaEngine::runCurrentChapter() {
 			selectVerb(kVerbNone);
 		}
 
+		if (_leftMouseButton == 0)
+			_leftMouseButtonHeld = false;
+
 		if (_leftMouseButton == 1 && _menuBar) {
 			selectVerbFromBar();
-		} else if (_leftMouseButton == 1 && takeObject == 0) {
+		} else if (_leftMouseButton == 1 && takeObject == 0 && !_leftMouseButtonHeld) {
 			if (verify1())
 				return true;
-			delay(100);
-		} else if (_leftMouseButton == 1 && takeObject == 1) {
+			delay(50);
+			_leftMouseButtonHeld = true;
+		} else if (_leftMouseButton == 1 && takeObject == 1 && !_leftMouseButtonHeld) {
 			if (verify2())
 				return true;
+			delay(50);
+			_leftMouseButtonHeld = true;
 		}
 
 		_menuBar = (_mouseY < 24 && !_menuScreen) ? true : false;
diff --git a/engines/drascula/drascula.h b/engines/drascula/drascula.h
index 1fa63685661..8aa41f56db9 100644
--- a/engines/drascula/drascula.h
+++ b/engines/drascula/drascula.h
@@ -464,6 +464,7 @@ public:
 	int _color;
 	int musicStopped;
 	int _mouseX, _mouseY, _leftMouseButton, _rightMouseButton;
+	bool _leftMouseButtonHeld;
 
 	Common::KeyState _keyBuffer[KEYBUFSIZE];
 	int _keyBufferHead;




More information about the Scummvm-git-logs mailing list