From 63f43aa9590607e18157bb08c7f0de68ff8ae0a0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 1 Oct 2013 07:43:21 +0200 Subject: AVALANCHE: Move some more variables out of Avalanche --- engines/avalanche/animation.cpp | 3 +-- engines/avalanche/avalanche.h | 7 ++----- engines/avalanche/avalot.h | 2 +- engines/avalanche/dialogs.cpp | 18 ++++++++---------- engines/avalanche/dialogs.h | 1 + engines/avalanche/graphics.cpp | 19 ++++++++++++------- engines/avalanche/graphics.h | 2 ++ 7 files changed, 27 insertions(+), 25 deletions(-) diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp index 3de2c7c83c..836864bf9e 100644 --- a/engines/avalanche/animation.cpp +++ b/engines/avalanche/animation.cpp @@ -319,8 +319,7 @@ void AnimationType::stopWalk() { void AnimationType::chatter() { _anim->_vm->_talkX = _x + _info._xLength / 2; _anim->_vm->_talkY = _y; - _anim->_vm->_talkFontColor = _stat._fgBubbleCol; - _anim->_vm->_talkBackgroundColor = _stat._bgBubbleCol; + _anim->_vm->_graphics->setDialogColor(_stat._bgBubbleCol, _stat._fgBubbleCol); } void AnimationType::remove() { diff --git a/engines/avalanche/avalanche.h b/engines/avalanche/avalanche.h index 06d7e68a8e..845aa09f08 100644 --- a/engines/avalanche/avalanche.h +++ b/engines/avalanche/avalanche.h @@ -259,15 +259,12 @@ public: bool _dropsOk; bool _cheat; // CHECKME: Currently unused bool _letMeOut; + byte _thinks; + bool _thinkThing; - - byte _thinks; - bool _thinkThing; int16 _talkX, _talkY; - Color _talkBackgroundColor, _talkFontColor; - byte _scrollBells; // no. of times to ring the bell bool _seeScroll; // TODO: maybe this means we're interacting with the toolbar / a scroll? char _objectList[10]; // Called .free() for them in ~Gyro(). diff --git a/engines/avalanche/avalot.h b/engines/avalanche/avalot.h index a9ec69fb3b..292596b89f 100644 --- a/engines/avalanche/avalot.h +++ b/engines/avalanche/avalot.h @@ -95,7 +95,7 @@ typedef int8 TuneType[31]; struct QuasipedType { byte _whichPed; - Color _foregroundColor; + Color _textColor; Room _room; Color _backgroundColor; People _who; diff --git a/engines/avalanche/dialogs.cpp b/engines/avalanche/dialogs.cpp index f15216cb2a..551b45e984 100644 --- a/engines/avalanche/dialogs.cpp +++ b/engines/avalanche/dialogs.cpp @@ -340,14 +340,14 @@ void Dialogs::scrollModeMusic() { } void Dialogs::resetScrollDriver() { - _vm->_scrollBells = 0; + _scrollBells = 0; _currentFont = kFontStyleRoman; _useIcon = 0; _vm->_interrogation = 0; // Always reset after a scroll comes up. } void Dialogs::ringBell() { // Pussy's in the well. Who put her in? Little... - for (int i = 0; i < _vm->_scrollBells; i++) + for (int i = 0; i < _scrollBells; i++) _vm->errorLed(); // Ring the bell "x" times. } @@ -533,7 +533,7 @@ void Dialogs::drawBubble(DialogFunctionType modeFunc) { for (int i = 0; i <= _maxLineNum; i++) { int16 x = xc + _vm->_talkX - _scroll[i].size() / 2 * 8; bool offset = _scroll[i].size() % 2; - _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_talkFontColor); + _vm->_graphics->drawScrollText(_scroll[i], _vm->_font, 8, x - offset * 4, (i * 10) + 12, _vm->_graphics->_talkFontColor); } ringBell(); @@ -559,8 +559,7 @@ void Dialogs::reset() { void Dialogs::setBubbleStateNatural() { _vm->_talkX = 320; _vm->_talkY = 200; - _vm->_talkBackgroundColor = kColorDarkgray; - _vm->_talkFontColor = kColorWhite; + _vm->_graphics->setDialogColor(kColorDarkgray, kColorWhite); } Common::String Dialogs::displayMoney() { @@ -656,8 +655,8 @@ void Dialogs::callDialogDriver() { return; break; case kControlBell: - _vm->_scrollBells++; - break; // #7 = "Bel" + _scrollBells++; + break; case kControlSpeechBubble: if ((_maxLineNum == 0) && (_scroll[0].empty())) break; @@ -682,9 +681,8 @@ void Dialogs::callDialogDriver() { PedType *quasiPed = &_vm->_peds[_vm->kQuasipeds[_param - 10]._whichPed]; _vm->_talkX = quasiPed->_x; _vm->_talkY = quasiPed->_y; // Position. - - _vm->_talkFontColor = _vm->kQuasipeds[_param - 10]._foregroundColor; - _vm->_talkBackgroundColor = _vm->kQuasipeds[_param - 10]._backgroundColor; // Colors. + + _vm->_graphics->setDialogColor(_vm->kQuasipeds[_param - 10]._backgroundColor, _vm->kQuasipeds[_param - 10]._textColor); } else { _vm->errorLed(); // Not valid. setBubbleStateNatural(); diff --git a/engines/avalanche/dialogs.h b/engines/avalanche/dialogs.h index a7eb231517..fec842907d 100644 --- a/engines/avalanche/dialogs.h +++ b/engines/avalanche/dialogs.h @@ -102,6 +102,7 @@ private: byte _useIcon; byte _maxLineNum; bool _scReturn; + byte _scrollBells; // no. of times to ring the bell // These 3 "Mode" functions are always passed as ScrollsFunctionType parameters. void scrollModeNormal(); diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp index 4db93c435c..2d3d82ebd7 100644 --- a/engines/avalanche/graphics.cpp +++ b/engines/avalanche/graphics.cpp @@ -565,20 +565,20 @@ void GraphicManager::prepareBubble(int xc, int xw, int my, Common::Point points[ _scrolls.copyFrom(_surface); // The body of the bubble. - _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _vm->_talkBackgroundColor); - _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _vm->_talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw + 9, 7, _vm->_talkX + xw - 8 + xc, my + 1), _talkBackgroundColor); + _scrolls.fillRect(Common::Rect(xc + _vm->_talkX - xw - 1, 12, _vm->_talkX + xw + xc + 2, my - 4), _talkBackgroundColor); // Top right corner of the bubble. - drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX + xw - 10, 11, 0, 90, 9, _talkBackgroundColor); // Bottom right corner of the bubble. - drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX + xw - 10, my - 4, 270, 360, 9, _talkBackgroundColor); // Top left corner of the bubble. - drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX - xw + 10, 11, 90, 180, 9, _talkBackgroundColor); // Bottom left corner of the bubble. - drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _vm->_talkBackgroundColor); + drawPieSlice(xc + _vm->_talkX - xw + 10, my - 4, 180, 270, 9, _talkBackgroundColor); // "Tail" of the speech bubble. - drawTriangle(points, _vm->_talkBackgroundColor); + drawTriangle(points, _talkBackgroundColor); } // And set the background of the text to the desired color. @@ -652,6 +652,11 @@ void GraphicManager::restoreScreen() { refreshScreen(); } +void GraphicManager::setDialogColor(Color bg, Color text) { + _talkBackgroundColor = bg; + _talkFontColor = text; +} + // Original name background() void GraphicManager::setBackgroundColor(Color x) { warning("STUB: setBackgroundColor(%d)", x); diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h index 80724f8216..c78ac56a9c 100644 --- a/engines/avalanche/graphics.h +++ b/engines/avalanche/graphics.h @@ -58,6 +58,7 @@ public: class GraphicManager { public: Graphics::Surface _surface; + Color _talkBackgroundColor, _talkFontColor; GraphicManager(AvalancheEngine *vm); ~GraphicManager(); @@ -110,6 +111,7 @@ public: void loadBackground(Common::File &file); void refreshBackground(); void setBackgroundColor(Color x); + void setDialogColor(Color bg, Color text); void zoomOut(int16 x, int16 y); // Only used when entering the map. -- cgit v1.2.3