aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirben2014-08-20 09:26:39 +1000
committerKirben2014-08-20 09:26:39 +1000
commitaca10de1b58acf21aeaf0af18d5ca82511ce93f2 (patch)
tree6a439e6f01d569f6103eb4a92b44160b3c1b2022
parent7761c75c31eb8bb7b9794649fe9a7fbbccdced03 (diff)
downloadscummvm-rg350-aca10de1b58acf21aeaf0af18d5ca82511ce93f2.tar.gz
scummvm-rg350-aca10de1b58acf21aeaf0af18d5ca82511ce93f2.tar.bz2
scummvm-rg350-aca10de1b58acf21aeaf0af18d5ca82511ce93f2.zip
SCUMM: Add support for quit script in HE90+ games.
-rw-r--r--engines/scumm/script.cpp12
-rw-r--r--engines/scumm/scumm.cpp3
-rw-r--r--engines/scumm/scumm.h3
-rw-r--r--engines/scumm/vars.cpp1
4 files changed, 19 insertions, 0 deletions
diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 2c672ccc89..2fe5333bfc 100644
--- a/engines/scumm/script.cpp
+++ b/engines/scumm/script.cpp
@@ -972,6 +972,18 @@ void ScummEngine::runEntryScript() {
runScript(VAR(VAR_ENTRY_SCRIPT2), 0, 0, 0);
}
+void ScummEngine::runQuitScript() {
+ if (VAR_QUIT_SCRIPT != 0xFF && VAR(VAR_QUIT_SCRIPT)) {
+ int args[NUM_SCRIPT_LOCAL];
+
+ memset(args, 0, sizeof(args));
+ args[0] = 2;
+ args[1] = 1003;
+
+ runScript(VAR(VAR_QUIT_SCRIPT), 0, 0, args);
+ }
+}
+
void ScummEngine::killScriptsAndResources() {
ScriptSlot *ss;
int i;
diff --git a/engines/scumm/scumm.cpp b/engines/scumm/scumm.cpp
index 73776bad5a..475b146a7b 100644
--- a/engines/scumm/scumm.cpp
+++ b/engines/scumm/scumm.cpp
@@ -467,6 +467,8 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
VAR_NUM_SCRIPT_CYCLES = 0xFF;
VAR_SCRIPT_CYCLE = 0xFF;
+ VAR_QUIT_SCRIPT = 0xFF;
+
VAR_NUM_GLOBAL_OBJS = 0xFF;
// Use g_scumm from error() ONLY
@@ -2073,6 +2075,7 @@ Common::Error ScummEngine::go() {
if (shouldQuit()) {
// TODO: Maybe perform an autosave on exit?
+ runQuitScript();
}
}
diff --git a/engines/scumm/scumm.h b/engines/scumm/scumm.h
index 36d05077c6..af118a89a1 100644
--- a/engines/scumm/scumm.h
+++ b/engines/scumm/scumm.h
@@ -671,6 +671,7 @@ protected:
virtual void checkAndRunSentenceScript();
void runExitScript();
void runEntryScript();
+ void runQuitScript();
void runAllScripts();
void freezeScripts(int scr);
void unfreezeScripts();
@@ -1361,6 +1362,8 @@ public:
byte VAR_SCRIPT_CYCLE; // Used in runScript()/runObjectScript()
byte VAR_NUM_SCRIPT_CYCLES; // Used in runAllScripts()
+
+ byte VAR_QUIT_SCRIPT; // Used in confirmExitDialog()
// Exists both in V7 and in V72HE:
byte VAR_NUM_GLOBAL_OBJS;
diff --git a/engines/scumm/vars.cpp b/engines/scumm/vars.cpp
index 79d7ed03da..a903ac5804 100644
--- a/engines/scumm/vars.cpp
+++ b/engines/scumm/vars.cpp
@@ -320,6 +320,7 @@ void ScummEngine_v90he::setupScummVars() {
ScummEngine_v80he::setupScummVars();
VAR_TIMER = 97;
+ VAR_QUIT_SCRIPT = 102;
VAR_SCRIPT_CYCLE = 103;
VAR_NUM_SCRIPT_CYCLES = 104;