From 1b4660a50899a697f16cc8d09443cbb10e08e44a Mon Sep 17 00:00:00 2001 From: sluicebox <22204938+sluicebox@users.noreply.github.com> Date: Sun, 16 Jan 2022 13:50:39 -0500 Subject: [PATCH] SCI32: Fix event type for Direction events The direction event type changed from 64 in SCI16 to 16 in SCI32. Fixes direction events not appearing when pressing arrow keys in SCI32 games, such as on the QFG4 character creation screen: bug #13223 --- engines/sci/engine/kevent.cpp | 6 +++++- engines/sci/event.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index 6ff3b328c53..247a9733164 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -295,7 +295,11 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { if (readSelectorValue(segMan, obj, SELECTOR(type)) == kSciEventKeyDown) { uint16 message = readSelectorValue(segMan, obj, SELECTOR(message)); - SciEventType eventType = kSciEventDirection; +#ifdef ENABLE_SCI32 + SciEventType eventType = (getSciVersion() < SCI_VERSION_2) ? kSciEventDirection16 : kSciEventDirection32; +#else + SciEventType eventType = kSciEventDirection16; +#endif // It seems with SCI1 Sierra started to add the kSciEventDirection bit instead of setting it directly. // It was done inside the keyboard driver and is required for the PseudoMouse functionality and class // to work (script 933). diff --git a/engines/sci/event.h b/engines/sci/event.h index d01bbcadc90..8dedc7c9df4 100644 --- a/engines/sci/event.h +++ b/engines/sci/event.h @@ -35,9 +35,10 @@ enum SciEventType { kSciEventKeyDown = 1 << 2, kSciEventKeyUp = 1 << 3, kSciEventKey = kSciEventKeyDown | kSciEventKeyUp, - kSciEventDirection = 1 << 6, + kSciEventDirection16 = 1 << 6, // SCI16 kSciEventSaid = 1 << 7, #ifdef ENABLE_SCI32 + kSciEventDirection32 = 1 << 4, // SCI32 kSciEventHotRectangle = 1 << 10, #endif kSciEventQuit = 1 << 11,