[Scummvm-git-logs] scummvm master -> c0dd68182484981f92851a283d546dde80fecec6

bluegr noreply at scummvm.org
Tue Apr 12 07:00:35 UTC 2022


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c0dd681824 SCUMM: Fix fighting in Indy 3 when Num lock is off


Commit: c0dd68182484981f92851a283d546dde80fecec6
    https://github.com/scummvm/scummvm/commit/c0dd68182484981f92851a283d546dde80fecec6
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2022-04-12T10:00:31+03:00

Commit Message:
SCUMM: Fix fighting in Indy 3 when Num lock is off

Changed paths:
    engines/scumm/input.cpp


diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp
index 5b93281b2e3..2d7fbdfea15 100644
--- a/engines/scumm/input.cpp
+++ b/engines/scumm/input.cpp
@@ -134,6 +134,14 @@ void ScummEngine::parseEvent(Common::Event event) {
 			_keyPressed = event.kbd;
 		}
 
+		// HACK: Because we use ASCII values here, it's necessary to
+		// remap keypad keys to always have a corresponding ASCII value.
+		// Normally, keypad keys would only have an ASCII value when
+		// NumLock is enabled. This fixes fighting in Indy 3 (Trac #11227)
+		if (_keyPressed.keycode >= Common::KEYCODE_KP0 && _keyPressed.keycode <= Common::KEYCODE_KP9) {
+			_keyPressed.ascii = (_keyPressed.keycode - Common::KEYCODE_KP0) + '0';
+		}
+
 		// FIXME: We are using ASCII values to index the _keyDownMap here,
 		// yet later one code which checks _keyDownMap will use KEYCODEs
 		// to do so. That is, we are mixing ascii and keycode values here,
@@ -149,6 +157,14 @@ void ScummEngine::parseEvent(Common::Event event) {
 		break;
 
 	case Common::EVENT_KEYUP:
+		// HACK: Because we use ASCII values here, it's necessary to
+		// remap keypad keys to always have a corresponding ASCII value.
+		// Normally, keypad keys would only have an ASCII value when
+		// NumLock is enabled. This fixes fighting in Indy 3 (Trac #11227)
+		if (_keyPressed.keycode >= Common::KEYCODE_KP0 && _keyPressed.keycode <= Common::KEYCODE_KP9) {
+			_keyPressed.ascii = (_keyPressed.keycode - Common::KEYCODE_KP0) + '0';
+		}
+
 		if (event.kbd.ascii >= 512) {
 			debugC(DEBUG_GENERAL, "keyPressed > 512 (%d)", event.kbd.ascii);
 		} else {




More information about the Scummvm-git-logs mailing list