diff options
author | Dmitry Iskrich | 2016-06-30 23:15:23 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2016-08-03 23:40:36 +0200 |
commit | b460a7c03601952e4e60c565893bdaf90ae92f33 (patch) | |
tree | dc9ee5ce6b84f0afa1dc29d74f638fd67b2e29cd /engines/director/score.cpp | |
parent | 0f58203c021512396d8e3a32ada41f49eb0e1880 (diff) | |
download | scummvm-rg350-b460a7c03601952e4e60c565893bdaf90ae92f33.tar.gz scummvm-rg350-b460a7c03601952e4e60c565893bdaf90ae92f33.tar.bz2 scummvm-rg350-b460a7c03601952e4e60c565893bdaf90ae92f33.zip |
DIRECTOR: Calculate values for text rendering
Diffstat (limited to 'engines/director/score.cpp')
-rw-r--r-- | engines/director/score.cpp | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/engines/director/score.cpp b/engines/director/score.cpp index 6b9cdb293a..c799eef6d8 100644 --- a/engines/director/score.cpp +++ b/engines/director/score.cpp @@ -1240,7 +1240,35 @@ Image::ImageDecoder *Frame::getImageFrom(uint16 spriteId) { void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteID) { - warning("STUB: renderText()"); + Cast *textCast = _vm->_currentScore->_casts[_sprites[spriteID]->_castId]; + Common::SeekableSubReadStreamEndian *textStream; + + if (_vm->_currentScore->_movieArchive->hasResource(MKTAG('S','T','X','T'), spriteID + 1024)) { + textStream = _vm->_currentScore->_movieArchive->getResource(MKTAG('S','T','X','T'), spriteID + 1024); + } else { + textStream = _vm->getSharedSTXT()->getVal(spriteID + 1024); + } + /*uint32 unk1 = */ textStream->readUint32(); + uint32 strLen = textStream->readUint32(); + /*uin32 dataLen = */ textStream->readUint32(); + Common::String text; + + for (uint32 i = 0; i < strLen; i++) { + byte ch = textStream->readByte(); + if (ch == 0x0d) { + ch = '\n'; + } + text += ch; + } + + uint32 rectLeft = static_cast<TextCast *>(_sprites[spriteID]->_cast)->initialRect.left; + uint32 rectTop = static_cast<TextCast *>(_sprites[spriteID]->_cast)->initialRect.top; + + int x = _sprites[spriteID]->_startPoint.x + rectLeft; + int y = _sprites[spriteID]->_startPoint.y + rectTop; + int height = _sprites[spriteID]->_height; + int width = _sprites[spriteID]->_width; + //TODO render text } void Frame::drawBackgndTransSprite(Graphics::ManagedSurface &target, const Graphics::Surface &sprite, Common::Rect &drawRect) { |