aboutsummaryrefslogtreecommitdiff
path: root/engines/lab
diff options
context:
space:
mode:
authorFilippos Karapetis2015-12-23 04:19:59 +0200
committerWillem Jan Palenstijn2015-12-23 21:43:16 +0100
commitf7395ba0ab0847961fda31479f0483f3686a5a4e (patch)
tree92942def62fda1a7b25e1d9cdd7597f81cdc94c0 /engines/lab
parent333d55371668f25e8879300b738f75f722e110df (diff)
downloadscummvm-rg350-f7395ba0ab0847961fda31479f0483f3686a5a4e.tar.gz
scummvm-rg350-f7395ba0ab0847961fda31479f0483f3686a5a4e.tar.bz2
scummvm-rg350-f7395ba0ab0847961fda31479f0483f3686a5a4e.zip
LAB: Rewrite the action message functionality (_doNotShowMessage)
Diffstat (limited to 'engines/lab')
-rw-r--r--engines/lab/dispman.cpp21
-rw-r--r--engines/lab/dispman.h8
-rw-r--r--engines/lab/engine.cpp12
-rw-r--r--engines/lab/intro.cpp2
-rw-r--r--engines/lab/lab.cpp2
-rw-r--r--engines/lab/processroom.cpp18
6 files changed, 39 insertions, 24 deletions
diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp
index 55c66cd211..2ae99a51af 100644
--- a/engines/lab/dispman.cpp
+++ b/engines/lab/dispman.cpp
@@ -45,6 +45,7 @@ namespace Lab {
DisplayMan::DisplayMan(LabEngine *vm) : _vm(vm) {
_longWinInFront = false;
_lastMessageLong = false;
+ _actionMessageShown = false;
_screenBytesPerPage = 65536;
_curPen = 0;
@@ -229,7 +230,14 @@ void DisplayMan::createBox(uint16 y2) {
drawVLine(_vm->_utils->vgaScaleX(2), _vm->_utils->vgaScaleY(152), _vm->_utils->vgaScaleY(y2));
}
-int DisplayMan::longDrawMessage(Common::String str) {
+int DisplayMan::longDrawMessage(Common::String str, bool isActionMessage) {
+ if (isActionMessage) {
+ _actionMessageShown = true;
+ } else if (_actionMessageShown) {
+ _actionMessageShown = false;
+ return 0;
+ }
+
if (str.empty())
return 0;
@@ -249,12 +257,19 @@ int DisplayMan::longDrawMessage(Common::String str) {
return flowText(_vm->_msgFont, 0, 1, 7, false, true, true, true, _vm->_utils->vgaRectScale(6, 155, 313, 195), str.c_str());
}
-void DisplayMan::drawMessage(Common::String str) {
+void DisplayMan::drawMessage(Common::String str, bool isActionMessage) {
+ if (isActionMessage) {
+ _actionMessageShown = true;
+ } else if (_actionMessageShown) {
+ _actionMessageShown = false;
+ return;
+ }
+
if (str.empty())
return;
if ((textLength(_vm->_msgFont, str) > _vm->_utils->vgaScaleX(306))) {
- longDrawMessage(str);
+ longDrawMessage(str, isActionMessage);
_lastMessageLong = true;
} else {
if (_longWinInFront) {
diff --git a/engines/lab/dispman.h b/engines/lab/dispman.h
index b5e1248fad..99a4f45bb0 100644
--- a/engines/lab/dispman.h
+++ b/engines/lab/dispman.h
@@ -139,12 +139,15 @@ public:
* Sets up the Labyrinth screens, and opens up the initial windows.
*/
void setUpScreens();
- int32 longDrawMessage(Common::String str);
+
+ int32 longDrawMessage(Common::String str, bool isActionMessage);
/**
* Draws a message to the message box.
*/
- void drawMessage(Common::String str);
+ void drawMessage(Common::String str, bool isActionMessage);
+
+ void setActionMessage(bool val) { _actionMessageShown = val; }
/**
* Sets the pen number to use on all the drawing operations.
@@ -279,6 +282,7 @@ public:
bool _longWinInFront;
bool _lastMessageLong;
+ bool _actionMessageShown;
uint32 _screenBytesPerPage;
int _screenWidth;
int _screenHeight;
diff --git a/engines/lab/engine.cpp b/engines/lab/engine.cpp
index 3350dd74a2..501ca08ee6 100644
--- a/engines/lab/engine.cpp
+++ b/engines/lab/engine.cpp
@@ -133,9 +133,9 @@ void LabEngine::drawRoomMessage(uint16 curInv, CloseDataPtr closePtr) {
drawStaticMessage(kTextkLampOn);
else if (_inventory[curInv]._quantity > 1) {
Common::String roomMessage = _inventory[curInv]._name + " (" + Common::String::format("%d", _inventory[curInv]._quantity) + ")";
- _graphics->drawMessage(roomMessage.c_str());
+ _graphics->drawMessage(roomMessage.c_str(), false);
} else
- _graphics->drawMessage(_inventory[curInv]._name.c_str());
+ _graphics->drawMessage(_inventory[curInv]._name.c_str(), false);
}
} else
drawDirection(closePtr);
@@ -305,7 +305,7 @@ bool LabEngine::doUse(uint16 curInv) {
_closeDataPtr = nullptr;
doMap(_roomNum);
_graphics->setPalette(initcolors, 8);
- _graphics->drawMessage(nullptr);
+ _graphics->drawMessage(nullptr, false);
_graphics->drawPanel();
return true;
case kItemJournal:
@@ -316,7 +316,7 @@ bool LabEngine::doUse(uint16 curInv) {
_closeDataPtr = nullptr;
doJournal();
_graphics->drawPanel();
- _graphics->drawMessage(nullptr);
+ _graphics->drawMessage(nullptr, false);
return true;
case kItemLamp:
interfaceOff();
@@ -718,7 +718,7 @@ bool LabEngine::processKey(IntuiMessage *curMsg, uint32 &msgClass, uint16 &quali
}
} else if ((code == Common::KEYCODE_x) || (code == Common::KEYCODE_q)) {
// Quit?
- _graphics->drawMessage("Do you want to quit? (Y/N)");
+ _graphics->drawMessage("Do you want to quit? (Y/N)", false);
eatMessages();
interfaceOff();
@@ -927,7 +927,7 @@ void LabEngine::processAltButton(uint16 &curInv, uint16 &lastInv, uint16 buttonI
_graphics->drawPanel();
if (doit) {
- _graphics->drawMessage("Disk operation failed.");
+ _graphics->drawMessage("Disk operation failed.", false);
_graphics->setPalette(initcolors, 8);
g_system->delayMillis(1000);
}
diff --git a/engines/lab/intro.cpp b/engines/lab/intro.cpp
index a60bd241a1..8e580f1250 100644
--- a/engines/lab/intro.cpp
+++ b/engines/lab/intro.cpp
@@ -98,7 +98,7 @@ void Intro::doPictText(const Common::String filename, TextFont *msgFont, bool is
charDrawn = _vm->_graphics->flowText(msgFont, (!_vm->_isHiRes) * -1, 5, 7, false, false, true, true, _vm->_utils->vgaRectScale(14, 11, 306, 189), (char *)curText);
_vm->_graphics->fade(true, 0);
} else
- charDrawn = _vm->_graphics->longDrawMessage(Common::String((char *)curText));
+ charDrawn = _vm->_graphics->longDrawMessage(Common::String((char *)curText), false);
curText += charDrawn;
doneFl = (*curText == 0);
diff --git a/engines/lab/lab.cpp b/engines/lab/lab.cpp
index 52dd4169ba..01300ae442 100644
--- a/engines/lab/lab.cpp
+++ b/engines/lab/lab.cpp
@@ -222,7 +222,7 @@ Common::String LabEngine::generateSaveFileName(uint slot) {
}
void LabEngine::drawStaticMessage(byte index) {
- _graphics->drawMessage(_resource->getStaticText((StaticText)index));
+ _graphics->drawMessage(_resource->getStaticText((StaticText)index), false);
}
void LabEngine::changeVolume(int delta) {
diff --git a/engines/lab/processroom.cpp b/engines/lab/processroom.cpp
index 2e37847346..fede42d938 100644
--- a/engines/lab/processroom.cpp
+++ b/engines/lab/processroom.cpp
@@ -132,7 +132,7 @@ Common::String LabEngine::getPictName(CloseDataPtr *closePtrList) {
void LabEngine::drawDirection(CloseDataPtr closePtr) {
if (closePtr && !closePtr->_message.empty()) {
- _graphics->drawMessage(closePtr->_message);
+ _graphics->drawMessage(closePtr->_message, false);
return;
}
@@ -150,7 +150,7 @@ void LabEngine::drawDirection(CloseDataPtr closePtr) {
else if (_direction == WEST)
message += _resource->getStaticText(kTextFacingWest);
- _graphics->drawMessage(message);
+ _graphics->drawMessage(message, false);
}
uint16 LabEngine::processArrow(uint16 curDirection, uint16 arrow) {
@@ -304,18 +304,18 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) {
case kActionShowMessage:
if (_graphics->_longWinInFront)
- _graphics->longDrawMessage(actionList->_messages[0]);
+ _graphics->longDrawMessage(actionList->_messages[0], true);
else
- _graphics->drawMessage(actionList->_messages[0]);
+ _graphics->drawMessage(actionList->_messages[0], true);
break;
case kActionCShowMessage:
if (!*closePtrList)
- _graphics->drawMessage(actionList->_messages[0]);
+ _graphics->drawMessage(actionList->_messages[0], true);
break;
case kActionShowMessages:
- _graphics->drawMessage(actionList->_messages[_utils->getRandom(actionList->_param1)]);
+ _graphics->drawMessage(actionList->_messages[_utils->getRandom(actionList->_param1)], true);
break;
case kActionChangeRoom:
@@ -363,11 +363,7 @@ void LabEngine::doActions(Action *actionList, CloseDataPtr *closePtrList) {
break;
case kActionShowDir:
- // 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.
+ _graphics->setActionMessage(false);
break;
case kActionWaitSecs: {