[Scummvm-git-logs] scummvm master -> 4f1a821e6602ff580992c73b00e9174bd46a9c14

waltervn walter at vanniftrik-it.nl
Tue Dec 27 19:08:49 CET 2016


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

Summary:
4f1a821e66 ADL: Implement hires5 save/restore/restart


Commit: 4f1a821e6602ff580992c73b00e9174bd46a9c14
    https://github.com/scummvm/scummvm/commit/4f1a821e6602ff580992c73b00e9174bd46a9c14
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2016-12-27T19:06:57+01:00

Commit Message:
ADL: Implement hires5 save/restore/restart

Changed paths:
    engines/adl/adl_v2.h
    engines/adl/adl_v4.cpp
    engines/adl/adl_v4.h
    engines/adl/hires5.cpp


diff --git a/engines/adl/adl_v2.h b/engines/adl/adl_v2.h
index fe0c781..f0af9eb 100644
--- a/engines/adl/adl_v2.h
+++ b/engines/adl/adl_v2.h
@@ -59,6 +59,7 @@ protected:
 	void loadPictures(Common::ReadStream &stream);
 	void loadItemPictures(Common::ReadStream &stream, byte count);
 	virtual bool isInventoryFull() { return false; }
+	int askForSlot(const Common::String &question);
 
 	void checkTextOverflow(char c);
 
@@ -91,8 +92,6 @@ protected:
 	byte _roomOnScreen, _picOnScreen, _itemsOnScreen;
 
 private:
-	int askForSlot(const Common::String &question);
-
 	Common::RandomSource *_random;
 };
 
diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp
index 2ab784f..c979f83 100644
--- a/engines/adl/adl_v4.cpp
+++ b/engines/adl/adl_v4.cpp
@@ -21,6 +21,7 @@
  */
 
 #include "adl/adl_v4.h"
+#include "adl/display.h"
 #include "adl/detection.h"
 
 namespace Adl {
@@ -452,6 +453,68 @@ int AdlEngine_v4::o4_setRegion(ScriptEnv &e) {
 	return -1;
 }
 
+int AdlEngine_v4::o4_save(ScriptEnv &e) {
+	OP_DEBUG_0("\tSAVE_GAME()");
+
+	_display->printString(_strings_v2.saveReplace);
+	const char key = inputKey();
+
+	if (shouldQuit())
+		return -1;
+
+	if (key != APPLECHAR('Y'))
+		return 0;
+
+	const int slot = askForSlot(_strings_v2.saveInsert);
+
+	if (slot < 0)
+		return -1;
+
+	saveGameState(slot, "");
+	return 0;
+}
+
+int AdlEngine_v4::o4_restore(ScriptEnv &e) {
+	OP_DEBUG_0("\tRESTORE_GAME()");
+
+	const int slot = askForSlot(_strings_v2.restoreInsert);
+
+	if (slot < 0)
+		return -1;
+
+	loadGameState(slot);
+	_isRestoring = false;
+
+	_picOnScreen = 0;
+	_roomOnScreen = 0;
+
+	// Long jump
+	_isRestarting = true;
+	return -1;
+}
+
+int AdlEngine_v4::o4_restart(ScriptEnv &e) {
+	OP_DEBUG_0("\tRESTART_GAME()");
+
+	while (true) {
+		_display->printString(_strings.playAgain);
+		const Common::String input(inputString());
+
+		if (shouldQuit())
+			return -1;
+
+		if (input.firstChar() == APPLECHAR('N')) {
+			return o1_quit(e);
+		} else if (input.firstChar() == APPLECHAR('Y')) {
+			// The original game loads a special save game from volume 3
+			initState();
+			// Long jump
+			_isRestarting = true;
+			return -1;
+		}
+	}
+}
+
 int AdlEngine_v4::o4_setRegionRoom(ScriptEnv &e) {
 	OP_DEBUG_2("\tSET_REGION_ROOM(%d, %d)", e.arg(1), e.arg(2));
 
diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h
index c1f9bfb..caf2b3f 100644
--- a/engines/adl/adl_v4.h
+++ b/engines/adl/adl_v4.h
@@ -78,6 +78,9 @@ protected:
 	int o4_setRegionToPrev(ScriptEnv &e);
 	int o4_moveAllItems(ScriptEnv &e);
 	int o4_setRegion(ScriptEnv &e);
+	int o4_save(ScriptEnv &e);
+	int o4_restore(ScriptEnv &e);
+	int o4_restart(ScriptEnv &e);
 	int o4_setRegionRoom(ScriptEnv &e);
 	int o4_setRoomPic(ScriptEnv &e);
 
diff --git a/engines/adl/hires5.cpp b/engines/adl/hires5.cpp
index 299d1ec..c1ada9e 100644
--- a/engines/adl/hires5.cpp
+++ b/engines/adl/hires5.cpp
@@ -111,10 +111,10 @@ void HiRes5Engine::setupOpcodeTables() {
 	Opcode(o4_moveAllItems);
 	Opcode(o1_quit);
 	Opcode(o4_setRegion);
-	Opcode(o2_save); // TODO
+	Opcode(o4_save);
 	// 0x10
-	Opcode(o2_restore); // TODO
-	Opcode(o1_restart); // TODO
+	Opcode(o4_restore);
+	Opcode(o4_restart);
 	Opcode(o4_setRegionRoom);
 	Opcode(o_startAnimation);
 	// 0x14
@@ -244,7 +244,11 @@ void HiRes5Engine::init() {
 	stream.reset(_disk->createReadStream(0x7, 0xc));
 	_strings.lineFeeds = readString(*stream);
 
-	// TODO: opcode strings
+	stream.reset(_disk->createReadStream(0x8, 0x3, 0x00, 2));
+	_strings_v2.saveInsert = readStringAt(*stream, 0x66);
+	_strings_v2.saveReplace = readStringAt(*stream, 0x112);
+	_strings_v2.restoreInsert = readStringAt(*stream, 0x180);
+	_strings.playAgain = readStringAt(*stream, 0x247, 0xff);
 
 	_messageIds.cantGoThere = 110;
 	_messageIds.dontUnderstand = 112;





More information about the Scummvm-git-logs mailing list