aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
Diffstat (limited to 'scumm')
-rw-r--r--scumm/script_v2.cpp2
-rw-r--r--scumm/script_v5.cpp16
-rw-r--r--scumm/script_v6.cpp16
-rw-r--r--scumm/script_v8.cpp11
-rw-r--r--scumm/scumm.h5
-rw-r--r--scumm/scummvm.cpp38
6 files changed, 60 insertions, 28 deletions
diff --git a/scumm/script_v2.cpp b/scumm/script_v2.cpp
index 9990c95ec2..25ebfbe207 100644
--- a/scumm/script_v2.cpp
+++ b/scumm/script_v2.cpp
@@ -708,7 +708,7 @@ void Scumm_v2::o2_actorSet() {
}
void Scumm_v2::o2_restart() {
- warning("o2_restart NYI");
+ restart();
}
void Scumm_v2::o2_drawObject() {
diff --git a/scumm/script_v5.cpp b/scumm/script_v5.cpp
index 2eb939b018..11249eca24 100644
--- a/scumm/script_v5.cpp
+++ b/scumm/script_v5.cpp
@@ -1478,13 +1478,19 @@ void Scumm_v5::o5_putActorInRoom() {
}
void Scumm_v5::o5_quitPauseRestart() {
- switch (fetchScriptByte()) {
- case 1:
- pauseGame(false);
+ byte subOp = fetchScriptByte();
+ switch (subOp) {
+ case 1: // Restart
+ restart();
break;
- case 3:
- shutDown(0);
+ case 2: // Pause
+ pauseGame();
break;
+ case 3: // Quit
+ shutDown();
+ break;
+ default:
+ error("o5_quitPauseRestart invalid case %d\n", subOp);
}
}
diff --git a/scumm/script_v6.cpp b/scumm/script_v6.cpp
index 255165a48f..1cf1b3066b 100644
--- a/scumm/script_v6.cpp
+++ b/scumm/script_v6.cpp
@@ -2140,15 +2140,19 @@ void Scumm_v6::o6_isAnyOf() {
}
void Scumm_v6::o6_quitPauseRestart() {
- switch (fetchScriptByte()) {
- case 158:
- pauseGame(false);
+ byte subOp = fetchScriptByte();
+ switch (subOp) {
+ case 158: // Restart
+ restart();
+ break;
+ case 159: // Pause
+ pauseGame();
break;
- case 160:
- shutDown(0);
+ case 160: // Quit
+ shutDown();
break;
default:
- error("o6_quitPauseRestart: invalid case");
+ error("o6_quitPauseRestart invalid case %d\n", subOp);
}
}
diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp
index 2f228ed851..c26a6ac3de 100644
--- a/scumm/script_v8.cpp
+++ b/scumm/script_v8.cpp
@@ -1312,17 +1312,16 @@ void Scumm_v8::o8_soundKludge() {
}
void Scumm_v8::o8_system() {
- // TODO
byte subOp = fetchScriptByte();
switch (subOp) {
case 0x28: // SO_SYSTEM_RESTART Restart game
-// pauseGame(false);
-// break;
+ restart();
+ break;
case 0x29: // SO_SYSTEM_QUIT Quit game
-// shutDown(0);
-// break;
+ shutDown();
+ break;
default:
- error("o8_system: default case 0x%x", subOp);
+ error("o8_system: invalid case 0x%x", subOp);
}
}
diff --git a/scumm/scumm.h b/scumm/scumm.h
index 746c1ea18e..cec7b30acd 100644
--- a/scumm/scumm.h
+++ b/scumm/scumm.h
@@ -345,8 +345,9 @@ public:
bool _videoFinished;
bool _smushPlay;
- void pauseGame(bool user);
- void shutDown(int i);
+ void pauseGame();
+ void restart();
+ void shutDown();
void setOptions(void);
#ifdef __PALM_OS__
diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp
index c171c16a08..8e783ae8d5 100644
--- a/scumm/scummvm.cpp
+++ b/scumm/scummvm.cpp
@@ -1676,7 +1676,7 @@ int Scumm::checkKeyHit() {
return a;
}
-void Scumm::pauseGame(bool user) {
+void Scumm::pauseGame() {
pauseDialog();
}
@@ -1745,9 +1745,31 @@ char Scumm::displayError(bool showCancel, const char *message, ...) {
return result;
}
-void Scumm::shutDown(int i) {
- /* TODO: implement this */
- warning("shutDown: not implemented");
+void Scumm::shutDown() {
+ // FIXME: This is ugly
+ _system->quit();
+}
+
+void Scumm::restart() {
+ // TODO: implement restart
+ // To implement this, there are two approaches (at least):
+ // 1) Manually cleanup all vars, etc. and run the bootscript again
+ // 2) Use the savegame system
+ // For 2, we could modify the savegame system to allow us to "save" to a memory
+ // block. We then do that at the start of the game, just before invoking the
+ // bootscript (or maybe just after launching it, whatever). Then to restart
+ // we simply load the state. Easy, hu? :-)
+ //
+ // For 1), we first have to clean up / restructure the current init code. Right now
+ // we have the code which inits the state spread over at least these functions:
+ // The constructor, launch, scummInit, readIndexFile
+ // Problem is, the init code is not very logically distributed over those.
+ // We should first clean this up... Code that sets up fixed state (e.g. gdi._vm = this)
+ // can be moved to either the constructor or maybe scummInit. Code that
+ // might be useful for restart should be moved to a seperate function.
+ // Finally, all the init code in launch should go - launch should only contain
+ // a few function calls and not much else, iMHO.
+ error("Restart not implemented");
}
void Scumm::processKbd() {
@@ -1789,14 +1811,13 @@ void Scumm::processKbd() {
if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY)) {
warning("Restart not implemented");
-// pauseGame(true);
+ //restart();
return;
}
if ((VAR_PAUSE_KEY != 0xFF && _lastKeyHit == VAR(VAR_PAUSE_KEY)) ||
(VAR_PAUSE_KEY == 0xFF && _lastKeyHit == ' ')) {
- pauseGame(true);
- /* pause */
+ pauseGame();
return;
}
@@ -2331,8 +2352,9 @@ void Scumm::launch() {
_sound->setupSound();
// If requested, load a save game instead of running the boot script
- if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveLoadCompatible))
+ if (_saveLoadFlag != 2 || !loadState(_saveLoadSlot, _saveLoadCompatible)) {
runScript(1, 0, 0, &_bootParam);
+ }
}
void Scumm::go() {