diff options
-rw-r--r-- | engines/titanic/pet_control/pet_text.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/support/screen_manager.cpp | 18 | ||||
-rw-r--r-- | engines/titanic/support/screen_manager.h | 12 |
3 files changed, 24 insertions, 11 deletions
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp index 77019d7f2d..3a10ab4c87 100644 --- a/engines/titanic/pet_control/pet_text.cpp +++ b/engines/titanic/pet_control/pet_text.cpp @@ -140,7 +140,7 @@ void CPetText::draw(CScreenManager *screenManager) { tempRect.grow(-2); screenManager->setFontNumber(_fontNumber2); - screenManager->writeString(0, tempRect, _field74, _lines, _textCursor); + screenManager->writeString(SURFACE_BACKBUFFER, tempRect, _field74, _lines, _textCursor); screenManager->setFontNumber(_fontNumber1); } @@ -149,11 +149,10 @@ void CPetText::mergeStrings() { if (!_stringsMerged) { _lines.clear(); - for (int idx = 0; idx < _lineCount; ++idx) { + for (int idx = 0; idx <= _lineCount; ++idx) { CString line = _array[idx]._rgb + _array[idx]._string3 + _array[idx]._line + "\n"; _lines += line; - } _stringsMerged = true; diff --git a/engines/titanic/support/screen_manager.cpp b/engines/titanic/support/screen_manager.cpp index 0c9d3ab4e0..1a43d78dd0 100644 --- a/engines/titanic/support/screen_manager.cpp +++ b/engines/titanic/support/screen_manager.cpp @@ -201,12 +201,22 @@ void OSScreenManager::blitFrom(SurfaceNum surfaceNum, CVideoSurface *src, void OSScreenManager::proc12() {} int OSScreenManager::writeString(int surfaceNum, const Rect &destRect, - int val1, const CString &str, CTextCursor *textCursor) { - if (_backSurfaces.empty()) + int yOffset, const CString &str, CTextCursor *textCursor) { + CVideoSurface *surface; + Rect bounds; + + if (surfaceNum >= 0 && surfaceNum < (int)_backSurfaces.size()) { + surface = _backSurfaces[surfaceNum]._surface; + bounds = _backSurfaces[surfaceNum]._bounds; + } else if (surfaceNum == -1) { + surface = _frontRenderSurface; + bounds = Rect(0, 0, surface->getWidth(), surface->getHeight()); + } else { return -1; + } - return _fonts[_fontNumber].writeString(_backSurfaces[surfaceNum]._surface, - destRect, _backSurfaces[surfaceNum]._bounds, val1, str, textCursor); + return _fonts[_fontNumber].writeString(surface, destRect, bounds, + yOffset, str, textCursor); } void OSScreenManager::proc14() {} diff --git a/engines/titanic/support/screen_manager.h b/engines/titanic/support/screen_manager.h index b963fcd3d6..2e80869085 100644 --- a/engines/titanic/support/screen_manager.h +++ b/engines/titanic/support/screen_manager.h @@ -115,12 +115,14 @@ public: * Write a string * @param surfaceNum Destination surface * @param destRect Bounds within dest surface + * @param yOffset Y offset for drawing, to allow for parts of + * the text to be scrolled off-screen * @param str Line or lines to write * @param textCursor Optional text cursor pointer */ - virtual int writeString(int surfaceNum, const Rect &destRect, int val1, - const CString &str, CTextCursor *textCursor) = 0; - + virtual int writeString(int surfaceNum, const Rect &destRect, + int yOffset, const CString &str, CTextCursor *textCursor) = 0; + virtual void proc14() = 0; /** @@ -252,11 +254,13 @@ public: * Write a string * @param surfaceNum Destination surface * @param destRect Bounds within dest surface + * @param yOffset Y offset for drawing, to allow for parts of + * the text to be scrolled off-screen * @param str Line or lines to write * @param textCursor Optional text cursor pointer */ virtual int writeString(int surfaceNum, const Rect &destRect, - int val1, const CString &str, CTextCursor *textCursor); + int yOffset, const CString &str, CTextCursor *textCursor); virtual void proc14(); |