diff options
author | Nicola Mettifogo | 2008-08-16 13:10:54 +0000 |
---|---|---|
committer | Nicola Mettifogo | 2008-08-16 13:10:54 +0000 |
commit | fbc9483ed2d7ee96a9c67b0b0b85b53d282b3f1a (patch) | |
tree | fb5ce187d00d29a19c3029490b7c6d0453563e1d | |
parent | b08a3885a82ee0fc18153f3bc4cb21eb15e78ecd (diff) | |
download | scummvm-rg350-fbc9483ed2d7ee96a9c67b0b0b85b53d282b3f1a.tar.gz scummvm-rg350-fbc9483ed2d7ee96a9c67b0b0b85b53d282b3f1a.tar.bz2 scummvm-rg350-fbc9483ed2d7ee96a9c67b0b0b85b53d282b3f1a.zip |
Extended balloon manager to handle color constants and fixed color of text in balloons for BRA.
svn-id: r33940
-rw-r--r-- | engines/parallaction/balloons.cpp | 50 | ||||
-rw-r--r-- | engines/parallaction/dialogue.cpp | 12 | ||||
-rw-r--r-- | engines/parallaction/exec_ns.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/graphics.h | 12 |
4 files changed, 48 insertions, 32 deletions
diff --git a/engines/parallaction/balloons.cpp b/engines/parallaction/balloons.cpp index 06fdca8261..550b8316a4 100644 --- a/engines/parallaction/balloons.cpp +++ b/engines/parallaction/balloons.cpp @@ -246,6 +246,8 @@ class BalloonManager_ns : public BalloonManager { static int16 _dialogueBalloonX[5]; + byte _textColors[2]; + struct Balloon { Common::Rect outerBox; Common::Rect innerBox; @@ -266,16 +268,18 @@ public: void freeBalloons(); int setLocationBalloon(char *text, bool endGame); - int setDialogueBalloon(char *text, uint16 winding, byte textColor); - int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor); - void setBalloonText(uint id, char *text, byte textColor); + int setDialogueBalloon(char *text, uint16 winding, TextColor textColor); + int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor); + void setBalloonText(uint id, char *text, TextColor textColor); int hitTestDialogueBalloon(int x, int y); }; int16 BalloonManager_ns::_dialogueBalloonX[5] = { 80, 120, 150, 150, 150 }; BalloonManager_ns::BalloonManager_ns(Gfx *gfx) : _numBalloons(0), _gfx(gfx) { - + _textColors[kSelectedColor] = 0; + _textColors[kUnselectedColor] = 3; + _textColors[kNormalColor] = 0; } BalloonManager_ns::~BalloonManager_ns() { @@ -323,7 +327,7 @@ int BalloonManager_ns::createBalloon(int16 w, int16 h, int16 winding, uint16 bor } -int BalloonManager_ns::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor) { +int BalloonManager_ns::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) { int16 w, h; @@ -336,7 +340,7 @@ int BalloonManager_ns::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 w Balloon *balloon = &_intBalloons[id]; StringWriter_NS sw(_vm->_dialogueFont); - sw.write(text, MAX_BALLOON_WIDTH, textColor, balloon->surface); + sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); // TODO: extract some text to make a name for obj balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0); @@ -347,7 +351,7 @@ int BalloonManager_ns::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 w return id; } -int BalloonManager_ns::setDialogueBalloon(char *text, uint16 winding, byte textColor) { +int BalloonManager_ns::setDialogueBalloon(char *text, uint16 winding, TextColor textColor) { int16 w, h; @@ -361,7 +365,7 @@ int BalloonManager_ns::setDialogueBalloon(char *text, uint16 winding, byte textC Balloon *balloon = &_intBalloons[id]; StringWriter_NS sw(_vm->_dialogueFont); - sw.write(text, MAX_BALLOON_WIDTH, textColor, balloon->surface); + sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); // TODO: extract some text to make a name for obj balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0); @@ -377,12 +381,12 @@ int BalloonManager_ns::setDialogueBalloon(char *text, uint16 winding, byte textC return id; } -void BalloonManager_ns::setBalloonText(uint id, char *text, byte textColor) { +void BalloonManager_ns::setBalloonText(uint id, char *text, TextColor textColor) { Balloon *balloon = getBalloon(id); balloon->surface->fillRect(balloon->innerBox, 1); StringWriter_NS sw(_vm->_dialogueFont); - sw.write(text, MAX_BALLOON_WIDTH, textColor, balloon->surface); + sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); } @@ -398,7 +402,7 @@ int BalloonManager_ns::setLocationBalloon(char *text, bool endGame) { int id = createBalloon(w+(endGame ? 5 : 10), h+5, -1, BALLOON_TRANSPARENT_COLOR_NS); Balloon *balloon = &_intBalloons[id]; StringWriter_NS sw(_vm->_dialogueFont); - sw.write(text, MAX_BALLOON_WIDTH, 0, balloon->surface); + sw.write(text, MAX_BALLOON_WIDTH, _textColors[kNormalColor], balloon->surface); // TODO: extract some text to make a name for obj balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0); @@ -534,6 +538,8 @@ public: class BalloonManager_br : public BalloonManager { + byte _textColors[2]; + struct Balloon { Common::Rect box; Graphics::Surface *surface; @@ -562,9 +568,9 @@ public: void freeBalloons(); int setLocationBalloon(char *text, bool endGame); - int setDialogueBalloon(char *text, uint16 winding, byte textColor); - int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor); - void setBalloonText(uint id, char *text, byte textColor); + int setDialogueBalloon(char *text, uint16 winding, TextColor textColor); + int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor); + void setBalloonText(uint id, char *text, TextColor textColor); int hitTestDialogueBalloon(int x, int y); }; @@ -590,7 +596,7 @@ Graphics::Surface *BalloonManager_br::expandBalloon(Frames *data, int frameNum) return surf; } -int BalloonManager_br::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor) { +int BalloonManager_br::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) { cacheAnims(); int id = _numBalloons; @@ -613,7 +619,7 @@ int BalloonManager_br::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 w balloon->surface = expandBalloon(src, srcFrame); src->getRect(srcFrame, balloon->box); - _writer.write(text, MAX_BALLOON_WIDTH, textColor, balloon->surface); + _writer.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); // TODO: extract some text to make a name for obj balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0); @@ -626,7 +632,7 @@ int BalloonManager_br::setSingleBalloon(char *text, uint16 x, uint16 y, uint16 w return id; } -int BalloonManager_br::setDialogueBalloon(char *text, uint16 winding, byte textColor) { +int BalloonManager_br::setDialogueBalloon(char *text, uint16 winding, TextColor textColor) { cacheAnims(); int id = _numBalloons; @@ -649,7 +655,7 @@ int BalloonManager_br::setDialogueBalloon(char *text, uint16 winding, byte textC balloon->surface = expandBalloon(src, srcFrame); src->getRect(srcFrame, balloon->box); - _writer.write(text, MAX_BALLOON_WIDTH, textColor, balloon->surface); + _writer.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); // TODO: extract some text to make a name for obj balloon->obj = _gfx->registerBalloon(new SurfaceToFrames(balloon->surface), 0); @@ -662,11 +668,11 @@ int BalloonManager_br::setDialogueBalloon(char *text, uint16 winding, byte textC return id; } -void BalloonManager_br::setBalloonText(uint id, char *text, byte textColor) { +void BalloonManager_br::setBalloonText(uint id, char *text, TextColor textColor) { Balloon *balloon = getBalloon(id); StringWriter_BR sw(_vm->_dialogueFont); - sw.write(text, MAX_BALLOON_WIDTH, textColor, balloon->surface); + sw.write(text, MAX_BALLOON_WIDTH, _textColors[textColor], balloon->surface); } int BalloonManager_br::setLocationBalloon(char *text, bool endGame) { @@ -722,6 +728,10 @@ void BalloonManager_br::cacheAnims() { BalloonManager_br::BalloonManager_br(Disk *disk, Gfx *gfx) : _numBalloons(0), _disk(disk), _gfx(gfx), _leftBalloon(0), _rightBalloon(0), _writer(_vm->_dialogueFont) { + + _textColors[kSelectedColor] = 12; + _textColors[kUnselectedColor] = 0; + _textColors[kNormalColor] = 0; } BalloonManager_br::~BalloonManager_br() { diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 205d702aa0..a2de3cbbf3 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -173,7 +173,7 @@ bool DialogueManager::displayAnswer(uint16 i) { // display suitable answers if (((a->_yesFlags & flags) == a->_yesFlags) && ((a->_noFlags & ~flags) == a->_noFlags)) { - int id = _vm->_balloonMan->setDialogueBalloon(a->_text, 1, 3); + int id = _vm->_balloonMan->setDialogueBalloon(a->_text, 1, BalloonManager::kUnselectedColor); assert(id >= 0); _visAnswers[id] = i; @@ -203,7 +203,7 @@ bool DialogueManager::displayAnswers() { if (_numVisAnswers == 1) { int id = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y); _vm->_gfx->setItemFrame(id, _q->_answers[0]->_mood & 0xF); - _vm->_balloonMan->setBalloonText(0, _q->_answers[_visAnswers[0]]->_text, 0); + _vm->_balloonMan->setBalloonText(0, _q->_answers[_visAnswers[0]]->_text, BalloonManager::kNormalColor); } else if (_numVisAnswers > 1) { int id = _vm->_gfx->setItem(_answerer, _ballonPos._answerChar.x, _ballonPos._answerChar.y); @@ -218,7 +218,7 @@ bool DialogueManager::displayAnswers() { bool DialogueManager::displayQuestion() { if (!scumm_stricmp(_q->_text, "NULL")) return false; - _vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, 0); + _vm->_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->_mood & 0x10, BalloonManager::kNormalColor); int id = _vm->_gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y); _vm->_gfx->setItemFrame(id, _q->_mood & 0xF); @@ -256,7 +256,7 @@ int16 DialogueManager::askPassword() { } if (_passwordChanged) { - _vm->_balloonMan->setBalloonText(0, _q->_answers[0]->_text, 3); + _vm->_balloonMan->setBalloonText(0, _q->_answers[0]->_text, BalloonManager::kNormalColor); _passwordChanged = false; } @@ -286,11 +286,11 @@ int16 DialogueManager::selectAnswerN() { if (_selection != _oldSelection) { if (_oldSelection != -1) { - _vm->_balloonMan->setBalloonText(_oldSelection, _q->_answers[_visAnswers[_oldSelection]]->_text, 3); + _vm->_balloonMan->setBalloonText(_oldSelection, _q->_answers[_visAnswers[_oldSelection]]->_text, BalloonManager::kUnselectedColor); } if (_selection != -1) { - _vm->_balloonMan->setBalloonText(_selection, _q->_answers[_visAnswers[_selection]]->_text, 0); + _vm->_balloonMan->setBalloonText(_selection, _q->_answers[_visAnswers[_selection]]->_text, BalloonManager::kSelectedColor); _vm->_gfx->setItemFrame(0, _q->_answers[_visAnswers[_selection]]->_mood & 0xF); } } diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp index 18ca1994bb..0ee362e50b 100644 --- a/engines/parallaction/exec_ns.cpp +++ b/engines/parallaction/exec_ns.cpp @@ -558,7 +558,7 @@ void Parallaction::enterCommentMode(ZonePtr z) { } _gfx->setHalfbriteMode(true); - _balloonMan->setSingleBalloon(data->_description, 0, 90, 0, 0); + _balloonMan->setSingleBalloon(data->_description, 0, 90, 0, BalloonManager::kNormalColor); Common::Rect r; data->_cnv->getRect(0, r); id = _gfx->setItem(data->_cnv, 140, (_screenHeight - r.height())/2); @@ -566,13 +566,13 @@ void Parallaction::enterCommentMode(ZonePtr z) { id = _gfx->setItem(_char._head, 100, 152); _gfx->setItemFrame(id, 0); } else { - _balloonMan->setSingleBalloon(data->_description, 140, 10, 0, 0); + _balloonMan->setSingleBalloon(data->_description, 140, 10, 0, BalloonManager::kNormalColor); id = _gfx->setItem(_char._talk, 190, 80); _gfx->setItemFrame(id, 0); } } else if (getGameType() == GType_BRA) { - _balloonMan->setSingleBalloon(data->_description, 0, 0, 1, 0); + _balloonMan->setSingleBalloon(data->_description, 0, 0, 1, BalloonManager::kNormalColor); int id = _gfx->setItem(_char._talk, 10, 80); _gfx->setItemFrame(id, 0); } diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 471f71dfa8..0aaa12b0e5 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -495,13 +495,19 @@ enum { class BalloonManager { public: + enum TextColor { + kSelectedColor = 0, + kUnselectedColor = 1, + kNormalColor = 2 + }; + virtual ~BalloonManager() { } virtual void freeBalloons() = 0; virtual int setLocationBalloon(char *text, bool endGame) = 0; - virtual int setDialogueBalloon(char *text, uint16 winding, byte textColor) = 0; - virtual int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, byte textColor) = 0; - virtual void setBalloonText(uint id, char *text, byte textColor) = 0; + virtual int setDialogueBalloon(char *text, uint16 winding, TextColor textColor) = 0; + virtual int setSingleBalloon(char *text, uint16 x, uint16 y, uint16 winding, TextColor textColor) = 0; + virtual void setBalloonText(uint id, char *text, TextColor textColor) = 0; virtual int hitTestDialogueBalloon(int x, int y) = 0; }; |