[Scummvm-git-logs] scummvm master -> 6585310ad98b23f27eec142290259488e1aaf791

aquadran aquadran at gmail.com
Mon Mar 8 07:00:18 UTC 2021


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:
6585310ad9 ICB: Cleanup input code a bit


Commit: 6585310ad98b23f27eec142290259488e1aaf791
    https://github.com/scummvm/scummvm/commit/6585310ad98b23f27eec142290259488e1aaf791
Author: Paweł Kołodziejski (aquadran at gmail.com)
Date: 2021-03-08T08:00:12+01:00

Commit Message:
ICB: Cleanup input code a bit

Changed paths:
    engines/icb/direct_input.cpp
    engines/icb/direct_input.h


diff --git a/engines/icb/direct_input.cpp b/engines/icb/direct_input.cpp
index 5462ad9cb8..2e94604b44 100644
--- a/engines/icb/direct_input.cpp
+++ b/engines/icb/direct_input.cpp
@@ -38,8 +38,8 @@
 
 namespace ICB {
 
-bool8 keyboard_buf_scancodes[512]; // SDL_NUM_SCANCODES
-bool8 repeats_scancodes[512];      // SDL_NUM_SCANCODES
+bool8 keyboard_buf_scancodes[Common::KEYCODE_LAST];
+bool8 repeats_scancodes[Common::KEYCODE_LAST];
 
 void Init_direct_input() {
 	SetDefaultKeys();
@@ -48,7 +48,7 @@ void Init_direct_input() {
 void setKeyState(Common::KeyCode key, bool pressed) { keyboard_buf_scancodes[key] = pressed; }
 
 uint32 Get_DI_key_press() {
-	for (uint32 i = 0; i < 512; i++) {
+	for (uint32 i = 0; i < Common::KEYCODE_LAST; i++) {
 		if (Read_DI_once_keys(i)) {
 			return i;
 		}
@@ -58,7 +58,7 @@ uint32 Get_DI_key_press() {
 }
 
 void Clear_DI_key_buffer() {
-	for (uint32 i = 0; i < 512; i++) {
+	for (uint32 i = 0; i < Common::KEYCODE_LAST; i++) {
 		repeats_scancodes[i] = FALSE8;
 		keyboard_buf_scancodes[i] = FALSE8;
 	}
@@ -72,7 +72,7 @@ bool8 Read_DI_once_keys(uint32 key) {
 	//      0 not pressed down currently
 	//      1 pressed down
 
-	if (key >= 512)
+	if (key >= Common::KEYCODE_LAST)
 		FALSE8;
 
 	// set repeat
@@ -92,7 +92,7 @@ bool8 Read_DI_keys(uint32 key) {
 	//      0 not pressed down currently
 	//      1 pressed down
 
-	if (key >= 512)
+	if (key >= Common::KEYCODE_LAST)
 		FALSE8;
 
 	// set repeat
@@ -102,7 +102,7 @@ bool8 Read_DI_keys(uint32 key) {
 }
 
 bool8 DI_key_waiting() {
-	for (uint32 i = 0; i < 512; i++) {
+	for (uint32 i = 0; i < Common::KEYCODE_LAST; i++) {
 		if (keyboard_buf_scancodes[i])
 			return TRUE8;
 	}
diff --git a/engines/icb/direct_input.h b/engines/icb/direct_input.h
index ab3e64bc79..c2342314c8 100644
--- a/engines/icb/direct_input.h
+++ b/engines/icb/direct_input.h
@@ -32,10 +32,8 @@
 
 namespace ICB {
 
-extern bool8 keyboard_buf_ascii[256];
-extern bool8 repeats_ascii[256];
-extern bool8 keyboard_buf_scancodes[512]; // SDL_NUM_SCANCODES
-extern bool8 repeats_scancodes[512];      // SDL_NUM_SCANCODES
+extern bool8 keyboard_buf_scancodes[Common::KEYCODE_LAST];
+extern bool8 repeats_scancodes[Common::KEYCODE_LAST];
 
 void Init_direct_input();
 void setKeyState(Common::KeyCode key, bool pressed);




More information about the Scummvm-git-logs mailing list