aboutsummaryrefslogtreecommitdiff
path: root/engines/xeen/saves.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2015-01-07 22:11:18 -0500
committerPaul Gilbert2015-01-07 22:11:18 -0500
commit96d086ab9cc28a2145072487b60036f916b28774 (patch)
tree93b880f20ecb1d2730c90cbe3b684ecaf3d07845 /engines/xeen/saves.cpp
parentcd7c00ca8c93258d7b6c3ef92fc32452df1052cb (diff)
downloadscummvm-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.cpp33
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() {