From 27f2307b8a00f44ebfa98f13fc6508435c2ca27b Mon Sep 17 00:00:00 2001 From: Donovan Watteau Date: Mon, 15 Aug 2022 18:21:11 +0200 Subject: [PATCH] SCUMM: Work around a small glitch with Largo's door in Monkey2 If one closes the door just before using the pins with the voodoo doll in front of Largo, the middle of the door will glitch when Largo opens it again to escape from his room. It looks like script 13-200 forgot to clean the part of the door which deals with the (invisible) laundry claim ticket, in this case. But script 13-213 triggers the same action without any problem, since this one properly updates the class and state of this object; so let's just reuse its `setState(111,2)` and `setClass(111,[160])` calls. --- engines/scumm/script_v5.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/engines/scumm/script_v5.cpp b/engines/scumm/script_v5.cpp index 5ac7d5026e0..de45bd0a8a3 100644 --- a/engines/scumm/script_v5.cpp +++ b/engines/scumm/script_v5.cpp @@ -2450,8 +2450,21 @@ void ScummEngine_v5::o5_setOwnerOf() { void ScummEngine_v5::o5_setState() { int obj, state; + obj = getVarOrDirectWord(PARAM_1); state = getVarOrDirectByte(PARAM_2); + + // WORKAROUND: The door will glitch if one closes it before using the voodoo + // doll on Largo. Script 13-213 triggers the same action without any glitch, + // though, since it properly resets the state of the (invisible) laundry claim + // ticket part of the door, so we just reuse its setState and setClass calls. + if (_game.id == GID_MONKEY2 && _currentRoom == 13 && vm.slot[_currentScript].number == 200 && + obj == 108 && state == 1 && getState(100) != 1 && getState(111) != 2 && _enableEnhancements) { + putState(111, 2); + markObjectRectAsDirty(111); + putClass(111, 160, true); + } + putState(obj, state); markObjectRectAsDirty(obj); if (_bgNeedsRedraw)