LAB: Fix switching between texts in monitor

This commit is contained in:
Willem Jan Palenstijn 2016-01-05 23:00:06 +01:00
parent 1eed77c376
commit 15bbcff786
2 changed files with 8 additions and 7 deletions

View file

@ -461,7 +461,7 @@ private:
/** /**
* Processes user input. * 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. * Figures out what a room's coordinates should be.

View file

@ -334,10 +334,11 @@ void LabEngine::drawMonText(const char *text, TextFont *monitorFont, Common::Rec
_event->mouseShow(); _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; Common::String startFileName = _monitorTextFilename;
const CloseData *startClosePtr = _closeDataPtr, *lastClosePtr[10]; const CloseData *startClosePtr = _closeDataPtr, *lastClosePtr[10];
uint16 depth = 0; uint16 depth = 0;
Common::String text = ntext;
lastClosePtr[0] = _closeDataPtr; lastClosePtr[0] = _closeDataPtr;
@ -356,7 +357,7 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is
_monitorPage = 0; _monitorPage = 0;
_monitorTextFilename = filename; _monitorTextFilename = filename;
Common::String text = _resource->getText(_monitorTextFilename); text = _resource->getText(_monitorTextFilename);
_graphics->fade(false); _graphics->fade(false);
drawMonText(text.c_str(), monitorFont, textRect, isInteractive); drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
_graphics->fade(true); _graphics->fade(true);
@ -402,7 +403,7 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is
} }
} else if (_monitorPage > 0) { } else if (_monitorPage > 0) {
_monitorPage = 0; _monitorPage = 0;
drawMonText(ntext, monitorFont, textRect, isInteractive); drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
} }
} else if (mouseX < _utils->vgaScaleX(259)) { } else if (mouseX < _utils->vgaScaleX(259)) {
// empty region; ignore // empty region; ignore
@ -410,12 +411,12 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is
// Page down button // Page down button
if (!_lastPage) { if (!_lastPage) {
_monitorPage += 1; _monitorPage += 1;
drawMonText(ntext, monitorFont, textRect, isInteractive); drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
} }
} else if (_monitorPage >= 1) { } else if (_monitorPage >= 1) {
// Page up button // Page up button
_monitorPage -= 1; _monitorPage -= 1;
drawMonText(ntext, monitorFont, textRect, isInteractive); drawMonText(text.c_str(), monitorFont, textRect, isInteractive);
} }
} else if (isInteractive) { } else if (isInteractive) {
const CloseData *tmpClosePtr = _closeDataPtr; const CloseData *tmpClosePtr = _closeDataPtr;
@ -458,7 +459,7 @@ void LabEngine::doMonitor(const Common::String background, const Common::String
drawMonText(ntext.c_str(), monitorFont, scaledRect, isinteractive); drawMonText(ntext.c_str(), monitorFont, scaledRect, isinteractive);
_event->mouseShow(); _event->mouseShow();
_graphics->fade(true); _graphics->fade(true);
processMonitor(ntext.c_str(), monitorFont, isinteractive, scaledRect); processMonitor(ntext, monitorFont, isinteractive, scaledRect);
_graphics->fade(false); _graphics->fade(false);
_event->mouseHide(); _event->mouseHide();
_graphics->freeFont(&monitorFont); _graphics->freeFont(&monitorFont);