[Scummvm-cvs-logs] SF.net SVN: scummvm: [27631] scummvm/trunk/engines/sword1

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jun 23 00:00:47 CEST 2007


Revision: 27631
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27631&view=rev
Author:   fingolfin
Date:     2007-06-22 15:00:46 -0700 (Fri, 22 Jun 2007)

Log Message:
-----------
Converted rest of BS1 to use Common::KeyState (removing two more hacks)

Modified Paths:
--------------
    scummvm/trunk/engines/sword1/sword1.cpp
    scummvm/trunk/engines/sword1/sword1.h

Modified: scummvm/trunk/engines/sword1/sword1.cpp
===================================================================
--- scummvm/trunk/engines/sword1/sword1.cpp	2007-06-22 21:58:32 UTC (rev 27630)
+++ scummvm/trunk/engines/sword1/sword1.cpp	2007-06-22 22:00:46 UTC (rev 27631)
@@ -635,7 +635,7 @@
 
 uint8 SwordEngine::mainLoop(void) {
 	uint8 retCode = 0;
-	_keyPressed = 0;
+	_keyPressed.keycode = Common::KEYCODE_INVALID;
 
 	while ((retCode == 0) && (!_systemVars.engineQuit)) {
 		// do we need the section45-hack from sword.c here?
@@ -678,12 +678,14 @@
 
 			// The control panel is triggered by F5 or ESC.
 			// FIXME: This is a very strange way of detecting F5...
-			else if (((_keyPressed == 63 || _keyPressed == 27) && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
+			else if (((_keyPressed.keycode == Common::KEYCODE_F5 || _keyPressed.keycode == Common::KEYCODE_ESCAPE)
+			         && (Logic::_scriptVars[MOUSE_STATUS] & 1)) || (_systemVars.controlPanelMode)) {
 				retCode = _control->runPanel();
 				if (!retCode)
 					_screen->fullRefresh();
 			}
-			_mouseState = _keyPressed = 0;
+			_mouseState = 0;
+			_keyPressed.keycode = Common::KEYCODE_INVALID;
 		} while ((Logic::_scriptVars[SCREEN] == Logic::_scriptVars[NEW_SCREEN]) && (retCode == 0) && (!_systemVars.engineQuit));
 
 		if ((retCode == 0) && (Logic::_scriptVars[SCREEN] != 53) && _systemVars.wantFade && (!_systemVars.engineQuit)) {
@@ -712,11 +714,7 @@
 		while (_eventMan->pollEvent(event)) {
 			switch (event.type) {
 			case Common::EVENT_KEYDOWN:
-				// Make sure backspace works right (this fixes a small issue on OS X)
-				if (event.kbd.keycode == Common::KEYCODE_BACKSPACE)
-					_keyPressed = 8;
-				else
-					_keyPressed = (uint8)event.kbd.ascii;
+				_keyPressed = event.kbd;
 				break;
 			case Common::EVENT_MOUSEMOVE:
 				_mouseX = event.mouse.x;

Modified: scummvm/trunk/engines/sword1/sword1.h
===================================================================
--- scummvm/trunk/engines/sword1/sword1.h	2007-06-22 21:58:32 UTC (rev 27630)
+++ scummvm/trunk/engines/sword1/sword1.h	2007-06-22 22:00:46 UTC (rev 27631)
@@ -27,6 +27,7 @@
 #define SWORD1_H
 
 #include "engines/engine.h"
+#include "common/events.h"
 #include "common/util.h"
 #include "sword1/sworddefs.h"
 
@@ -92,7 +93,7 @@
 	uint8 mainLoop(void);
 
 	uint16 _mouseX, _mouseY, _mouseState;
-	uint8 _keyPressed;
+	Common::KeyState _keyPressed;
 
 	ResMan		*_resMan;
 	ObjectMan	*_objectMan;


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