diff options
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 17 | ||||
-rw-r--r-- | engines/access/access.h | 4 | ||||
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 11 |
3 files changed, 16 insertions, 16 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index a97bd6d322..051884c704 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -218,17 +218,20 @@ void AccessEngine::freeInactiveData() { _inactive._spritesPtr = nullptr; } -void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr) { +void AccessEngine::speakText(ASurface *s, const Common::String &msg) { + Common::String lines = msg; + Common::String line; int curPage = 0; int soundsLeft = 0; - while(true) { + for (;;) { soundsLeft = _countTbl[curPage]; _events->zeroKeys(); Common::String line; int width = 0; - bool lastLine = _fonts._font2.getLine(msgArr[curPage], s->_maxChars * 6, line, width); + bool lastLine = _fonts._font2.getLine(lines, s->_maxChars * 6, line, width); + // Set font colors _fonts._font2._fontColors[0] = 0; _fonts._font2._fontColors[1] = 28; @@ -308,11 +311,13 @@ void AccessEngine::speakText(ASurface *s, Common::Array<Common::String> msgArr) } } -void AccessEngine::printText(ASurface *s, Common::String &msg) { +void AccessEngine::printText(ASurface *s, const Common::String &msg) { + Common::String lines = msg; Common::String line; int width = 0; - while (true) { - bool lastLine = _fonts._font2.getLine(msg, s->_maxChars * 6, line, width); + + for (;;) { + bool lastLine = _fonts._font2.getLine(lines, s->_maxChars * 6, line, width); // Set font colors _fonts._font2._fontColors[0] = 0; diff --git a/engines/access/access.h b/engines/access/access.h index 157a33c723..bec1dacb4c 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -271,8 +271,8 @@ public: /** * Draw a string on a given surface and update text positioning */ - void printText(ASurface *s, Common::String &msg); - void speakText(ASurface *s, Common::Array<Common::String>msgArr); + void printText(ASurface *s, const Common::String &msg); + void speakText(ASurface *s, const Common::String &msg); /** * Load a savegame diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 66b77d66d2..187b38c497 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -282,17 +282,12 @@ void AmazonEngine::doEstablish(int screenId, int estabIndex) { uint16 msgOffset = READ_LE_UINT16(_eseg->data() + (estabIndex * 2) + 2); _printEnd = 155; + Common::String msg((const char *)_eseg->data() + msgOffset); + if (_txtPages == 0) { - Common::String msg((const char *)_eseg->data() + msgOffset); printText(_screen, msg); } else { - Common::Array<Common::String> msgArr; - for (int i = 0; i < _txtPages; ++i) { - Common::String msg((const char *)_eseg->data() + msgOffset); - msgOffset += msg.size() + 1; - msgArr.push_back(msg); - } - speakText(_screen, msgArr); + speakText(_screen, msg); } _screen->forceFadeOut(); |