aboutsummaryrefslogtreecommitdiff
path: root/engines/agi/saveload.cpp
diff options
context:
space:
mode:
authorMartin Kiewitz2016-02-13 20:42:30 +0100
committerMartin Kiewitz2016-02-13 20:42:30 +0100
commit9f59b5ed7c3130bd7b0060e770a9ec915a91a891 (patch)
treea25c0a9be25596fa1c236fb2a49879253a27e0e2 /engines/agi/saveload.cpp
parent94e5804b84e3e165055fd210f002279d0deb1bb0 (diff)
downloadscummvm-rg350-9f59b5ed7c3130bd7b0060e770a9ec915a91a891.tar.gz
scummvm-rg350-9f59b5ed7c3130bd7b0060e770a9ec915a91a891.tar.bz2
scummvm-rg350-9f59b5ed7c3130bd7b0060e770a9ec915a91a891.zip
AGI: Fix priority band handling
- Fix saving/loading priority bands table. Now saving the actual raw data - Now also saving the flag, that defines if the priority table got modified by scripts - For older saved games it will try to figure out the state of that flag - Blocking set.pri.base for AGI below 2.936 - set.pri.base was actually introduced in 2.936 and not AGI3 - The set.pri.base bug was present in 2.936 as well - Saved games created between the graphics rewrite and this commit may have priority issues for games, that used AGI2.936+
Diffstat (limited to 'engines/agi/saveload.cpp')
-rw-r--r--engines/agi/saveload.cpp55
1 files changed, 36 insertions, 19 deletions
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index e22b127021..5f1c5112cd 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -45,24 +45,25 @@
#include "agi/systemui.h"
#include "agi/words.h"
-#define SAVEGAME_CURRENT_VERSION 9
+#define SAVEGAME_CURRENT_VERSION 10
//
-// Version 0 (Sarien): view table has 64 entries
-// Version 1 (Sarien): view table has 256 entries (needed in KQ3)
-// Version 2 (ScummVM): first ScummVM version
-// Version 3 (ScummVM): added AGIPAL save/load support
-// Version 4 (ScummVM): added thumbnails and save creation date/time
-// Version 5 (ScummVM): Added game md5
-// Version 6 (ScummVM): Added game played time
-// Version 7 (ScummVM): Added controller key mappings
-// required for some games for quick-loading from ScummVM main menu
-// for games, that do not set all key mappings right at the start
-// Added automatic save data (for command SetSimple)
-// Version 8 (ScummVM): Added Hold-Key-Mode boolean
-// required for at least Mixed Up Mother Goose
-// gets set at the start of the game only
-// Version 9 (ScummVM): Added seconds to saved game time stamp
+// Version 0 (Sarien): view table has 64 entries
+// Version 1 (Sarien): view table has 256 entries (needed in KQ3)
+// Version 2 (ScummVM): first ScummVM version
+// Version 3 (ScummVM): added AGIPAL save/load support
+// Version 4 (ScummVM): added thumbnails and save creation date/time
+// Version 5 (ScummVM): Added game md5
+// Version 6 (ScummVM): Added game played time
+// Version 7 (ScummVM): Added controller key mappings
+// required for some games for quick-loading from ScummVM main menu
+// for games, that do not set all key mappings right at the start
+// Added automatic save data (for command SetSimple)
+// Version 8 (ScummVM): Added Hold-Key-Mode boolean
+// required for at least Mixed Up Mother Goose
+// gets set at the start of the game only
+// Version 9 (ScummVM): Added seconds to saved game time stamp
+// Version 10 (ScummVM): Added priorityTableSet boolean
namespace Agi {
@@ -174,9 +175,11 @@ int AgiEngine::saveGame(const Common::String &fileName, const Common::String &de
out->writeSint16BE(0);
}
- // TODO: save if priority table was modified
for (i = 0; i < SCRIPT_HEIGHT; i++)
- out->writeByte(_gfx->priorityFromY(i));
+ out->writeByte(_gfx->saveLoadGetPriority(i));
+
+ // Version 10+: Save, if priority table got modified (set.pri.base opcode)
+ out->writeSint16BE((int16)_gfx->saveLoadWasPriorityTableModified());
out->writeSint16BE((int16)_game.gfxMode);
out->writeByte(_text->inputGetCursorChar());
@@ -500,7 +503,21 @@ int AgiEngine::loadGame(const Common::String &fileName, bool checkId) {
}
for (i = 0; i < SCRIPT_HEIGHT; i++)
- _gfx->setPriority(i, in->readByte());
+ _gfx->saveLoadSetPriority(i, in->readByte());
+
+ if (saveVersion >= 10) {
+ // Version 10+: priority table was modified by scripts
+ int16 priorityTableWasModified = in->readSint16BE();
+
+ if (priorityTableWasModified) {
+ _gfx->saveLoadSetPriorityTableModifiedBool(true);
+ } else {
+ _gfx->saveLoadSetPriorityTableModifiedBool(false);
+ }
+ } else {
+ // Try to figure it out by ourselves
+ _gfx->saveLoadFigureOutPriorityTableModifiedBool();
+ }
_text->closeWindow();