[Scummvm-cvs-logs] SF.net SVN: scummvm:[55590] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Fri Jan 28 14:24:32 CET 2011
Revision: 55590
http://scummvm.svn.sourceforge.net/scummvm/?rev=55590&view=rev
Author: peres001
Date: 2011-01-28 13:24:32 +0000 (Fri, 28 Jan 2011)
Log Message:
-----------
Replaced char* with Common::String in balloon code.
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/balloons.cpp
scummvm/trunk/engines/parallaction/dialogue.cpp
scummvm/trunk/engines/parallaction/graphics.h
scummvm/trunk/engines/parallaction/parallaction.cpp
Modified: scummvm/trunk/engines/parallaction/balloons.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/balloons.cpp 2011-01-28 12:35:20 UTC (rev 55589)
+++ scummvm/trunk/engines/parallaction/balloons.cpp 2011-01-28 13:24:32 UTC (rev 55590)
@@ -61,7 +61,7 @@
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 @@
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 @@
~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::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 @@
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 @@
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 @@
}
-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 @@
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 @@
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 @@
~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 @@
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 @@
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 @@
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 @@
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);
Modified: scummvm/trunk/engines/parallaction/dialogue.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/dialogue.cpp 2011-01-28 12:35:20 UTC (rev 55589)
+++ scummvm/trunk/engines/parallaction/dialogue.cpp 2011-01-28 13:24:32 UTC (rev 55590)
@@ -163,7 +163,7 @@
// 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 @@
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 @@
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 @@
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 @@
}
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;
}
Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h 2011-01-28 12:35:20 UTC (rev 55589)
+++ scummvm/trunk/engines/parallaction/graphics.h 2011-01-28 13:24:32 UTC (rev 55590)
@@ -409,10 +409,10 @@
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;
};
Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp 2011-01-28 12:35:20 UTC (rev 55589)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp 2011-01-28 13:24:32 UTC (rev 55590)
@@ -253,7 +253,7 @@
}
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 @@
}
_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);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list