diff options
author | Filippos Karapetis | 2016-01-14 01:42:03 +0200 |
---|---|---|
committer | Filippos Karapetis | 2016-01-14 23:41:32 +0200 |
commit | ce5f8f32cbbf185046ce390c67fe3d6ccee00533 (patch) | |
tree | e3195fee0b3721dcfe543e9f5109966419469d68 /engines/lab | |
parent | 816381bbfed1b8d8a3305506d5e007e7fc0969c2 (diff) | |
download | scummvm-rg350-ce5f8f32cbbf185046ce390c67fe3d6ccee00533.tar.gz scummvm-rg350-ce5f8f32cbbf185046ce390c67fe3d6ccee00533.tar.bz2 scummvm-rg350-ce5f8f32cbbf185046ce390c67fe3d6ccee00533.zip |
LAB: Clean up the event loops of special game screens
Diffstat (limited to 'engines/lab')
-rw-r--r-- | engines/lab/map.cpp | 8 | ||||
-rw-r--r-- | engines/lab/special.cpp | 148 |
2 files changed, 80 insertions, 76 deletions
diff --git a/engines/lab/map.cpp b/engines/lab/map.cpp index 18c1b17a43..27e80d69b8 100644 --- a/engines/lab/map.cpp +++ b/engines/lab/map.cpp @@ -386,14 +386,16 @@ void LabEngine::processMap(uint16 curRoom) { uint16 curFloor = _maps[curRoom]._pageNumber; while (1) { - // Make sure we check the music at least after every message - updateEvents(); IntuiMessage *msg = _event->getMsg(); if (shouldQuit()) { _quitLab = true; return; } + updateEvents(); + _graphics->screenUpdate(); + _system->delayMillis(10); + if (!msg) { updateEvents(); @@ -520,7 +522,7 @@ void LabEngine::processMap(uint16 curRoom) { _graphics->screenUpdate(); } - } + } // while } void LabEngine::doMap() { diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index d373f8a667..b91ffb454e 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -221,40 +221,41 @@ void LabEngine::drawJournal(uint16 wipenum, bool needFade) { void LabEngine::processJournal() { while (1) { - // Make sure we check the music at least after every message - updateEvents(); IntuiMessage *msg = _event->getMsg(); if (shouldQuit()) { _quitLab = true; return; } + updateEvents(); + _graphics->screenUpdate(); + _system->delayMillis(10); + if (!msg) - updateEvents(); - else { - MessageClass msgClass = msg->_msgClass; + continue; - if ((msgClass == kMessageRightClick) || - ((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) + MessageClass msgClass = msg->_msgClass; + + if ((msgClass == kMessageRightClick) || + ((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) + return; + else if (msgClass == kMessageButtonUp) { + uint16 buttonId = msg->_code; + if (buttonId == 0) { + if (_journalPage >= 2) { + _journalPage -= 2; + drawJournal(1, false); + } + } else if (buttonId == 1) { return; - else if (msgClass == kMessageButtonUp) { - uint16 buttonId = msg->_code; - if (buttonId == 0) { - if (_journalPage >= 2) { - _journalPage -= 2; - drawJournal(1, false); - } - } else if (buttonId == 1) { - return; - } else if (buttonId == 2) { - if (!_lastPage) { - _journalPage += 2; - drawJournal(2, false); - } + } else if (buttonId == 2) { + if (!_lastPage) { + _journalPage += 2; + drawJournal(2, false); } } } - } + } // while } void LabEngine::doJournal() { @@ -364,74 +365,75 @@ void LabEngine::processMonitor(const Common::String &ntext, TextFont *monitorFon } } - updateEvents(); - _graphics->screenUpdate(); - _system->delayMillis(10); - IntuiMessage *msg = _event->getMsg(); if (shouldQuit()) { _quitLab = true; return; } - if (msg) { - MessageClass msgClass = msg->_msgClass; + updateEvents(); + _graphics->screenUpdate(); + _system->delayMillis(10); - if ((msgClass == kMessageRightClick) || - ((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) - return; + if (!msg) + continue; - if (msgClass == kMessageLeftClick) { - int16 mouseX = msg->_mouse.x; - int16 mouseY = msg->_mouse.y; + MessageClass msgClass = msg->_msgClass; - // Check if mouse was in button bar - if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) { - if (mouseX <= _utils->vgaScaleX(31)) { - // Exit button - return; - } + if ((msgClass == kMessageRightClick) || + ((msgClass == kMessageRawKey) && (msg->_code == Common::KEYCODE_ESCAPE))) + return; + + if (msgClass == kMessageLeftClick) { + int16 mouseX = msg->_mouse.x; + int16 mouseY = msg->_mouse.y; + + // Check if mouse was in button bar + if ((mouseY >= _utils->vgaScaleY(171)) && (mouseY <= _utils->vgaScaleY(200))) { + if (mouseX <= _utils->vgaScaleX(31)) { + // Exit button + return; + } - if (mouseX <= _utils->vgaScaleX(59)) { - // Back button - if (isInteractive) { - _monitorPage = 0; - - if (depth) { - depth--; - _closeDataPtr = lastClosePtr[depth]; - } - } else if (_monitorPage > 0) { - _monitorPage = 0; - drawMonText(text.c_str(), monitorFont, textRect, isInteractive); - } - } else if (mouseX < _utils->vgaScaleX(259)) { - // empty region; ignore - } else if (mouseX <= _utils->vgaScaleX(289)) { - // Page down button - if (!_lastPage) { - _monitorPage += 1; - drawMonText(text.c_str(), monitorFont, textRect, isInteractive); + if (mouseX <= _utils->vgaScaleX(59)) { + // Back button + if (isInteractive) { + _monitorPage = 0; + + if (depth) { + depth--; + _closeDataPtr = lastClosePtr[depth]; } - } else if (_monitorPage >= 1) { - // Page up button - _monitorPage -= 1; + } else if (_monitorPage > 0) { + _monitorPage = 0; drawMonText(text.c_str(), monitorFont, textRect, isInteractive); } - } else if (isInteractive) { - const CloseData *tmpClosePtr = _closeDataPtr; - mouseY = 64 + (mouseY / _monitorButtonHeight) * 42; - mouseX = 101; - setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false); - - if (tmpClosePtr != _closeDataPtr) { - lastClosePtr[depth] = tmpClosePtr; - depth++; + } else if (mouseX < _utils->vgaScaleX(259)) { + // empty region; ignore + } else if (mouseX <= _utils->vgaScaleX(289)) { + // Page down button + if (!_lastPage) { + _monitorPage += 1; + drawMonText(text.c_str(), monitorFont, textRect, isInteractive); } + } else if (_monitorPage >= 1) { + // Page up button + _monitorPage -= 1; + drawMonText(text.c_str(), monitorFont, textRect, isInteractive); + } + } else if (isInteractive) { + const CloseData *tmpClosePtr = _closeDataPtr; + mouseY = 64 + (mouseY / _monitorButtonHeight) * 42; + mouseX = 101; + setCurrentClose(Common::Point(mouseX, mouseY), &_closeDataPtr, false); + + if (tmpClosePtr != _closeDataPtr) { + lastClosePtr[depth] = tmpClosePtr; + depth++; } } } - } + } // while } void LabEngine::doMonitor(const Common::String background, const Common::String textfile, bool isinteractive, Common::Rect textRect) { |