diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp index cb4b3790e8a..011ef888480 100644 --- a/engines/adl/adl_v5.cpp +++ b/engines/adl/adl_v5.cpp @@ -88,9 +88,9 @@ void AdlEngine_v5::setupOpcodeTables() { Opcode(o4_moveAllItems); Opcode(o1_quit); Opcode(o5_dummy); - Opcode(o2_save); + Opcode(o4_save); // 0x10 - Opcode(o2_restore); + Opcode(o4_restore); Opcode(o1_restart); Opcode(o5_setRegionRoom); Opcode(o5_dummy); diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp index 91ab16313b7..01de0615848 100644 --- a/engines/adl/hires6.cpp +++ b/engines/adl/hires6.cpp @@ -50,6 +50,8 @@ private: void showRoom(); Common::String formatVerbError(const Common::String &verb) const; Common::String formatNounError(const Common::String &verb, const Common::String &noun) const; + void loadState(Common::ReadStream &stream); + void saveState(Common::WriteStream &stream); // AdlEngine_v2 void printString(const Common::String &str); @@ -146,12 +148,9 @@ void HiRes6Engine::init() { _strings.lineFeeds = readStringAt(*stream, 0x408); - // Read opcode strings (TODO) _strings_v2.saveInsert = readStringAt(*stream, 0xad8); - readStringAt(*stream, 0xb95); // Confirm save - // _strings_v2.saveReplace + _strings_v2.saveReplace = readStringAt(*stream, 0xb95); _strings_v2.restoreInsert = readStringAt(*stream, 0xc07); - // _strings_v2.restoreReplace _strings.playAgain = readStringAt(*stream, 0xcdf, 0xff); _messageIds.cantGoThere = 249; @@ -275,6 +274,20 @@ Common::String HiRes6Engine::formatNounError(const Common::String &verb, const C return err; } +void HiRes6Engine::loadState(Common::ReadStream &stream) { + AdlEngine_v5::loadState(stream); + _state.moves = (getVar(39) << 8) | getVar(24); + setVar(39, 0); +} + +void HiRes6Engine::saveState(Common::WriteStream &stream) { + // Move counter is stuffed into variables, in order to save it + setVar(24, _state.moves & 0xff); + setVar(39, _state.moves >> 8); + AdlEngine_v5::saveState(stream); + setVar(39, 0); +} + void HiRes6Engine::printString(const Common::String &str) { Common::String s; uint found = 0;