[Scummvm-cvs-logs] scummvm master -> cca9fc918f9d9c89b5526cce43ea42a9a003735e

m-kiewitz m_kiewitz at users.sourceforge.net
Fri Feb 19 02:01:21 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:
cca9fc918f AGI: Save screen object loop_flag


Commit: cca9fc918f9d9c89b5526cce43ea42a9a003735e
    https://github.com/scummvm/scummvm/commit/cca9fc918f9d9c89b5526cce43ea42a9a003735e
Author: Martin Kiewitz (m_kiewitz at users.sourceforge.net)
Date: 2016-02-19T02:00:35+01:00

Commit Message:
AGI: Save screen object loop_flag

loop_flag was previously vt.parm1, which was shared for multiple
uses. Was split up during graphics rewrite in commit
8a595e7771aa89d06876e13d7ab6751e26da8982

Is indirectly part of bug #7046. Saving, restarting ScummVM and
restoring right after grabbing the eagle resulted in the glitch
not happening (which was of course an inaccuracy anyway). This
was caused by AGI currently not saving/restoring the loop_flag.
Needs to get further figured out what's exactly happening
internally and if this issue was just hidden by the shared
vt.parm1 in previous versions. If triggered, it would have
just set another pseudo-random flag on end-of-loop.

Changed paths:
    engines/agi/checks.cpp
    engines/agi/saveload.cpp



diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp
index 1e1670f..c67b6a5 100644
--- a/engines/agi/checks.cpp
+++ b/engines/agi/checks.cpp
@@ -129,7 +129,7 @@ bool AgiEngine::checkPriority(ScreenObjEntry *screenObj) {
 			screenPriority = _gfx->getPriority(curX, curY);
 
 			if (screenPriority == 0) {  // unconditional black. no go at all!
-				touchedControl = 0;
+				touchedControl = false;
 				break;
 			}
 
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 5f1c511..0658609 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -45,7 +45,7 @@
 #include "agi/systemui.h"
 #include "agi/words.h"
 
-#define SAVEGAME_CURRENT_VERSION 10
+#define SAVEGAME_CURRENT_VERSION 11
 
 //
 // Version 0 (Sarien):   view table has 64 entries
@@ -266,6 +266,8 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
 
 		out->writeByte(screenObj->motionType);
 		out->writeByte(screenObj->cycle);
+		// Version 11+: loop_flag, was saved previously under vt.parm1
+		out->writeByte(screenObj->loop_flag);
 		out->writeByte(screenObj->priority);
 
 		out->writeUint16BE(screenObj->flags);
@@ -344,6 +346,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 	int16 parm[7];
 	Common::InSaveFile *in;
 	bool totalPlayTimeWasSet = false;
+	byte oldLoopFlag = 0;
 
 	debugC(3, kDebugLevelMain | kDebugLevelSavegame, "AgiEngine::loadGame(%s)", fileName.c_str());
 
@@ -634,6 +637,10 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 
 		screenObj->motionType = (MotionType)in->readByte();
 		screenObj->cycle = (CycleType)in->readByte();
+		if (saveVersion >= 11) {
+			// Version 11+: loop_flag, was previously vt.parm1
+			screenObj->loop_flag = in->readByte();
+		}
 		screenObj->priority = in->readByte();
 
 		screenObj->flags = in->readUint16BE();
@@ -641,7 +648,7 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 		// this was done so that saved games compatibility isn't broken
 		switch (screenObj->motionType) {
 		case kMotionNormal:
-			in->readByte();
+			oldLoopFlag = in->readByte();
 			in->readByte();
 			in->readByte();
 			in->readByte();
@@ -651,12 +658,14 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 			in->readByte();
 			in->readByte();
 			in->readByte();
+			oldLoopFlag = screenObj->wander_count;
 			break;
 		case kMotionFollowEgo:
 			screenObj->follow_stepSize = in->readByte();
 			screenObj->follow_flag = in->readByte();
 			screenObj->follow_count = in->readByte();
 			in->readByte();
+			oldLoopFlag = screenObj->follow_stepSize;
 			break;
 		case kMotionEgo:
 		case kMotionMoveObj:
@@ -664,10 +673,21 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
 			screenObj->move_y = in->readByte();
 			screenObj->move_stepSize = in->readByte();
 			screenObj->move_flag = in->readByte();
+			oldLoopFlag = screenObj->move_x;
 			break;
 		default:
 			error("unknown motion-type");
 		}
+		if (saveVersion < 11) {
+			if (saveVersion < 7) {
+				// Recreate loop_flag from motion-type (was previously vt.parm1)
+				// vt.parm1 was shared for multiple uses
+				screenObj->loop_flag = oldLoopFlag;
+			} else {
+				// for Version 7-10 we can't really do anything, it was not saved
+				screenObj->loop_flag = 0; // set it to 0
+			}
+		}
 	}
 	for (i = vtEntries; i < SCREENOBJECTS_MAX; i++) {
 		memset(&_game.screenObjTable[i], 0, sizeof(ScreenObjEntry));






More information about the Scummvm-git-logs mailing list