aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kevent.cpp18
-rw-r--r--engines/sci/engine/kgraphics.cpp13
-rw-r--r--engines/sci/engine/kmenu.cpp16
-rw-r--r--engines/sci/gfx/gfx_driver.cpp24
-rw-r--r--engines/sci/gfx/operations.cpp23
-rw-r--r--engines/sci/include/uinput.h14
6 files changed, 41 insertions, 67 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index 451d49c413..2b236e329f 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -27,6 +27,8 @@
#include "sci/gfx/gfx_widgets.h"
#include "sci/engine/kernel.h"
+#include "common/keyboard.h"
+
namespace Sci {
int stop_on_event;
@@ -151,32 +153,32 @@ reg_t kMapKeyToDir(EngineState *s, int funct_nr, int argc, reg_t *argv) {
if (GET_SEL32V(obj, type) == SCI_EVT_KEYBOARD) { // Keyboard
int mover = -1;
switch (GET_SEL32V(obj, message)) {
- case SCI_K_HOME:
+ case Common::KEYCODE_HOME:
mover = 8;
break;
- case SCI_K_UP:
+ case Common::KEYCODE_UP:
mover = 1;
break;
- case SCI_K_PGUP:
+ case Common::KEYCODE_PAGEUP:
mover = 2;
break;
- case SCI_K_LEFT:
+ case Common::KEYCODE_LEFT:
mover = 7;
break;
case SCI_K_CENTER:
case 76:
mover = 0;
break;
- case SCI_K_RIGHT:
+ case Common::KEYCODE_RIGHT:
mover = 3;
break;
- case SCI_K_END:
+ case Common::KEYCODE_END:
mover = 6;
break;
- case SCI_K_DOWN:
+ case Common::KEYCODE_DOWN:
mover = 5;
break;
- case SCI_K_PGDOWN:
+ case Common::KEYCODE_PAGEDOWN:
mover = 4;
break;
default:
diff --git a/engines/sci/engine/kgraphics.cpp b/engines/sci/engine/kgraphics.cpp
index 75b989e0c4..088c351c82 100644
--- a/engines/sci/engine/kgraphics.cpp
+++ b/engines/sci/engine/kgraphics.cpp
@@ -24,6 +24,7 @@
*/
#include "common/system.h"
+#include "common/keyboard.h"
#include "sci/include/sciresource.h"
#include "sci/include/engine.h"
@@ -1449,7 +1450,7 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) {
} else if (key < 31) {
PUT_SEL32V(event, claimed, 1);
switch (key) {
- case SCI_K_BACKSPACE:
+ case Common::KEYCODE_BACKSPACE:
_K_EDIT_BACKSPACE;
break;
default:
@@ -1457,21 +1458,21 @@ reg_t kEditControl(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
} else if (key & 0xff00) {
switch (key) {
- case SCI_K_HOME:
+ case Common::KEYCODE_HOME:
cursor = 0;
break;
- case SCI_K_END:
+ case Common::KEYCODE_END:
cursor = textlen;
break;
- case SCI_K_RIGHT:
+ case Common::KEYCODE_RIGHT:
if (cursor + 1 <= textlen)
++cursor;
break;
- case SCI_K_LEFT:
+ case Common::KEYCODE_LEFT:
if (cursor > 0)
--cursor;
break;
- case SCI_K_DELETE:
+ case Common::KEYCODE_DELETE:
_K_EDIT_DELETE;
break;
}
diff --git a/engines/sci/engine/kmenu.cpp b/engines/sci/engine/kmenu.cpp
index 300a762e76..d6b75160c2 100644
--- a/engines/sci/engine/kmenu.cpp
+++ b/engines/sci/engine/kmenu.cpp
@@ -29,6 +29,8 @@
#include "sci/gfx/menubar.h"
#include "sci/engine/kernel.h"
+#include "common/keyboard.h"
+
namespace Sci {
reg_t
@@ -326,7 +328,7 @@ kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
int menuc, itemc;
if ((type == SCI_EVT_KEYBOARD)
- && (message == SCI_K_ESC))
+ && (message == Common::KEYCODE_ESCAPE))
menu_mode = 1;
else if ((type == SCI_EVT_SAID) || message) { /* Don't claim 0 keyboard event */
@@ -403,17 +405,17 @@ kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
s->visual->print(GFXW(s->visual), 0);
break;
- case SCI_K_ESC:
+ case Common::KEYCODE_ESCAPE:
menu_mode = 0;
break;
- case SCI_K_ENTER:
+ case Common::KEYCODE_RETURN:
menu_mode = 0;
if ((item_nr >= 0) && (menu_nr >= 0))
claimed = 1;
break;
- case SCI_K_LEFT:
+ case Common::KEYCODE_LEFT:
if (menu_nr > 0)
--menu_nr;
else
@@ -422,7 +424,7 @@ kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
item_nr = _menu_go_down(s, menu_nr, -1);
break;
- case SCI_K_RIGHT:
+ case Common::KEYCODE_RIGHT:
if (menu_nr < (s->menubar->menus_nr - 1))
++menu_nr;
else
@@ -431,7 +433,7 @@ kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
item_nr = _menu_go_down(s, menu_nr, -1);
break;
- case SCI_K_UP:
+ case Common::KEYCODE_UP:
if (item_nr > -1) {
do { --item_nr; }
@@ -439,7 +441,7 @@ kMenuSelect(EngineState *s, int funct_nr, int argc, reg_t *argv) {
}
break;
- case SCI_K_DOWN: {
+ case Common::KEYCODE_DOWN: {
item_nr = _menu_go_down(s, menu_nr, item_nr);
}
break;
diff --git a/engines/sci/gfx/gfx_driver.cpp b/engines/sci/gfx/gfx_driver.cpp
index 2967d83525..d388e869cc 100644
--- a/engines/sci/gfx/gfx_driver.cpp
+++ b/engines/sci/gfx/gfx_driver.cpp
@@ -382,11 +382,11 @@ static sci_event_t scummvm_get_event(gfx_driver_t *drv) {
if (input.data == Common::KEYCODE_TAB) {
// Tab
input.type = SCI_EVT_KEYBOARD;
- input.data = SCI_K_TAB;
+ input.data = Common::KEYCODE_TAB;
if (input.buckybits & (SCI_EVM_LSHIFT | SCI_EVM_RSHIFT))
input.character = SCI_K_SHIFT_TAB;
else
- input.character = SCI_K_TAB;
+ input.character = Common::KEYCODE_TAB;
}
} else if ((input.data >= Common::KEYCODE_F1) && input.data <= Common::KEYCODE_F10) {
// F1-F10
@@ -403,34 +403,16 @@ static sci_event_t scummvm_get_event(gfx_driver_t *drv) {
input.type = SCI_EVT_KEYBOARD;
switch (ev.kbd.keycode) {
case Common::KEYCODE_UP:
- input.data = SCI_K_UP;
- break;
case Common::KEYCODE_DOWN:
- input.data = SCI_K_DOWN;
- break;
case Common::KEYCODE_RIGHT:
- input.data = SCI_K_RIGHT;
- break;
case Common::KEYCODE_LEFT:
- input.data = SCI_K_LEFT;
- break;
case Common::KEYCODE_INSERT:
- input.data = SCI_K_INSERT;
- break;
case Common::KEYCODE_HOME:
- input.data = SCI_K_HOME;
- break;
case Common::KEYCODE_END:
- input.data = SCI_K_END;
- break;
case Common::KEYCODE_PAGEUP:
- input.data = SCI_K_PGUP;
- break;
case Common::KEYCODE_PAGEDOWN:
- input.data = SCI_K_PGDOWN;
- break;
case Common::KEYCODE_DELETE:
- input.data = SCI_K_DELETE;
+ input.data = ev.kbd.keycode;
break;
//TODO: SCI_K_CENTER
default:
diff --git a/engines/sci/gfx/operations.cpp b/engines/sci/gfx/operations.cpp
index f29aeb395c..e02b5ffed0 100644
--- a/engines/sci/gfx/operations.cpp
+++ b/engines/sci/gfx/operations.cpp
@@ -29,6 +29,7 @@
#include "sci/gfx/operations.h"
#include "common/system.h"
+#include "common/keyboard.h"
namespace Sci {
@@ -1529,7 +1530,7 @@ int _gfxop_shiftify(int c) {
return shifted_numbers[c-'0'];
switch (c) {
- case SCI_K_TAB:
+ case Common::KEYCODE_TAB:
return SCI_K_SHIFT_TAB;
case ']':
return '}';
@@ -1586,27 +1587,27 @@ int _gfxop_shiftify(int c) {
static int _gfxop_numlockify(int c) {
switch (c) {
- case SCI_K_DELETE:
+ case Common::KEYCODE_DELETE:
return '.';
- case SCI_K_INSERT:
+ case Common::KEYCODE_INSERT:
return '0';
- case SCI_K_END:
+ case Common::KEYCODE_END:
return '1';
- case SCI_K_DOWN:
+ case Common::KEYCODE_DOWN:
return '2';
- case SCI_K_PGDOWN:
+ case Common::KEYCODE_PAGEDOWN:
return '3';
- case SCI_K_LEFT:
+ case Common::KEYCODE_LEFT:
return '4';
case SCI_K_CENTER:
return '5';
- case SCI_K_RIGHT:
+ case Common::KEYCODE_RIGHT:
return '6';
- case SCI_K_HOME:
+ case Common::KEYCODE_HOME:
return '7';
- case SCI_K_UP:
+ case Common::KEYCODE_UP:
return '8';
- case SCI_K_PGUP:
+ case Common::KEYCODE_PAGEUP:
return '9';
default:
return c; // Unchanged
diff --git a/engines/sci/include/uinput.h b/engines/sci/include/uinput.h
index 16339a113f..eb9a5a6439 100644
--- a/engines/sci/include/uinput.h
+++ b/engines/sci/include/uinput.h
@@ -69,23 +69,9 @@ struct sci_event_t {
/* Keycodes of special keys: */
-#define SCI_K_ESC 27
-#define SCI_K_BACKSPACE 8
-#define SCI_K_ENTER 13
-#define SCI_K_TAB '\t'
#define SCI_K_SHIFT_TAB (0xf << 8)
-#define SCI_K_END (79 << 8)
-#define SCI_K_DOWN (80 << 8)
-#define SCI_K_PGDOWN (81 << 8)
-#define SCI_K_LEFT (75 << 8)
#define SCI_K_CENTER (76 << 8)
-#define SCI_K_RIGHT (77 << 8)
-#define SCI_K_HOME (71 << 8)
-#define SCI_K_UP (72 << 8)
-#define SCI_K_PGUP (73 << 8)
-#define SCI_K_INSERT (82 << 8)
-#define SCI_K_DELETE (83 << 8)
#define SCI_K_F1 (59<<8)
#define SCI_K_F2 (60<<8)