From f59ccf534cc357d4cde1889fc9ff3ad852d73360 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Tue, 22 Dec 2015 22:41:56 +0200 Subject: [PATCH] LAB: Get rid of the _doNotDrawMessage hack (from the original) This is actually a nasty hack in the original to avoid duplicate messages, but it ended up hiding some game messages. This hack isn't really necessary at all for game functionality, so it has been removed, without any notable side-effects --- engines/lab/dispman.cpp | 6 ------ engines/lab/dispman.h | 1 - engines/lab/engine.cpp | 9 --------- engines/lab/processroom.cpp | 35 ++++++++++++----------------------- 4 files changed, 12 insertions(+), 39 deletions(-) diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index 307a7f78aee..55c66cd2112 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -45,7 +45,6 @@ namespace Lab { DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) { _longWinInFront = false; _lastMessageLong = false; - _doNotDrawMessage = false; _screenBytesPerPage = 65536; _curPen = 0; @@ -251,11 +250,6 @@ int DisplayMan::longDrawMessage(Common::String str) { } void DisplayMan::drawMessage(Common::String str) { - if (_doNotDrawMessage) { - _doNotDrawMessage = false; - return; - } - if (str.empty()) return; diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h index a88923ee4c7..b5e1248fadb 100644 --- a/engines/lab/dispman.h +++ b/engines/lab/dispman.h @@ -284,7 +284,6 @@ public: int _screenHeight; byte *_displayBuffer; byte *_currentDisplayBuffer; - bool _doNotDrawMessage; uint16 *_fadePalette; BitMap *_dispBitMap; }; diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp index b4c20b58da1..4a977d8a41d 100644 --- a/engines/lab/engine.cpp +++ b/engines/lab/engine.cpp @@ -592,7 +592,6 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo if (_graphics->_longWinInFront) { if ((msgClass == kMessageRawKey) || (leftButtonClick || rightButtonClick)) { _graphics->_longWinInFront = false; - _graphics->_doNotDrawMessage = false; _graphics->drawPanel(); drawRoomMessage(curInv, _closeDataPtr); _graphics->screenUpdate(); @@ -628,7 +627,6 @@ bool LabEngine::fromCrumbs(uint32 tmpClass, uint16 code, uint16 qualifier, Commo eatMessages(); _alternate = !_alternate; _anim->_doBlack = true; - _graphics->_doNotDrawMessage = false; _mainDisplay = true; // Sets the correct button list interfaceOn(); @@ -701,7 +699,6 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 &msgClass, uint16 &quali eatMessages(); _alternate = false; _anim->_doBlack = true; - _graphics->_doNotDrawMessage = false; _mainDisplay = true; // Sets the correct button list @@ -721,7 +718,6 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 &msgClass, uint16 &quali } } else if ((code == Common::KEYCODE_x) || (code == Common::KEYCODE_q)) { // Quit? - _graphics->_doNotDrawMessage = false; _graphics->drawMessage("Do you want to quit? (Y/N)"); eatMessages(); interfaceOff(); @@ -792,7 +788,6 @@ void LabEngine::processMainButton(uint16 &curInv, uint16 &lastInv, uint16 &oldDi _alternate = true; _anim->_doBlack = true; - _graphics->_doNotDrawMessage = false; // Sets the correct button list interfaceOn(); _mainDisplay = false; @@ -909,7 +904,6 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI eatMessages(); _alternate = false; _anim->_doBlack = true; - _graphics->_doNotDrawMessage = false; _mainDisplay = true; // Sets the correct button list @@ -971,14 +965,12 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI case kButtonPrevItem: decIncInv(&curInv, true); lastInv = curInv; - _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _closeDataPtr); break; case kButtonNextItem: decIncInv(&curInv, false); lastInv = curInv; - _graphics->_doNotDrawMessage = false; drawRoomMessage(curInv, _closeDataPtr); break; @@ -1001,7 +993,6 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI eatMessages(); _alternate = false; _anim->_doBlack = true; - _graphics->_doNotDrawMessage = false; _mainDisplay = true; // Sets the correct button list diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp index 0d09c37e847..71f53e10209 100644 --- a/engines/lab/processroom.cpp +++ b/engines/lab/processroom.cpp @@ -302,35 +302,20 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { _conditions->exclElement(actionList->_param1); break; - case SHOWMESSAGE: { - _graphics->_doNotDrawMessage = false; - - Common::String text = actionList->_messages[0]; + case SHOWMESSAGE: if (_graphics->_longWinInFront) - _graphics->longDrawMessage(text); + _graphics->longDrawMessage(actionList->_messages[0]); else - _graphics->drawMessage(text); - - _graphics->_doNotDrawMessage = true; - } + _graphics->drawMessage(actionList->_messages[0]); break; case CSHOWMESSAGE: - if (!*closePtrList) { - Common::String text = actionList->_messages[0]; - _graphics->_doNotDrawMessage = false; - _graphics->drawMessage(text); - _graphics->_doNotDrawMessage = true; - } - + if (!*closePtrList) + _graphics->drawMessage(actionList->_messages[0]); break; - case SHOWMESSAGES: { - Common::String *str = actionList->_messages; - _graphics->_doNotDrawMessage = false; - _graphics->drawMessage(str[_utils->getRandom(actionList->_param1)]); - _graphics->_doNotDrawMessage = true; - } + case SHOWMESSAGES: + _graphics->drawMessage(actionList->_messages[_utils->getRandom(actionList->_param1)]); break; case SETPOSITION: @@ -378,7 +363,11 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) { break; case SHOWDIR: - _graphics->_doNotDrawMessage = false; + // Originally, this set _doNotDrawMessage to false, so that the + // message would be shown by drawMessage(). However, _doNotDrawMEssage + // ended up hiding subsequent game messages, so this call is actually + // a nasty hack, and has been removed in ScummVM without any notable + // side-effects. break; case WAITSECS: {