From c4911135c152b9f7eb082dee1af79d82932e72c0 Mon Sep 17 00:00:00 2001 From: Marisa-Chan Date: Wed, 12 Nov 2014 15:50:18 +0600 Subject: ZVISION: Implement keyboard hotkeys --- engines/zvision/core/events.cpp | 27 +++++++++++++++++++++++++++ engines/zvision/zvision.h | 1 + 2 files changed, 28 insertions(+) (limited to 'engines') diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp index 97565dd4d7..72e3fa6d34 100644 --- a/engines/zvision/core/events.cpp +++ b/engines/zvision/core/events.cpp @@ -31,6 +31,7 @@ #include "zvision/animation/rlf_animation.h" #include "zvision/core/menu.h" #include "zvision/utility/win_keys.h" +#include "zvision/core/menu.h" #include "zvision/sound/zork_raw.h" #include "common/events.h" @@ -42,6 +43,31 @@ namespace ZVision { +void ZVision::shortKeys(Common::Event event) { + if (event.kbd.hasFlags(Common::KBD_CTRL)) { + switch (event.kbd.keycode) { + case Common::KEYCODE_s: + if (getMenuBarEnable() & menuBar_Save) + _scriptManager->changeLocation('g', 'j', 's', 'e', 0); + break; + case Common::KEYCODE_r: + if (getMenuBarEnable() & menuBar_Restore) + _scriptManager->changeLocation('g', 'j', 'r', 'e', 0); + break; + case Common::KEYCODE_p: + if (getMenuBarEnable() & menuBar_Settings) + _scriptManager->changeLocation('g', 'j', 'p', 'e', 0); + break; + case Common::KEYCODE_q: + if (getMenuBarEnable() & menuBar_Exit) + ifQuit(); + break; + default: + break; + } + } +} + void ZVision::cheatCodes(uint8 key) { pushKeyToCheatBuf(key); @@ -176,6 +202,7 @@ void ZVision::processEvents() { _scriptManager->setStateValue(StateKey_KeyPress, vkKey); _scriptManager->addEvent(_event); + shortKeys(_event); cheatCodes(vkKey); } break; diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 041a8574a6..8564e4e26b 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -209,6 +209,7 @@ private: void updateRotation(); void registerDefaultSettings(); + void shortKeys(Common::Event); void cheatCodes(uint8 key); void pushKeyToCheatBuf(uint8 key); -- cgit v1.2.3