[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.187,1.188 saveload.cpp,1.117,1.118 saveload.h,1.26,1.27
Max Horn
fingolfin at users.sourceforge.net
Sat Nov 29 05:59:02 CET 2003
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1:/tmp/cvs-serv22364
Modified Files:
actor.cpp saveload.cpp saveload.h
Log Message:
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)
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.187
retrieving revision 1.188
diff -u -d -r1.187 -r1.188
--- actor.cpp 16 Nov 2003 20:52:56 -0000 1.187
+++ actor.cpp 29 Nov 2003 13:58:17 -0000 1.188
@@ -1655,7 +1655,7 @@
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)),
Index: saveload.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- saveload.cpp 11 Nov 2003 00:40:35 -0000 1.117
+++ saveload.cpp 29 Nov 2003 13:58:17 -0000 1.118
@@ -35,6 +35,7 @@
#include "scumm/sound.h"
#include "scumm/verbs.h"
+#include "sound/audiocd.h"
#include "sound/mixer.h"
@@ -548,25 +549,34 @@
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 @@
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 @@
}
// 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"));
Index: saveload.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/saveload.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- saveload.h 3 Oct 2003 18:33:55 -0000 1.26
+++ saveload.h 29 Nov 2003 13:58:17 -0000 1.27
@@ -32,7 +32,7 @@
// 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 @@
void saveLoadEntries(void *d, const SaveLoadEntry *sle);
bool isSaving() { return _saveOrLoad; }
+ bool isLoading() { return !_saveOrLoad; }
uint32 getVersion() { return _savegameVersion; }
void saveUint32(uint32 d);
More information about the Scummvm-git-logs
mailing list