aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/sci.cpp
diff options
context:
space:
mode:
authorFilippos Karapetis2010-06-09 18:42:21 +0000
committerFilippos Karapetis2010-06-09 18:42:21 +0000
commitc486b77bb7d96908d7df1e00b6a61b92fbd176ee (patch)
treecb06f541fad894588a9d27ef8329792f5299f7fb /engines/sci/sci.cpp
parentd191c9d0f935d280d7c1a7e71e3e13bbb76ee893 (diff)
downloadscummvm-rg350-c486b77bb7d96908d7df1e00b6a61b92fbd176ee.tar.gz
scummvm-rg350-c486b77bb7d96908d7df1e00b6a61b92fbd176ee.tar.bz2
scummvm-rg350-c486b77bb7d96908d7df1e00b6a61b92fbd176ee.zip
Fixed crash in SCI2.1 games
svn-id: r49546
Diffstat (limited to 'engines/sci/sci.cpp')
-rw-r--r--engines/sci/sci.cpp14
1 files changed, 8 insertions, 6 deletions
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...");