diff options
author | Nicola Mettifogo | 2011-01-28 13:24:32 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2011-01-28 13:24:32 +0000 |
commit | dd7bc67f82179b40ad0118d3cb81a226e5e53a0a (patch) | |
tree | 11a26612817320dc065668c6b349b0800f26b463 /engines/parallaction | |
parent | 2187411977dc41911c6948b806401aa1330cae94 (diff) | |
download | scummvm-rg350-dd7bc67f82179b40ad0118d3cb81a226e5e53a0a.tar.gz scummvm-rg350-dd7bc67f82179b40ad0118d3cb81a226e5e53a0a.tar.bz2 scummvm-rg350-dd7bc67f82179b40ad0118d3cb81a226e5e53a0a.zip |
Replaced char* with Common::String in balloon code.
svn-id: r55590
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/balloons.cpp | 39 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 12 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 8 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 8 |
4 files changed, 33 insertions, 34 deletions
diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp index b18afb14d7..527f2d2812 100644 --- a/engines/parallaction/balloons.cpp +++ b/engines/parallaction/balloons.cpp @@ -61,7 +61,7 @@ public: WrappedLineFormatter(Font *font) : _font(font) { } virtual ~WrappedLineFormatter() { } - virtual void calc(const char *text, uint16 maxwidth) { + virtual void calc(const Common::String &text, uint16 maxwidth) { setup(); _lineWidth = 0; @@ -194,7 +194,7 @@ protected: public: StringWriter_NS(Parallaction_ns *vm, Font *font) : WrappedLineFormatter(font), _vm(vm) { } - void write(const char *text, uint maxWidth, byte color, Graphics::Surface *surf) { + void write(const Common::String &text, uint maxWidth, byte color, Graphics::Surface *surf) { StringExtent_NS se(_font); se.calc(text, maxWidth); _width = se.width() + 10; @@ -270,10 +270,10 @@ public: ~BalloonManager_ns(); void reset(); - int setLocationBalloon(const char *text, bool endGame); - int setDialogueBalloon(const char *text, uint16 winding, TextColor textColor); - int setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor); - void setBalloonText(uint id, const char *text, TextColor textColor); + int setLocationBalloon(const Common::String &text, bool endGame); + int setDialogueBalloon(const Common::String &text, uint16 winding, TextColor textColor); + int setSingleBalloon(const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor); + void setBalloonText(uint id, const Common::String &text, TextColor textColor); int hitTestDialogueBalloon(int x, int y); }; @@ -330,7 +330,7 @@ int BalloonManager_ns::createBalloon(int16 w, int16 h, int16 winding, uint16 bor } -int BalloonManager_ns::setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) { +int BalloonManager_ns::setSingleBalloon(const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor) { int16 w, h; @@ -352,7 +352,7 @@ int BalloonManager_ns::setSingleBalloon(const char *text, uint16 x, uint16 y, ui return id; } -int BalloonManager_ns::setDialogueBalloon(const char *text, uint16 winding, TextColor textColor) { +int BalloonManager_ns::setDialogueBalloon(const Common::String &text, uint16 winding, TextColor textColor) { int16 w, h; @@ -380,7 +380,7 @@ int BalloonManager_ns::setDialogueBalloon(const char *text, uint16 winding, Text return id; } -void BalloonManager_ns::setBalloonText(uint id, const char *text, TextColor textColor) { +void BalloonManager_ns::setBalloonText(uint id, const Common::String &text, TextColor textColor) { Balloon *balloon = getBalloon(id); balloon->surface->fillRect(balloon->innerBox, 1); @@ -388,7 +388,7 @@ void BalloonManager_ns::setBalloonText(uint id, const char *text, TextColor text } -int BalloonManager_ns::setLocationBalloon(const char *text, bool endGame) { +int BalloonManager_ns::setLocationBalloon(const Common::String &text, bool endGame) { int16 w, h; @@ -509,7 +509,7 @@ protected: public: StringWriter_BR(Font *font) : WrappedLineFormatter(font) { } - void write(const char *text, uint maxWidth, byte color, Graphics::Surface *surf) { + void write(const Common::String &text, uint maxWidth, byte color, Graphics::Surface *surf) { StringExtent_BR se(_font); se.calc(text, maxWidth); _width = se.width() + 10; @@ -544,7 +544,6 @@ class BalloonManager_br : public BalloonManager { Frames *_rightBalloon; void cacheAnims(); - void drawWrappedText(Font *font, Graphics::Surface* surf, char *text, byte color, int16 wrapwidth); int createBalloon(int16 w, int16 h, uint16 borderThickness); Balloon *getBalloon(uint id); Graphics::Surface *expandBalloon(Frames *data, int frameNum); @@ -557,10 +556,10 @@ public: ~BalloonManager_br(); void reset(); - int setLocationBalloon(const char *text, bool endGame); - int setDialogueBalloon(const char *text, uint16 winding, TextColor textColor); - int setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor); - void setBalloonText(uint id, const char *text, TextColor textColor); + int setLocationBalloon(const Common::String &text, bool endGame); + int setDialogueBalloon(const Common::String &text, uint16 winding, TextColor textColor); + int setSingleBalloon(const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor); + void setBalloonText(uint id, const Common::String &text, TextColor textColor); int hitTestDialogueBalloon(int x, int y); }; @@ -586,7 +585,7 @@ Graphics::Surface *BalloonManager_br::expandBalloon(Frames *data, int frameNum) return surf; } -int BalloonManager_br::setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) { +int BalloonManager_br::setSingleBalloon(const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor) { cacheAnims(); int id = _numBalloons; @@ -622,7 +621,7 @@ int BalloonManager_br::setSingleBalloon(const char *text, uint16 x, uint16 y, ui return id; } -int BalloonManager_br::setDialogueBalloon(const char *text, uint16 winding, TextColor textColor) { +int BalloonManager_br::setDialogueBalloon(const Common::String &text, uint16 winding, TextColor textColor) { cacheAnims(); int id = _numBalloons; @@ -659,7 +658,7 @@ int BalloonManager_br::setDialogueBalloon(const char *text, uint16 winding, Text return id; } -void BalloonManager_br::setBalloonText(uint id, const char *text, TextColor textColor) { +void BalloonManager_br::setBalloonText(uint id, const Common::String &text, TextColor textColor) { Balloon *balloon = getBalloon(id); _sw.write(text, 216, _textColors[textColor], balloon->surface); } @@ -683,7 +682,7 @@ int BalloonManager_br::createBalloon(int16 w, int16 h, uint16 borderThickness) { return id; } -int BalloonManager_br::setLocationBalloon(const char *text, bool endGame) { +int BalloonManager_br::setLocationBalloon(const Common::String &text, bool endGame) { _se.calc(text, 240); int id = createBalloon(_se.width() + 20, _se.height() + 30, 2); diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 7a28d18f17..44087ab0b1 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -163,7 +163,7 @@ bool DialogueManager::displayAnswers() { // create balloons int id; for (int i = 0; i < _numVisAnswers; ++i) { - id = _vm->_balloonMan->setDialogueBalloon(_visAnswers[i]._a->_text.c_str(), 1, BalloonManager::kUnselectedColor); + id = _vm->_balloonMan->setDialogueBalloon(_visAnswers[i]._a->_text, 1, BalloonManager::kUnselectedColor); assert(id >= 0); _visAnswers[i]._balloon = id; @@ -172,7 +172,7 @@ bool DialogueManager::displayAnswers() { int mood = 0; if (_numVisAnswers == 1) { mood = _visAnswers[0]._a->_mood & 0xF; - _vm->_balloonMan->setBalloonText(_visAnswers[0]._balloon, _visAnswers[0]._a->_text.c_str(), BalloonManager::kNormalColor); + _vm->_balloonMan->setBalloonText(_visAnswers[0]._balloon, _visAnswers[0]._a->_text, BalloonManager::kNormalColor); } else if (_numVisAnswers > 1) { mood = _visAnswers[0]._a->_mood & 0xF; @@ -204,11 +204,11 @@ int16 DialogueManager::selectAnswerN() { if (_selection != _oldSelection) { if (_oldSelection != -1) { - _vm->_balloonMan->setBalloonText(_visAnswers[_oldSelection]._balloon, _visAnswers[_oldSelection]._a->_text.c_str(), BalloonManager::kUnselectedColor); + _vm->_balloonMan->setBalloonText(_visAnswers[_oldSelection]._balloon, _visAnswers[_oldSelection]._a->_text, BalloonManager::kUnselectedColor); } if (_selection != -1) { - _vm->_balloonMan->setBalloonText(_visAnswers[_selection]._balloon, _visAnswers[_selection]._a->_text.c_str(), BalloonManager::kSelectedColor); + _vm->_balloonMan->setBalloonText(_visAnswers[_selection]._balloon, _visAnswers[_selection]._a->_text, BalloonManager::kSelectedColor); _vm->_gfx->setItemFrame(_faceId, _visAnswers[_selection]._a->_mood & 0xF); } } @@ -225,7 +225,7 @@ int16 DialogueManager::selectAnswerN() { bool DialogueManager::displayQuestion() { if (!_q->_text.compareToIgnoreCase("NULL")) return false; - _vm->_balloonMan->setSingleBalloon(_q->_text.c_str(), _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, BalloonManager::kNormalColor); + _vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, BalloonManager::kNormalColor); _faceId = _vm->_gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y); _vm->_gfx->setItemFrame(_faceId, _q->_mood & 0xF); @@ -352,7 +352,7 @@ protected: } if (_passwordChanged) { - _vm->_balloonMan->setBalloonText(_visAnswers[0]._balloon, _visAnswers[0]._a->_text.c_str(), BalloonManager::kNormalColor); + _vm->_balloonMan->setBalloonText(_visAnswers[0]._balloon, _visAnswers[0]._a->_text, BalloonManager::kNormalColor); _passwordChanged = false; } diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index f4bccf3c44..afabcad21c 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -409,10 +409,10 @@ public: virtual ~BalloonManager() { } virtual void reset() = 0; - virtual int setLocationBalloon(const char *text, bool endGame) = 0; - virtual int setDialogueBalloon(const char *text, uint16 winding, TextColor textColor) = 0; - virtual int setSingleBalloon(const char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) = 0; - virtual void setBalloonText(uint id, const char *text, TextColor textColor) = 0; + virtual int setLocationBalloon(const Common::String &text, bool endGame) = 0; + virtual int setDialogueBalloon(const Common::String &text, uint16 winding, TextColor textColor) = 0; + virtual int setSingleBalloon(const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor) = 0; + virtual void setBalloonText(uint id, const Common::String &text, TextColor textColor) = 0; virtual int hitTestDialogueBalloon(int x, int y) = 0; }; diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index c852c5ecb2..1113eb5dca 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -253,7 +253,7 @@ void Parallaction::showSlide(const char *name, int x, int y) { } void Parallaction::showLocationComment(const Common::String &text, bool end) { - _balloonMan->setLocationBalloon(text.c_str(), end); + _balloonMan->setLocationBalloon(text, end); } void Parallaction::runGameFrame(int event) { @@ -505,18 +505,18 @@ void Parallaction::enterCommentMode(ZonePtr z) { } _gfx->setHalfbriteMode(true); - _balloonMan->setSingleBalloon(data->_examineText.c_str(), 0, 90, 0, BalloonManager::kNormalColor); + _balloonMan->setSingleBalloon(data->_examineText, 0, 90, 0, BalloonManager::kNormalColor); Common::Rect r; data->_gfxobj->getRect(0, r); _gfx->setItem(data->_gfxobj, 140, (_screenHeight - r.height())/2); _gfx->setItem(_char._head, 100, 152); } else { - _balloonMan->setSingleBalloon(data->_examineText.c_str(), 140, 10, 0, BalloonManager::kNormalColor); + _balloonMan->setSingleBalloon(data->_examineText, 140, 10, 0, BalloonManager::kNormalColor); _gfx->setItem(_char._talk, 190, 80); } } else if (_gameType == GType_BRA) { - _balloonMan->setSingleBalloon(data->_examineText.c_str(), 0, 0, 1, BalloonManager::kNormalColor); + _balloonMan->setSingleBalloon(data->_examineText, 0, 0, 1, BalloonManager::kNormalColor); _gfx->setItem(_char._talk, 10, 80); } |