[Scummvm-git-logs] scummvm master -> 655ea96f168bb1fad071e6120c93299dc7461040

sev- noreply at scummvm.org
Mon Oct 6 16:41:49 UTC 2025


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

Summary:
81aed2f1ea DIRECTOR: LINGO: Add code for catching some D5 Sprite events
5dfdd19a7e DIRECTOR: LINGO: WIP code for D5 mouseEnter/mouseLeave
655ea96f16 DIRECTOR: LINGO: Implement correct behavior for sprite mouse events in D5+


Commit: 81aed2f1ea32243ee5fd76ab9aee3841e52dc314
    https://github.com/scummvm/scummvm/commit/81aed2f1ea32243ee5fd76ab9aee3841e52dc314
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-06T18:41:22+02:00

Commit Message:
DIRECTOR: LINGO: Add code for catching some D5 Sprite events

The documentation does not mention mouseEnter, mouseLeave or mouseWithin,
however they are present in the symbols table.

This will fall with hard error() if we ever encounter a movie with
these handlers.

Changed paths:
    engines/director/lingo/lingo-bytecode.cpp
    engines/director/lingo/lingo-events.cpp


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index f1ae36a75cf..9cd2a20446d 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -1654,6 +1654,15 @@ ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &s
 			functionName = g_lingo->_eventHandlerTypes[kEventGeneric];
 		}
 
