[Scummvm-git-logs] scummvm master -> 549ac7ca4712c7e4dfe9fc8ca1fa6b2084e451ba

waltervn walter at vanniftrik-it.nl
Sat Feb 18 11:51:20 CET 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9ed63332fa ADL: Fix restoring of global vars in v4+
549ac7ca47 ADL: Implement hires6 save/restore


Commit: 9ed63332faca6eef549d7f9b7ed11f6d4c22af28
    https://github.com/scummvm/scummvm/commit/9ed63332faca6eef549d7f9b7ed11f6d4c22af28
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-18T11:46:12+01:00

Commit Message:
ADL: Fix restoring of global vars in v4+

Changed paths:
    engines/adl/adl_v4.cpp


diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp
index 8370bea..a5d2de2 100644
--- a/engines/adl/adl_v4.cpp
+++ b/engines/adl/adl_v4.cpp
@@ -127,7 +127,7 @@ void AdlEngine_v4::loadState(Common::ReadStream &stream) {
 	if (size != expectedSize)
 		error("Variable count mismatch (expected %i; found %i)", expectedSize, size);
 
-	for (uint i = getRegion(1).vars.size(); i < size; ++i)
+	for (uint i = getRegion(1).vars.size(); i < _state.vars.size(); ++i)
 		_state.vars[i] = stream.readByte();
 
 	if (stream.err() || stream.eos())


Commit: 549ac7ca4712c7e4dfe9fc8ca1fa6b2084e451ba
    https://github.com/scummvm/scummvm/commit/549ac7ca4712c7e4dfe9fc8ca1fa6b2084e451ba
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-18T11:46:12+01:00

Commit Message:
ADL: Implement hires6 save/restore

Changed paths:
    engines/adl/adl_v5.cpp
    engines/adl/hires6.cpp


diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp
index cb4b379..011ef88 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 91ab163..01de061 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;





More information about the Scummvm-git-logs mailing list