diff options
author | Matthew Hoops | 2010-12-07 18:33:58 +0000 |
---|---|---|
committer | Matthew Hoops | 2010-12-07 18:33:58 +0000 |
commit | ce0f0bd0560d713aeddb45c16506cc9d2387c136 (patch) | |
tree | e8651732ca3e19475e6ce199e2faa7e940c15d4c | |
parent | 2f86db50ef835031aa218b906d96761d4e0f8597 (diff) | |
download | scummvm-rg350-ce0f0bd0560d713aeddb45c16506cc9d2387c136.tar.gz scummvm-rg350-ce0f0bd0560d713aeddb45c16506cc9d2387c136.tar.bz2 scummvm-rg350-ce0f0bd0560d713aeddb45c16506cc9d2387c136.zip |
MOHAWK: Allow loading both original and ME saves in any version of Myst
svn-id: r54814
-rw-r--r-- | engines/mohawk/myst.cpp | 16 | ||||
-rw-r--r-- | engines/mohawk/myst_saveload.cpp | 23 | ||||
-rw-r--r-- | engines/mohawk/myst_saveload.h | 2 |
3 files changed, 19 insertions, 22 deletions
diff --git a/engines/mohawk/myst.cpp b/engines/mohawk/myst.cpp index 6026eb3462..1fb83a12df 100644 --- a/engines/mohawk/myst.cpp +++ b/engines/mohawk/myst.cpp @@ -261,14 +261,6 @@ Common::Error MohawkEngine_Myst::run() { _rnd = new Common::RandomSource(); _mouseClicked = false; - // Load Help System (Masterpiece Edition Only) - if (getFeatures() & GF_ME) { - MohawkArchive *mhk = new MohawkArchive(); - if (!mhk->open("help.dat")) - error("Could not load help.dat"); - _mhk.push_back(mhk); - } - // Load game from launcher/command line if requested if (ConfMan.hasKey("save_slot") && canLoadGameStateCurrently()) { uint32 gameToLoad = ConfMan.getInt("save_slot"); @@ -291,6 +283,14 @@ Common::Error MohawkEngine_Myst::run() { changeToCard(1, true); } + // Load Help System (Masterpiece Edition Only) + if (getFeatures() & GF_ME) { + MohawkArchive *mhk = new MohawkArchive(); + if (!mhk->open("help.dat")) + error("Could not load help.dat"); + _mhk.push_back(mhk); + } + // Test Load Function... loadHelp(10000); diff --git a/engines/mohawk/myst_saveload.cpp b/engines/mohawk/myst_saveload.cpp index 04b2be93bc..62b658a7fe 100644 --- a/engines/mohawk/myst_saveload.cpp +++ b/engines/mohawk/myst_saveload.cpp @@ -74,17 +74,14 @@ bool MystSaveLoad::loadGame(const Common::String &filename) { // First, let's make sure we're using a saved game file from this version of Myst // By checking length of file... int32 size = loadFile->size(); - if ((size == -1) - || (size != 664 && (_vm->getFeatures() & GF_ME)) - || (size != 601 && !(_vm->getFeatures() & GF_ME))) { + if (size != 664 && size != 601) { warning("Incompatible saved game version"); - // FIXME: Add Support to load original game saves in ME and vice versa delete loadFile; return false; } Common::Serializer s(loadFile, 0); - syncGameState(s); + syncGameState(s, size == 664); delete loadFile; // Switch us back to the intro stack @@ -124,14 +121,14 @@ bool MystSaveLoad::saveGame(const Common::String &fname) { debugC(kDebugSaveLoad, "Saving game to '%s'", filename.c_str()); Common::Serializer s(0, saveFile); - syncGameState(s); + syncGameState(s, _vm->getFeatures() & GF_ME); saveFile->finalize(); delete saveFile; return true; } -void MystSaveLoad::syncGameState(Common::Serializer &s) { +void MystSaveLoad::syncGameState(Common::Serializer &s, bool isME) { // Globals first s.syncAsUint16LE(_v->globals.u0); s.syncAsUint16LE(_v->globals.currentAge); @@ -143,7 +140,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s) { s.syncAsUint16LE(_v->globals.bluePagesInBook); // Onto Myst - if (_vm->getFeatures() & GF_ME) { + if (isME) { s.syncAsUint32LE(_v->myst.cabinMarkerSwitch); s.syncAsUint32LE(_v->myst.clockTowerMarkerSwitch); s.syncAsUint32LE(_v->myst.dockMarkerSwitch); @@ -206,7 +203,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s) { s.syncAsUint16LE(_v->myst.u9); // Channelwood - if (_vm->getFeatures() & GF_ME) { + if (isME) { s.syncAsUint32LE(_v->channelwood.waterPumpBridgeState); s.syncAsUint32LE(_v->channelwood.elevatorState); s.syncAsUint32LE(_v->channelwood.stairsLowerDoorState); @@ -222,7 +219,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s) { s.syncAsUint16LE(_v->channelwood.holoprojectorSelection); s.syncAsUint16LE(_v->channelwood.stairsUpperDoorState); - if (_vm->getFeatures() & GF_ME) + if (isME) s.skip(4); else s.skip(1); @@ -239,7 +236,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s) { // Selenitic - if (_vm->getFeatures() & GF_ME) { + if (isME) { s.syncAsUint32LE(_v->selenitic.emitterEnabledWater); s.syncAsUint32LE(_v->selenitic.emitterEnabledVolcano); s.syncAsUint32LE(_v->selenitic.emitterEnabledClock); @@ -267,7 +264,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s) { // Stoneship - if (_vm->getFeatures() & GF_ME) { + if (isME) { s.syncAsUint16LE(_v->stoneship.lightState); s.syncAsUint16LE(_v->stoneship.u0); s.syncAsUint16LE(_v->stoneship.u1); @@ -319,7 +316,7 @@ void MystSaveLoad::syncGameState(Common::Serializer &s) { s.skip(38); - if ((_vm->getFeatures() & GF_ME && s.bytesSynced() != 664) || (!(_vm->getFeatures() & GF_ME) && s.bytesSynced() != 601)) + if ((isME && s.bytesSynced() != 664) || (!isME && s.bytesSynced() != 601)) warning("Unexpected File Position 0x%03X At End of Save/Load", s.bytesSynced()); } diff --git a/engines/mohawk/myst_saveload.h b/engines/mohawk/myst_saveload.h index 095ac11b24..fd1317bd0b 100644 --- a/engines/mohawk/myst_saveload.h +++ b/engines/mohawk/myst_saveload.h @@ -296,7 +296,7 @@ public: bool loadGame(const Common::String &); bool saveGame(const Common::String &); void deleteSave(const Common::String &); - void syncGameState(Common::Serializer &s); + void syncGameState(Common::Serializer &s, bool isME); MystVariables *_v; private: |