From efadb34b8d5e42ae20a5151687980721dc320c98 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 22 Feb 2017 20:41:25 -0500 Subject: TITANIC: Renamings and cleanup for CCreditText --- engines/titanic/support/credit_text.cpp | 51 ++++++++++++++++----------------- engines/titanic/support/credit_text.h | 13 +++------ 2 files changed, 29 insertions(+), 35 deletions(-) (limited to 'engines/titanic/support') diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp index da6de6278e..dfe2298048 100644 --- a/engines/titanic/support/credit_text.cpp +++ b/engines/titanic/support/credit_text.cpp @@ -25,10 +25,10 @@ namespace Titanic { -CCreditText::CCreditText() : _screenManagerP(nullptr), _field14(0), - _ticks(0), _fontHeight(1), _objectP(nullptr), _totalHeight(0), - _field40(0), _field44(0), _field48(0), _field4C(0), _field50(0), - _field54(0), _field58(0), _counter(0) { +CCreditText::CCreditText() : _screenManagerP(nullptr), _ticks(0), + _fontHeight(1), _objectP(nullptr), _totalHeight(0), + _yPos(0), _textR(0), _textG(0), _textB(0), _destR(0), + _destG(0), _destB(0), _counter(0) { } void CCreditText::clear() { @@ -37,21 +37,20 @@ void CCreditText::clear() { } void CCreditText::load(CGameObject *obj, CScreenManager *screenManager, - const Rect &rect, int v) { + const Rect &rect) { _objectP = obj; _screenManagerP = screenManager; - _field14 = v; setup(); _ticks = g_vm->_events->getTicksCount(); - _field40 = 0; - _field44 = 0xFF; - _field48 = 0xFF; - _field4C = 0xFF; - _field50 = 0; - _field54 = 0; - _field58 = 0; + _yPos = 0; + _textR = 0xFF; + _textG = 0xFF; + _textB = 0xFF; + _destR = 0; + _destG = 0; + _destB = 0; _counter = 0; } @@ -154,26 +153,26 @@ bool CCreditText::draw() { return false; if (++_counter > 200) { - _field44 += _field50; - _field48 += _field54; - _field4C += _field58; - _field50 = g_vm->getRandomNumber(63) + 192 - _field44; - _field54 = g_vm->getRandomNumber(63) + 192 - _field48; - _field58 = g_vm->getRandomNumber(63) + 192 - _field4C; + _textR += _destR; + _textG += _destG; + _textB += _destB; + _destR = g_vm->getRandomNumber(63) + 192 - _textR; + _destG = g_vm->getRandomNumber(63) + 192 - _textG; + _destB = g_vm->getRandomNumber(63) + 192 - _textB; _counter = 0; } // Positioning adjustment, changing lines and/or group if necessary - int yDiff = (int)(g_vm->_events->getTicksCount() - _ticks) / 22 - _field40; + int yDiff = (int)(g_vm->_events->getTicksCount() - _ticks) / 22 - _yPos; while (yDiff > 0) { if (_totalHeight > 0) { if (yDiff < _totalHeight) { _totalHeight -= yDiff; - _field40 += yDiff; + _yPos += yDiff; yDiff = 0; } else { yDiff -= _totalHeight; - _field40 += _totalHeight; + _yPos += _totalHeight; _totalHeight = 0; } } else { @@ -182,7 +181,7 @@ bool CCreditText::draw() { ++_lineIt; yDiff -= _fontHeight; - _field40 += _fontHeight; + _yPos += _fontHeight; if (_lineIt == (*_groupIt)->_lines.end()) { // Move to next line group @@ -204,9 +203,9 @@ bool CCreditText::draw() { Point textPos; for (textPos.y = _rect.top + _totalHeight; textPos.y <= _rect.bottom; textPos.y += _fontHeight) { - int textR = _field44 + _field50 * _counter / 200; - int textG = _field48 + _field54 * _counter / 200; - int textB = _field4C + _field58 * _counter / 200; + int textR = _textR + _destR * _counter / 200; + int textG = _textG + _destG * _counter / 200; + int textB = _textB + _destB * _counter / 200; // Single iteration loop to figure out RGB values for the line do { diff --git a/engines/titanic/support/credit_text.h b/engines/titanic/support/credit_text.h index 3e5bfca0c2..05392f5048 100644 --- a/engines/titanic/support/credit_text.h +++ b/engines/titanic/support/credit_text.h @@ -65,7 +65,6 @@ private: public: CScreenManager *_screenManagerP; Rect _rect; - int _field14; CCreditLineGroups _groups; uint _ticks; int _fontHeight; @@ -73,13 +72,9 @@ public: CCreditLineGroups::iterator _groupIt; CCreditLines::iterator _lineIt; int _totalHeight; - int _field40; - int _field44; - int _field48; - int _field4C; - int _field50; - int _field54; - int _field58; + int _yPos; + int _textR, _textG, _textB; + int _destR, _destG, _destB; int _counter; public: CCreditText(); @@ -93,7 +88,7 @@ public: * Sets the game object this override is associated with */ void load(CGameObject *obj, CScreenManager *screenManager, - const Rect &rect, int v = 0); + const Rect &rect); /** * Draw the item -- cgit v1.2.3