From 31bf101af1df3f665b7ab407082287a9ed58ed2d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 21 Aug 2021 10:49:05 -0700 Subject: [PATCH] AGS: Fix quitting via abort key --- engines/ags/engine/main/quit.cpp | 5 ++--- engines/ags/events.cpp | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/engines/ags/engine/main/quit.cpp b/engines/ags/engine/main/quit.cpp index 9785efcff10..0d42ee49063 100644 --- a/engines/ags/engine/main/quit.cpp +++ b/engines/ags/engine/main/quit.cpp @@ -152,9 +152,8 @@ QuitReason quit_check_for_error_state(const char *&qmsg, String &alertis) { } void quit_message_on_exit(const String &qmsg, String &alertis, QuitReason qreason) { - // successful exit displays no messages (because Windoze closes the dos-box - // if it is empty). - if ((qreason & kQuitKind_NormalExit) == 0 && !_G(handledErrorInEditor)) { + // successful exit or user abort displays no messages + if ((qreason & (kQuitKind_NormalExit | kQuit_UserAbort)) == 0 && !_G(handledErrorInEditor)) { // Display the message (at this point the window still exists) sprintf(_G(pexbuf), "%s\n", qmsg.GetCStr()); alertis.Append(_G(pexbuf)); diff --git a/engines/ags/events.cpp b/engines/ags/events.cpp index 55e2ebb91c8..d9a4301f028 100644 --- a/engines/ags/events.cpp +++ b/engines/ags/events.cpp @@ -315,9 +315,6 @@ AGS3::eAGSKeyCode EventsManager::scummvm_key_to_ags_key(const Common::Event &eve if (event.type != Common::EVENT_KEYDOWN) return AGS3::eAGSKeyCodeNone; - if (event.kbd.ascii >= 32 && event.kbd.ascii <= 127) - return static_cast(event.kbd.ascii); - const Common::KeyCode sym = event.kbd.keycode; const uint16 mod = event.kbd.flags; @@ -329,6 +326,9 @@ AGS3::eAGSKeyCode EventsManager::scummvm_key_to_ags_key(const Common::Event &eve return static_cast(AGS_EXT_KEY_SHIFT + (sym - Common::KEYCODE_a) + 1); } + if (event.kbd.ascii >= 32 && event.kbd.ascii <= 127) + return static_cast(event.kbd.ascii); + // Remaining codes may match or not, but we use a big table anyway. // TODO: this is code by [sonneveld], // double check that we must use scan codes here, maybe can use sdl key (sym) too?