aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2013-01-23 03:16:31 +0200
committerFilippos Karapetis2013-01-23 03:17:10 +0200
commit0968acccfd36e4871fbd781815ce89c65f49aead (patch)
tree0ec9eb94762661128273dfae46d91abed14927c7
parentb1ff5ba24735271ab97b9430d3dd848987a74d7d (diff)
downloadscummvm-rg350-0968acccfd36e4871fbd781815ce89c65f49aead.tar.gz
scummvm-rg350-0968acccfd36e4871fbd781815ce89c65f49aead.tar.bz2
scummvm-rg350-0968acccfd36e4871fbd781815ce89c65f49aead.zip
SCI: Fix script bug #3601090 - "SCI: Pepper's Adventures in Time: Game becomes unsolvable"
Many thanks to lskovlun for debugging this problem and finding the offending script code that caused it.
-rw-r--r--engines/sci/engine/kstring.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index cdc50ca440..3838c68502 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -519,6 +519,30 @@ reg_t kMessage(EngineState *s, int argc, reg_t *argv) {
if (argc >= 6)
tuple = MessageTuple(argv[2].toUint16(), argv[3].toUint16(), argv[4].toUint16(), argv[5].toUint16());
+ // WORKAROUND for a script bug in Pepper. When using objects together,
+ // there is code inside script 894 that shows appropriate messages.
+ // In the case of the jar of cabbage (noun 26), the relevant message
+ // shown when using any object with it is missing. This leads to the
+ // script code being triggered, which modifies the jar's noun and
+ // message selectors, and renders it useless. Thus, when using any
+ // object with the jar of cabbage, it's effectively corrupted, and
+ // can't be used on the goat to empty it, therefore the game reaches
+ // an unsolvable state. It's almost impossible to patch the offending
+ // script, as it is used in many cases. But we can prevent the
+ // corruption of the jar here: if the message is found, the offending
+ // code is never reached and the jar is never corrupted. To do this,
+ // we substitute all verbs on the cabbage jar with the default verb,
+ // which shows the "Cannot use this object with the jar" message, and
+ // never triggers the offending script code that corrupts the object.
+ // This only affects the jar of cabbage - any other object, including
+ // the empty jar has a different noun, thus it's unaffected.
+ // Fixes bug #3601090.
+ // NOTE: To fix a corrupted jar object, type "send Glass_Jar message 52"
+ // in the debugger.
+ if (g_sci->getGameId() == GID_PEPPER && func == 0 && argc >= 6 && module == 894 &&
+ tuple.noun == 26 && tuple.cond == 0 && tuple.seq == 1)
+ tuple.verb = 0;
+
switch (func) {
case K_MESSAGE_GET:
return make_reg(0, s->_msgState->getMessage(module, tuple, (argc == 7 ? argv[6] : NULL_REG)));