[Scummvm-cvs-logs] SF.net SVN: scummvm: [27593] scummvm/trunk/engines/sword2

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Jun 21 21:33:07 CEST 2007


Revision: 27593
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27593&view=rev
Author:   eriktorbjorn
Date:     2007-06-21 12:33:05 -0700 (Thu, 21 Jun 2007)

Log Message:
-----------
Use the KEYCODE constants.

Modified Paths:
--------------
    scummvm/trunk/engines/sword2/animation.cpp
    scummvm/trunk/engines/sword2/controls.cpp
    scummvm/trunk/engines/sword2/screen.cpp
    scummvm/trunk/engines/sword2/sword2.cpp

Modified: scummvm/trunk/engines/sword2/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword2/animation.cpp	2007-06-21 18:35:15 UTC (rev 27592)
+++ scummvm/trunk/engines/sword2/animation.cpp	2007-06-21 19:33:05 UTC (rev 27593)
@@ -429,7 +429,7 @@
 				terminate = true;
 				break;
 			case Common::EVENT_KEYDOWN:
-				if (event.kbd.keycode == 27)
+				if (event.kbd.keycode == Common::KEYCODE_ESCAPE)
 					terminate = true;
 				break;
 			default:

Modified: scummvm/trunk/engines/sword2/controls.cpp
===================================================================
--- scummvm/trunk/engines/sword2/controls.cpp	2007-06-21 18:35:15 UTC (rev 27592)
+++ scummvm/trunk/engines/sword2/controls.cpp	2007-06-21 19:33:05 UTC (rev 27593)
@@ -26,6 +26,7 @@
  */
 
 #include "common/stdafx.h"
+#include "common/events.h"
 #include "common/rect.h"
 #include "common/config-manager.h"
 #include "common/system.h"
@@ -317,9 +318,9 @@
 		KeyboardEvent *ke = _vm->keyboardEvent();
 
 		if (ke) {
-			if (ke->keycode == 27)
+			if (ke->keycode == Common::KEYCODE_ESCAPE)
 				setResult(0);
-			else if (ke->keycode == '\n' || ke->keycode == '\r')
+			else if (ke->keycode == Common::KEYCODE_RETURN || ke->keycode == Common::KEYCODE_KP_ENTER)
 				setResult(1);
 		}
 
@@ -1130,8 +1131,8 @@
 
 	virtual void onKey(KeyboardEvent *ke) {
 		if (_editable) {
-			if (ke->keycode == 8)
-				_parent->onAction(this, 8);
+			if (ke->keycode == Common::KEYCODE_BACKSPACE)
+				_parent->onAction(this, Common::KEYCODE_BACKSPACE);
 			else if (ke->ascii >= ' ' && ke->ascii <= 255) {
 				// Accept the character if the font renderer
 				// has what looks like a valid glyph for it.
@@ -1354,7 +1355,7 @@
 				drawEditBuffer(slot);
 			}
 			break;
-		case 8:
+		case Common::KEYCODE_BACKSPACE:
 			if (_editPos > _firstPos) {
 				_editBuffer[_editPos - 1] = _editBuffer[_editPos];
 				_editBuffer[_editPos--] = 0;

Modified: scummvm/trunk/engines/sword2/screen.cpp
===================================================================
--- scummvm/trunk/engines/sword2/screen.cpp	2007-06-21 18:35:15 UTC (rev 27592)
+++ scummvm/trunk/engines/sword2/screen.cpp	2007-06-21 19:33:05 UTC (rev 27593)
@@ -31,6 +31,7 @@
 
 #include "common/stdafx.h"
 #include "common/system.h"
+#include "common/events.h"
 
 #include "sword2/sword2.h"
 #include "sword2/defs.h"
@@ -1091,7 +1092,7 @@
 
 		KeyboardEvent *ke = _vm->keyboardEvent();
 
-		if (ke && ke->keycode == 27) {
+		if (ke && ke->keycode == Common::KEYCODE_ESCAPE) {
 			if (!abortCredits) {
 				abortCredits = true;
 				fadeDown();

Modified: scummvm/trunk/engines/sword2/sword2.cpp
===================================================================
--- scummvm/trunk/engines/sword2/sword2.cpp	2007-06-21 18:35:15 UTC (rev 27592)
+++ scummvm/trunk/engines/sword2/sword2.cpp	2007-06-21 19:33:05 UTC (rev 27593)
@@ -381,17 +381,17 @@
 		KeyboardEvent *ke = keyboardEvent();
 
 		if (ke) {
-			if ((ke->modifiers == Common::KBD_CTRL && ke->keycode == 'd') || ke->ascii == '#' || ke->ascii == '~') {
+			if ((ke->modifiers == Common::KBD_CTRL && ke->keycode == Common::KEYCODE_d) || ke->ascii == '#' || ke->ascii == '~') {
 				_debugger->attach();
 			} else if (ke->modifiers == 0 || ke->modifiers == Common::KBD_SHIFT) {
 				switch (ke->keycode) {
-				case 'p':
+				case Common::KEYCODE_p:
 					if (_gamePaused)
 						unpauseGame();
 					else
 						pauseGame();
 					break;
-				case 'c':
+				case Common::KEYCODE_c:
 					if (!_logic->readVar(DEMO) && !_mouse->isChoosing()) {
 						ScreenInfo *screenInfo = _screen->getScreenInfo();
 						_logic->fnPlayCredits(NULL);
@@ -399,13 +399,13 @@
 					}
 					break;
 #ifdef SWORD2_DEBUG
-				case ' ':
+				case Common::KEYCODE_SPACE:
 					if (_gamePaused) {
 						_stepOneCycle = true;
 						unpauseGame();
 					}
 					break;
-				case 's':
+				case Common::KEYCODE_s:
 					_renderSkip = !_renderSkip;
 					break;
 #endif


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