diff options
author | Filippos Karapetis | 2013-03-21 21:05:28 +0200 |
---|---|---|
committer | Filippos Karapetis | 2013-03-21 21:27:14 +0200 |
commit | 045b10efb6fdc7b2910c18f10583d2c8e9e2badf (patch) | |
tree | a0b5bca9d9a73730c4dc95ea35ca825c104d504a /engines/sci/engine | |
parent | 1ef6ee26cc179a0c076f9abf2390a31629ff76e3 (diff) | |
download | scummvm-rg350-045b10efb6fdc7b2910c18f10583d2c8e9e2badf.tar.gz scummvm-rg350-045b10efb6fdc7b2910c18f10583d2c8e9e2badf.tar.bz2 scummvm-rg350-045b10efb6fdc7b2910c18f10583d2c8e9e2badf.zip |
SCI: Fix loading in Jones
This has been broken for a (very) long time, a regression from commit 6ff4dd2
Diffstat (limited to 'engines/sci/engine')
-rw-r--r-- | engines/sci/engine/kfile.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/engines/sci/engine/kfile.cpp b/engines/sci/engine/kfile.cpp index e977f15c0c..09ea35e792 100644 --- a/engines/sci/engine/kfile.cpp +++ b/engines/sci/engine/kfile.cpp @@ -770,7 +770,10 @@ reg_t kSaveGame(EngineState *s, int argc, reg_t *argv) { return NULL_REG; } else if (virtualId < SAVEGAMEID_OFFICIALRANGE_START) { // virtualId is low, we assume that scripts expect us to create new slot - if (virtualId == s->_lastSaveVirtualId) { + if (g_sci->getGameId() == GID_JONES) { + // Jones has one save slot only + savegameId = 0; + } else if (virtualId == s->_lastSaveVirtualId) { // if last virtual id is the same as this one, we assume that caller wants to overwrite last save savegameId = s->_lastSaveNewId; } else { @@ -848,12 +851,17 @@ reg_t kRestoreGame(EngineState *s, int argc, reg_t *argv) { } else { if (argv[2].isNull()) error("kRestoreGame: called with parameter 2 being NULL"); - // Real call from script, we need to adjust ID - if ((savegameId < SAVEGAMEID_OFFICIALRANGE_START) || (savegameId > SAVEGAMEID_OFFICIALRANGE_END)) { - warning("Savegame ID %d is not allowed", savegameId); - return TRUE_REG; + if (g_sci->getGameId() == GID_JONES) { + // Jones has one save slot only + savegameId = 0; + } else { + // Real call from script, we need to adjust ID + if ((savegameId < SAVEGAMEID_OFFICIALRANGE_START) || (savegameId > SAVEGAMEID_OFFICIALRANGE_END)) { + warning("Savegame ID %d is not allowed", savegameId); + return TRUE_REG; + } + savegameId -= SAVEGAMEID_OFFICIALRANGE_START; } - savegameId -= SAVEGAMEID_OFFICIALRANGE_START; } s->r_acc = NULL_REG; // signals success @@ -922,10 +930,16 @@ reg_t kCheckSaveGame(EngineState *s, int argc, reg_t *argv) { if (virtualId == 0) return NULL_REG; - // Find saved-game - if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END)) - error("kCheckSaveGame: called with invalid savegameId"); - uint savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START; + uint savegameId = 0; + if (g_sci->getGameId() == GID_JONES) { + // Jones has one save slot only + } else { + // Find saved game + if ((virtualId < SAVEGAMEID_OFFICIALRANGE_START) || (virtualId > SAVEGAMEID_OFFICIALRANGE_END)) + error("kCheckSaveGame: called with invalid savegame ID (%d)", virtualId); + savegameId = virtualId - SAVEGAMEID_OFFICIALRANGE_START; + } + int savegameNr = findSavegame(saves, savegameId); if (savegameNr == -1) return NULL_REG; |