aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/agi/agi.cpp22
-rw-r--r--engines/agi/agi.h1
-rw-r--r--engines/agi/menu.cpp5
3 files changed, 19 insertions, 9 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index d78a2dc587..a8d521ff69 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -247,6 +247,19 @@ void AgiEngine::processEvents() {
}
}
+void AgiEngine::checkQuickLoad() {
+ if (ConfMan.hasKey("save_slot")) {
+ char saveNameBuffer[256];
+
+ snprintf (saveNameBuffer, 256, "%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot"));
+
+ if (loadGame(saveNameBuffer, false) == errOK) { // Do not check game id
+ _game.exitAllLogics = 1;
+ _menu->enableAll();
+ }
+ }
+}
+
int AgiEngine::agiIsKeypressLow() {
processEvents();
return _keyQueueStart != _keyQueueEnd;
@@ -437,15 +450,6 @@ int AgiEngine::agiInit() {
if (ec == errOK)
ec = _loader->loadResource(rLOGIC, 0);
-
- if (ConfMan.hasKey("save_slot")) {
- char saveNameBuffer[256];
-
- snprintf (saveNameBuffer, 256, "%s.%03d", _targetName.c_str(), ConfMan.getInt("save_slot"));
-
- loadGame(saveNameBuffer, false); // Do not check game id
- }
-
#ifdef __DS__
// Normally, the engine loads the predictive text dictionary when the predictive dialog
// is shown. On the DS version, the word completion feature needs the dictionary too.
diff --git a/engines/agi/agi.h b/engines/agi/agi.h
index 03965681f1..358660619b 100644
--- a/engines/agi/agi.h
+++ b/engines/agi/agi.h
@@ -811,6 +811,7 @@ public:
void allowSynthetic(bool);
void processEvents();
+ void checkQuickLoad();
// Objects
int showObjects();
diff --git a/engines/agi/menu.cpp b/engines/agi/menu.cpp
index 916c4c184f..cad3da5721 100644
--- a/engines/agi/menu.cpp
+++ b/engines/agi/menu.cpp
@@ -260,6 +260,11 @@ void Menu::submit() {
--iter;
}
}
+
+ // We need to wait till the main menu is submitted by the game scripts
+ // before checking if we can start loading a save game from the command line.
+ // Menu initialization and submital takes place when the game starts only
+ _vm->checkQuickLoad();
}
bool Menu::keyhandler(int key) {