[Scummvm-git-logs] scummvm master -> 55d783198c7cb7f569b74cf6b66807f89394ada5
dreammaster
noreply at scummvm.org
Thu Dec 30 06:17:42 UTC 2021
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:
55d783198c XEEN: Debugger command for loading original savegames
Commit: 55d783198c7cb7f569b74cf6b66807f89394ada5
https://github.com/scummvm/scummvm/commit/55d783198c7cb7f569b74cf6b66807f89394ada5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2021-12-29T22:17:24-08:00
Commit Message:
XEEN: Debugger command for loading original savegames
Changed paths:
engines/xeen/debugger.cpp
engines/xeen/debugger.h
engines/xeen/files.h
diff --git a/engines/xeen/debugger.cpp b/engines/xeen/debugger.cpp
index 6cdc574034b..00dd4872028 100644
--- a/engines/xeen/debugger.cpp
+++ b/engines/xeen/debugger.cpp
@@ -22,6 +22,7 @@
#include "common/file.h"
#include "xeen/xeen.h"
#include "xeen/debugger.h"
+#include "xeen/files.h"
namespace Xeen {
@@ -59,6 +60,7 @@ Debugger::Debugger(XeenEngine *vm) : GUI::Debugger(), _vm(vm),
registerCmd("invincible", WRAP_METHOD(Debugger, cmdInvincible));
registerCmd("strength", WRAP_METHOD(Debugger, cmdSuperStrength));
registerCmd("intangible", WRAP_METHOD(Debugger, cmdIntangible));
+ registerCmd("load", WRAP_METHOD(Debugger, cmdLoadOriginal));
}
void Debugger::onFrame() {
@@ -219,4 +221,55 @@ bool Debugger::cmdIntangible(int argc, const char **argv) {
return true;
}
+bool Debugger::cmdLoadOriginal(int argc, const char **argv) {
+ Combat &combat = *g_vm->_combat;
+ FileManager &files = *g_vm->_files;
+ Interface &intf = *g_vm->_interface;
+ Map &map = *g_vm->_map;
+ Party &party = *g_vm->_party;
+
+ if (argc != 3) {
+ debugPrintf("load <game path> <savegame slot>: Loads original save\n");
+ return true;
+ }
+
+ // Loop through loading the sides' save archives
+ SaveArchive *archives[2] = { File::_xeenSave, File::_darkSave };
+ CCArchive *cc[2] = { File::_xeenCc, File::_darkCc };
+ const char *prefix[2] = { "XEEN", "DARK" };
+
+ Common::FSNode folder(argv[1]);
+
+ for (int idx = 0; idx < 2; ++idx) {
+ Common::FSNode fsNode = folder.getChild(
+ Common::String::format("%s%.2d.SAV", prefix[idx], strToInt(argv[2])));
+ Common::File f;
+
+ if (f.open(fsNode)) {
+ archives[idx]->load(f);
+ f.close();
+ } else {
+ archives[idx]->reset(cc[idx]);
+ }
+ }
+
+ // TODO: Figure out to set correct side from original saves
+ files.setGameCc(_vm->getGameID() == GType_DarkSide ? 1 : 0);
+
+ // Load the character roster and party
+ File::_currentSave->loadParty();
+
+ // Reset any combat information from the previous game
+ combat.reset();
+ party._treasure.reset();
+
+ // Load the new map
+ map.clearMaze();
+ map._loadCcNum = files._ccNum;
+ map.load(party._mazeId);
+
+ intf.drawParty(true);
+ return false;
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/debugger.h b/engines/xeen/debugger.h
index aa58c68b432..7ae619f8778 100644
--- a/engines/xeen/debugger.h
+++ b/engines/xeen/debugger.h
@@ -83,6 +83,12 @@ private:
* Flags whether to make the party invincible
*/
bool cmdIntangible(int argc, const char **argv);
+
+ /**
+ * Tries to load an original savegame
+ */
+ bool cmdLoadOriginal(int argc, const char **argv);
+
public:
bool _invincible;
bool _intangible;
diff --git a/engines/xeen/files.h b/engines/xeen/files.h
index 89f9d7efb05..51807b88996 100644
--- a/engines/xeen/files.h
+++ b/engines/xeen/files.h
@@ -118,6 +118,7 @@ class File : public Common::File {
friend class FileManager;
friend class OutFile;
friend class SavesManager;
+ friend class Debugger;
private:
static CCArchive *_xeenCc, *_darkCc, *_introCc;
static SaveArchive *_xeenSave, *_darkSave;
More information about the Scummvm-git-logs
mailing list