aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/credit_text.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-29 00:07:40 -0400
committerPaul Gilbert2016-08-29 00:07:40 -0400
commit28a5a747b3042da71e764f6a21b4d9007ec6dc78 (patch)
treee38de07a0a96c0fe66457ac36d97a6703aff056b /engines/titanic/support/credit_text.cpp
parente4519aa1e78a11cc6d8194f90f1715ca0959d7c6 (diff)
downloadscummvm-rg350-28a5a747b3042da71e764f6a21b4d9007ec6dc78.tar.gz
scummvm-rg350-28a5a747b3042da71e764f6a21b4d9007ec6dc78.tar.bz2
scummvm-rg350-28a5a747b3042da71e764f6a21b4d9007ec6dc78.zip
TITANIC: Finished CCreditText draw method
Diffstat (limited to 'engines/titanic/support/credit_text.cpp')
-rw-r--r--engines/titanic/support/credit_text.cpp56
1 files changed, 53 insertions, 3 deletions
diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp
index 9364acf6d3..009c3f4944 100644
--- a/engines/titanic/support/credit_text.cpp
+++ b/engines/titanic/support/credit_text.cpp
@@ -197,11 +197,61 @@ bool CCreditText::draw() {
}
}
- _screenManagerP->setFontNumber(3);
+ int oldFontNumber = _screenManagerP->setFontNumber(3);
+ CCreditLineGroups::iterator groupIt = _groupIt;
+ CCreditLines::iterator lineIt = _lineIt;
+
+ 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;
+
+ // Single iteration loop to figure out RGB values for the line
+ do {
+ int percent = 0;
+ if (textPos.y < (_rect.top + 2 * _fontHeight)) {
+ percent = (textPos.y - _rect.top) * 100 / (_fontHeight * 2);
+ if (percent < 0)
+ percent = 0;
+ } else {
+ int bottom = _rect.bottom - 2 * _fontHeight;
+ if (textPos.y < bottom)
+ break;
- // TODO: Drawing loop
+ percent = (_rect.bottom - textPos.y) * 100
+ / (_fontHeight * 2);
+ }
+
+ // Adjust the RGB to the specified percentage intensity
+ textR = textR * percent / 100;
+ textG = textG * percent / 100;
+ textB = textB * percent / 100;
+ } while (0);
+
+ // Write out the line
+ _screenManagerP->setFontColor(textR, textG, textB);
+ textPos.x = _rect.left + (_rect.width() - (*lineIt)->_lineWidth) / 2;
+ _screenManagerP->writeString(SURFACE_BACKBUFFER, textPos,
+ _rect, (*lineIt)->_line, (*lineIt)->_lineWidth);
+
+ // Move to next line
+ ++lineIt;
+ if (lineIt == (*groupIt)->_lines.end()) {
+ ++groupIt;
+ if (groupIt == _groups.end())
+ // Finished all lines
+ break;
- return false;
+ lineIt = (*groupIt)->_lines.begin();
+ textPos.y += _fontHeight * 3 / 2;
+ }
+ }
+
+ _objectP->makeDirty();
+ _screenManagerP->setFontNumber(oldFontNumber);
+ return true;
}
} // End of namespace Titanic