Skip to content

Commit

Permalink
LAB: Fix switching between texts in monitor
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp committed Jan 5, 2016
1 parent 1eed77c commit 15bbcff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion engines/lab/lab.h
Expand Up @@ -461,7 +461,7 @@ class LabEngine : public Engine {
/**
* Processes user input.
*/
void processMonitor(const char *ntext, TextFont *monitorFont, bool isInteractive, Common::Rect textRect);
void processMonitor(const Common::String &ntext, TextFont *monitorFont, bool isInteractive, Common::Rect textRect);

/**
* Figures out what a room's coordinates should be.
Expand Down
13 changes: 7 additions & 6 deletions engines/lab/special.cpp
Expand Up @@ -334,10 +334,11 @@ void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rec
_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;

Expand All @@ -356,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);
Expand Down Expand Up @@ -402,20 +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)) {
// 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) {
// Page up button
_monitorPage -= 1;
drawMonText(ntext, monitorFont, textRect, isInteractive);
drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
}
} else if (isInteractive) {
const CloseData *tmpClosePtr = _closeDataPtr;
Expand Down Expand Up @@ -458,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);
Expand Down

0 comments on commit 15bbcff

Please sign in to comment.