aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cge/cge.cpp2
-rw-r--r--engines/cge/events.cpp33
-rw-r--r--engines/cge/events.h3
3 files changed, 35 insertions, 3 deletions
diff --git a/engines/cge/cge.cpp b/engines/cge/cge.cpp
index 514580bbe3..b56635125d 100644
--- a/engines/cge/cge.cpp
+++ b/engines/cge/cge.cpp
@@ -121,7 +121,7 @@ void CGEEngine::init() {
_snail_ = new Snail(this, true);
_mouse = new Mouse(this);
- _keyboard = new Keyboard();
+ _keyboard = new Keyboard(this);
_eventManager = new EventManager();
_fx = new Fx(16); // must precede SOUND!!
_sound = new Sound(this);
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++) {
diff --git a/engines/cge/events.h b/engines/cge/events.h
index 62841dabe4..f170455fa7 100644
--- a/engines/cge/events.h
+++ b/engines/cge/events.h
@@ -84,6 +84,7 @@ class Keyboard {
private:
bool getKey(Common::Event &event, int &cgeCode);
uint16 _current;
+ CGEEngine *_vm;
public:
static const uint16 _code[0x60];
static const uint16 _scummVmCodes[0x60];
@@ -95,7 +96,7 @@ public:
uint16 lastKey();
Sprite *setClient(Sprite *spr);
- Keyboard();
+ Keyboard(CGEEngine *vm);
~Keyboard();
};