aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Kiewitz2009-12-31 17:43:54 +0000
committerMartin Kiewitz2009-12-31 17:43:54 +0000
commite56dedec3ff64ce21a2868b545d8e99ea5d21ee4 (patch)
treeaf1f4094ab2ab33ff7a5f0ca3230b0ae81f36816
parente53d82b28786f28ddb8761086c626d0672b41424 (diff)
downloadscummvm-rg350-e56dedec3ff64ce21a2868b545d8e99ea5d21ee4.tar.gz
scummvm-rg350-e56dedec3ff64ce21a2868b545d8e99ea5d21ee4.tar.bz2
scummvm-rg350-e56dedec3ff64ce21a2868b545d8e99ea5d21ee4.zip
SCI: keyboard change cleanup, fixed Ctrl and Alt related keys on foreign keyboards as well
svn-id: r46803
-rw-r--r--engines/sci/engine/kevent.cpp20
-rw-r--r--engines/sci/event.cpp71
2 files changed, 12 insertions, 79 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp
index fbc0f71cad..e8f37ae535 100644
--- a/engines/sci/engine/kevent.cpp
+++ b/engines/sci/engine/kevent.cpp
@@ -75,22 +75,12 @@ reg_t kGetEvent(EngineState *s, int argc, reg_t *argv) {
break;
case SCI_EVENT_KEYBOARD:
- if ((curEvent.modifiers & SCI_KEYMOD_LSHIFT) && (curEvent.modifiers & SCI_KEYMOD_RSHIFT) && (curEvent.data == '-')) {
- printf("Debug mode activated\n");
- g_debugState.seeking = kDebugSeekNothing;
- g_debugState.runningStep = 0;
- } else if ((curEvent.modifiers & SCI_KEYMOD_CTRL) && (curEvent.data == '`')) {
- printf("Debug mode activated\n");
- g_debugState.seeking = kDebugSeekNothing;
- g_debugState.runningStep = 0;
- } else {
- PUT_SEL32V(segMan, obj, type, SCI_EVENT_KEYBOARD); // Keyboard event
- s->r_acc = make_reg(0, 1);
+ PUT_SEL32V(segMan, obj, type, SCI_EVENT_KEYBOARD); // Keyboard event
+ s->r_acc = make_reg(0, 1);
- PUT_SEL32V(segMan, obj, message, curEvent.character);
- // We only care about the translated character
- PUT_SEL32V(segMan, obj, modifiers, curEvent.modifiers & modifier_mask);
- }
+ PUT_SEL32V(segMan, obj, message, curEvent.character);
+ // We only care about the translated character
+ PUT_SEL32V(segMan, obj, modifiers, curEvent.modifiers & modifier_mask);
break;
case SCI_EVENT_MOUSE_RELEASE:
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index 19f155f47d..0128f97629 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -52,9 +52,8 @@ struct scancode_row {
};
int SciEvent::controlify(int ch) {
- if ((ch >= 97) && (ch <= 121)) {
- ch -= 96; // 'a' -> 0x01, etc.
- }
+ if (ch < 26)
+ ch += 96; // 0x01 -> 'a'
return ch;
}
@@ -79,54 +78,6 @@ int SciEvent::altify (int ch) {
return ch;
}
-int SciEvent::shiftify (int c) {
- char shifted_numbers[] = ")!@#$%^&*(";
-
- if (c < 256) {
- c = toupper((char)c);
-
- if (c >= 'A' && c <= 'Z')
- return c;
-
- if (c >= '0' && c <= '9')
- return shifted_numbers[c-'0'];
-
- switch (c) {
- case SCI_KEY_TAB:
- return SCI_KEY_SHIFT_TAB;
- case ']':
- return '}';
- case '[':
- return '{';
- case '`':
- return '~';
- case '-':
- return '_';
- case '=':
- return '+';
- case ';':
- return ':';
- case '\'':
- return '"';
- case '\\':
- return '|';
- case ',':
- return '<';
- case '.':
- return '>';
- case '/':
- return '?';
- default:
- return c; // No match
- }
- }
-
- if (c >= SCI_KEY_F1 && c <= SCI_KEY_F10)
- return c + 25;
-
- return c;
-}
-
int SciEvent::numlockify (int c) {
switch (c) {
case SCI_KEY_DELETE:
@@ -397,26 +348,18 @@ sciEvent SciEvent::get(unsigned int mask) {
if (event.type == SCI_EVENT_KEYBOARD) {
// Do we still have to translate the key?
- // TODO: Needs cleanup
- //event.character = event.data;
-
// Scancodify if appropriate
if (event.modifiers & SCI_KEYMOD_ALT) {
- event.character = altify(event.data);
+ event.character = altify(event.character);
} else if (event.modifiers & SCI_KEYMOD_CTRL) {
- event.character = event.data;
- //event.character = controlify(event.data);
+ //event.character = event.data;
+ event.character = controlify(event.character);
}
- // Shift if appropriate
- // else
- //if (((event.modifiers & (SCI_KEYMOD_RSHIFT | SCI_KEYMOD_LSHIFT)) && !(event.modifiers & SCI_KEYMOD_CAPSLOCK))
- // || (!(event.modifiers & (SCI_KEYMOD_RSHIFT | SCI_KEYMOD_LSHIFT)) && (event.modifiers & SCI_KEYMOD_CAPSLOCK)))
- // event.character = shiftify(event.character);
-
// Numlockify if appropriate
- //else if (event.modifiers & SCI_KEYMOD_NUMLOCK)
+ //if (event.modifiers & SCI_KEYMOD_NUMLOCK)
// event.data = numlockify(event.data);
+ // TODO: dont know yet if this can get dumped as well
}
return event;