aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/groovie/script.cpp')
-rw-r--r--engines/groovie/script.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 3ba3d5d78a..b68c41831e 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -175,7 +175,15 @@ void Script::directGameLoad(int slot) {
return;
}
- // TODO: Return to the main script, likely reusing most of o_returnscript()
+ // Return to the main script if required
+ if (_savedCode) {
+ // Returning the correct spot, dealing with _savedVariables, etc
+ // is not needed as game state is getting nuked anyway
+ delete[] _code;
+ _code = _savedCode;
+ _codeSize = _savedCodeSize;
+ _savedCode = nullptr;
+ }
// HACK: We set the slot to load in the appropriate variable, and set the
// current instruction to the one that actually loads the saved game
@@ -396,6 +404,11 @@ void Script::loadgame(uint slot) {
_vm->_grvCursorMan->show(false);
}
+bool Script::canDirectSave() const {
+ // Disallow when running a subscript
+ return _savedCode == nullptr;
+}
+
void Script::directGameSave(int slot, const Common::String &desc) {
if (slot < 0 || slot > MAX_SAVES - 1) {
return;