aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTobia Tesan2017-04-30 00:56:52 +0200
committerEugene Sandulenko2017-04-30 09:48:08 +0200
commitb6eb8a1a6697ba068590e50164cb5e4f37a1c1df (patch)
tree5fdec52294e097a1942f3dca395c07e4c21a6ffb /engines
parented2f09b13f31f4d9c372c2d7f8f0f66d7acb854d (diff)
downloadscummvm-rg350-b6eb8a1a6697ba068590e50164cb5e4f37a1c1df.tar.gz
scummvm-rg350-b6eb8a1a6697ba068590e50164cb5e4f37a1c1df.tar.bz2
scummvm-rg350-b6eb8a1a6697ba068590e50164cb5e4f37a1c1df.zip
DIRECTOR: consolidate font, width instructions in renderText
Diffstat (limited to 'engines')
-rw-r--r--engines/director/frame.cpp62
1 files changed, 32 insertions, 30 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 49c755ce23..8911a60728 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -742,6 +742,38 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
return;
TextCast *textCast = _sprites[spriteId]->_buttonCast != nullptr ? (TextCast*)_sprites[spriteId]->_buttonCast : _sprites[spriteId]->_textCast;
+ int x = _sprites[spriteId]->_startPoint.x; // +rectLeft;
+ int y = _sprites[spriteId]->_startPoint.y; // +rectTop;
+ int height = textCast->initialRect.height(); //_sprites[spriteId]->_height;
+ int width;
+
+ if (_vm->getVersion() >= 4 && textSize != NULL)
+ width = textCast->initialRect.right;
+ else
+ width = textCast->initialRect.width(); //_sprites[spriteId]->_width;
+
+ if (width == 0 || height == 0) {
+ warning("renderText: Requested to draw on an empty surface: %d x %d", width, height);
+ return;
+ }
+
+ if (_vm->getVersion() >= 4) {
+ if (textSize == NULL)
+ width = textCast->initialRect.right;
+ else {
+ width = textSize->width();
+ }
+ }
+
+ if (_vm->getCurrentScore()->_fontMap.contains(textCast->fontId)) {
+ // We need to make sure that the Shared Cast fonts have been loaded in?
+ // might need a mapping table here of our own.
+ // textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->getCurrentScore()->_fontMap[textCast->fontId]);
+ }
+
+ Graphics::MacFont* macFont = new Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
+
+ debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont));
uint32 unk1 = textStream->readUint32();
uint32 strLen = textStream->readUint32();
@@ -827,28 +859,6 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
//uint32 rectLeft = textCast->initialRect.left;
//uint32 rectTop = textCast->initialRect.top;
- int x = _sprites[spriteId]->_startPoint.x; // +rectLeft;
- int y = _sprites[spriteId]->_startPoint.y; // +rectTop;
- int height = textCast->initialRect.height(); //_sprites[spriteId]->_height;
- int width = textCast->initialRect.width(); //_sprites[spriteId]->_width;
-
- if (_vm->getVersion() >= 4 && textSize != NULL)
- width = textCast->initialRect.right;
-
- if (_vm->getCurrentScore()->_fontMap.contains(textCast->fontId)) {
- // We need to make sure that the Shared Cast fonts have been loaded in?
- // might need a mapping table here of our own.
- // textCast->fontId = _vm->_wm->_fontMan->getFontIdByName(_vm->getCurrentScore()->_fontMap[textCast->fontId]);
- }
-
- if (width == 0 || height == 0) {
- warning("renderText: Requested to draw on an empty surface: %d x %d", width, height);
- return;
- }
-
- Graphics::MacFont *macFont = new Graphics::MacFont(textCast->fontId, textCast->fontSize, textCast->textSlant);
-
- debugC(3, kDebugText, "renderText: x: %d y: %d w: %d h: %d font: '%s'", x, y, width, height, _vm->_wm->_fontMan->getFontName(*macFont));
int alignment = (int)textCast->textAlign;
if (alignment == -1)
@@ -856,14 +866,6 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
else
alignment++;
- if (_vm->getVersion() >= 4) {
- if (textSize == NULL)
- width = textCast->initialRect.right;
- else {
- width = textSize->width();
- }
- }
-
Graphics::MacText mt(ftext, _vm->_wm, macFont, 0x00, 0xff, width, (Graphics::TextAlign)alignment);
mt.setInterLinear(1);
mt.render();