aboutsummaryrefslogtreecommitdiff
path: root/scumm/saveload.cpp
diff options
context:
space:
mode:
authorJamieson Christian2003-09-14 20:34:48 +0000
committerJamieson Christian2003-09-14 20:34:48 +0000
commitd91278198b40cb86d9816971904fbad1e9bcfbf3 (patch)
tree24a38d4046079245ea2cd592a6044b4e86040a11 /scumm/saveload.cpp
parent6512592d0f0be9afcc0f3aa30b1b505490ebea54 (diff)
downloadscummvm-rg350-d91278198b40cb86d9816971904fbad1e9bcfbf3.tar.gz
scummvm-rg350-d91278198b40cb86d9816971904fbad1e9bcfbf3.tar.bz2
scummvm-rg350-d91278198b40cb86d9816971904fbad1e9bcfbf3.zip
Fix for Bug [805593] MI2: Music stops in LeChuck's fortress
Implemented _cmd_queue save/load. In addition to requiring _cmd_queue information, this bug arises from a rare assumption that sound resources are loaded in memory even though they aren't currently playing. Therefore, a list of sound resources loaded in memory is included in the savegame, so that all relevant sound resources are reloaded when the savegame is loaded. This also fixes an unreported music bug in S&M when saving a game while outside the Bumpusville mansion. As a result of savegame format modifications, we are now at savegame version 23. svn-id: r10254
Diffstat (limited to 'scumm/saveload.cpp')
-rw-r--r--scumm/saveload.cpp50
1 files changed, 30 insertions, 20 deletions
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 7d7b4775a3..49f08f1e18 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -600,7 +600,7 @@ void Scumm::saveOrLoad(Serializer *s, uint32 savegameVersion) {
// We should at least store for each save resource it's type and ID. Then at least
// we can perform some integrety checks when loading.
for (i = rtFirst; i <= rtLast; i++)
- if (res.mode[i] == 0)
+ if (res.mode[i] != 1)
for (j = 1; j < res.num[i]; j++)
saveLoadResource(s, i, j);
@@ -684,32 +684,42 @@ void Scumm::saveLoadResource(Serializer *ser, int type, int idx) {
uint32 size;
/* don't save/load these resource types */
- if (type == rtTemp || type == rtBuffer || res.mode[type])
+ if (type == rtTemp || type == rtBuffer)
return;
- if (ser->isSaving()) {
- ptr = res.address[type][idx];
- if (ptr == NULL) {
- ser->saveUint32(0);
- return;
- }
+ if (!res.mode[type]) {
+ if (ser->isSaving()) {
+ ptr = res.address[type][idx];
+ if (ptr == NULL) {
+ ser->saveUint32(0);
+ return;
+ }
- size = ((MemBlkHeader *)ptr)->size;
+ size = ((MemBlkHeader *)ptr)->size;
- ser->saveUint32(size);
- ser->saveBytes(ptr + sizeof(MemBlkHeader), size);
+ ser->saveUint32(size);
+ ser->saveBytes(ptr + sizeof(MemBlkHeader), size);
- if (type == rtInventory) {
- ser->saveWord(_inventory[idx]);
- }
- } else {
- size = ser->loadUint32();
- if (size) {
- createResource(type, idx, size);
- ser->loadBytes(getResourceAddress(type, idx), size);
if (type == rtInventory) {
- _inventory[idx] = ser->loadWord();
+ ser->saveWord(_inventory[idx]);
}
+ } else {
+ size = ser->loadUint32();
+ if (size) {
+ createResource(type, idx, size);
+ ser->loadBytes(getResourceAddress(type, idx), size);
+ if (type == rtInventory) {
+ _inventory[idx] = ser->loadWord();
+ }
+ }
+ }
+ } else if (res.mode[type] == 2 && ser->getVersion() >= VER(23)) {
+ // Save/load only a list of resource numbers that need reloaded.
+ if (ser->isSaving()) {
+ ser->saveWord (res.address[type][idx] ? 1 : 0);
+ } else {
+ if (ser->loadWord())
+ ensureResourceLoaded (type, idx);
}
}
}