diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/sci/engine/kernel.cpp | 5 | ||||
-rw-r--r-- | engines/sci/engine/kernel.h | 6 | ||||
-rw-r--r-- | engines/sci/engine/kernel32.cpp | 4 | ||||
-rw-r--r-- | engines/sci/sci.cpp | 14 |
4 files changed, 15 insertions, 14 deletions
diff --git a/engines/sci/engine/kernel.cpp b/engines/sci/engine/kernel.cpp index 08aa65aa6d..2315dc384f 100644 --- a/engines/sci/engine/kernel.cpp +++ b/engines/sci/engine/kernel.cpp @@ -394,7 +394,6 @@ SciKernelFunction kfunct_mappers[] = { Kernel::Kernel(ResourceManager *resMan, SegManager *segMan) : _resMan(resMan), _segMan(segMan) { loadSelectorNames(); mapSelectors(); // Map a few special selectors for later use - loadKernelNames(); // must be called after the selectors are set } Kernel::~Kernel() { @@ -748,12 +747,12 @@ void Kernel::setDefaultKernelNames() { } } -void Kernel::loadKernelNames() { +void Kernel::loadKernelNames(GameFeatures *features) { _kernelNames.clear(); #ifdef ENABLE_SCI32 if (getSciVersion() >= SCI_VERSION_2_1) - setKernelNamesSci21(); + setKernelNamesSci21(features); else if (getSciVersion() == SCI_VERSION_2) setKernelNamesSci2(); else diff --git a/engines/sci/engine/kernel.h b/engines/sci/engine/kernel.h index b79ba8caaa..990e2aff17 100644 --- a/engines/sci/engine/kernel.h +++ b/engines/sci/engine/kernel.h @@ -207,7 +207,6 @@ public: */ Common::String lookupText(reg_t address, int index); -private: /** * Loads the kernel function names. * @@ -216,8 +215,9 @@ private: * The resulting list has the same format regardless of the format of the * name table of the resource (the format changed between version 0 and 1). */ - void loadKernelNames(); + void loadKernelNames(GameFeatures *features); +private: /** * Sets the default kernel function names, based on the SCI version used */ @@ -232,7 +232,7 @@ private: /** * Sets the default kernel function names to the SCI2.1 kernel functions */ - void setKernelNamesSci21(); + void setKernelNamesSci21(GameFeatures *features); #endif /** diff --git a/engines/sci/engine/kernel32.cpp b/engines/sci/engine/kernel32.cpp index 0afdc3f2eb..f279d9a66f 100644 --- a/engines/sci/engine/kernel32.cpp +++ b/engines/sci/engine/kernel32.cpp @@ -378,7 +378,7 @@ void Kernel::setKernelNamesSci2() { _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesSci2); } -void Kernel::setKernelNamesSci21() { +void Kernel::setKernelNamesSci21(GameFeatures *features) { // Some SCI games use a modified SCI2 kernel table instead of the SCI2.1/SCI3 kernel table. // The GK2 demo does this as well as at least one version of KQ7. We detect which version // to use based on where kDoSound is called from Sound::play(). @@ -386,7 +386,7 @@ void Kernel::setKernelNamesSci21() { // This is interesting because they all have the same interpreter version (2.100.002), yet // they would not be compatible with other games of the same interpreter. - if (g_sci->_features->detectSci21KernelType() == SCI_VERSION_2) { + if (features->detectSci21KernelType() == SCI_VERSION_2) { _kernelNames = Common::StringArray(sci2_default_knames, kKernelEntriesGk2Demo); // OnMe is IsOnMe here, but they should be compatible _kernelNames[0x23] = "Robot"; // Graph in SCI2 diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index 22c93c1de0..1d0bbadd63 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -141,6 +141,9 @@ Common::Error SciEngine::run() { return Common::kNoGameDataFoundError; } + // Add the after market GM patches for the specified game, if they exist + _resMan->addNewGMPatch(getGameID()); + SegManager *segMan = new SegManager(_resMan); // Scale the screen, if needed @@ -170,6 +173,8 @@ Common::Error SciEngine::run() { else _gfxScreen = new GfxScreen(_resMan, 320, 200, upscaledHires); + _gfxScreen->debugUnditherSetState(ConfMan.getBool("undither")); + if (_resMan->isSci11Mac() && getSciVersion() == SCI_VERSION_1_1) _gfxMacIconBar = new GfxMacIconBar(); @@ -181,10 +186,10 @@ Common::Error SciEngine::run() { _console = new Console(this); _kernel = new Kernel(_resMan, segMan); + _features = new GameFeatures(segMan, _kernel); // Only SCI0 and SCI01 games used a parser _vocabulary = (getSciVersion() <= SCI_VERSION_1_EGA) ? new Vocabulary(_resMan) : NULL; _audio = new AudioPlayer(_resMan); - _features = new GameFeatures(segMan, _kernel); _gamestate = new EngineState(segMan); _eventMan = new EventManager(_resMan); @@ -207,14 +212,13 @@ Common::Error SciEngine::run() { } #endif - // Add the after market GM patches for the specified game, if they exist - _resMan->addNewGMPatch(getGameID()); - if (game_init(_gamestate)) { /* Initialize */ warning("Game initialization failed: Aborting..."); // TODO: Add an "init failed" error? return Common::kUnknownError; } + + _kernel->loadKernelNames(_features); // Must be called after game_init() script_adjust_opcode_formats(_gamestate); @@ -222,8 +226,6 @@ Common::Error SciEngine::run() { _gamestate->_soundCmd = new SoundCommandParser(_resMan, segMan, _kernel, _audio, soundVersion); - _gfxScreen->debugUnditherSetState(ConfMan.getBool("undither")); - #ifdef USE_OLD_MUSIC_FUNCTIONS if (game_init_sound(_gamestate, 0, soundVersion)) { warning("Game initialization failed: Error in sound subsystem. Aborting..."); |