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

alexbevi noreply at scummvm.org
Sat Aug 22 17:31:29 UTC 2026


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

Summary:
ec424f1bb0 ASYLUM: Restore the cursor after encounters


Commit: ec424f1bb0e38d68249dbb719be94e5d1e3d1846
    https://github.com/scummvm/scummvm/commit/ec424f1bb0e38d68249dbb719be94e5d1e3d1846
Author: Alex Bevilacqua (alex at alexbevi.com)
Date: 2026-08-22T13:30:58-04:00

Commit Message:
ASYLUM: Restore the cursor after encounters

ActivateEncounterDialog at 0x00412940 restores gameplay handling but does not select a cursor. UpdateGameState at 0x0040B5B0 then calls SelectGameplayCursorResource at 0x0040D580. SanitariumWindowProc at 0x004367C0 updates the mouse-button bitmask before dispatching button messages.

Refresh the scene's right-button latch from Common::EventManager and clear ScummVM's arrow-key movement state when the scene loses input focus. HandleGameplayKeyboardMessage at 0x0040FE20 has no retail arrow-key movement state. Use animation mode 0 for fallback cursors, preserve the Chapter 2 player-10 exception, and match Find/Grab/Talk priority.

Fixes bug #17044

Assisted-by: Codex:gpt-5.6-sol

Changed paths:
    engines/asylum/views/scene.cpp


diff --git a/engines/asylum/views/scene.cpp b/engines/asylum/views/scene.cpp
index 820d8172aa3..89b8776f5c7 100644
--- a/engines/asylum/views/scene.cpp
+++ b/engines/asylum/views/scene.cpp
@@ -316,6 +316,15 @@ bool Scene::handleEvent(const AsylumEvent &evt) {
 	case EVENT_ASYLUM_INIT:
 		return init();
 
+	case EVENT_ASYLUM_DEINIT:
+		// Keyboard movement is a ScummVM extension. Reset it when the scene
+		// loses input focus so another handler cannot swallow the key release.
+		if (_keyState) {
+			_keyState = 0;
+			activate();
+		}
+		break;
+
 	case EVENT_ASYLUM_ACTIVATE:
 		activate();
 		break;
@@ -769,6 +778,10 @@ bool Scene::updateScene() {
 void Scene::updateMouse() {
 	Actor *player = getActor();
 	Common::Point mouse = getCursor()->position();
+	bool rightButtonDown = (_vm->getEventManager()->getButtonState() & Common::EventManager::RBUTTON) != 0;
+
+	if (_rightButtonDown != rightButtonDown)
+		_rightButtonDown = rightButtonDown;
 
 	Common::Point pt;
 	player->adjustCoordinates(&pt);
@@ -1321,10 +1334,10 @@ void Scene::updateCursor(ActorDirection direction, const Common::Rect &rect) {
 	if (index == -1) {
 		if (_ws->chapter != kChapter2 || getSharedData()->getPlayerIndex() != 10) {
 			if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->getAnimation())
-				getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
+				getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass], 0, kCursorAnimationNone);
 		} else {
 			if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->getAnimation())
-				getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2]);
+				getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2], 0, kCursorAnimationNone);
 		}
 
 		return;
@@ -1352,21 +1365,29 @@ void Scene::updateCursor(ActorDirection direction, const Common::Rect &rect) {
 	if (actionType & kActionTypeFind) {
 		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->getAnimation() != kCursorAnimationMirror)
 			getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
-	} else if (actionType & kActionTypeTalk) {
-		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceTalkNPC])
-			getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC]);
 	} else if (actionType & kActionTypeGrab) {
 		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceHand])
 			getCursor()->set(_ws->cursorResources[kCursorResourceHand]);
+	} else if (actionType & kActionTypeTalk) {
+		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceTalkNPC])
+			getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC]);
 	} else if (actionType & kActionType16) {
 		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->getAnimation() != kCursorAnimationMirror)
 			getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2]);
-	} else if (_ws->chapter != kChapter2 && getSharedData()->getPlayerIndex() != 10) {
-		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceMagnifyingGlass] || getCursor()->getAnimation())
-			getCursor()->set(_ws->cursorResources[kCursorResourceMagnifyingGlass]);
 	} else {
-		if (getCursor()->getResourceId() != _ws->cursorResources[kCursorResourceTalkNPC2] || getCursor()->getAnimation())
-			getCursor()->set(_ws->cursorResources[kCursorResourceTalkNPC2]);
+		// SelectGameplayCursorResource (sntrm.exe 0x0040D580) reserves the
+		// alternate cursor for Chapter 2's special player only.
+		bool useAlternateCursor = _ws->chapter == kChapter2 && getSharedData()->getPlayerIndex() == 10;
+		CursorResourceType cursorType = useAlternateCursor ? kCursorResourceTalkNPC2 : kCursorResourceMagnifyingGlass;
+		ResourceId resourceId = _ws->cursorResources[cursorType];
+
+		if (getCursor()->getResourceId() != resourceId || getCursor()->getAnimation()) {
+			debugC(3, kDebugLevelScene,
+					"[Scene::updateCursor] Fallback cursor: hit type %d, index %d, action 0x%X, "
+					"chapter %d, player %d, resource 0x%08X",
+					type, index, actionType, _ws->chapter, getSharedData()->getPlayerIndex(), (uint32)resourceId);
+			getCursor()->set(resourceId, 0, kCursorAnimationNone);
+		}
 	}
 }
 




More information about the Scummvm-git-logs mailing list