aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2010-08-04 08:25:39 +0000
committerMax Horn2010-08-04 08:25:39 +0000
commit5ed9ddaa2c0ba1df52b72799c6fbd35a566e6960 (patch)
tree2dacbbf0b7f58d452bd888c419d95a0d2475bd6f
parent0e2807dc27af89c46a191834e5e623a9e77e9187 (diff)
downloadscummvm-rg350-5ed9ddaa2c0ba1df52b72799c6fbd35a566e6960.tar.gz
scummvm-rg350-5ed9ddaa2c0ba1df52b72799c6fbd35a566e6960.tar.bz2
scummvm-rg350-5ed9ddaa2c0ba1df52b72799c6fbd35a566e6960.zip
SCI: Remove reference to common/serializer.h from vm_types.h
svn-id: r51726
-rw-r--r--engines/sci/engine/savegame.cpp74
-rw-r--r--engines/sci/engine/vm_types.h6
2 files changed, 36 insertions, 44 deletions
diff --git a/engines/sci/engine/savegame.cpp b/engines/sci/engine/savegame.cpp
index a086669997..96dddb2c62 100644
--- a/engines/sci/engine/savegame.cpp
+++ b/engines/sci/engine/savegame.cpp
@@ -55,34 +55,6 @@ namespace Sci {
#pragma mark -
-// TODO: Many of the following sync_*() methods should be turned into member funcs
-// of the classes they are syncing.
-
-void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
- soundObj.saveLoadWithSerializer(s);
- s.syncAsSint16LE(resourceId);
- s.syncAsSint16LE(dataInc);
- s.syncAsSint16LE(ticker);
- s.syncAsSint16LE(signal, VER(17));
- s.syncAsByte(priority);
- s.syncAsSint16LE(loop, VER(17));
- s.syncAsByte(volume);
- s.syncAsByte(hold, VER(17));
- s.syncAsByte(fadeTo);
- s.syncAsSint16LE(fadeStep);
- s.syncAsSint32LE(fadeTicker);
- s.syncAsSint32LE(fadeTickerStep);
- s.syncAsByte(status);
-
- // pMidiParser and pStreamAud will be initialized when the
- // sound list is reconstructed in gamestate_restore()
- if (s.isLoading()) {
- soundRes = 0;
- pMidiParser = 0;
- pStreamAud = 0;
- }
-}
-
// Experimental hack: Use syncWithSerializer to sync. By default, this assume
// the object to be synced is a subclass of Serializable and thus tries to invoke
// the saveLoadWithSerializer() method. But it is possible to specialize this
@@ -142,7 +114,8 @@ void syncArray(Common::Serializer &s, Common::Array<T> &arr) {
template <>
void syncWithSerializer(Common::Serializer &s, reg_t &obj) {
- obj.saveLoadWithSerializer(s);
+ s.syncAsUint16LE(obj.segment);
+ s.syncAsUint16LE(obj.offset);
}
void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
@@ -200,7 +173,7 @@ void SegManager::saveLoadWithSerializer(Common::Serializer &s) {
template <>
void syncWithSerializer(Common::Serializer &s, Class &obj) {
s.syncAsSint32LE(obj.script);
- obj.reg.saveLoadWithSerializer(s);
+ syncWithSerializer<reg_t>(s, obj.reg);
}
static void sync_SavegameMetadata(Common::Serializer &s, SavegameMetadata &obj) {
@@ -260,7 +233,7 @@ void LocalVariables::saveLoadWithSerializer(Common::Serializer &s) {
void Object::saveLoadWithSerializer(Common::Serializer &s) {
s.syncAsSint32LE(_flags);
- _pos.saveLoadWithSerializer(s);
+ syncWithSerializer<reg_t>(s, _pos);
s.syncAsSint32LE(_methodCount); // that's actually a uint16
syncArray<reg_t>(s, _variables);
@@ -277,18 +250,18 @@ template <>
void syncWithSerializer(Common::Serializer &s, Table<List>::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
- obj.first.saveLoadWithSerializer(s);
- obj.last.saveLoadWithSerializer(s);
+ syncWithSerializer<reg_t>(s, obj.first);
+ syncWithSerializer<reg_t>(s, obj.last);
}
template <>
void syncWithSerializer(Common::Serializer &s, Table<Node>::Entry &obj) {
s.syncAsSint32LE(obj.next_free);
- obj.pred.saveLoadWithSerializer(s);
- obj.succ.saveLoadWithSerializer(s);
- obj.key.saveLoadWithSerializer(s);
- obj.value.saveLoadWithSerializer(s);
+ syncWithSerializer<reg_t>(s, obj.pred);
+ syncWithSerializer<reg_t>(s, obj.succ);
+ syncWithSerializer<reg_t>(s, obj.key);
+ syncWithSerializer<reg_t>(s, obj.value);
}
#ifdef ENABLE_SCI32
@@ -322,7 +295,7 @@ void syncWithSerializer(Common::Serializer &s, Table<SciArray<reg_t> >::Entry &o
if (s.isSaving())
value = obj.getValue(i);
- value.saveLoadWithSerializer(s);
+ syncWithSerializer<reg_t>(s, value);
if (s.isLoading())
obj.setValue(i, value);
@@ -520,6 +493,31 @@ void SciMusic::saveLoadWithSerializer(Common::Serializer &s) {
}
}
+void MusicEntry::saveLoadWithSerializer(Common::Serializer &s) {
+ syncWithSerializer<reg_t>(s, soundObj);
+ s.syncAsSint16LE(resourceId);
+ s.syncAsSint16LE(dataInc);
+ s.syncAsSint16LE(ticker);
+ s.syncAsSint16LE(signal, VER(17));
+ s.syncAsByte(priority);
+ s.syncAsSint16LE(loop, VER(17));
+ s.syncAsByte(volume);
+ s.syncAsByte(hold, VER(17));
+ s.syncAsByte(fadeTo);
+ s.syncAsSint16LE(fadeStep);
+ s.syncAsSint32LE(fadeTicker);
+ s.syncAsSint32LE(fadeTickerStep);
+ s.syncAsByte(status);
+
+ // pMidiParser and pStreamAud will be initialized when the
+ // sound list is reconstructed in gamestate_restore()
+ if (s.isLoading()) {
+ soundRes = 0;
+ pMidiParser = 0;
+ pStreamAud = 0;
+ }
+}
+
void SoundCommandParser::syncPlayList(Common::Serializer &s) {
_music->saveLoadWithSerializer(s);
}
diff --git a/engines/sci/engine/vm_types.h b/engines/sci/engine/vm_types.h
index 828fba3d7d..edf35a122a 100644
--- a/engines/sci/engine/vm_types.h
+++ b/engines/sci/engine/vm_types.h
@@ -27,7 +27,6 @@
#define SCI_ENGINE_VM_TYPES_H
#include "common/scummsys.h"
-#include "common/serializer.h"
namespace Sci {
@@ -57,11 +56,6 @@ struct reg_t {
int16 toSint16() const {
return (int16) offset;
}
-
- void saveLoadWithSerializer(Common::Serializer &s) {
- s.syncAsUint16LE(segment);
- s.syncAsUint16LE(offset);
- }
};
static inline reg_t make_reg(SegmentId segment, uint16 offset) {