aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2017-07-16 01:22:18 -0500
committerColin Snover2017-07-16 01:33:57 -0500
commitb4c0be8b42d63cbf3c808be1a94839483f674ce9 (patch)
treec5e0c25d1f78fd1f39013f3bb42380862aba7cf3
parent8e0ccc5eb144a458d3e12cae24fa7970a7d9a749 (diff)
downloadscummvm-rg350-b4c0be8b42d63cbf3c808be1a94839483f674ce9.tar.gz
scummvm-rg350-b4c0be8b42d63cbf3c808be1a94839483f674ce9.tar.bz2
scummvm-rg350-b4c0be8b42d63cbf3c808be1a94839483f674ce9.zip
SCI: Fix control character keyboard events
Used by: * All games with text inputs (Ctrl+C clears text boxes) * QFG1VGA (Ctrl+S shows stats) * Torin (Ctrl+N, Ctrl+O, Ctrl+S, etc. activate menu commands) The branch that used to shift control keys for SCI versions <= SCI_VERSION_1_MIDDLE was bogus; history indicates it was intended to be used to fix backends that sent control characters when Ctrl+Alt were used together, but that case is already handled by the Alt-checking code just prior to that code. Games expect to receive control characters only when Ctrl is the only active modifier, and this seems to be consistent across all versions of SCI engine from SCI0 all the way through at least SCI2.1. Fixes Trac#6703, Trac#9837.
-rw-r--r--engines/sci/event.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp
index e365296914..873b6bb48a 100644
--- a/engines/sci/event.cpp
+++ b/engines/sci/event.cpp
@@ -335,13 +335,13 @@ SciEvent EventManager::getScummVMEvent() {
// Scancodify if appropriate
if (scummVMKeyFlags & Common::KBD_ALT)
input.character = altify(input.character);
- if (getSciVersion() <= SCI_VERSION_1_MIDDLE && (scummVMKeyFlags & Common::KBD_CTRL) && input.character > 0 && input.character < 27)
- input.character += 96; // 0x01 -> 'a'
-#ifdef ENABLE_SCI32
- if (getSciVersion() >= SCI_VERSION_2 && (scummVMKeyFlags & Common::KBD_CTRL) && input.character == 'c') {
- input.character = SCI_KEY_ETX;
+
+ // In SSCI, Ctrl+<key> generates ASCII control characters, but the backends
+ // usually give us a latin character + Ctrl flag, so convert this combo back
+ // into what is expected by game scripts
+ if ((scummVMKeyFlags & Common::KBD_NON_STICKY) == Common::KBD_CTRL && input.character >= 'a' && input.character <= 'z') {
+ input.character -= 96;
}
-#endif
// If no actual key was pressed (e.g. if only a modifier key was pressed),
// ignore the event