diff options
author | Strangerke | 2015-12-29 13:31:34 +0100 |
---|---|---|
committer | Strangerke | 2015-12-29 13:31:34 +0100 |
commit | 9834d37b33e3b02d3632a9b1806a065a0146b2c1 (patch) | |
tree | 0bb417926f3c9ce1d7857bc74f696a894fbff4be /engines | |
parent | b580d2d1d019d117544cd2a618f0823f80dcfbb9 (diff) | |
download | scummvm-rg350-9834d37b33e3b02d3632a9b1806a065a0146b2c1.tar.gz scummvm-rg350-9834d37b33e3b02d3632a9b1806a065a0146b2c1.tar.bz2 scummvm-rg350-9834d37b33e3b02d3632a9b1806a065a0146b2c1.zip |
LAB: Reduce the scope of some variables
Diffstat (limited to 'engines')
-rw-r--r-- | engines/lab/engine.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index 42587eb7bb..cd47342097 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -380,12 +380,6 @@ void LabEngine::decIncInv(uint16 *curInv, bool decreaseFl) { } void LabEngine::mainGameLoop() { - uint16 actionMode = 4; - uint16 curInv = kItemMap; - - bool forceDraw = false; - bool gotMessage = true; - _graphics->setPalette(initColors, 8); _closeDataPtr = nullptr; @@ -407,6 +401,7 @@ void LabEngine::mainGameLoop() { _graphics->_longWinInFront = false; _graphics->drawPanel(); + uint16 actionMode = 4; perFlipButton(actionMode); // Load saved slot from the launcher, if requested @@ -421,6 +416,9 @@ void LabEngine::mainGameLoop() { _music->checkRoomMusic(); } + uint16 curInv = kItemMap; + bool forceDraw = false; + bool gotMessage = true; // Set up initial picture. while (1) { _event->processInput(); @@ -549,6 +547,10 @@ void LabEngine::showLab2Teaser() { bool LabEngine::processEvent(MessageClass tmpClass, uint16 code, uint16 qualifier, Common::Point tmpPos, uint16 &curInv, IntuiMessage *curMsg, bool &forceDraw, uint16 buttonId, uint16 &actionMode) { + + if (shouldQuit()) + return false; + MessageClass msgClass = tmpClass; Common::Point curPos = tmpPos; uint16 oldDirection = 0; @@ -562,9 +564,6 @@ bool LabEngine::processEvent(MessageClass tmpClass, uint16 code, uint16 qualifie _anim->_doBlack = false; - if (shouldQuit()) - return false; - if (_graphics->_longWinInFront) { if (msgClass == kMessageRawKey || leftButtonClick || rightButtonClick) { _graphics->_longWinInFront = false; @@ -704,9 +703,6 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 msgClass, uint16 &qualif } void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDirection, bool &forceDraw, uint16 buttonId, uint16 &actionMode) { - uint16 newDir; - uint16 oldRoomNum; - switch (buttonId) { case kButtonPickup: case kButtonUse: @@ -753,7 +749,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi break; case kButtonLeft: - case kButtonRight: + case kButtonRight: { _closeDataPtr = nullptr; if (buttonId == kButtonLeft) drawStaticMessage(kTextTurnLeft); @@ -763,17 +759,18 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi _curFileName = " "; oldDirection = _direction; - newDir = processArrow(_direction, buttonId - 6); + uint16 newDir = processArrow(_direction, buttonId - 6); doTurn(_direction, newDir); _anim->_doBlack = true; _direction = newDir; forceDraw = true; mayShowCrumbIndicator(); + } break; - case kButtonForward: + case kButtonForward: { _closeDataPtr = nullptr; - oldRoomNum = _roomNum; + int oldRoomNum = _roomNum; if (doGoForward()) { if (oldRoomNum == _roomNum) @@ -831,6 +828,7 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi } mayShowCrumbIndicator(); + } break; case kButtonMap: @@ -844,8 +842,6 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi } void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonId, uint16 &actionMode) { - bool saveRestoreSuccessful = true; - _anim->_doBlack = true; switch (buttonId) { @@ -861,12 +857,12 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI drawRoomMessage(curInv, _closeDataPtr); break; - case kButtonSaveLoad: + case kButtonSaveLoad: { interfaceOff(); _anim->stopDiff(); _curFileName = " "; - saveRestoreSuccessful = saveRestoreGame(); + bool saveRestoreSuccessful = saveRestoreGame(); _closeDataPtr = nullptr; _mainDisplay = true; @@ -880,6 +876,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI _graphics->setPalette(initColors, 8); _system->delayMillis(1000); } + } break; case kButtonUseItem: @@ -1006,8 +1003,8 @@ void LabEngine::performAction(uint16 actionMode, Common::Point curPos, uint16 &c _closeDataPtr = tmpClosePtr; } else if (curPos.y < (_utils->vgaScaleY(149) + _utils->svgaCord(2))) drawStaticMessage(kTextNothing); - } - break; + } + break; case 5: if (_conditions->in(curInv)) { |