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
This commit is contained in:
parent
e68ac71155
commit
eeb3cdebf1
3 changed files with 32 additions and 9 deletions
|
@ -1655,7 +1655,7 @@ const SaveLoadEntry *Actor::getSaveLoadEntries() {
|
||||||
MKLINE(Actor, room, sleByte, VER(8)),
|
MKLINE(Actor, room, sleByte, VER(8)),
|
||||||
MKLINE(Actor, talkColor, sleByte, VER(8)),
|
MKLINE(Actor, talkColor, sleByte, VER(8)),
|
||||||
MKLINE(Actor, talkFrequency, sleInt16, VER(16)),
|
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, scalex, sleByte, VER(8)),
|
||||||
MKLINE(Actor, scaley, sleByte, VER(8)),
|
MKLINE(Actor, scaley, sleByte, VER(8)),
|
||||||
MKLINE(Actor, charset, sleByte, VER(8)),
|
MKLINE(Actor, charset, sleByte, VER(8)),
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include "scumm/sound.h"
|
#include "scumm/sound.h"
|
||||||
#include "scumm/verbs.h"
|
#include "scumm/verbs.h"
|
||||||
|
|
||||||
|
#include "sound/audiocd.h"
|
||||||
#include "sound/mixer.h"
|
#include "sound/mixer.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -548,25 +549,34 @@ void ScummEngine::saveOrLoad(Serializer *s, uint32 savegameVersion) {
|
||||||
MKEND()
|
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 i, j;
|
||||||
int var120Backup;
|
int var120Backup;
|
||||||
int var98Backup;
|
int var98Backup;
|
||||||
|
|
||||||
if (!s->isSaving() && (_saveSound || !_saveLoadCompatible)) {
|
if (s->isLoading() && (_saveSound || !_saveLoadCompatible)) {
|
||||||
_sound->stopAllSounds();
|
_sound->stopAllSounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Because old savegames won't fill the entire gfxUsageBits[] array,
|
// Because old savegames won't fill the entire gfxUsageBits[] array,
|
||||||
// clear it here just to be sure it won't hold any unforseen garbage.
|
// 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));
|
memset(gfxUsageBits, 0, sizeof(gfxUsageBits));
|
||||||
|
|
||||||
s->saveLoadEntries(this, mainEntries);
|
s->saveLoadEntries(this, mainEntries);
|
||||||
|
|
||||||
if (!s->isSaving() && savegameVersion < VER(14))
|
if (s->isLoading() && savegameVersion < VER(14))
|
||||||
upgradeGfxUsageBits();
|
upgradeGfxUsageBits();
|
||||||
|
|
||||||
if (!s->isSaving() && savegameVersion >= VER(20)) {
|
if (s->isLoading() && savegameVersion >= VER(20)) {
|
||||||
updateCursor();
|
updateCursor();
|
||||||
_system->warp_mouse(_mouse.x, _mouse.y);
|
_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(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries);
|
||||||
|
|
||||||
s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries);
|
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
|
// Since roughly v13 of the save games, the objs storage has changed a bit
|
||||||
for (i = _numObjectsInRoom; i < _numLocalObjects; i++) {
|
for (i = _numObjectsInRoom; i < _numLocalObjects; i++) {
|
||||||
_objs[i].obj_nr = 0;
|
_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
|
// 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
|
// Convert all rtScaleTable resources to matching scale items
|
||||||
for (i = 1; i < res.num[rtScaleTable]; i++) {
|
for (i = 1; i < res.num[rtScaleTable]; i++) {
|
||||||
convertScaleTableToScaleSlot(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)) {
|
if (_imuse && (_saveSound || !_saveLoadCompatible)) {
|
||||||
_imuse->save_or_load(s, this);
|
_imuse->save_or_load(s, this);
|
||||||
_imuse->setMasterVolume(ConfMan.getInt("master_volume"));
|
_imuse->setMasterVolume(ConfMan.getInt("master_volume"));
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Scumm {
|
||||||
// Can be useful for other ports too :)
|
// Can be useful for other ports too :)
|
||||||
|
|
||||||
#define VER(x) x
|
#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,
|
// 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
|
// 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);
|
void saveLoadEntries(void *d, const SaveLoadEntry *sle);
|
||||||
|
|
||||||
bool isSaving() { return _saveOrLoad; }
|
bool isSaving() { return _saveOrLoad; }
|
||||||
|
bool isLoading() { return !_saveOrLoad; }
|
||||||
uint32 getVersion() { return _savegameVersion; }
|
uint32 getVersion() { return _savegameVersion; }
|
||||||
|
|
||||||
void saveUint32(uint32 d);
|
void saveUint32(uint32 d);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue