[Scummvm-cvs-logs] scummvm master -> aca10de1b58acf21aeaf0af18d5ca82511ce93f2

Kirben kirben at optusnet.com.au
Wed Aug 20 01:27:28 CEST 2014


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:
aca10de1b5 SCUMM: Add support for quit script in HE90+ games.


Commit: aca10de1b58acf21aeaf0af18d5ca82511ce93f2
    https://github.com/scummvm/scummvm/commit/aca10de1b58acf21aeaf0af18d5ca82511ce93f2
Author: Kirben (kirben at optusnet.com.au)
Date: 2014-08-20T09:26:39+10:00

Commit Message:
SCUMM: Add support for quit script in HE90+ games.

Changed paths:
    engines/scumm/script.cpp
    engines/scumm/scumm.cpp
    engines/scumm/scumm.h
    engines/scumm/vars.cpp



diff --git a/engines/scumm/script.cpp b/engines/scumm/script.cpp
index 2c672cc..2fe5333 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 73776ba..475b146 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 36d0507..af118a8 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 79d7ed0..a903ac5 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;
 






More information about the Scummvm-git-logs mailing list