From 53615c91288b32892e9a8334ea67d4c0059b575c Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Wed, 23 Jul 2008 07:52:43 +0000 Subject: Removed the historical waitUntilLeftClick function and adapted code to use the more general readInput and waitForButtonEvent. svn-id: r33226 --- engines/parallaction/callables_ns.cpp | 17 +++---- engines/parallaction/gui_ns.cpp | 83 ++++++++++++++++++-------------- engines/parallaction/input.cpp | 12 ----- engines/parallaction/input.h | 1 - engines/parallaction/parallaction.cpp | 5 +- engines/parallaction/parallaction_ns.cpp | 4 +- 6 files changed, 59 insertions(+), 63 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp index ed60a193ce..558d6fdc33 100644 --- a/engines/parallaction/callables_ns.cpp +++ b/engines/parallaction/callables_ns.cpp @@ -340,7 +340,7 @@ void Parallaction_ns::_c_endComment(void *param) { g_system->delayMillis(20); } - _input->waitUntilLeftClick(); + _input->waitForButtonEvent(kMouseLeftUp); _balloonMan->freeBalloons(); return; @@ -396,7 +396,9 @@ void Parallaction_ns::_c_finito(void *parm) { _gfx->showLabel(id[1], CENTER_LABEL_HORIZONTAL, 100); _gfx->showLabel(id[2], CENTER_LABEL_HORIZONTAL, 130); _gfx->showLabel(id[3], CENTER_LABEL_HORIZONTAL, 160); - _input->waitUntilLeftClick(); + + _gfx->updateScreen(); + _input->waitForButtonEvent(kMouseLeftUp); _gfx->freeLabels(); @@ -498,18 +500,15 @@ void Parallaction_ns::_c_endIntro(void *parm) { id[0] = _gfx->createLabel(_menuFont, "CLICK MOUSE BUTTON TO START", 1); _gfx->showLabel(id[0], CENTER_LABEL_HORIZONTAL, 80); - - _input->waitUntilLeftClick(); - + _gfx->updateScreen(); + _input->waitForButtonEvent(kMouseLeftUp); _gfx->freeLabels(); - _engineFlags &= ~kEngineBlockInput; selectStartLocation(); - cleanupGame(); - } else { - _input->waitUntilLeftClick(); + _gfx->updateScreen(); + _input->waitForButtonEvent(kMouseLeftUp); } return; diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp index 9c48586dbc..6068a6a0dd 100644 --- a/engines/parallaction/gui_ns.cpp +++ b/engines/parallaction/gui_ns.cpp @@ -271,15 +271,22 @@ uint16 Parallaction_ns::guiChooseLanguage() { Common::Point p; int selection = -1; + int event; while (selection == -1) { - _input->waitUntilLeftClick(); - _input->getCursorPos(p); - for (uint16 i = 0; i < 4; i++) { - if (blocks[i].contains(p)) { - selection = i; - break; + _input->readInput(); + event = _input->getLastButtonEvent(); + + if (event == kMouseLeftUp) { + _input->getCursorPos(p); + for (uint16 i = 0; i < 4; i++) { + if (blocks[i].contains(p)) { + selection = i; + break; + } } } + + _gfx->updateScreen(); } beep(); @@ -305,9 +312,7 @@ uint16 Parallaction_ns::guiSelectGame() { Common::Point p; - _input->readInput(); - uint32 event = _input->getLastButtonEvent(); - + uint32 event = kMouseNone; while (event != kMouseLeftUp) { _input->readInput(); @@ -432,37 +437,41 @@ int Parallaction_ns::guiSelectCharacter() { _gfx->showLabel(id[0], 60, 30); _di = 0; + int event; while (_di < PASSWORD_LEN) { - - _input->waitUntilLeftClick(); - _input->getCursorPos(p); - - int _si = guiGetSelectedBlock(p); - - if (_si != -1) { - _gfx->grabBackground(codeTrueBlocks[_si], block); - _gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false); - - if (keys[0][_di] == _si) { - points[0]++; - } else - if (keys[1][_di] == _si) { - points[1]++; - } else - if (keys[2][_di] == _si) { - points[2]++; - } else { - fail = true; + _input->readInput(); + event = _input->getLastButtonEvent(); + if (event == kMouseLeftUp) { + + _input->getCursorPos(p); + + int _si = guiGetSelectedBlock(p); + + if (_si != -1) { + _gfx->grabBackground(codeTrueBlocks[_si], block); + _gfx->patchBackground(block, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, false); + + if (keys[0][_di] == _si) { + points[0]++; + } else + if (keys[1][_di] == _si) { + points[1]++; + } else + if (keys[2][_di] == _si) { + points[2]++; + } else { + fail = true; + } + + // build user preference + points[0] += (keys[0][_di] == _si); + points[1] += (keys[1][_di] == _si); + points[2] += (keys[2][_di] == _si); + + _di++; } - - // build user preference - points[0] += (keys[0][_di] == _si); - points[1] += (keys[1][_di] == _si); - points[2] += (keys[2][_di] == _si); - - _di++; } - + _gfx->updateScreen(); } if (!fail) { diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp index 4de5ff711b..c26e28b377 100644 --- a/engines/parallaction/input.cpp +++ b/engines/parallaction/input.cpp @@ -126,18 +126,6 @@ void Input::waitForButtonEvent(uint32 buttonEventMask, int32 timeout) { } -// FIXME: see comment for readInput() -void Input::waitUntilLeftClick() { - - do { - readInput(); - _vm->_gfx->updateScreen(); - _vm->_system->delayMillis(30); - } while (_mouseButtons != kMouseLeftUp); - - return; -} - void Input::updateGameInput() { diff --git a/engines/parallaction/input.h b/engines/parallaction/input.h index 679417c0e5..68acce6554 100644 --- a/engines/parallaction/input.h +++ b/engines/parallaction/input.h @@ -113,7 +113,6 @@ public: void readInput(); InputData* updateInput(); void trackMouse(ZonePtr z); - void waitUntilLeftClick(); void waitForButtonEvent(uint32 buttonEventMask, int32 timeout = -1); uint32 getLastButtonEvent() { return _mouseButtons; } bool getLastKeyDown(uint16 &ascii); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 59a97d1dd4..e7455220ec 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -384,11 +384,10 @@ void Parallaction::doLocationEnterTransition() { _programExec->runScripts(_location._programs.begin(), _location._programs.end()); drawAnimations(); - + showLocationComment(_location._comment, false); _gfx->updateScreen(); - showLocationComment(_location._comment, false); - _input->waitUntilLeftClick(); + _input->waitForButtonEvent(kMouseLeftUp); _balloonMan->freeBalloons(); // fades maximum intensity palette towards approximation of main palette diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index 9e925d1e1d..b2e60c5851 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -323,7 +323,9 @@ void Parallaction_ns::changeLocation(char *location) { showSlide(locname.slide()); uint id = _gfx->createLabel(_menuFont, _location._slideText[0], 1); _gfx->showLabel(id, CENTER_LABEL_HORIZONTAL, 14); - _input->waitUntilLeftClick(); + _gfx->updateScreen(); + + _input->waitForButtonEvent(kMouseLeftUp); _gfx->freeLabels(); freeBackground(); } -- cgit v1.2.3