aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2004-11-15 03:57:22 +0000
committerEugene Sandulenko2004-11-15 03:57:22 +0000
commitdf4d3fe47a2b76ba165e0821679b3c5d823fd91b (patch)
tree467175b052bb78f79ff655aa938c6a8ebcd1422a
parent4295a17c2323d025aad8ccd7084a8c3bdedfcaa6 (diff)
downloadscummvm-rg350-df4d3fe47a2b76ba165e0821679b3c5d823fd91b.tar.gz
scummvm-rg350-df4d3fe47a2b76ba165e0821679b3c5d823fd91b.tar.bz2
scummvm-rg350-df4d3fe47a2b76ba165e0821679b3c5d823fd91b.zip
Move most heavy initialization from engine constructor to mainInit()
method which is called from go(). This ensures that extrapath is added to list od default directories after all other paths. svn-id: r15815
-rw-r--r--scumm/scumm.cpp99
-rw-r--r--scumm/scumm.h1
2 files changed, 52 insertions, 48 deletions
diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp
index e880b47a0f..f8abc97773 100644
--- a/scumm/scumm.cpp
+++ b/scumm/scumm.cpp
@@ -896,54 +896,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_screenHeight = 200;
}
- // Initialize backend
- _system->initSize(_screenWidth, _screenHeight);
- int cd_num = ConfMan.getInt("cdrom");
- if (cd_num >= 0 && (_features & GF_AUDIOTRACKS))
- _system->openCD(cd_num);
-
- // Create the sound manager
- _sound = new Sound(this);
-
- // Setup the music engine
- setupMusic(gs.midi);
-
- // TODO: We shouldn't rely on the global Language values matching those COMI etc. expect.
- // Rather we should explicitly translate them.
- _language = Common::parseLanguage(ConfMan.get("language"));
-
- // Load localization data, if present
- loadLanguageBundle();
-
- // Load CJK font, if present
- loadCJKFont();
-
- // Create the charset renderer
- if (_version <= 2)
- _charset = new CharsetRendererV2(this, _language);
- else if (_version == 3)
- _charset = new CharsetRendererV3(this);
- else if (_version == 8)
- _charset = new CharsetRendererNut(this);
- else
- _charset = new CharsetRendererClassic(this);
-
- // Create the costume renderer
- if (_features & GF_NEW_COSTUMES)
- _costumeRenderer = new AkosRenderer(this);
- else
- _costumeRenderer = new CostumeRenderer(this);
-
- // Create FT INSANE object
- if (_gameId == GID_FT)
- _insane = new Insane((ScummEngine_v6 *)this);
- else
- _insane = 0;
-
- // Load game from specified slot, if any
- if (ConfMan.hasKey("save_slot")) {
- requestLoad(ConfMan.getInt("save_slot"));
- }
+ _midi = gs.midi;
}
ScummEngine::~ScummEngine() {
@@ -1030,6 +983,56 @@ void ScummEngine::go() {
void ScummEngine::mainInit() {
+ // Initialize backend
+ _system->initSize(_screenWidth, _screenHeight);
+
+ int cd_num = ConfMan.getInt("cdrom");
+ if (cd_num >= 0 && (_features & GF_AUDIOTRACKS))
+ _system->openCD(cd_num);
+
+ // Create the sound manager
+ _sound = new Sound(this);
+
+ // Setup the music engine
+ setupMusic(_midi);
+
+ // TODO: We shouldn't rely on the global Language values matching those COMI etc. expect.
+ // Rather we should explicitly translate them.
+ _language = Common::parseLanguage(ConfMan.get("language"));
+
+ // Load localization data, if present
+ loadLanguageBundle();
+
+ // Load CJK font, if present
+ loadCJKFont();
+
+ // Create the charset renderer
+ if (_version <= 2)
+ _charset = new CharsetRendererV2(this, _language);
+ else if (_version == 3)
+ _charset = new CharsetRendererV3(this);
+ else if (_version == 8)
+ _charset = new CharsetRendererNut(this);
+ else
+ _charset = new CharsetRendererClassic(this);
+
+ // Create the costume renderer
+ if (_features & GF_NEW_COSTUMES)
+ _costumeRenderer = new AkosRenderer(this);
+ else
+ _costumeRenderer = new CostumeRenderer(this);
+
+ // Create FT INSANE object
+ if (_gameId == GID_FT)
+ _insane = new Insane((ScummEngine_v6 *)this);
+ else
+ _insane = 0;
+
+ // Load game from specified slot, if any
+ if (ConfMan.hasKey("save_slot")) {
+ requestLoad(ConfMan.getInt("save_slot"));
+ }
+
#ifdef __PALM_OS__
if (_features & GF_NEW_COSTUMES)
_maxHeapThreshold = gVars->memory[kMemScummNewCostGames];
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 61029f4689..4363a996f5 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -1089,6 +1089,7 @@ protected:
int _tempMusic;
int _saveSound;
bool _native_mt32;
+ int _midi;
int _midiDriver; // Use the MD_ values from mididrv.h
bool _copyProtection;
bool _demoMode;