[Scummvm-git-logs] scummvm master -> 9c6dd7113f406478a7deb1e674080a2d2f4f7b6b

dreammaster dreammaster at scummvm.org
Sun Jul 30 23:13:03 CEST 2017


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9c6dd7113f TITANIC: Fix speed of palette transitions in end credits


Commit: 9c6dd7113f406478a7deb1e674080a2d2f4f7b6b
    https://github.com/scummvm/scummvm/commit/9c6dd7113f406478a7deb1e674080a2d2f4f7b6b
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-30T17:12:55-04:00

Commit Message:
TITANIC: Fix speed of palette transitions in end credits

Changed paths:
    engines/titanic/support/credit_text.cpp
    engines/titanic/support/credit_text.h


diff --git a/engines/titanic/support/credit_text.cpp b/engines/titanic/support/credit_text.cpp
index b5b4fbe..98c3d9b 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 f3cc08a..2850fe7 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();





More information about the Scummvm-git-logs mailing list