aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2017-07-30 17:12:55 -0400
committerPaul Gilbert2017-07-30 17:12:55 -0400
commit9c6dd7113f406478a7deb1e674080a2d2f4f7b6b (patch)
treea08670f7d1b11ff350e7ca4e55e4c4bd87c2c242 /engines/titanic
parentd58f594755449f6a0402fdf5dba61cfa5edcf58e (diff)
downloadscummvm-rg350-9c6dd7113f406478a7deb1e674080a2d2f4f7b6b.tar.gz
scummvm-rg350-9c6dd7113f406478a7deb1e674080a2d2f4f7b6b.tar.bz2
scummvm-rg350-9c6dd7113f406478a7deb1e674080a2d2f4f7b6b.zip
TITANIC: Fix speed of palette transitions in end credits
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/support/credit_text.cpp32
-rw-r--r--engines/titanic/support/credit_text.h2
2 files changed, 18 insertions, 16 deletions
diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp
index b5b4fbe4f1..98c3d9bf1d 100644
--- a/engines/titanic/support/credit_text.cpp
+++ b/engines/titanic/support/credit_text.cpp
@@ -25,10 +25,12 @@
namespace Titanic {
+#define FRAMES_PER_CYCLE 16
+
CCreditText::CCreditText() : _screenManagerP(nullptr), _ticks(0),
_fontHeight(1), _objectP(nullptr), _yOffset(0),
- _priorInc(0), _textR(0), _textG(0), _textB(0), _destR(0),
- _destG(0), _destB(0), _counter(0) {
+ _priorInc(0), _textR(0), _textG(0), _textB(0), _deltaR(0),
+ _deltaG(0), _deltaB(0), _counter(0) {
}
void CCreditText::clear() {
@@ -49,9 +51,9 @@ void CCreditText::load(CGameObject *obj, CScreenManager *screenManager,
_textR = 0xFF;
_textG = 0xFF;
_textB = 0xFF;
- _destR = 0;
- _destG = 0;
- _destB = 0;
+ _deltaR = 0;
+ _deltaG = 0;
+ _deltaB = 0;
_counter = 0;
}
@@ -153,13 +155,13 @@ bool CCreditText::draw() {
if (_groupIt == _groups.end())
return false;
- if (++_counter > 200) {
- _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;
+ if (++_counter >= FRAMES_PER_CYCLE) {
+ _textR += _deltaR;
+ _textG += _deltaG;
+ _textB += _deltaB;
+ _deltaR = g_vm->getRandomNumber(63) + 192 - _textR;
+ _deltaG = g_vm->getRandomNumber(63) + 192 - _textG;
+ _deltaB = g_vm->getRandomNumber(63) + 192 - _textB;
_counter = 0;
}
@@ -205,9 +207,9 @@ bool CCreditText::draw() {
Point textPos;
for (textPos.y = _rect.top + _yOffset - yDiff; textPos.y <= _rect.bottom;
textPos.y += _fontHeight) {
- int textR = _textR + _destR * _counter / 200;
- int textG = _textG + _destG * _counter / 200;
- int textB = _textB + _destB * _counter / 200;
+ int textR = _textR + _deltaR * _counter / FRAMES_PER_CYCLE;
+ int textG = _textG + _deltaG * _counter / FRAMES_PER_CYCLE;
+ int textB = _textB + _deltaB * _counter / FRAMES_PER_CYCLE;
// 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 f3cc08a049..2850fe79c6 100644
--- a/engines/titanic/support/credit_text.h
+++ b/engines/titanic/support/credit_text.h
@@ -74,7 +74,7 @@ public:
int _yOffset;
int _priorInc;
int _textR, _textG, _textB;
- int _destR, _destG, _destB;
+ int _deltaR, _deltaG, _deltaB;
int _counter;
public:
CCreditText();