aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2015-01-02 04:52:53 +0200
committerFilippos Karapetis2015-01-07 11:42:24 +0200
commit9f642074ba8e17aa23b01bcee82b2293fe84f8f1 (patch)
treeb6fb8b1dd23272d16484d994cdce7b5d7cf75a46
parent9420cc2faaa54a782084d7386be29e72d97ffcef (diff)
downloadscummvm-rg350-9f642074ba8e17aa23b01bcee82b2293fe84f8f1.tar.gz
scummvm-rg350-9f642074ba8e17aa23b01bcee82b2293fe84f8f1.tar.bz2
scummvm-rg350-9f642074ba8e17aa23b01bcee82b2293fe84f8f1.zip
ZVISION: Remove ActionRestoreGame and loading of r.svr (restart slot)
This is handled internally now, so r.svr isn't needed anymore
-rw-r--r--engines/zvision/scripting/actions.cpp19
-rw-r--r--engines/zvision/scripting/actions.h9
-rw-r--r--engines/zvision/scripting/scr_file_handling.cpp4
-rw-r--r--engines/zvision/scripting/script_manager.cpp6
-rw-r--r--engines/zvision/scripting/script_manager.h1
5 files changed, 10 insertions, 29 deletions
diff --git a/engines/zvision/scripting/actions.cpp b/engines/zvision/scripting/actions.cpp
index a61fa26223..e41ac90c20 100644
--- a/engines/zvision/scripting/actions.cpp
+++ b/engines/zvision/scripting/actions.cpp
@@ -22,14 +22,13 @@
#include "common/scummsys.h"
-#include "zvision/scripting/actions.h"
-
#include "zvision/zvision.h"
#include "zvision/scripting/script_manager.h"
#include "zvision/graphics/render_manager.h"
#include "zvision/sound/zork_raw.h"
#include "zvision/video/zork_avi_decoder.h"
#include "zvision/file/save_manager.h"
+#include "zvision/scripting/actions.h"
#include "zvision/scripting/menu.h"
#include "zvision/scripting/effects/timer_effect.h"
#include "zvision/scripting/effects/music_effect.h"
@@ -804,22 +803,6 @@ bool ActionRandom::execute() {
}
//////////////////////////////////////////////////////////////////////////////
-// ActionRestoreGame
-//////////////////////////////////////////////////////////////////////////////
-
-ActionRestoreGame::ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line) :
- ResultAction(engine, slotkey) {
- char buf[128];
- sscanf(line.c_str(), "%s", buf);
- _fileName = Common::String(buf);
-}
-
-bool ActionRestoreGame::execute() {
- _engine->getSaveManager()->loadGame(_fileName);
- return false;
-}
-
-//////////////////////////////////////////////////////////////////////////////
// ActionRotateTo
//////////////////////////////////////////////////////////////////////////////
diff --git a/engines/zvision/scripting/actions.h b/engines/zvision/scripting/actions.h
index 8d43309b74..c2350bc83a 100644
--- a/engines/zvision/scripting/actions.h
+++ b/engines/zvision/scripting/actions.h
@@ -340,15 +340,6 @@ private:
ValueSlot *_max;
};
-class ActionRestoreGame : public ResultAction {
-public:
- ActionRestoreGame(ZVision *engine, int32 slotkey, const Common::String &line);
- bool execute();
-
-private:
- Common::String _fileName;
-};
-
class ActionRotateTo : public ResultAction {
public:
ActionRotateTo(ZVision *engine, int32 slotkey, const Common::String &line);
diff --git a/engines/zvision/scripting/scr_file_handling.cpp b/engines/zvision/scripting/scr_file_handling.cpp
index 227c43557c..7856bf7b2e 100644
--- a/engines/zvision/scripting/scr_file_handling.cpp
+++ b/engines/zvision/scripting/scr_file_handling.cpp
@@ -270,7 +270,9 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis
// Only used by Zork: Nemesis
actionList.push_back(new ActionRegion(_engine, slot, args));
} else if (act.matchString("restore_game", true)) {
- actionList.push_back(new ActionRestoreGame(_engine, slot, args));
+ // Only used by ZGI to load the restart game slot, r.svr.
+ _engine->getScriptManager()->reset();
+ _engine->getScriptManager()->changeLocation('g', 'a', 'r', 'y', 0);
} else if (act.matchString("rotate_to", true)) {
actionList.push_back(new ActionRotateTo(_engine, slot, args));
} else if (act.matchString("save_game", true)) {
diff --git a/engines/zvision/scripting/script_manager.cpp b/engines/zvision/scripting/script_manager.cpp
index 464e8bfe4d..ba38d3a0e4 100644
--- a/engines/zvision/scripting/script_manager.cpp
+++ b/engines/zvision/scripting/script_manager.cpp
@@ -686,7 +686,7 @@ void ScriptManager::serialize(Common::WriteStream *stream) {
stream->writeSint16LE(getStateValue(i));
}
-void ScriptManager::deserialize(Common::SeekableReadStream *stream) {
+void ScriptManager::reset() {
// Clear out the current table values
_globalState.clear();
_globalStateFlags.clear();
@@ -706,6 +706,10 @@ void ScriptManager::deserialize(Common::SeekableReadStream *stream) {
_activeSideFx.clear();
_referenceTable.clear();
+}
+
+void ScriptManager::deserialize(Common::SeekableReadStream *stream) {
+ reset();
if (stream->readUint32BE() != MKTAG('Z', 'N', 'S', 'G') || stream->readUint32LE() != 4) {
changeLocation('g', 'a', 'r', 'y', 0);
diff --git a/engines/zvision/scripting/script_manager.h b/engines/zvision/scripting/script_manager.h
index 78c1b77dea..136b3427f7 100644
--- a/engines/zvision/scripting/script_manager.h
+++ b/engines/zvision/scripting/script_manager.h
@@ -247,6 +247,7 @@ public:
void serialize(Common::WriteStream *stream);
void deserialize(Common::SeekableReadStream *stream);
+ void reset();
Location getCurrentLocation() const;
Location getLastLocation();