From 61cd407405777a85bd6f40b3c1b04d340d811c34 Mon Sep 17 00:00:00 2001 From: Tobia Tesan Date: Mon, 1 May 2017 00:11:22 +0200 Subject: DIRECTOR: Use text from textCasts --- engines/director/frame.cpp | 17 ++++------------- engines/director/frame.h | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) (limited to 'engines/director') diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp index e6a8505fea..770617e6f9 100644 --- a/engines/director/frame.cpp +++ b/engines/director/frame.cpp @@ -593,9 +593,7 @@ void Frame::renderSprites(Graphics::ManagedSurface &surface, bool renderTrail) { if (castType == kCastShape) { renderShape(surface, i); } else if (castType == kCastText) { - uint id = (_vm->getVersion() < 4) ? _sprites[i]->_castId + 1024 : _sprites[i]->_textCast->children[0].index; - const Stxt *stxt = _vm->getCurrentScore()->_loadedStxts->getVal(id); - renderText(surface, i, stxt, NULL); + renderText(surface, i, NULL); } else if (castType == kCastButton) { renderButton(surface, i, _vm->getVersion() < 4 ? _sprites[i]->_castId + 1024 : _sprites[i]->_buttonCast->children[0].index); } else { @@ -672,8 +670,7 @@ void Frame::renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uin Common::Rect textRect(0, 0, width, height); // pass the rect of the button into the label. - const Stxt *stxt = _vm->getCurrentScore()->_loadedStxts->getVal(textId); - renderText(surface, spriteId, stxt, &textRect); + renderText(surface, spriteId, &textRect); // TODO: review all cases to confirm if we should use text height. // height = textRect.height(); @@ -729,15 +726,9 @@ void Frame::inkBasedBlit(Graphics::ManagedSurface &targetSurface, const Graphics } -void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, const Stxt *stxt, Common::Rect *textSize) { +void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::Rect *textSize) { TextCast *textCast = _sprites[spriteId]->_buttonCast != nullptr ? (TextCast*)_sprites[spriteId]->_buttonCast : _sprites[spriteId]->_textCast; - textCast->fontId = stxt->_fontId; - textCast->textSlant = stxt->_textSlant; - textCast->fontSize = stxt->_fontSize; - textCast->palinfo1 = stxt->_palinfo1; - textCast->palinfo2 = stxt->_palinfo2; - textCast->palinfo3 = stxt->_palinfo3; int x = _sprites[spriteId]->_startPoint.x; // +rectLeft; int y = _sprites[spriteId]->_startPoint.y; // +rectTop; @@ -786,7 +777,7 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, const else alignment++; - Graphics::MacText mt(stxt->_ftext, _vm->_wm, macFont, 0x00, 0xff, width, (Graphics::TextAlign)alignment, 1); + Graphics::MacText mt(textCast->_ftext, _vm->_wm, macFont, 0x00, 0xff, width, (Graphics::TextAlign)alignment, 1); mt.render(); const Graphics::ManagedSurface *textSurface = mt.getSurface(); diff --git a/engines/director/frame.h b/engines/director/frame.h index fd0dbc8aef..546573fb40 100644 --- a/engines/director/frame.h +++ b/engines/director/frame.h @@ -128,7 +128,7 @@ private: void playTransition(Score *score); void playSoundChannel(); void renderSprites(Graphics::ManagedSurface &surface, bool renderTrail); - void renderText(Graphics::ManagedSurface &surface, uint16 spriteId, const Stxt *stxt, Common::Rect *textSize); + void renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Common::Rect *textSize); void renderShape(Graphics::ManagedSurface &surface, uint16 spriteId); void renderButton(Graphics::ManagedSurface &surface, uint16 spriteId, uint16 textId); void readPaletteInfo(Common::SeekableSubReadStreamEndian &stream); -- cgit v1.2.3