diff options
author | David Corrales | 2007-06-23 18:51:33 +0000 |
---|---|---|
committer | David Corrales | 2007-06-23 18:51:33 +0000 |
commit | cacd7a28fd51d960947de88abbf30c487e66529d (patch) | |
tree | f3baa59853bfb307e452b86b9d93c4737b1fa6ab /engines/sky/control.cpp | |
parent | 0ac96302fe9c04df79cb01a77d19535b45fe2db0 (diff) | |
parent | 90c2210dae8c91fa8babc6b05564e15c9d445d18 (diff) | |
download | scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.gz scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.tar.bz2 scummvm-rg350-cacd7a28fd51d960947de88abbf30c487e66529d.zip |
Merged the FSNode branch with trunk r27031:27680
svn-id: r27681
Diffstat (limited to 'engines/sky/control.cpp')
-rw-r--r-- | engines/sky/control.cpp | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/engines/sky/control.cpp b/engines/sky/control.cpp index 04f6800aab..c03cf9688b 100644 --- a/engines/sky/control.cpp +++ b/engines/sky/control.cpp @@ -497,7 +497,7 @@ void Control::doControlPanel(void) { _system->updateScreen(); _mouseClicked = false; delay(50); - if (_keyPressed == 27) { // escape pressed + if (_keyPressed.keycode == Common::KEYCODE_ESCAPE) { // escape pressed _mouseClicked = false; quitPanel = true; } @@ -841,7 +841,7 @@ bool Control::autoSaveExists(void) { uint16 Control::saveRestorePanel(bool allowSave) { - _keyPressed = 0; + _keyPressed.reset(); _mouseWheel = 0; buttonControl(NULL); _text->drawToScreen(WITH_MASK); // flush text restore buffer @@ -898,21 +898,21 @@ uint16 Control::saveRestorePanel(bool allowSave) { _system->updateScreen(); _mouseClicked = false; delay(50); - if (_keyPressed == 27) { // escape pressed + if (_keyPressed.keycode == Common::KEYCODE_ESCAPE) { // escape pressed _mouseClicked = false; clickRes = CANCEL_PRESSED; quitPanel = true; - } else if ((_keyPressed == 13) || (_keyPressed == 15)) { + } else if ((_keyPressed.keycode == Common::KEYCODE_RETURN) || (_keyPressed.keycode == Common::KEYCODE_KP_ENTER)) { clickRes = handleClick(lookList[0]); if (clickRes == GAME_SAVED) saveDescriptions(saveGameTexts); quitPanel = true; _mouseClicked = false; - _keyPressed = 0; - } if (allowSave && _keyPressed) { + _keyPressed.reset(); + } if (allowSave && _keyPressed.keycode) { handleKeyPress(_keyPressed, _selectedGame * MAX_TEXT_LEN + saveGameTexts); refreshNames = true; - _keyPressed = 0; + _keyPressed.reset(); } if (_mouseWheel) { @@ -991,9 +991,9 @@ bool Control::checkKeyList(uint8 key) { return false; } -void Control::handleKeyPress(uint8 key, uint8 *textBuf) { +void Control::handleKeyPress(Common::KeyState kbd, uint8 *textBuf) { - if (key == 8) { // backspace + if (kbd.keycode == Common::KEYCODE_BACKSPACE) { // backspace for (uint8 cnt = 0; cnt < 6; cnt++) if (!textBuf[cnt]) return; @@ -1004,15 +1004,15 @@ void Control::handleKeyPress(uint8 key, uint8 *textBuf) { } else { if (_enteredTextWidth >= PAN_LINE_WIDTH - 10) return; - if (((key >= 'A') && (key <= 'Z')) || ((key >= 'a') && (key <= 'z')) || - ((key >= '0') && (key <= '9')) || checkKeyList(key)) { + if (((kbd.ascii >= 'A') && (kbd.ascii <= 'Z')) || ((kbd.ascii >= 'a') && (kbd.ascii <= 'z')) || + ((kbd.ascii >= '0') && (kbd.ascii <= '9')) || checkKeyList(kbd.ascii)) { uint8 strLen = 0; while (textBuf[0]) { textBuf++; strLen++; } if (strLen < MAX_TEXT_LEN) { - textBuf[0] = key; + textBuf[0] = kbd.ascii; textBuf[1] = 0; } } @@ -1556,18 +1556,14 @@ void Control::delay(unsigned int amount) { uint32 start = _system->getMillis(); uint32 cur = start; - _keyPressed = 0; //reset + _keyPressed.reset(); do { Common::EventManager *eventMan = _system->getEventManager(); 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 == 8) - _keyPressed = 8; - else - _keyPressed = (byte)event.kbd.ascii; + _keyPressed = event.kbd; break; case Common::EVENT_MOUSEMOVE: if (!(SkyEngine::_systemVars.systemFlags & SF_MOUSE_LOCKED)) |