diff options
author | Filippos Karapetis | 2007-09-19 08:27:32 +0000 |
---|---|---|
committer | Filippos Karapetis | 2007-09-19 08:27:32 +0000 |
commit | a89694c0d61a75a960f5bec6c498659c988401cc (patch) | |
tree | 280a0256ddbbb2980ec931ec6068fea195e4e415 /engines | |
parent | 85b1bc594d96bbb1fb9aec3f8e085f219bb52a89 (diff) | |
download | scummvm-rg350-a89694c0d61a75a960f5bec6c498659c988401cc.tar.gz scummvm-rg350-a89694c0d61a75a960f5bec6c498659c988401cc.tar.bz2 scummvm-rg350-a89694c0d61a75a960f5bec6c498659c988401cc.zip |
Moved some keyboard code from Winnie together with the other keyboard functions
svn-id: r28965
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/preagi.h | 2 | ||||
-rw-r--r-- | engines/agi/preagi_common.cpp | 27 | ||||
-rw-r--r-- | engines/agi/preagi_winnie.cpp | 30 |
3 files changed, 31 insertions, 28 deletions
diff --git a/engines/agi/preagi.h b/engines/agi/preagi.h index 50c68991c9..7476dde3cf 100644 --- a/engines/agi/preagi.h +++ b/engines/agi/preagi.h @@ -75,6 +75,8 @@ public: // Keyboard int getSelection(SelectionTypes type); bool waitAnyKeyChoice(); + bool getSelOkBack(); + int rnd(int hi) { return (_rnd->getRandomNumber(hi) + 1); } // Text diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp index a1d6883f58..5e735b896a 100644 --- a/engines/agi/preagi_common.cpp +++ b/engines/agi/preagi_common.cpp @@ -208,4 +208,31 @@ bool PreAgiEngine::waitAnyKeyChoice() { } } +bool PreAgiEngine::getSelOkBack() { + Common::Event event; + + for (;;) { + while (_eventMan->pollEvent(event)) { + switch (event.type) { + case Common::EVENT_QUIT: + _system->quit(); + break; + case Common::EVENT_LBUTTONUP: + return true; + case Common::EVENT_RBUTTONUP: + return false; + case Common::EVENT_KEYDOWN: + switch (event.kbd.keycode) { + case Common::KEYCODE_BACKSPACE: + return false; + default: + return true; + } + default: + break; + } + } + } +} + } diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp index 28ccec294e..02682c92f4 100644 --- a/engines/agi/preagi_winnie.cpp +++ b/engines/agi/preagi_winnie.cpp @@ -218,7 +218,7 @@ int Winnie::parser(int pc, int index, uint8 *buffer) { default: // print description _vm->printStrXOR((char *)(buffer + pc)); - if (getSelOkBack()) + if (_vm->getSelOkBack()) return IDI_WTP_PAR_OK; else return IDI_WTP_PAR_BACK; @@ -854,7 +854,7 @@ void Winnie::getMenuSel(char *szMenu, int *iSel, int fCanSel[]) { break; case Common::KEYCODE_s: if (event.kbd.flags & Common::KBD_CTRL) { - //FlipSound(); + _vm->flipflag(fSoundOn); } else { *iSel = IDI_WTP_SEL_SOUTH; makeSel(); @@ -1018,32 +1018,6 @@ void Winnie::drawRoomPic() { delete [] buffer; } -bool Winnie::getSelOkBack() { - Common::Event event; - - for (;;) { - while (_vm->_system->getEventManager()->pollEvent(event)) { - switch (event.type) { - case Common::EVENT_QUIT: - _vm->_system->quit(); - break; - case Common::EVENT_LBUTTONUP: - return true; - case Common::EVENT_RBUTTONUP: - return false; - case Common::EVENT_KEYDOWN: - switch (event.kbd.keycode) { - case Common::KEYCODE_BACKSPACE: - return false; - default: - return true; - } - default: - break; - } - } - } -} void Winnie::clrMenuSel(int *iSel, int fCanSel[]) { *iSel = IDI_WTP_SEL_OPT_1; while (!fCanSel[*iSel]) { |