aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamieson Christian2002-12-21 20:10:47 +0000
committerJamieson Christian2002-12-21 20:10:47 +0000
commitf60bda7d5ccbb721f716c61434b23956e573403e (patch)
tree1210aca5150c02d37552ee4f2a8e368e6b68a18e
parent0182836591273b19abbeafd9ad2760fc0738a5e8 (diff)
downloadscummvm-rg350-f60bda7d5ccbb721f716c61434b23956e573403e.tar.gz
scummvm-rg350-f60bda7d5ccbb721f716c61434b23956e573403e.tar.bz2
scummvm-rg350-f60bda7d5ccbb721f716c61434b23956e573403e.zip
Implemented new instrumentation save/load.
Save/load version is now VER_V11. Adlib/MT-32 instrumentation is now saved and loaded. BACK UP YOUR VER_V10 SAVEGAMES, JUST IN CASE! svn-id: r6044
-rw-r--r--scumm/imuse.cpp23
-rw-r--r--scumm/instrument.cpp9
-rw-r--r--scumm/saveload.h4
3 files changed, 21 insertions, 15 deletions
diff --git a/scumm/imuse.cpp b/scumm/imuse.cpp
index 08d47112ad..b1ddb67081 100644
--- a/scumm/imuse.cpp
+++ b/scumm/imuse.cpp
@@ -3127,6 +3127,17 @@ int IMuseInternal::save_or_load(Serializer *ser, Scumm *scumm)
ser->saveLoadEntries(this, mainEntries);
ser->saveLoadArrayOf(_players, ARRAYSIZE(_players), sizeof(_players[0]), playerEntries);
ser->saveLoadArrayOf(_parts, ARRAYSIZE(_parts), sizeof(_parts[0]), partEntries);
+
+ // Load/save the instrument definitions, which were revamped with V11.
+ if (ser->getVersion() >= VER_V11) {
+ int i;
+ Part *part = &_parts[0];
+ for (i = ARRAYSIZE(_parts); i; --i, ++part) {
+ part->_program = 255;
+ part->_instrument.saveOrLoad (ser);
+ }
+ }
+
ser->saveLoadArrayOf(_volume_fader, ARRAYSIZE(_volume_fader),
sizeof(_volume_fader[0]), volumeFaderEntries);
@@ -3170,18 +3181,6 @@ void IMuseInternal::fix_players_after_load(Scumm *scumm)
scumm->getResourceAddress(rtSound, player->_id);
player->_mt32emulate = isMT32(player->_id);
player->_isGM = isGM(player->_id);
- if (scumm->_use_adlib) {
- // FIXME - This should make sure the right
- // instruments are loaded, but it does not
- // even try to move to the right position in
- // the track. Using scan() gives a marginally
- // better result, but not good enough.
- //
- // The correct fix is probably to store the
- // Adlib instruments, or information on where
- // to find them, in the savegame.
- player->jump(player->_track_index, 0, 0);
- }
}
}
}
diff --git a/scumm/instrument.cpp b/scumm/instrument.cpp
index e8201ab8d7..c2ebaffb1f 100644
--- a/scumm/instrument.cpp
+++ b/scumm/instrument.cpp
@@ -330,8 +330,13 @@ Instrument_Program::Instrument_Program (Serializer *s)
void Instrument_Program::saveOrLoad (Serializer *s)
{
- _program = s->loadByte();
- _mt32 = (s->loadByte() > 0);
+ if (s->isSaving()) {
+ s->saveByte (_program);
+ s->saveByte (_mt32 ? 1 : 0);
+ } else {
+ _program = s->loadByte();
+ _mt32 = (s->loadByte() > 0);
+ }
}
void Instrument_Program::send (MidiChannel *mc)
diff --git a/scumm/saveload.h b/scumm/saveload.h
index 7be5d061a1..d30a771a83 100644
--- a/scumm/saveload.h
+++ b/scumm/saveload.h
@@ -25,12 +25,13 @@
// Support for "old" savegames (made with 2501 CVS build)
// Can be useful for other ports too :)
+#define VER_V11 11
#define VER_V10 10
#define VER_V9 9
#define VER_V8 8
#define VER_V7 7
-#define CURRENT_VER VER_V10
+#define CURRENT_VER VER_V11
// To work around a warning in GCC 3.2 (and 3.1 ?) regarding non-POD types,
@@ -105,6 +106,7 @@ public:
void saveLoadEntries(void *d, const SaveLoadEntry *sle);
bool isSaving() { return _saveOrLoad; }
+ uint32 getVersion() { return _savegameVersion; }
bool checkEOFLoadStream();