[Scummvm-cvs-logs] SF.net SVN: scummvm:[38886] scummvm/trunk/engines/sci

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Wed Feb 25 20:52:18 CET 2009


Revision: 38886
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38886&view=rev
Author:   thebluegr
Date:     2009-02-25 19:52:17 +0000 (Wed, 25 Feb 2009)

Log Message:
-----------
Reverted my wrong commit #38870. Most of the key codes are handled by the engine itself, however there are cases where they are handled by the game scripts, e.g. in save/load dialogs. The arrow keys in the save/load dialogs should work properly again. The numpad keys still look to be broken by some other commit

Modified Paths:
--------------
    scummvm/trunk/engines/sci/engine/kevent.cpp
    scummvm/trunk/engines/sci/engine/kgraphics.cpp
    scummvm/trunk/engines/sci/engine/kmenu.cpp
    scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
    scummvm/trunk/engines/sci/gfx/operations.cpp
    scummvm/trunk/engines/sci/include/uinput.h

Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp	2009-02-25 19:30:11 UTC (rev 38885)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2009-02-25 19:52:17 UTC (rev 38886)
@@ -27,8 +27,6 @@
 #include "sci/gfx/gfx_widgets.h"
 #include "sci/engine/kernel.h"
 
-#include "common/keyboard.h"
-
 namespace Sci {
 
 int stop_on_event;
@@ -153,32 +151,32 @@
 	if (GET_SEL32V(obj, type) == SCI_EVT_KEYBOARD) { // Keyboard
 		int mover = -1;
 		switch (GET_SEL32V(obj, message)) {
-		case Common::KEYCODE_HOME:
+		case SCI_K_HOME:
 			mover = 8;
 			break;
-		case Common::KEYCODE_UP:
+		case SCI_K_UP:
 			mover = 1;
 			break;
-		case Common::KEYCODE_PAGEUP:
+		case SCI_K_PGUP:
 			mover = 2;
 			break;
-		case Common::KEYCODE_LEFT:
+		case SCI_K_LEFT:
 			mover = 7;
 			break;
 		case SCI_K_CENTER:
 		case 76:
 			mover = 0;
 			break;
-		case Common::KEYCODE_RIGHT:
+		case SCI_K_RIGHT:
 			mover = 3;
 			break;
-		case Common::KEYCODE_END:
+		case SCI_K_END:
 			mover = 6;
 			break;
-		case Common::KEYCODE_DOWN:
+		case SCI_K_DOWN:
 			mover = 5;
 			break;
-		case Common::KEYCODE_PAGEDOWN:
+		case SCI_K_PGDOWN:
 			mover = 4;
 			break;
 		default:

Modified: scummvm/trunk/engines/sci/engine/kgraphics.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-25 19:30:11 UTC (rev 38885)
+++ scummvm/trunk/engines/sci/engine/kgraphics.cpp	2009-02-25 19:52:17 UTC (rev 38886)
@@ -24,7 +24,6 @@
  */
 
 #include "common/system.h"
-#include "common/keyboard.h"
 
 #include "sci/include/sciresource.h"
 #include "sci/include/engine.h"
@@ -1450,7 +1449,7 @@
 				} else if (key < 31) {
 					PUT_SEL32V(event, claimed, 1);
 					switch (key) {
-					case Common::KEYCODE_BACKSPACE:
+					case SCI_K_BACKSPACE:
 						_K_EDIT_BACKSPACE;
 						break;
 					default:
@@ -1458,21 +1457,21 @@
 					}
 				} else if (key & 0xff00) {
 					switch (key) {
-					case Common::KEYCODE_HOME:
+					case SCI_K_HOME:
 						cursor = 0;
 						break;
-					case Common::KEYCODE_END:
+					case SCI_K_END:
 						cursor = textlen;
 						break;
-					case Common::KEYCODE_RIGHT:
+					case SCI_K_RIGHT:
 						if (cursor + 1 <= textlen)
 							++cursor;
 						break;
-					case Common::KEYCODE_LEFT:
+					case SCI_K_LEFT:
 						if (cursor > 0)
 							--cursor;
 						break;
-					case Common::KEYCODE_DELETE:
+					case SCI_K_DELETE:
 						_K_EDIT_DELETE;
 						break;
 					}

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-02-25 19:30:11 UTC (rev 38885)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-02-25 19:52:17 UTC (rev 38886)
@@ -29,8 +29,6 @@
 #include "sci/gfx/menubar.h"
 #include "sci/engine/kernel.h"
 
-#include "common/keyboard.h"
-
 namespace Sci {
 
 reg_t
@@ -328,7 +326,7 @@
 		int menuc, itemc;
 
 		if ((type == SCI_EVT_KEYBOARD)
-		        && (message == Common::KEYCODE_ESCAPE))
+		        && (message == SCI_K_ESC))
 			menu_mode = 1;
 
 		else if ((type == SCI_EVT_SAID) || message) { /* Don't claim 0 keyboard event */
@@ -405,17 +403,17 @@
 						s->visual->print(GFXW(s->visual), 0);
 					break;
 
-				case Common::KEYCODE_ESCAPE:
+				case SCI_K_ESC:
 					menu_mode = 0;
 					break;
 
-				case Common::KEYCODE_RETURN:
+				case SCI_K_ENTER:
 					menu_mode = 0;
 					if ((item_nr >= 0) && (menu_nr >= 0))
 						claimed = 1;
 					break;
 
-				case Common::KEYCODE_LEFT:
+				case SCI_K_LEFT:
 					if (menu_nr > 0)
 						--menu_nr;
 					else
@@ -424,7 +422,7 @@
 					item_nr = _menu_go_down(s, menu_nr, -1);
 					break;
 
-				case Common::KEYCODE_RIGHT:
+				case SCI_K_RIGHT:
 					if (menu_nr < (s->menubar->menus_nr - 1))
 						++menu_nr;
 					else
@@ -433,7 +431,7 @@
 					item_nr = _menu_go_down(s, menu_nr, -1);
 					break;
 
-				case Common::KEYCODE_UP:
+				case SCI_K_UP:
 					if (item_nr > -1) {
 
 						do { --item_nr; }
@@ -441,7 +439,7 @@
 					}
 					break;
 
-				case Common::KEYCODE_DOWN: {
+				case SCI_K_DOWN: {
 					item_nr = _menu_go_down(s, menu_nr, item_nr);
 				}
 				break;

Modified: scummvm/trunk/engines/sci/gfx/gfx_driver.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-25 19:30:11 UTC (rev 38885)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-25 19:52:17 UTC (rev 38886)
@@ -375,11 +375,11 @@
 				if (input.data == Common::KEYCODE_TAB) {
 					// Tab
 					input.type = SCI_EVT_KEYBOARD;
-					input.data = Common::KEYCODE_TAB;
+					input.data = SCI_K_TAB;
 					if (input.buckybits & (SCI_EVM_LSHIFT | SCI_EVM_RSHIFT))
 						input.character = SCI_K_SHIFT_TAB;
 					else
-						input.character = Common::KEYCODE_TAB;
+						input.character = SCI_K_TAB;
 				}
 			} else if ((input.data >= Common::KEYCODE_F1) && input.data <= Common::KEYCODE_F10) {
 				// F1-F10
@@ -396,16 +396,34 @@
 				input.type = SCI_EVT_KEYBOARD;
 				switch (ev.kbd.keycode) {
 				case Common::KEYCODE_UP:
+					input.data = SCI_K_UP;
+					break;
 				case Common::KEYCODE_DOWN:
+					input.data = SCI_K_DOWN;
+					break;
 				case Common::KEYCODE_RIGHT:
+					input.data = SCI_K_RIGHT;
+					break;
 				case Common::KEYCODE_LEFT:
+					input.data = SCI_K_LEFT;
+					break;
 				case Common::KEYCODE_INSERT:
+					input.data = SCI_K_INSERT;
+					break;
 				case Common::KEYCODE_HOME:
+					input.data = SCI_K_HOME;
+					break;
 				case Common::KEYCODE_END:
+					input.data = SCI_K_END;
+					break;
 				case Common::KEYCODE_PAGEUP:
+					input.data = SCI_K_PGUP;
+					break;
 				case Common::KEYCODE_PAGEDOWN:
+					input.data = SCI_K_PGDOWN;
+					break;
 				case Common::KEYCODE_DELETE:
-					input.data = ev.kbd.keycode;
+					input.data = SCI_K_DELETE;
 					break;
 					//TODO: SCI_K_CENTER
 				default:

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-25 19:30:11 UTC (rev 38885)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-25 19:52:17 UTC (rev 38886)
@@ -29,7 +29,6 @@
 #include "sci/gfx/operations.h"
 
 #include "common/system.h"
-#include "common/keyboard.h"
 
 namespace Sci {
 
@@ -1375,7 +1374,7 @@
 			return shifted_numbers[c-'0'];
 
 		switch (c) {
-		case Common::KEYCODE_TAB:
+		case SCI_K_TAB:
 			return SCI_K_SHIFT_TAB;
 		case ']':
 			return '}';
@@ -1432,27 +1431,27 @@
 
 static int _gfxop_numlockify(int c) {
 	switch (c) {
-	case Common::KEYCODE_DELETE:
+	case SCI_K_DELETE:
 		return '.';
-	case Common::KEYCODE_INSERT:
+	case SCI_K_INSERT:
 		return '0';
-	case Common::KEYCODE_END:
+	case SCI_K_END:
 		return '1';
-	case Common::KEYCODE_DOWN:
+	case SCI_K_DOWN:
 		return '2';
-	case Common::KEYCODE_PAGEDOWN:
+	case SCI_K_PGDOWN:
 		return '3';
-	case Common::KEYCODE_LEFT:
+	case SCI_K_LEFT:
 		return '4';
 	case SCI_K_CENTER:
 		return '5';
-	case Common::KEYCODE_RIGHT:
+	case SCI_K_RIGHT:
 		return '6';
-	case Common::KEYCODE_HOME:
+	case SCI_K_HOME:
 		return '7';
-	case Common::KEYCODE_UP:
+	case SCI_K_UP:
 		return '8';
-	case Common::KEYCODE_PAGEUP:
+	case SCI_K_PGUP:
 		return '9';
 	default:
 		return c; // Unchanged

Modified: scummvm/trunk/engines/sci/include/uinput.h
===================================================================
--- scummvm/trunk/engines/sci/include/uinput.h	2009-02-25 19:30:11 UTC (rev 38885)
+++ scummvm/trunk/engines/sci/include/uinput.h	2009-02-25 19:52:17 UTC (rev 38886)
@@ -69,9 +69,23 @@
 
 
 /* Keycodes of special keys: */
+#define SCI_K_ESC 27
+#define SCI_K_BACKSPACE 8
+#define SCI_K_ENTER 13
+#define SCI_K_TAB '\t'
 #define SCI_K_SHIFT_TAB (0xf << 8)
 
+#define SCI_K_END (79 << 8)
+#define SCI_K_DOWN (80 << 8)
+#define SCI_K_PGDOWN (81 << 8)
+#define SCI_K_LEFT (75 << 8)
 #define SCI_K_CENTER (76 << 8)
+#define SCI_K_RIGHT (77 << 8)
+#define SCI_K_HOME (71 << 8)
+#define SCI_K_UP (72 << 8)
+#define SCI_K_PGUP (73 << 8)
+#define SCI_K_INSERT (82 << 8)
+#define SCI_K_DELETE (83 << 8)
 
 #define SCI_K_F1 (59<<8)
 #define SCI_K_F2 (60<<8)


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list