aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-12-16 20:12:03 -0500
committerPaul Gilbert2017-12-16 20:12:03 -0500
commit5819da8d3b01c1726c847b23414179c8895c94f5 (patch)
tree9e1ffb5e574d9e627dde982c1a0247946e59e98e
parent56e7ef2f3d96ceecc6bc83a38c81d2000e58f81c (diff)
downloadscummvm-rg350-5819da8d3b01c1726c847b23414179c8895c94f5.tar.gz
scummvm-rg350-5819da8d3b01c1726c847b23414179c8895c94f5.tar.bz2
scummvm-rg350-5819da8d3b01c1726c847b23414179c8895c94f5.zip
XEEN: Fix handling of keyboard hotkeys
-rw-r--r--engines/xeen/dialogs.cpp2
-rw-r--r--engines/xeen/events.cpp12
-rw-r--r--engines/xeen/events.h3
3 files changed, 8 insertions, 9 deletions
diff --git a/engines/xeen/dialogs.cpp b/engines/xeen/dialogs.cpp
index 3925d69b45..d44a361c3c 100644
--- a/engines/xeen/dialogs.cpp
+++ b/engines/xeen/dialogs.cpp
@@ -95,7 +95,7 @@ bool ButtonContainer::checkEvents(XeenEngine *vm) {
else if (_buttonValue == Common::KEYCODE_KP_ENTER)
_buttonValue = Common::KEYCODE_RETURN;
- _buttonValue |= (keyState.flags & ~Common::KBD_CAPS) << 16;
+ _buttonValue |= (keyState.flags & ~Common::KBD_STICKY) << 16;
}
if (_buttonValue) {
diff --git a/engines/xeen/events.cpp b/engines/xeen/events.cpp
index a4b0134d31..cc58edda89 100644
--- a/engines/xeen/events.cpp
+++ b/engines/xeen/events.cpp
@@ -35,7 +35,6 @@ EventsManager::EventsManager(XeenEngine *vm) : _vm(vm),
_frameCounter(0), _priorFrameCounterTime(0), _gameCounter(0),
_leftButton(false), _rightButton(false), _sprites("mouse.icn") {
Common::fill(&_gameCounters[0], &_gameCounters[6], 0);
- _key.keycode = Common::KEYCODE_INVALID;
}
EventsManager::~EventsManager() {
@@ -81,7 +80,7 @@ void EventsManager::pollEvents() {
_vm->_debugger->attach();
_vm->_debugger->onFrame();
} else {
- _key = event.kbd;
+ _keys.push(event.kbd);
}
break;
case Common::EVENT_MOUSEMOVE:
@@ -111,7 +110,7 @@ void EventsManager::pollEventsAndWait() {
}
void EventsManager::clearEvents() {
- _key.keycode = Common::KEYCODE_INVALID;
+ _keys.clear();
_leftButton = _rightButton = false;
}
@@ -122,17 +121,16 @@ void EventsManager::debounceMouse() {
}
}
bool EventsManager::getKey(Common::KeyState &key) {
- if (_key.keycode == Common::KEYCODE_INVALID) {
+ if (_keys.empty()) {
return false;
} else {
- key = _key;
- _key.keycode = Common::KEYCODE_INVALID;
+ key = _keys.pop();
return true;
}
}
bool EventsManager::isKeyPending() const {
- return _key.keycode != Common::KEYCODE_INVALID;
+ return !_keys.empty();
}
bool EventsManager::isKeyMousePressed() {
diff --git a/engines/xeen/events.h b/engines/xeen/events.h
index 9a086b8f19..cf74a641c6 100644
--- a/engines/xeen/events.h
+++ b/engines/xeen/events.h
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
#include "common/events.h"
+#include "common/queue.h"
#include "xeen/sprites.h"
namespace Xeen {
@@ -40,7 +41,7 @@ private:
uint32 _priorFrameCounterTime;
uint32 _gameCounter;
uint32 _gameCounters[6];
- Common::KeyState _key;
+ Common::Queue<Common::KeyState> _keys;
SpriteResource _sprites;
/**