aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-19 02:00:03 +0100
committerMartin Kiewitz2016-02-19 02:00:35 +0100
commitcca9fc918f9d9c89b5526cce43ea42a9a003735e (patch)
tree1ff38ebf242cec9003c9e31f37834f8a680eda39 /engines
parentc1dacbe65d4fa72128f7f521326beb0838784ac2 (diff)
downloadscummvm-rg350-cca9fc918f9d9c89b5526cce43ea42a9a003735e.tar.gz
scummvm-rg350-cca9fc918f9d9c89b5526cce43ea42a9a003735e.tar.bz2
scummvm-rg350-cca9fc918f9d9c89b5526cce43ea42a9a003735e.zip
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.
Diffstat (limited to 'engines')
-rw-r--r--engines/agi/checks.cpp2
-rw-r--r--engines/agi/saveload.cpp24
2 files changed, 23 insertions, 3 deletions
diff --git a/engines/agi/checks.cpp b/engines/agi/checks.cpp
index 1e1670f674..c67b6a5810 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 5f1c5112cd..0658609cd0 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));