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

svn-id: r27631
This commit is contained in:
Max Horn 2007-06-22 22:00:46 +00:00
parent 8cfb778bfa
commit 1441f0d044
2 changed files with 8 additions and 9 deletions

View File

@ -635,7 +635,7 @@ void SwordEngine::checkCd(void) {
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 @@ uint8 SwordEngine::mainLoop(void) {
// 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 @@ void SwordEngine::delay(int32 amount) { //copied and mutilated from sky.cpp
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;

View File

@ -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 @@ private:
uint8 mainLoop(void);
uint16 _mouseX, _mouseY, _mouseState;
uint8 _keyPressed;
Common::KeyState _keyPressed;
ResMan *_resMan;
ObjectMan *_objectMan;