From 3fca9d42f3ff6d19eba40d09754cc794f8e17585 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 18 Dec 2014 07:23:18 +0100 Subject: ACCESS: Use Common::String to display bubble box text --- engines/access/bubble_box.cpp | 10 +++++----- engines/access/bubble_box.h | 2 +- engines/access/scripts.cpp | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/engines/access/bubble_box.cpp b/engines/access/bubble_box.cpp index 572567c3a3..e37a8142e8 100644 --- a/engines/access/bubble_box.cpp +++ b/engines/access/bubble_box.cpp @@ -29,7 +29,7 @@ namespace Access { BubbleBox::BubbleBox(AccessEngine *vm) : Manager(vm) { _type = TYPE_2; _bounds = Common::Rect(64, 32, 64 + 130, 32 + 122); - _bubblePtr = nullptr; + _bubbleDisplStr = ""; _fieldD = 0; _fieldE = 0; _fieldF = 0; @@ -43,7 +43,7 @@ void BubbleBox::load(Common::SeekableReadStream *stream) { while ((v = stream->readByte()) != 0) _bubbleTitle += (char)v; - _bubblePtr = _bubbleTitle.c_str(); + _bubbleDisplStr = _bubbleTitle; } void BubbleBox::clearBubbles() { @@ -90,7 +90,7 @@ void BubbleBox::calcBubble(const Common::String &msg) { if (_type == TYPE_4) { _vm->_fonts._printMaxX = 110; } else { - _vm->_fonts._printMaxX = _vm->_fonts._font2.stringWidth(_bubblePtr); + _vm->_fonts._printMaxX = _vm->_fonts._font2.stringWidth(_bubbleDisplStr); } // Start of with a rect with the given starting x and y @@ -257,13 +257,13 @@ void BubbleBox::doBox(int item, int box) { } // Handle drawing title - int titleWidth = _vm->_fonts._font2.stringWidth(_bubblePtr); + int titleWidth = _vm->_fonts._font2.stringWidth(_bubbleDisplStr); Font &font2 = _vm->_fonts._font2; font2._fontColors[0] = 0; font2._fontColors[1] = 3; font2._fontColors[2] = 2; font2._fontColors[3] = 1; - font2.drawString(_vm->_screen, _bubblePtr, Common::Point( + font2.drawString(_vm->_screen, _bubbleDisplStr, Common::Point( _bounds.left + (_bounds.width() / 2) - (titleWidth / 2), _bounds.top + 1)); // Restore positional state diff --git a/engines/access/bubble_box.h b/engines/access/bubble_box.h index 2c05d096c3..0130344c7e 100644 --- a/engines/access/bubble_box.h +++ b/engines/access/bubble_box.h @@ -48,7 +48,7 @@ public: Common::Rect _bounds; Common::StringArray _nameIndex; Common::String _bubbleTitle; - const char *_bubblePtr; + Common::String _bubbleDisplStr; int _fieldD; int _fieldE; int _fieldF; diff --git a/engines/access/scripts.cpp b/engines/access/scripts.cpp index ac10fe38d9..99f52c0ff8 100644 --- a/engines/access/scripts.cpp +++ b/engines/access/scripts.cpp @@ -621,7 +621,7 @@ void Scripts::cmdTexSpeak() { while ((v = _data->readByte()) != 0) tmpStr += (char)v; - _vm->_bubbleBox->_bubblePtr = Common::String("JASON").c_str(); + _vm->_bubbleBox->_bubbleDisplStr = Common::String("JASON"); _vm->_bubbleBox->placeBubble1(tmpStr); findNull(); } @@ -645,7 +645,7 @@ void Scripts::cmdTexChoice() { _vm->_screen->_printStart = _texsOrg; _vm->_bubbleBox->clearBubbles(); - _vm->_bubbleBox->_bubblePtr = Common::String("RESPONSE 1").c_str(); + _vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 1"); byte v; Common::String tmpStr = ""; @@ -666,7 +666,7 @@ void Scripts::cmdTexChoice() { tmpStr += (char)v; if (tmpStr.size() != 0) { - _vm->_bubbleBox->_bubblePtr = Common::String("RESPONSE 2").c_str(); + _vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 2"); _vm->_bubbleBox->calcBubble(tmpStr); _vm->_bubbleBox->printBubble(tmpStr); responseCoords.push_back(_vm->_bubbleBox->_bounds); @@ -681,7 +681,7 @@ void Scripts::cmdTexChoice() { tmpStr += (char)v; if (tmpStr.size() != 0) { - _vm->_bubbleBox->_bubblePtr = Common::String("RESPONSE 3").c_str(); + _vm->_bubbleBox->_bubbleDisplStr = Common::String("RESPONSE 3"); _vm->_bubbleBox->calcBubble(tmpStr); _vm->_bubbleBox->printBubble(tmpStr); responseCoords.push_back(_vm->_bubbleBox->_bounds); @@ -698,7 +698,7 @@ void Scripts::cmdTexChoice() { charLoop(); - _vm->_bubbleBox->_bubblePtr = _vm->_bubbleBox->_bubbleTitle.c_str(); + _vm->_bubbleBox->_bubbleDisplStr = _vm->_bubbleBox->_bubbleTitle; if (_vm->_events->_leftButton) { if (_vm->_events->_mouseRow >= 22) { _vm->_events->debounceLeft(); -- cgit v1.2.3