aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support/credit_text.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-08-28 22:33:06 -0400
committerPaul Gilbert2016-08-28 22:33:06 -0400
commite4519aa1e78a11cc6d8194f90f1715ca0959d7c6 (patch)
tree22909d9df8be8e53d60d4e6aeba5264f6c239a22 /engines/titanic/support/credit_text.cpp
parentbfbbee869740f00d82a6f7badbb8d18a53cd5425 (diff)
downloadscummvm-rg350-e4519aa1e78a11cc6d8194f90f1715ca0959d7c6.tar.gz
scummvm-rg350-e4519aa1e78a11cc6d8194f90f1715ca0959d7c6.tar.bz2
scummvm-rg350-e4519aa1e78a11cc6d8194f90f1715ca0959d7c6.zip
TITANIC: Add positioning logic to credit text drawing
Diffstat (limited to 'engines/titanic/support/credit_text.cpp')
-rw-r--r--engines/titanic/support/credit_text.cpp55
1 files changed, 53 insertions, 2 deletions
diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp
index 24035d1f6d..9364acf6d3 100644
--- a/engines/titanic/support/credit_text.cpp
+++ b/engines/titanic/support/credit_text.cpp
@@ -28,7 +28,7 @@ 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), _field5C(0) {
+ _field54(0), _field58(0), _counter(0) {
}
void CCreditText::clear() {
@@ -52,7 +52,7 @@ void CCreditText::load(CGameObject *obj, CScreenManager *screenManager,
_field50 = 0;
_field54 = 0;
_field58 = 0;
- _field5C = 0;
+ _counter = 0;
}
void CCreditText::setup() {
@@ -150,6 +150,57 @@ void CCreditText::handleDots(CCreditLineGroup *group) {
}
bool CCreditText::draw() {
+ if (_groupIt == _groups.end())
+ 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;
+ _counter = 0;
+ }
+
+ // Positioning adjustment, changing lines and/or group if necessary
+ int yDiff = (int)(g_vm->_events->getTicksCount() - _ticks) / 22 - _field40;
+ while (yDiff > 0) {
+ if (_totalHeight > 0) {
+ if (yDiff < _totalHeight) {
+ _totalHeight -= yDiff;
+ _field40 += yDiff;
+ yDiff = 0;
+ } else {
+ yDiff -= _totalHeight;
+ _field40 += _totalHeight;
+ _totalHeight = 0;
+ }
+ } else {
+ if (yDiff < _fontHeight)
+ break;
+
+ ++_lineIt;
+ yDiff -= _fontHeight;
+ _field40 += _fontHeight;
+
+ if (_lineIt == (*_groupIt)->_lines.end()) {
+ // Move to next line group
+ ++_groupIt;
+ if (_groupIt == _groups.end())
+ // Reached end of groups
+ return false;
+
+ _lineIt = (*_groupIt)->_lines.begin();
+ _totalHeight = _fontHeight * 3 / 2;
+ }
+ }
+ }
+
+ _screenManagerP->setFontNumber(3);
+
+ // TODO: Drawing loop
+
return false;
}