diff options
author | Colin Snover | 2017-05-23 22:36:16 -0500 |
---|---|---|
committer | Colin Snover | 2017-05-23 22:41:56 -0500 |
commit | fdb87619c61c579cc2bb3162ae77b06e13d9cf91 (patch) | |
tree | 5d5da7066144499f19dbd43542efc730ba803ec9 /engines/sci | |
parent | 31c2aa8d246d7b5792007422f8cc17d97e78371b (diff) | |
download | scummvm-rg350-fdb87619c61c579cc2bb3162ae77b06e13d9cf91.tar.gz scummvm-rg350-fdb87619c61c579cc2bb3162ae77b06e13d9cf91.tar.bz2 scummvm-rg350-fdb87619c61c579cc2bb3162ae77b06e13d9cf91.zip |
SCI32: Fix selector search for SCI2/2.1 games with missing vocab.997
Fixes Trac#9796.
Diffstat (limited to 'engines/sci')
-rw-r--r-- | engines/sci/engine/static_selectors.cpp | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/engines/sci/engine/static_selectors.cpp b/engines/sci/engine/static_selectors.cpp index 8aa1697f07..08c6f5d75a 100644 --- a/engines/sci/engine/static_selectors.cpp +++ b/engines/sci/engine/static_selectors.cpp @@ -151,6 +151,13 @@ static const ClassReference classReferences[] = { { 999, "Script", "init", kSelectorMethod, 0 }, { 999, "Script", "dispose", kSelectorMethod, 2 }, { 999, "Script", "changeState", kSelectorMethod, 3 } +#ifdef ENABLE_SCI32 + , + { 64929, "Sync", "syncTime", kSelectorVariable, 2 }, + { 64929, "Sync", "syncCue", kSelectorVariable, 3 }, + { 64999, "Obj", "init", kSelectorMethod, 1 }, + { 64999, "Obj", "doit", kSelectorMethod, 2 } +#endif }; Common::StringArray Kernel::checkStaticSelectorNames() { @@ -222,27 +229,35 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) { // We need to initialize script 0 here, to make sure that it's always // located at segment 1. _segMan->instantiateScript(0); - uint16 sci2Offset = (getSciVersion() >= SCI_VERSION_2) ? 64000 : 0; // The Actor class contains the init, xLast and yLast selectors, which // we reference directly. It's always in script 998, so we need to // explicitly load it here. - if ((getSciVersion() >= SCI_VERSION_1_EGA_ONLY)) { + if (getSciVersion() >= SCI_VERSION_1_EGA_ONLY) { uint16 actorScript = 998; +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2) { + actorScript += 64000; + } +#endif - if (_resMan->testResource(ResourceId(kResourceTypeScript, actorScript + sci2Offset))) { - _segMan->instantiateScript(actorScript + sci2Offset); + if (_resMan->testResource(ResourceId(kResourceTypeScript, actorScript))) { + _segMan->instantiateScript(actorScript); const Object *actorClass = _segMan->getObject(_segMan->findObjectByName("Actor")); if (actorClass) { // Find the xLast and yLast selectors, used in kDoBresen - const int offset = (getSciVersion() < SCI_VERSION_1_1) ? 3 : 0; - const int offset2 = (getSciVersion() >= SCI_VERSION_2) ? 12 : 0; + int offset = (getSciVersion() < SCI_VERSION_1_1) ? 3 : 0; +#ifdef ENABLE_SCI32 + if (getSciVersion() >= SCI_VERSION_2) { + offset += 12; + } +#endif // xLast and yLast always come between illegalBits and xStep - int illegalBitsSelectorPos = actorClass->locateVarSelector(_segMan, 15 + offset + offset2); // illegalBits - int xStepSelectorPos = actorClass->locateVarSelector(_segMan, 51 + offset + offset2); // xStep + int illegalBitsSelectorPos = actorClass->locateVarSelector(_segMan, 15 + offset); // illegalBits + int xStepSelectorPos = actorClass->locateVarSelector(_segMan, 51 + offset); // xStep if (xStepSelectorPos - illegalBitsSelectorPos != 3) { error("illegalBits and xStep selectors aren't found in " "known locations. illegalBits = %d, xStep = %d", @@ -257,19 +272,19 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) { selectorNames[xLastSelectorPos] = "xLast"; selectorNames[yLastSelectorPos] = "yLast"; - } // if (actorClass) + } - _segMan->uninstantiateScript(998); - } // if (_resMan->testResource(ResourceId(kResourceTypeScript, 998))) - } // if ((getSciVersion() >= SCI_VERSION_1_EGA_ONLY)) + _segMan->uninstantiateScript(actorScript); + } + } // Find selectors from specific classes for (int i = 0; i < ARRAYSIZE(classReferences); i++) { - if (!_resMan->testResource(ResourceId(kResourceTypeScript, classReferences[i].script + sci2Offset))) + if (!_resMan->testResource(ResourceId(kResourceTypeScript, classReferences[i].script))) continue; - _segMan->instantiateScript(classReferences[i].script + sci2Offset); + _segMan->instantiateScript(classReferences[i].script); const Object *targetClass = _segMan->getObject(_segMan->findObjectByName(classReferences[i].className)); int targetSelectorPos = 0; @@ -303,7 +318,6 @@ void Kernel::findSpecificSelectors(Common::StringArray &selectorNames) { } } - // Reset the segment manager _segMan->resetSegMan(); } |