+		// We need to find if mouseEnter, mouseLeave or mouseWithin are ever present
+		if (g_director->getVersion() >= 500 && g_director->getVersion() < 600) {
+			if (functionName.equalsIgnoreCase("mouseEnter") ||
+				functionName.equalsIgnoreCase("mouseLeave") ||
+				functionName.equalsIgnoreCase("mouseWithin")) {
+				error("D5 does have mouseEnter, mouseLeave or mouseWithin events, please talk to sev");
+			}
+		}
+
 		Symbol sym;
 		if (!functionName.empty()) {
 			debugC(5, kDebugLoading, "Function %d binding: %s()", i, functionName.c_str());
diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index c53bec4beff..e70d0837a42 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -70,7 +70,7 @@ struct EventHandlerType {
 	{ kEventRightMouseDown,		"rightMouseDown" },		//				D5
 	{ kEventRightMouseUp,		"rightMouseUp" },		//				D5
 	{ kEventMouseEnter,			"mouseEnter" },			//					D6, present in D5
-	{ kEventMouseLeave,			"mouseLeave" },			//					D6
+	{ kEventMouseLeave,			"mouseLeave" },			//					D6, present in D5
 	{ kEventMouseUpOutSide,		"mouseUpOutSide" },		// 					D6
 	{ kEventMouseWithin,		"mouseWithin" },		//					D6, present in D5
 


Commit: 5dfdd19a7ea70ce27fdc2efdb2c69530d893d767
    https://github.com/scummvm/scummvm/commit/5dfdd19a7ea70ce27fdc2efdb2c69530d893d767
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-06T18:41:22+02:00

Commit Message:
DIRECTOR: LINGO: WIP code for D5 mouseEnter/mouseLeave

Changed paths:
    engines/director/events.cpp
    engines/director/lingo/lingo-bytecode.cpp


diff --git a/engines/director/events.cpp b/engines/director/events.cpp
index eb07a5d8af7..713579efd16 100644
--- a/engines/director/events.cpp
+++ b/engines/director/events.cpp
@@ -194,7 +194,13 @@ bool Movie::processEvent(Common::Event &event) {
 
 		// TODO: In the original, these events are generated only
 		// along with the kEventIdle event which depends on the idleHandlerPeriod property
-		if (g_director->getVersion() >= 600) {
+		if (g_director->getVersion() >= 500) {
+
+			// In D5, these events are only generated if a mouse button is pressed
+			if (g_director->getVersion() < 600)
+				if (g_system->getEventManager()->getButtonState() == 0)
+					return true;
+
 			if (spriteId > 0) {
 				if (spriteId != _lastEnteredChannelId) {
 					if (_lastEnteredChannelId) {
@@ -256,6 +262,12 @@ bool Movie::processEvent(Common::Event &event) {
 
 			debugC(3, kDebugEvents, "Movie::processEvent(): Button Down @(%d, %d), movie '%s'", pos.x, pos.y, _macName.c_str());
 			queueInputEvent(ev, 0, pos);
+
+			// D5 has special behavior here
+			if (g_director->getVersion() >= 500 && g_director->getVersion() < 600) {
+				if (_lastClickedSpriteId)
+					queueInputEvent(kEventMouseEnter, _lastClickedSpriteId, pos);
+			}
 		}
 
 		return true;
@@ -284,6 +296,13 @@ bool Movie::processEvent(Common::Event &event) {
 			}
 
 			queueInputEvent(ev, 0, pos);
+
+			// D5 has special behavior here
+			if (g_director->getVersion() >= 500 && g_director->getVersion() < 600) {
+				if (spriteId)
+					queueInputEvent(kEventMouseLeave, spriteId, pos);
+			}
+
 			sc->renderCursor(pos);
 		}
 		return true;
diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 9cd2a20446d..f1ae36a75cf 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -1654,15 +1654,6 @@ ScriptContext *LingoCompiler::compileLingoV4(Common::SeekableReadStreamEndian &s
 			functionName = g_lingo->_eventHandlerTypes[kEventGeneric];
 		}
 
-		// We need to find if mouseEnter, mouseLeave or mouseWithin are ever present
-		if (g_director->getVersion() >= 500 && g_director->getVersion() < 600) {
-			if (functionName.equalsIgnoreCase("mouseEnter") ||
-				functionName.equalsIgnoreCase("mouseLeave") ||
-				functionName.equalsIgnoreCase("mouseWithin")) {
-				error("D5 does have mouseEnter, mouseLeave or mouseWithin events, please talk to sev");
-			}
-		}
-
 		Symbol sym;
 		if (!functionName.empty()) {
 			debugC(5, kDebugLoading, "Function %d binding: %s()", i, functionName.c_str());


Commit: 655ea96f168bb1fad071e6120c93299dc7461040
    https://github.com/scummvm/scummvm/commit/655ea96f168bb1fad071e6120c93299dc7461040
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2025-10-06T18:41:22+02:00

Commit Message:
DIRECTOR: LINGO: Implement correct behavior for sprite mouse events in D5+

Changed paths:
    engines/director/lingo/lingo-events.cpp
    engines/director/score.cpp


diff --git a/engines/director/lingo/lingo-events.cpp b/engines/director/lingo/lingo-events.cpp
index e70d0837a42..65348fa30f8 100644
--- a/engines/director/lingo/lingo-events.cpp
+++ b/engines/director/lingo/lingo-events.cpp
@@ -233,7 +233,8 @@ void Movie::resolveScriptEvent(LingoEvent &event) {
 			bool immediate = false;
 			Common::String initializerParams;
 			// mouseUp events seem to check the frame script ID from the original mouseDown event
-			if ((event.event == kEventMouseUp) || (event.event == kEventRightMouseUp)) {
+			// In Director 5 and above, we always generate event for the actual sprite under the mouse
+			if (((event.event == kEventMouseUp) || (event.event == kEventRightMouseUp)) && _vm->getVersion() < 500) {
 				scriptId = _currentMouseDownSpriteScriptID;
 				immediate = _currentMouseDownSpriteImmediate;
 			} else {
diff --git a/engines/director/score.cpp b/engines/director/score.cpp
index 3e736039bff..e8ee72a0b58 100644
--- a/engines/director/score.cpp
+++ b/engines/director/score.cpp
@@ -359,6 +359,11 @@ void Score::step() {
 			if (_movie->_currentHoveredSpriteId) {
 				_movie->processEvent(kEventMouseWithin, _movie->_currentHoveredSpriteId);
 			}
+		} else 	if (_version >= kFileVer500) {
+			// In D5, these events are only generated if a mouse button is pressed
+			if (_movie->_currentHoveredSpriteId && g_system->getEventManager()->getButtonState() != 0) {
+				_movie->processEvent(kEventMouseWithin, _movie->_currentHoveredSpriteId);
+			}
 		}
 	}
 




More information about the Scummvm-git-logs mailing list