aboutsummaryrefslogtreecommitdiff
path: root/engines/lab/special.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/lab/special.cpp')
-rw-r--r--engines/lab/special.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp
index 43d6056125..48e32cb1dc 100644
--- a/engines/lab/special.cpp
+++ b/engines/lab/special.cpp
@@ -288,8 +288,6 @@ void LabEngine::doJournal() {
void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rect textRect, bool isinteractive) {
uint16 drawingToPage = 0, yspacing = 0;
- int charsDrawn = 0;
- const char *curText = text;
_event->mouseHide();
@@ -319,10 +317,10 @@ void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rec
_graphics->rectFill(textRect, 0);
}
+ const char *curText = text;
while (drawingToPage < _monitorPage) {
updateEvents();
- curText = text + charsDrawn;
- charsDrawn += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, textRect, curText);
+ curText += _graphics->flowText(monitorFont, yspacing, 0, 0, false, false, false, false, textRect, curText);
_lastPage = (*curText == 0);
if (_lastPage)
@@ -331,16 +329,16 @@ void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rec
drawingToPage++;
}
- curText = text + charsDrawn;
+ curText += _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, textRect, curText);
_lastPage = (*curText == 0);
- _graphics->flowText(monitorFont, yspacing, 2, 0, false, false, false, true, textRect, curText);
_event->mouseShow();
}
-void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool isInteractive, Common::Rect textRect) {
+void LabEngine::processMonitor(const Common::String &ntext, TextFont *monitorFont, bool isInteractive, Common::Rect textRect) {
Common::String startFileName = _monitorTextFilename;
const CloseData *startClosePtr = _closeDataPtr, *lastClosePtr[10];
uint16 depth = 0;
+ Common::String text = ntext;
lastClosePtr[0] = _closeDataPtr;
@@ -359,7 +357,7 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is
_monitorPage = 0;
_monitorTextFilename = filename;
- Common::String text = _resource->getText(_monitorTextFilename);
+ text = _resource->getText(_monitorTextFilename);
_graphics->fade(false);
drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
_graphics->fade(true);
@@ -387,11 +385,15 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is
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))
+ if (mouseX <= _utils->vgaScaleX(31)) {
+ // Exit button
return;
+ }
if (mouseX <= _utils->vgaScaleX(59)) {
+ // Back button
if (isInteractive) {
_monitorPage = 0;
@@ -401,19 +403,20 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is
}
} else if (_monitorPage > 0) {
_monitorPage = 0;
- drawMonText(ntext, monitorFont, textRect, isInteractive);
+ drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
}
} else if (mouseX < _utils->vgaScaleX(259)) {
- return;
+ // empty region; ignore
} else if (mouseX <= _utils->vgaScaleX(289)) {
+ // Page down button
if (!_lastPage) {
_monitorPage += 1;
- drawMonText(ntext, monitorFont, textRect, isInteractive);
+ drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
}
} else if (_monitorPage >= 1) {
- // mouseX is greater than 290 (scaled)
+ // Page up button
_monitorPage -= 1;
- drawMonText(ntext, monitorFont, textRect, isInteractive);
+ drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
}
} else if (isInteractive) {
const CloseData *tmpClosePtr = _closeDataPtr;
@@ -456,7 +459,7 @@ void LabEngine::doMonitor(const Common::String background, const Common::String
drawMonText(ntext.c_str(), monitorFont, scaledRect, isinteractive);
_event->mouseShow();
_graphics->fade(true);
- processMonitor(ntext.c_str(), monitorFont, isinteractive, scaledRect);
+ processMonitor(ntext, monitorFont, isinteractive, scaledRect);
_graphics->fade(false);
_event->mouseHide();
_graphics->freeFont(&monitorFont);