aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/support/credit_text.cpp56
-rw-r--r--engines/titanic/support/screen_manager.cpp5
-rw-r--r--engines/titanic/support/screen_manager.h20
3 files changed, 65 insertions, 16 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
diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp
index b0d852104c..aa72200056 100644
--- a/engines/titanic/support/screen_manager.cpp
+++ b/engines/titanic/support/screen_manager.cpp
@@ -239,10 +239,9 @@ int OSScreenManager::writeString(int surfaceNum, const Rect &destRect,
yOffset, str, textCursor);
}
-int OSScreenManager::writeString(int surfaceNum, const Rect &srcRect,
- const Rect &destRect, const CString &str, CTextCursor *textCursor) {
+void OSScreenManager::writeString(int surfaceNum, const Point &destPos,
+ const Rect &clipRect, const CString &str, int maxWidth) {
// TODO
- return 0;
}
void OSScreenManager::setFontColor(byte r, byte g, byte b) {
diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h
index 0736f1393c..a47b6a174b 100644
--- a/engines/titanic/support/screen_manager.h
+++ b/engines/titanic/support/screen_manager.h
@@ -140,13 +140,13 @@ public:
/**
* Write a string
* @param surfaceNum Destination surface
- * @param srcRect Drawing area
- * @param destRect Bounds of dest surface
+ * @param destPos Position to start writing text at
+ * @param clipRect Clipping area to constrain text to
* @param str Line or lines to write
- * @param textCursor Optional text cursor pointer
+ * @param maxWidth Maximum allowed line width
*/
- virtual int writeString(int surfaceNum, const Rect &srcRect,
- const Rect &destRect, const CString &str, CTextCursor *textCursor) = 0;
+ virtual void writeString(int surfaceNum, const Point &destPos,
+ const Rect &clipRect, const CString &str, int maxWidth) = 0;
/**
* Set the font color
@@ -322,13 +322,13 @@ public:
/**
* Write a string
* @param surfaceNum Destination surface
- * @param srcRect Drawing area
- * @param destRect Bounds of dest surface
+ * @param destPos Position to start writing text at
+ * @param clipRect Clipping area to constrain text to
* @param str Line or lines to write
- * @param textCursor Optional text cursor pointer
+ * @param maxWidth Maximum allowed line width
*/
- virtual int writeString(int surfaceNum, const Rect &srcRect,
- const Rect &destRect, const CString &str, CTextCursor *textCursor);
+ virtual void writeString(int surfaceNum, const Point &destPos,
+ const Rect &clipRect, const CString &str, int maxWidth);
/**
* Set the font color