From 15bbcff786d830bf665901b7bf02591fc818360c Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Tue, 5 Jan 2016 23:00:06 +0100 Subject: LAB: Fix switching between texts in monitor --- engines/lab/lab.h | 2 +- engines/lab/special.cpp | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) (limited to 'engines') diff --git a/engines/lab/lab.h b/engines/lab/lab.h index 2c3a723f3e..0e9cdd36b1 100644 --- a/engines/lab/lab.h +++ b/engines/lab/lab.h @@ -461,7 +461,7 @@ private: /** * 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. diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index d06d5911ee..48e32cb1dc 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -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; @@ -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); @@ -402,7 +403,7 @@ 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 @@ -410,12 +411,12 @@ void LabEngine::processMonitor(const char *ntext, TextFont *monitorFont, bool is // 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; @@ -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); -- cgit v1.2.3