diff options
author | Paul Gilbert | 2015-01-07 22:11:18 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-01-07 22:11:18 -0500 |
commit | 96d086ab9cc28a2145072487b60036f916b28774 (patch) | |
tree | 93b880f20ecb1d2730c90cbe3b684ecaf3d07845 /engines/xeen/saves.cpp | |
parent | cd7c00ca8c93258d7b6c3ef92fc32452df1052cb (diff) | |
download | scummvm-rg350-96d086ab9cc28a2145072487b60036f916b28774.tar.gz scummvm-rg350-96d086ab9cc28a2145072487b60036f916b28774.tar.bz2 scummvm-rg350-96d086ab9cc28a2145072487b60036f916b28774.zip |
XEEN: Add prefix support to CC files, initial save state fixes
Diffstat (limited to 'engines/xeen/saves.cpp')
-rw-r--r-- | engines/xeen/saves.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp index ae29dd1149..36bb7bda1a 100644 --- a/engines/xeen/saves.cpp +++ b/engines/xeen/saves.cpp @@ -99,10 +99,39 @@ void SavesManager::load(Common::SeekableReadStream *stream) { * Sets up the dynamic data for the game for a new game */ void SavesManager::reset() { - Common::String name(_vm->getGameID() == GType_Clouds ? "xeen.cur" : "dark.cur"); - File f(name); + Common::String prefix = _vm->getGameID() == GType_Clouds ? "xeen|" : "dark|"; + Common::MemoryWriteStreamDynamic saveFile(DisposeAfterUse::YES); + Common::File fIn; + + for (int i = 0; i <= 5; ++i) { + Common::String filename = prefix + Common::String::format("2A%dC", i); + if (fIn.exists(filename)) { + // Read in the next resource + fIn.open(filename); + byte *data = new byte[fIn.size()]; + fIn.read(data, fIn.size()); + + // Copy it to the combined savefile resource + saveFile.write(data, fIn.size()); + delete[] data; + fIn.close(); + } + } + Common::MemoryReadStream f(saveFile.getData(), saveFile.size()); load(&f); + + // Set up the party and characters from dark.cur + CCArchive gameCur("xeen.cur", false); + File fParty("maze.pty", gameCur); + Common::Serializer sParty(&fParty, nullptr); + _party.synchronize(sParty); + fParty.close(); + + File fChar("maze.chr", gameCur); + Common::Serializer sChar(&fChar, nullptr); + _roster.synchronize(sChar); + fChar.close(); } void SavesManager::readCharFile() { |