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

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Feb 24 23:58:44 CET 2009


Revision: 38870
          http://scummvm.svn.sourceforge.net/scummvm/?rev=38870&view=rev
Author:   thebluegr
Date:     2009-02-24 22:58:44 +0000 (Tue, 24 Feb 2009)

Log Message:
-----------
Replaced some of the internal SCI scan codes with the ones from ScummVM

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-24 22:51:19 UTC (rev 38869)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp	2009-02-24 22:58:44 UTC (rev 38870)
@@ -27,6 +27,8 @@
 #include "sci/gfx/gfx_widgets.h"
 #include "sci/engine/kernel.h"
 
+#include "common/keyboard.h"
+
 namespace Sci {
 
 int stop_on_event;
@@ -151,32 +153,32 @@
 	if (GET_SEL32V(obj, type) == SCI_EVT_KEYBOARD) { // Keyboard
 		int mover = -1;
 		switch (GET_SEL32V(obj, message)) {
-		case SCI_K_HOME:
+		case Common::KEYCODE_HOME:
 			mover = 8;
 			break;
-		case SCI_K_UP:
+		case Common::KEYCODE_UP:
 			mover = 1;
 			break;
-		case SCI_K_PGUP:
+		case Common::KEYCODE_PAGEUP:
 			mover = 2;
 			break;
-		case SCI_K_LEFT:
+		case Common::KEYCODE_LEFT:
 			mover = 7;
 			break;
 		case SCI_K_CENTER:
 		case 76:
 			mover = 0;
 			break;
-		case SCI_K_RIGHT:
+		case Common::KEYCODE_RIGHT:
 			mover = 3;
 			break;
-		case SCI_K_END:
+		case Common::KEYCODE_END:
 			mover = 6;
 			break;
-		case SCI_K_DOWN:
+		case Common::KEYCODE_DOWN:
 			mover = 5;
 			break;
-		case SCI_K_PGDOWN:
+		case Common::KEYCODE_PAGEDOWN:
 			mover = 4;
 			break;
 		default:

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

Modified: scummvm/trunk/engines/sci/engine/kmenu.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-02-24 22:51:19 UTC (rev 38869)
+++ scummvm/trunk/engines/sci/engine/kmenu.cpp	2009-02-24 22:58:44 UTC (rev 38870)
@@ -29,6 +29,8 @@
 #include "sci/gfx/menubar.h"
 #include "sci/engine/kernel.h"
 
+#include "common/keyboard.h"
+
 namespace Sci {
 
 reg_t
@@ -326,7 +328,7 @@
 		int menuc, itemc;
 
 		if ((type == SCI_EVT_KEYBOARD)
-		        && (message == SCI_K_ESC))
+		        && (message == Common::KEYCODE_ESCAPE))
 			menu_mode = 1;
 
 		else if ((type == SCI_EVT_SAID) || message) { /* Don't claim 0 keyboard event */
@@ -403,17 +405,17 @@
 						s->visual->print(GFXW(s->visual), 0);
 					break;
 
-				case SCI_K_ESC:
+				case Common::KEYCODE_ESCAPE:
 					menu_mode = 0;
 					break;
 
-				case SCI_K_ENTER:
+				case Common::KEYCODE_RETURN:
 					menu_mode = 0;
 					if ((item_nr >= 0) && (menu_nr >= 0))
 						claimed = 1;
 					break;
 
-				case SCI_K_LEFT:
+				case Common::KEYCODE_LEFT:
 					if (menu_nr > 0)
 						--menu_nr;
 					else
@@ -422,7 +424,7 @@
 					item_nr = _menu_go_down(s, menu_nr, -1);
 					break;
 
-				case SCI_K_RIGHT:
+				case Common::KEYCODE_RIGHT:
 					if (menu_nr < (s->menubar->menus_nr - 1))
 						++menu_nr;
 					else
@@ -431,7 +433,7 @@
 					item_nr = _menu_go_down(s, menu_nr, -1);
 					break;
 
-				case SCI_K_UP:
+				case Common::KEYCODE_UP:
 					if (item_nr > -1) {
 
 						do { --item_nr; }
@@ -439,7 +441,7 @@
 					}
 					break;
 
-				case SCI_K_DOWN: {
+				case Common::KEYCODE_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-24 22:51:19 UTC (rev 38869)
+++ scummvm/trunk/engines/sci/gfx/gfx_driver.cpp	2009-02-24 22:58:44 UTC (rev 38870)
@@ -382,11 +382,11 @@
 				if (input.data == Common::KEYCODE_TAB) {
 					// Tab
 					input.type = SCI_EVT_KEYBOARD;
-					input.data = SCI_K_TAB;
+					input.data = Common::KEYCODE_TAB;
 					if (input.buckybits & (SCI_EVM_LSHIFT | SCI_EVM_RSHIFT))
 						input.character = SCI_K_SHIFT_TAB;
 					else
-						input.character = SCI_K_TAB;
+						input.character = Common::KEYCODE_TAB;
 				}
 			} else if ((input.data >= Common::KEYCODE_F1) && input.data <= Common::KEYCODE_F10) {
 				// F1-F10
@@ -403,34 +403,16 @@
 				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 = SCI_K_DELETE;
+					input.data = ev.kbd.keycode;
 					break;
 					//TODO: SCI_K_CENTER
 				default:

Modified: scummvm/trunk/engines/sci/gfx/operations.cpp
===================================================================
--- scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-24 22:51:19 UTC (rev 38869)
+++ scummvm/trunk/engines/sci/gfx/operations.cpp	2009-02-24 22:58:44 UTC (rev 38870)
@@ -29,6 +29,7 @@
 #include "sci/gfx/operations.h"
 
 #include "common/system.h"
+#include "common/keyboard.h"
 
 namespace Sci {
 
@@ -1529,7 +1530,7 @@
 			return shifted_numbers[c-'0'];
 
 		switch (c) {
-		case SCI_K_TAB:
+		case Common::KEYCODE_TAB:
 			return SCI_K_SHIFT_TAB;
 		case ']':
 			return '}';
@@ -1586,27 +1587,27 @@
 
 static int _gfxop_numlockify(int c) {
 	switch (c) {
-	case SCI_K_DELETE:
+	case Common::KEYCODE_DELETE:
 		return '.';
-	case SCI_K_INSERT:
+	case Common::KEYCODE_INSERT:
 		return '0';
-	case SCI_K_END:
+	case Common::KEYCODE_END:
 		return '1';
-	case SCI_K_DOWN:
+	case Common::KEYCODE_DOWN:
 		return '2';
-	case SCI_K_PGDOWN:
+	case Common::KEYCODE_PAGEDOWN:
 		return '3';
-	case SCI_K_LEFT:
+	case Common::KEYCODE_LEFT:
 		return '4';
 	case SCI_K_CENTER:
 		return '5';
-	case SCI_K_RIGHT:
+	case Common::KEYCODE_RIGHT:
 		return '6';
-	case SCI_K_HOME:
+	case Common::KEYCODE_HOME:
 		return '7';
-	case SCI_K_UP:
+	case Common::KEYCODE_UP:
 		return '8';
-	case SCI_K_PGUP:
+	case Common::KEYCODE_PAGEUP:
 		return '9';
 	default:
 		return c; // Unchanged

Modified: scummvm/trunk/engines/sci/include/uinput.h
===================================================================
--- scummvm/trunk/engines/sci/include/uinput.h	2009-02-24 22:51:19 UTC (rev 38869)
+++ scummvm/trunk/engines/sci/include/uinput.h	2009-02-24 22:58:44 UTC (rev 38870)
@@ -69,23 +69,9 @@
 
 
 /* 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