aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2003-11-29 13:58:17 +0000
committerMax Horn2003-11-29 13:58:17 +0000
commiteeb3cdebf10a85364f47b2df3bb59c3c212d9d91 (patch)
treeabc67f0b4ee32275fd44bd543e317a92d5975774 /scumm
parente68ac71155bf775a32742335a1d8690aad17ecee (diff)
downloadscummvm-rg350-eeb3cdebf10a85364f47b2df3bb59c3c212d9d91.tar.gz
scummvm-rg350-eeb3cdebf10a85364f47b2df3bb59c3c212d9d91.tar.bz2
scummvm-rg350-eeb3cdebf10a85364f47b2df3bb59c3c212d9d91.zip
new savegame version: store actor pan data; store Audio CD playback status (and when loading, resume playing of tracks which are meant to loop forever)
svn-id: r11423
Diffstat (limited to 'scumm')
-rw-r--r--scumm/actor.cpp2
-rw-r--r--scumm/saveload.cpp36
-rw-r--r--scumm/saveload.h3
3 files changed, 32 insertions, 9 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp
index cc3e05a2b5..02808e4c45 100644
--- a/scumm/actor.cpp
+++ b/scumm/actor.cpp
@@ -1655,7 +1655,7 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() {
MKLINE(Actor, room, sleByte, VER(8)),
MKLINE(Actor, talkColor, sleByte, VER(8)),
MKLINE(Actor, talkFrequency, sleInt16, VER(16)),
-// MKLINE(Actor, talkPan, sleInt16, VER(???)), // TODO: Add this next time savegame format is updated
+ MKLINE(Actor, talkPan, sleInt16, VER(24)),
MKLINE(Actor, scalex, sleByte, VER(8)),
MKLINE(Actor, scaley, sleByte, VER(8)),
MKLINE(Actor, charset, sleByte, VER(8)),
diff --git a/scumm/saveload.cpp b/scumm/saveload.cpp
index 856e0d09df..ff8f86bf53 100644
--- a/scumm/saveload.cpp
+++ b/scumm/saveload.cpp
@@ -35,6 +35,7 @@
#include "scumm/sound.h"
#include "scumm/verbs.h"
+#include "sound/audiocd.h"
#include "sound/mixer.h"
@@ -548,25 +549,34 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
MKEND()
};
+ const SaveLoadEntry audioCDEntries[] = {
+ MKLINE(AudioCDManager::Status, playing, sleUint32, VER(24)),
+ MKLINE(AudioCDManager::Status, track, sleInt32, VER(24)),
+ MKLINE(AudioCDManager::Status, start, sleUint32, VER(24)),
+ MKLINE(AudioCDManager::Status, duration, sleUint32, VER(24)),
+ MKLINE(AudioCDManager::Status, numLoops, sleInt32, VER(24)),
+ MKEND()
+ };
+
int i, j;
int var120Backup;
int var98Backup;
- if (!s->isSaving() && (_saveSound || !_saveLoadCompatible)) {
+ if (s->isLoading() && (_saveSound || !_saveLoadCompatible)) {
_sound->stopAllSounds();
}
// Because old savegames won't fill the entire gfxUsageBits[] array,
// clear it here just to be sure it won't hold any unforseen garbage.
- if (!s->isSaving())
+ if (s->isLoading())
memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
s->saveLoadEntries(this, mainEntries);
- if (!s->isSaving() && savegameVersion < VER(14))
+ if (s->isLoading() && savegameVersion < VER(14))
upgradeGfxUsageBits();
- if (!s->isSaving() && savegameVersion >= VER(20)) {
+ if (s->isLoading() && savegameVersion >= VER(20)) {
updateCursor();
_system->warp_mouse(_mouse.x, _mouse.y);
}
@@ -581,7 +591,7 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
- if (!s->isSaving() && savegameVersion < VER(13)) {
+ if (s->isLoading() && savegameVersion < VER(13)) {
// Since roughly v13 of the save games, the objs storage has changed a bit
for (i = _numObjectsInRoom; i < _numLocalObjects; i++) {
_objs[i].obj_nr = 0;
@@ -667,14 +677,26 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
}
// With version 22, we replace the scale items with scale slots
- if (savegameVersion < VER(22) && !s->isSaving()) {
+ if (savegameVersion < VER(22) && s->isLoading()) {
// Convert all rtScaleTable resources to matching scale items
for (i = 1; i < res.num[rtScaleTable]; i++) {
convertScaleTableToScaleSlot(i);
}
}
-
+ // Save/load Audio CD status
+ if (savegameVersion >= VER(24)) {
+ AudioCDManager::Status info;
+ if (s->isSaving())
+ info = AudioCD.getStatus();
+ s->saveLoadArrayOf(&info, 1, sizeof(info), audioCDEntries);
+ // If we are loading, and the music being loaded was supposed to loop
+ // forever, then resume playing it. This helps a lot of audio CD
+ // is used to provide ambient music (see bug #788195).
+ if (s->isLoading() && info.playing && info.numLoops < 0)
+ AudioCD.play(info.track, info.numLoops, info.start, info.duration);
+ }
+
if (_imuse && (_saveSound || !_saveLoadCompatible)) {
_imuse->save_or_load(s, this);
_imuse->setMasterVolume(ConfMan.getInt("master_volume"));
diff --git a/scumm/saveload.h b/scumm/saveload.h
index dd51192ecf..89f5978fe0 100644
--- a/scumm/saveload.h
+++ b/scumm/saveload.h
@@ -32,7 +32,7 @@ namespace Scumm {
// Can be useful for other ports too :)
#define VER(x) x
-#define CURRENT_VER 23
+#define CURRENT_VER 24
// To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
// we use a small trick: instead of 0 we use 42. Why? Well, it seems newer GCC
@@ -109,6 +109,7 @@ public:
void saveLoadEntries(void *d, const SaveLoadEntry *sle);
bool isSaving() { return _saveOrLoad; }
+ bool isLoading() { return !_saveOrLoad; }
uint32 getVersion() { return _savegameVersion; }
void saveUint32(uint32 d);