[Scummvm-git-logs] scummvm master -> cc1f975a9cf1a04f8bd339336db100e63ae21385

waltervn walter at vanniftrik-it.nl
Sun Feb 19 18:57:07 CET 2017


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:
cc1f975a9c ADL: Implement hires6 action opcode 0x1d


Commit: cc1f975a9cf1a04f8bd339336db100e63ae21385
    https://github.com/scummvm/scummvm/commit/cc1f975a9cf1a04f8bd339336db100e63ae21385
Author: Walter van Niftrik (walter at scummvm.org)
Date: 2017-02-19T17:41:34+01:00

Commit Message:
ADL: Implement hires6 action opcode 0x1d

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


diff --git a/engines/adl/adl_v4.cpp b/engines/adl/adl_v4.cpp
index 494ff52..e8ee798 100644
--- a/engines/adl/adl_v4.cpp
+++ b/engines/adl/adl_v4.cpp
@@ -396,13 +396,16 @@ void AdlEngine_v4::backupRoomState(byte room) {
 	backup.picture = getRoom(room).picture;
 }
 
-void AdlEngine_v4::restoreRoomState(byte room) {
+byte AdlEngine_v4::restoreRoomState(byte room) {
 	const RoomState &backup = getCurRegion().rooms[room - 1];
 
 	if (backup.isFirstTime != 1) {
 		getRoom(room).curPicture = getRoom(room).picture = backup.picture;
 		getRoom(room).isFirstTime = false;
+		return 0;
 	}
+
+	return 1;
 }
 
 void AdlEngine_v4::backupVars() {
diff --git a/engines/adl/adl_v4.h b/engines/adl/adl_v4.h
index cca1c6f..ca9aeff 100644
--- a/engines/adl/adl_v4.h
+++ b/engines/adl/adl_v4.h
@@ -82,7 +82,7 @@ protected:
 	void loadItemPicIndex(Common::ReadStream &stream, uint items);
 	void backupRoomState(byte room);
 	virtual void initRoomState(RoomState &roomState) const;
-	virtual void restoreRoomState(byte room);
+	virtual byte restoreRoomState(byte room);
 	void backupVars();
 	void restoreVars();
 
diff --git a/engines/adl/adl_v5.cpp b/engines/adl/adl_v5.cpp
index 09abefd..503be9a 100644
--- a/engines/adl/adl_v5.cpp
+++ b/engines/adl/adl_v5.cpp
@@ -38,15 +38,20 @@ void AdlEngine_v5::initRoomState(RoomState &roomState) const {
 	roomState.isFirstTime = 0xff;
 }
 
-void AdlEngine_v5::restoreRoomState(byte room) {
+byte AdlEngine_v5::restoreRoomState(byte room) {
 	const RoomState &backup = getCurRegion().rooms[room - 1];
 
 	if (backup.isFirstTime != 0xff) {
 		getRoom(room).curPicture = getRoom(room).picture = backup.picture;
 
-		if (backup.isFirstTime != 1)
+		// CHECKME: Why doesn't this just copy the flag unconditionally?
+		if (backup.isFirstTime != 1) {
 			getRoom(room).isFirstTime = false;
+			return 0;
+		}
 	}
+
+	return backup.isFirstTime;
 }
 
 AdlEngine_v5::RegionChunkType AdlEngine_v5::getRegionChunkType(const uint16 addr) const {
@@ -136,6 +141,20 @@ int AdlEngine_v5::o5_setRegionRoom(ScriptEnv &e) {
 	return -1;
 }
 
+int AdlEngine_v5::o5_setRoomPic(ScriptEnv &e) {
+	const byte isFirstTime = restoreRoomState(e.arg(1));
+
+	// CHECKME: More peculiar isFirstTime handling (see also restoreRoomState).
+	// Is this here to prevent changing the backed up flag from 1 to 0? Since
+	// that could only happen if the room isFirstTime is 0 while the backed up flag
+	// is 1, is this scenario even possible?
+	if (isFirstTime != 0xff)
+		getRoom(e.arg(1)).isFirstTime = isFirstTime;
+
+	o4_setRoomPic(e);
+	return 2;
+}
+
 int AdlEngine_v5::o_winGame(ScriptEnv &e) {
 	OP_DEBUG_0("\tWIN_GAME()");
 
diff --git a/engines/adl/adl_v5.h b/engines/adl/adl_v5.h
index 0d3823d..a163381 100644
--- a/engines/adl/adl_v5.h
+++ b/engines/adl/adl_v5.h
@@ -37,13 +37,14 @@ protected:
 	// AdlEngine_v4
 	virtual RegionChunkType getRegionChunkType(const uint16 addr) const;
 	virtual void initRoomState(RoomState &roomState) const;
-	virtual void restoreRoomState(byte room);
+	virtual byte restoreRoomState(byte room);
 
 	int o5_isNounNotInRoom(ScriptEnv &e);
 	int o5_abortScript(ScriptEnv &e);
 	int o5_dummy(ScriptEnv &e);
 	int o5_setTextMode(ScriptEnv &e);
 	int o5_setRegionRoom(ScriptEnv &e);
+	int o5_setRoomPic(ScriptEnv &e);
 	int o_winGame(ScriptEnv &e);
 };
 
diff --git a/engines/adl/hires6.cpp b/engines/adl/hires6.cpp
index 7955d1a..3de7e59 100644
--- a/engines/adl/hires6.cpp
+++ b/engines/adl/hires6.cpp
@@ -128,7 +128,7 @@ void HiRes6Engine::setupOpcodeTables() {
 	Opcode(o1_takeItem);
 	// 0x1c
 	Opcode(o1_dropItem);
-	Opcode(o1_setRoomPic);
+	Opcode(o5_setRoomPic);
 	Opcode(o_winGame);
 	OpcodeUnImpl();
 	// 0x20





More information about the Scummvm-git-logs mailing list