aboutsummaryrefslogtreecommitdiff
path: root/engines/agi
diff options
context:
space:
mode:
authorFilippos Karapetis2007-10-31 21:28:33 +0000
committerFilippos Karapetis2007-10-31 21:28:33 +0000
commit39da7deefb0b55412d871165c563d0a11dcfe61f (patch)
treedc0e1d262ac15ff2268af93376de1f2c9b7731c3 /engines/agi
parent5add473048289ed235d69825cfc44a84a24118af (diff)
downloadscummvm-rg350-39da7deefb0b55412d871165c563d0a11dcfe61f.tar.gz
scummvm-rg350-39da7deefb0b55412d871165c563d0a11dcfe61f.tar.bz2
scummvm-rg350-39da7deefb0b55412d871165c563d0a11dcfe61f.zip
Fix for bug #1751483 - "AGI: The -x command-line option appears to be broken"
svn-id: r29346
Diffstat (limited to 'engines/agi')
-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) {