[Scummvm-git-logs] scummvm master -> 5eb03885729f9cc8e80e6312cf08a53a3f8a5709
dreammaster
dreammaster at scummvm.org
Sat Jan 13 23:29:49 CET 2018
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5eb0388572 XEEN: Saving fixes for party and roster
Commit: 5eb03885729f9cc8e80e6312cf08a53a3f8a5709
https://github.com/scummvm/scummvm/commit/5eb03885729f9cc8e80e6312cf08a53a3f8a5709
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2018-01-13T17:29:40-05:00
Commit Message:
XEEN: Saving fixes for party and roster
Changed paths:
engines/xeen/files.cpp
engines/xeen/files.h
engines/xeen/saves.cpp
diff --git a/engines/xeen/files.cpp b/engines/xeen/files.cpp
index 705a940..164313c 100644
--- a/engines/xeen/files.cpp
+++ b/engines/xeen/files.cpp
@@ -245,6 +245,14 @@ void FileManager::setGameCc(int ccMode) {
_isDarkCc = ccMode != 0;
}
+void FileManager::load(Common::SeekableReadStream &stream) {
+ setGameCc(stream.readByte());
+}
+
+void FileManager::save(Common::WriteStream &s) {
+ s.writeByte(_isDarkCc ? 1 : 0);
+}
+
/*------------------------------------------------------------------------*/
CCArchive *File::_xeenCc;
@@ -474,10 +482,12 @@ void SaveArchive::save(Common::WriteStream &s) {
OutFile chr("maze.chr", this);
XeenSerializer sChr(nullptr, &chr);
_party->_roster.synchronize(sChr);
+ chr.finalize();
OutFile pty("maze.pty", this);
Common::Serializer sPty(nullptr, &pty);
_party->synchronize(sPty);
+ pty.finalize();
// First caclculate file offsets for each resource, since replaced resources
// will shift file offsets for even the succeeding unchanged resources
diff --git a/engines/xeen/files.h b/engines/xeen/files.h
index b528658..ff10db5 100644
--- a/engines/xeen/files.h
+++ b/engines/xeen/files.h
@@ -93,6 +93,16 @@ public:
* @param ccMode 0=Clouds, 1=Dark Side
*/
void setGameCc(int ccMode);
+
+ /**
+ * Loads a save archive from a stream
+ */
+ void load(Common::SeekableReadStream &stream);
+
+ /**
+ * Saves a save archive to a savegame
+ */
+ void save(Common::WriteStream &s);
};
/**
diff --git a/engines/xeen/saves.cpp b/engines/xeen/saves.cpp
index 2a6b7d6..f84176c 100644
--- a/engines/xeen/saves.cpp
+++ b/engines/xeen/saves.cpp
@@ -159,6 +159,10 @@ Common::Error SavesManager::saveGameState(int slot, const Common::String &desc)
}
}
+ // Write out miscellaneous
+ FileManager &files = *g_vm->_files;
+ files.save(*out);
+
out->finalize();
delete out;
@@ -166,6 +170,11 @@ Common::Error SavesManager::saveGameState(int slot, const Common::String &desc)
}
Common::Error SavesManager::loadGameState(int slot) {
+ EventsManager &events = *g_vm->_events;
+ FileManager &files = *g_vm->_files;
+ Map &map = *g_vm->_map;
+ Party &party = *g_vm->_party;
+
Common::InSaveFile *saveFile = g_system->getSavefileManager()->openForLoading(
generateSaveName(slot));
if (!saveFile)
@@ -182,7 +191,7 @@ Common::Error SavesManager::loadGameState(int slot) {
}
// Set the total play time
- g_vm->_events->setPlayTime(header._totalFrames);
+ events.setPlayTime(header._totalFrames);
// Loop through loading the sides' save archives
SaveArchive *archives[2] = { File::_xeenSave, File::_darkSave };
@@ -198,6 +207,12 @@ Common::Error SavesManager::loadGameState(int slot) {
}
}
+ // Read in miscellaneous
+ files.load(*saveFile);
+
+ // Load the new map
+ map.load(party._mazeId);
+
return Common::kNoError;
}
More information about the Scummvm-git-logs
mailing list