diff options
author | Julien Templier | 2010-10-26 06:55:34 +0000 |
---|---|---|
committer | Julien Templier | 2010-10-26 06:55:34 +0000 |
commit | dc4a22ed7d1a43703b0a6f2d87480ce948bc20a8 (patch) | |
tree | 0f3f34b28861f0863ec9a1638e24048826f27ba4 /engines/lastexpress/game/sound.cpp | |
parent | fd8af7ba6ed6753f4b8a656b26d6092c824fc844 (diff) | |
download | scummvm-rg350-dc4a22ed7d1a43703b0a6f2d87480ce948bc20a8.tar.gz scummvm-rg350-dc4a22ed7d1a43703b0a6f2d87480ce948bc20a8.tar.bz2 scummvm-rg350-dc4a22ed7d1a43703b0a6f2d87480ce948bc20a8.zip |
LASTEXPRESS: More savegame work
- Implement SaveLoad::writeEntry
- Implement missing saveLoadWithSerializer functions for all serialized classes & structs
- Add stub for SaveLoad::computePadding
svn-id: r53845
Diffstat (limited to 'engines/lastexpress/game/sound.cpp')
-rw-r--r-- | engines/lastexpress/game/sound.cpp | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/engines/lastexpress/game/sound.cpp b/engines/lastexpress/game/sound.cpp index 3b47b6a405..50004bc001 100644 --- a/engines/lastexpress/game/sound.cpp +++ b/engines/lastexpress/game/sound.cpp @@ -503,8 +503,52 @@ SoundManager::SoundEntry *SoundManager::getEntry(SoundType type) { ////////////////////////////////////////////////////////////////////////// // Savegame ////////////////////////////////////////////////////////////////////////// -void SoundManager::saveLoadWithSerializer(Common::Serializer &ser) { - error("Sound::saveLoadWithSerializer: not implemented!"); +void SoundManager::saveLoadWithSerializer(Common::Serializer &s) { + s.syncAsUint32LE(_state); + s.syncAsUint32LE(_currentType); + + // Compute the number of entries to save + uint32 count = 0; + if (s.isSaving()) { + for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i) + if ((*i)->name2.matchString("NISSND?")) + ++count; + } + + s.syncAsUint32LE(count); + + // Save or load each entry data + if (s.isSaving()) { + for (Common::List<SoundEntry *>::iterator i = _cache.begin(); i != _cache.end(); ++i) { + SoundEntry *entry = *i; + if (entry->name2.matchString("NISSND?") && (entry->status.status & kFlagType7) != kFlag3) { + s.syncAsUint32LE(entry->status.status); // status; + s.syncAsUint32LE(entry->type); // type; + s.syncAsUint32LE(entry->field_1C); // field_8; + s.syncAsUint32LE(entry->time); // time; + s.syncAsUint32LE(entry->field_34); // field_10; + s.syncAsUint32LE(entry->field_38); // field_14; + s.syncAsUint32LE(entry->entity); // entity; + + uint32 field_1C = entry->field_48 - _data2; + if (field_1C > kFlag8) + field_1C = 0; + s.syncAsUint32LE(field_1C); // field_1C; + + s.syncAsUint32LE(entry->field_4C); // field_20; + + char name1[16]; + strcpy((char *)&name1, entry->name1.c_str()); + s.syncBytes((byte *)&name1, 16); + + char name2[16]; + strcpy((char *)&name2, entry->name2.c_str()); + s.syncBytes((byte *)&name2, 16); + } + } + } else { + error("Sound::saveLoadWithSerializer: not implemented!"); + } } ////////////////////////////////////////////////////////////////////////// |