aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/sci/engine/kscripts.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/engines/sci/engine/kscripts.cpp b/engines/sci/engine/kscripts.cpp
index de8710bd83..ed2ce6ed9e 100644
--- a/engines/sci/engine/kscripts.cpp
+++ b/engines/sci/engine/kscripts.cpp
@@ -80,6 +80,14 @@ reg_t kUnLoad(EngineState *s, int argc, reg_t *argv) {
ResourceType restype = (ResourceType)(argv[0].toUint16() & 0x7f);
reg_t resnr = argv[1];
+ // WORKAROUND for a broken script in room 320 in Castle of Dr. Brain.
+ // Script 377 tries to free the hunk memory allocated for the saved area
+ // (underbits) beneath the pop up window, which results in having the
+ // window stay on screen even when it's closed. Ignore this request here.
+ if (restype == kResourceTypeMemory && g_sci->getGameId() == GID_CASTLEBRAIN &&
+ s->currentRoomNumber() == 320)
+ return s->r_acc;
+
if (restype == kResourceTypeMemory)
s->_segMan->freeHunkEntry(resnr);