aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2007-02-03 21:14:35 +0000
committerJohannes Schickel2007-02-03 21:14:35 +0000
commitc3f84d67b283a557b3d5b654d5b583e1e211f63f (patch)
treedaebdafd952f97e57fd8830dbd95c7a54815b999
parenta2976a350fc7346148838125d751f902f66b8ca1 (diff)
downloadscummvm-rg350-c3f84d67b283a557b3d5b654d5b583e1e211f63f.tar.gz
scummvm-rg350-c3f84d67b283a557b3d5b654d5b583e1e211f63f.tar.bz2
scummvm-rg350-c3f84d67b283a557b3d5b654d5b583e1e211f63f.zip
Workaround bad values for _curSfxFile in old savegames.
svn-id: r25359
-rw-r--r--engines/kyra/kyra.cpp2
-rw-r--r--engines/kyra/saveload.cpp8
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);
}