aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/sword1/sword1.cpp14
-rw-r--r--engines/sword1/sword1.h3
2 files changed, 8 insertions, 9 deletions
diff --git a/engines/sword1/sword1.cpp b/engines/sword1/sword1.cpp
index 05115afc13..8968aefb5a 100644
--- a/engines/sword1/sword1.cpp
+++ b/engines/sword1/sword1.cpp
@@ -635,7 +635,7 @@ void SwordEngine::checkCd(void) {
uint8 SwordEngine::mainLoop(void) {
uint8 retCode = 0;
- _keyPressed = 0;
+ _keyPressed.keycode = Common::KEYCODE_INVALID;
while ((retCode == 0) && (!_systemVars.engineQuit)) {
// do we need the section45-hack from sword.c here?
@@ -678,12 +678,14 @@ uint8 SwordEngine::mainLoop(void) {
// The control panel is triggered by F5 or ESC.
// FIXME: This is a very strange way of detecting F5...
- else if (((_keyPressed == 63 || _keyPressed == 27) && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
+ else if (((_keyPressed.keycode == Common::KEYCODE_F5 || _keyPressed.keycode == Common::KEYCODE_ESCAPE)
+ && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
retCode = _control->runPanel();
if (!retCode)
_screen->fullRefresh();
}
- _mouseState = _keyPressed = 0;
+ _mouseState = 0;
+ _keyPressed.keycode = Common::KEYCODE_INVALID;
} while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0) && (!_systemVars.engineQuit));
if ((retCode == 0) && (Logic::_scriptVars[SCREEN] != 53) && _systemVars.wantFade && (!_systemVars.engineQuit)) {
@@ -712,11 +714,7 @@ void SwordEngine::delay(int32 amount) { //copied and mutilated from sky.cpp
while (_eventMan->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_KEYDOWN:
- // Make sure backspace works right (this fixes a small issue on OS X)
- if (event.kbd.keycode == Common::KEYCODE_BACKSPACE)
- _keyPressed = 8;
- else
- _keyPressed = (uint8)event.kbd.ascii;
+ _keyPressed = event.kbd;
break;
case Common::EVENT_MOUSEMOVE:
_mouseX = event.mouse.x;
diff --git a/engines/sword1/sword1.h b/engines/sword1/sword1.h
index 1ced01d6ef..7065b5498a 100644
--- a/engines/sword1/sword1.h
+++ b/engines/sword1/sword1.h
@@ -27,6 +27,7 @@
#define SWORD1_H
#include "engines/engine.h"
+#include "common/events.h"
#include "common/util.h"
#include "sword1/sworddefs.h"
@@ -92,7 +93,7 @@ private:
uint8 mainLoop(void);
uint16 _mouseX, _mouseY, _mouseState;
- uint8 _keyPressed;
+ Common::KeyState _keyPressed;
ResMan *_resMan;
ObjectMan *_objectMan;