diff options
-rw-r--r-- | engines/kyra/kyra.cpp | 2 | ||||
-rw-r--r-- | engines/kyra/saveload.cpp | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/engines/kyra/kyra.cpp b/engines/kyra/kyra.cpp index 8c427b354e..84e4a32c7e 100644 --- a/engines/kyra/kyra.cpp +++ b/engines/kyra/kyra.cpp @@ -108,6 +108,8 @@ KyraEngine::KyraEngine(OSystem *system, const GameFlags &flags) _quitFlag = false; _currHeadShape = 0; + _curSfxFile = _curMusicTheme = 0; + // sets up all engine specific debug levels Common::addSpecialDebugLevel(kDebugLevelScriptFuncs, "ScriptFuncs", "Script function debug level"); Common::addSpecialDebugLevel(kDebugLevelScript, "Script", "Script interpreter debug level"); diff --git a/engines/kyra/saveload.cpp b/engines/kyra/saveload.cpp index c0482d1da0..8f095237ab 100644 --- a/engines/kyra/saveload.cpp +++ b/engines/kyra/saveload.cpp @@ -206,6 +206,14 @@ void KyraEngine::loadGame(const char *fileName) { if (version >= 7) { _curSfxFile = in->readByte(); + + + // In the first version there this entry was introduced, + // it wasn't made sure that _curSfxFile was initialized + // so if it's out of bounds we just set it to 0. + if (_curSfxFile >= _soundFilesTownsCount || _curSfxFile < 0) + _curSfxFile = 0; + if (_flags.platform == Common::kPlatformFMTowns) _sound->loadSoundFile(_curSfxFile); } |