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 | |
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')
-rw-r--r-- | engines/sky/control.cpp | 32 | ||||
-rw-r--r-- | engines/sky/control.h | 5 | ||||
-rw-r--r-- | engines/sky/intro.cpp | 2 | ||||
-rw-r--r-- | engines/sky/mouse.cpp | 2 | ||||
-rw-r--r-- | engines/sky/sky.cpp | 45 | ||||
-rw-r--r-- | engines/sky/sky.h | 3 |
6 files changed, 40 insertions, 49 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)) diff --git a/engines/sky/control.h b/engines/sky/control.h index ebf66a9e16..217ab5714a 100644 --- a/engines/sky/control.h +++ b/engines/sky/control.h @@ -27,6 +27,7 @@ #define SKY_CONTROL_H #include "common/stdafx.h" +#include "common/events.h" #include "common/scummsys.h" class OSystem; @@ -220,7 +221,7 @@ private: void setUpGameSprites(uint8 *nameBuf, dataFileHeader **nameSprites, uint16 firstNum, uint16 selectedGame); void showSprites(dataFileHeader **nameSprites, bool allowSave); bool checkKeyList(uint8 key); - void handleKeyPress(uint8 key, uint8 *textBuf); + void handleKeyPress(Common::KeyState kbd, uint8 *textBuf); uint16 _selectedGame; uint16 saveGameToFile(void); @@ -243,7 +244,7 @@ private: Sound *_skySound; OSystem *_system; bool _mouseClicked; - byte _keyPressed; + Common::KeyState _keyPressed; int _mouseWheel; struct { diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp index 482dc623cc..6d841495af 100644 --- a/engines/sky/intro.cpp +++ b/engines/sky/intro.cpp @@ -917,7 +917,7 @@ bool Intro::escDelay(uint32 msecs) { do { while (eventMan->pollEvent(event)) { if (event.type == Common::EVENT_KEYDOWN) { - if (event.kbd.keycode == 27) + if (event.kbd.keycode == Common::KEYCODE_ESCAPE) return false; } else if (event.type == Common::EVENT_QUIT) { _quitProg = true; diff --git a/engines/sky/mouse.cpp b/engines/sky/mouse.cpp index c18eb6d901..524005b7e3 100644 --- a/engines/sky/mouse.cpp +++ b/engines/sky/mouse.cpp @@ -191,7 +191,7 @@ void Mouse::waitMouseNotPressed(int minDelay) { while (eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: - if (event.kbd.ascii == 27) { + if (event.kbd.keycode == Common::KEYCODE_ESCAPE) { minDelay = 0; mousePressed = false; } diff --git a/engines/sky/sky.cpp b/engines/sky/sky.cpp index d8e642d717..1ff23dbd07 100644 --- a/engines/sky/sky.cpp +++ b/engines/sky/sky.cpp @@ -217,57 +217,54 @@ void SkyEngine::initVirgin() { void SkyEngine::handleKey(void) { - if (_keyPressed && _systemVars.paused) { + if (_keyPressed.keycode && _systemVars.paused) { _skySound->fnUnPauseFx(); _systemVars.paused = false; _skyScreen->setPaletteEndian((uint8 *)_skyCompact->fetchCpt(SkyEngine::_systemVars.currentPalette)); - _keyFlags = _keyPressed = 0; - return; - } - - if (_keyFlags == Common::KBD_CTRL) { - if (_keyPressed == 'f') + } else if (_keyPressed.flags == Common::KBD_CTRL) { + if (_keyPressed.keycode == 'f') _fastMode ^= 1; - else if (_keyPressed == 'g') + else if (_keyPressed.keycode == 'g') _fastMode ^= 2; - else if (_keyPressed == 'd') + else if (_keyPressed.keycode == 'd') _debugger->attach(); - } else { - switch (_keyPressed) { - case '`': - case '~': - case '#': + } else if (_keyPressed.keycode) { + switch (_keyPressed.keycode) { + case Common::KEYCODE_BACKQUOTE: + case Common::KEYCODE_HASH: _debugger->attach(); break; - case 63: + case Common::KEYCODE_F5: _skyControl->doControlPanel(); break; - case 27: + case Common::KEYCODE_ESCAPE: if (!_systemVars.pastIntro) _skyControl->restartGame(); break; - case '.': + case Common::KEYCODE_PERIOD: _skyMouse->logicClick(); break; - case 'p': + case Common::KEYCODE_p: _skyScreen->halvePalette(); _skySound->fnPauseFx(); _systemVars.paused = true; break; + default: + break; } } - _keyFlags = _keyPressed = 0; + _keyPressed.reset(); } int SkyEngine::go() { _systemVars.quitGame = false; - _keyFlags = _keyPressed = 0; + _keyPressed.reset(); uint16 result = 0; if (ConfMan.hasKey("save_slot") && ConfMan.getInt("save_slot") >= 0) @@ -517,7 +514,7 @@ void SkyEngine::delay(int32 amount) { Common::Event event; uint32 start = _system->getMillis(); - _keyFlags = _keyPressed = 0; //reset + _keyPressed.reset(); if (amount < 0) amount = 0; @@ -526,11 +523,7 @@ void SkyEngine::delay(int32 amount) { while (_eventMan->pollEvent(event)) { switch (event.type) { case Common::EVENT_KEYDOWN: - _keyFlags = event.kbd.flags; - if (_keyFlags == Common::KBD_CTRL) - _keyPressed = event.kbd.keycode; - else - _keyPressed = (byte)event.kbd.ascii; + _keyPressed = event.kbd; break; case Common::EVENT_MOUSEMOVE: if (!(_systemVars.systemFlags & SF_MOUSE_LOCKED)) diff --git a/engines/sky/sky.h b/engines/sky/sky.h index bc76e37eef..002964d6bb 100644 --- a/engines/sky/sky.h +++ b/engines/sky/sky.h @@ -27,6 +27,7 @@ #define SKY_H #include "common/stdafx.h" +#include "common/events.h" #include "engines/engine.h" namespace Sky { @@ -60,7 +61,7 @@ class SkyCompact; class SkyEngine : public Engine { GUI::Debugger *getDebugger(); protected: - byte _keyPressed, _keyFlags; + Common::KeyState _keyPressed; bool _floppyIntro; Sound *_skySound; |