From ca705b9167e9462b259614a0874ac2db1a3cee44 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Wed, 25 Jan 2006 15:06:42 +0000 Subject: Extend the workaround for bug #1407789 in an attempt to deal with the different versions of Full Throttle. This is partly guesswork, and may be incorrect. svn-id: r20161 --- scumm/script.cpp | 10 +++++----- scumm/scumm.cpp | 26 ++++++++++++++++++++++++++ scumm/scumm.h | 3 +++ 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/scumm/script.cpp b/scumm/script.cpp index 62cd689980..5750f2d500 100644 --- a/scumm/script.cpp +++ b/scumm/script.cpp @@ -1082,12 +1082,12 @@ void ScummEngine::checkAndRunSentenceScript() { localParamList[1] = _sentence[_sentenceNum].objectA; localParamList[2] = _sentence[_sentenceNum].objectB; - // WORKAROUND for bug #1407789. The script clearly assumes that - // one of the two objects is an actor. If that's not the case, - // fall back on what appears to be the usual sentence script. + // WORKAROUND for bug #1407789. The buggy script clearly + // assumes that one of the two objects is an actor. If that's + // not the case, fall back on the default sentence script. - if (_gameId == GID_FT && sentenceScript == 103 && !isValidActor(localParamList[1]) && !isValidActor(localParamList[2])) { - sentenceScript = 28; + if (_gameId == GID_FT && sentenceScript == _buggyFTSentenceScript && !isValidActor(localParamList[1]) && !isValidActor(localParamList[2])) { + sentenceScript = _defaultFTSentenceScript; } } _currentScript = 0xFF; diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index 704266e45f..6783f4062b 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -962,6 +962,32 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS if (!elem) printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); + if (_gameId == GID_FT) { + // WORKAROUND for bug #1407789. See checkAndRunSentenceScript() + // for the actual workaround. + + // FIXME: We do not yet have all necessary information, but the + // following is known: + // + // * The US PC version uses scripts 28 and 103. + // * The French PC version uses scripts 29 and 104. + // * The German, Italian, Portuguese and Spanish PC versions + // use script 29. The other script is not currently known. + // * The US Mac demo uses script 28. + // + // For now, assume that the PC and Mac versions are the same, + // that all localized versions use scripts 29 and 104, and that + // any completely unknown version is localized. + + if (elem && elem->language == Common::EN_USA) { + _defaultFTSentenceScript = 28; + _buggyFTSentenceScript = 103; + } else { + _defaultFTSentenceScript = 29; + _buggyFTSentenceScript = 104; + } + } + // Add default file directories. if (((_platform == Common::kPlatformAmiga) || (_platform == Common::kPlatformAtariST)) && (_version <= 4)) { // This is for the Amiga version of Indy3/Loom/Maniac/Zak diff --git a/scumm/scumm.h b/scumm/scumm.h index d8fec6cfdf..157068628a 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -618,6 +618,9 @@ protected: int _vmStack[150]; int _keyScriptKey, _keyScriptNo; + // See the ScummEngine constructor and checkAndRunSentenceScript() + int _defaultFTSentenceScript, _buggyFTSentenceScript; + virtual void setupOpcodes() = 0; virtual void executeOpcode(byte i) = 0; virtual const char *getOpcodeDesc(byte i) = 0; -- cgit v1.2.3