aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/events.cpp
diff options
context:
space:
mode:
authorStrangerke2011-09-04 14:28:12 +0200
committerStrangerke2011-09-04 14:28:12 +0200
commit76f410958a6682406264032c401b80f322749950 (patch)
tree4cbb06d8ac6adf4eb20ca56653fabbfddee6b6af /engines/cge/events.cpp
parent56e57cf3807642ceff2460c255322325c779fb2e (diff)
downloadscummvm-rg350-76f410958a6682406264032c401b80f322749950.tar.gz
scummvm-rg350-76f410958a6682406264032c401b80f322749950.tar.bz2
scummvm-rg350-76f410958a6682406264032c401b80f322749950.zip
CGE: Use F5/F7 to display the save/load dialog box
Diffstat (limited to 'engines/cge/events.cpp')
-rw-r--r--engines/cge/events.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/engines/cge/events.cpp b/engines/cge/events.cpp
index 5af5a9ee3f..9cbf889dfe 100644
--- a/engines/cge/events.cpp
+++ b/engines/cge/events.cpp
@@ -25,6 +25,10 @@
* Copyright (c) 1994-1995 Janus B. Wisniewski and L.K. Avalon
*/
+#include "gui/saveload.h"
+#include "gui/about.h"
+#include "gui/message.h"
+#include "common/config-manager.h"
#include "common/events.h"
#include "cge/events.h"
#include "cge/events.h"
@@ -81,7 +85,7 @@ const uint16 Keyboard::_scummVmCodes[0x60] = {
0
};
-Keyboard::Keyboard() : _client(NULL) {
+Keyboard::Keyboard(CGEEngine *vm) : _client(NULL), _vm(vm) {
Common::set_to(&_key[0], &_key[0x60], false);
_current = 0;
}
@@ -108,6 +112,33 @@ bool Keyboard::getKey(Common::Event &event, int &cgeCode) {
cgeCode = 28;
return true;
}
+ if (keycode == Common::KEYCODE_F5) {
+ warning("keycode %d", event.kbd.ascii);
+ if (_vm->canSaveGameStateCurrently()) {
+ const EnginePlugin *plugin = NULL;
+ EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
+
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save");
+ dialog->setSaveMode(true);
+ int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ Common::String savegameDescription = dialog->getResultString();
+ delete dialog;
+ _vm->saveGameState(savegameId, savegameDescription);
+ }
+ return false;
+ } else if (keycode == Common::KEYCODE_F7) {
+ if (_vm->canLoadGameStateCurrently()) {
+ const EnginePlugin *plugin = NULL;
+ EngineMan.findGame(_vm->_gameDescription->gameid, &plugin);
+
+ GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore");
+ dialog->setSaveMode(false);
+ int16 savegameId = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
+ delete dialog;
+ _vm->loadGameState(savegameId);
+ }
+ return false;
+ }
// Scan through the ScummVM mapping list
for (int idx = 0; idx < 0x60; idx++) {