aboutsummaryrefslogtreecommitdiff
path: root/engines/director
diff options
context:
space:
mode:
authorstevenhoefel2017-01-14 08:45:22 +1100
committerstevenhoefel2017-01-14 08:45:22 +1100
commitab5ffb466ecd031c985c42dccf6d26e811ccc049 (patch)
tree27f13548a287a69cfdd6b295645b670049eb72be /engines/director
parent059cfbf69182f2a3f44fe1ab9680d012ce22884d (diff)
downloadscummvm-rg350-ab5ffb466ecd031c985c42dccf6d26e811ccc049.tar.gz
scummvm-rg350-ab5ffb466ecd031c985c42dccf6d26e811ccc049.tar.bz2
scummvm-rg350-ab5ffb466ecd031c985c42dccf6d26e811ccc049.zip
DIRECTOR: D3 font style, size and alignment.
Diffstat (limited to 'engines/director')
-rw-r--r--engines/director/frame.cpp70
1 files changed, 45 insertions, 25 deletions
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 97252344cd..eeecc0f29a 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -846,23 +846,21 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
if (strLen < 200)
debugC(3, kDebugText, "text: '%s'", text.c_str());
- if (_vm->getVersion() >= 4) {
- uint16 a = textStream->readUint16();
- uint32 b = textStream->readUint32();
- uint16 c = textStream->readUint16();
- uint16 d = textStream->readUint16();
-
- debugC(3, kDebugText, "text: a: %x b: %x c: %x d: %x", a, b, c, d);
-
- textCast->fontId = textStream->readUint16();
- textCast->textSlant = textStream->readByte();
- textStream->readByte();
- textCast->fontSize = textStream->readUint16();
-
- textCast->palinfo1 = textStream->readUint16();
- textCast->palinfo2 = textStream->readUint16();
- textCast->palinfo3 = textStream->readUint16();
- }
+ uint16 a = textStream->readUint16();
+ uint32 b = textStream->readUint32();
+ uint16 c = textStream->readUint16();
+ uint16 d = textStream->readUint16();
+
+ debugC(3, kDebugText, "text: a: %x b: %x c: %x d: %x", a, b, c, d);
+
+ textCast->fontId = textStream->readUint16();
+ textCast->textSlant = textStream->readByte();
+ textStream->readByte();
+ textCast->fontSize = textStream->readUint16();
+
+ textCast->palinfo1 = textStream->readUint16();
+ textCast->palinfo2 = textStream->readUint16();
+ textCast->palinfo3 = textStream->readUint16();
uint16 boxShadow = (uint16)textCast->boxShadow;
uint16 borderSize = (uint16)textCast->borderSize;
@@ -886,39 +884,61 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
if (_vm->_currentScore->_fontMap.contains(textCast->fontId)) {
// Override
- macFont.setName(_vm->_currentScore->_fontMap[textCast->fontId]);
+ //macFont.setName(_vm->_currentScore->_fontMap[textCast->fontId]);
+ //TODO: this still needs to take font style and size into account!
}
const Graphics::Font *font = _vm->_wm->_fontMan->getFont(macFont);
+ height = font->getFontHeight();
+
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) alignment = 3;
- else alignment++;
+ if (alignment == -1)
+ alignment = 3;
+ else
+ alignment++;
uint16 textX = x, textY = y;
if (!isButtonLabel) {
if (borderSize > 0) {
+ if (_vm->getVersion() <= 3)
+ height++;
+ else
+ height += borderSize;
+
textX += (borderSize + 1);
textY += borderSize;
- }
+ } else
+ textX += 1;
if (padding > 0) {
width += padding * 2;
height += padding;
- if (textCast->textAlign == kTextAlignLeft) textX += padding;
- else if (textCast->textAlign == kTextAlignRight) textX -= (padding + 1);
+
+ if (textCast->textAlign == kTextAlignLeft)
+ textX += padding;
+ else if (textCast->textAlign == kTextAlignRight)
+ textX -= padding;
+
//TODO: alignment issue with odd-size-width center-aligned text
//else if (textCast->textAlign == kTextAlignCenter && ((borderSize + padding) % 2 == 1)) textX--;
+
textY += padding / 2;
}
+ if (textCast->textAlign == kTextAlignRight)
+ textX -= 1;
+
if (textShadow > 0) {
- if (borderSize == 0) textX += 1;
+ if (borderSize == 0 && _vm->getVersion() > 3)
+ textX += 1;
+
font->drawString(&surface, text, textX + textShadow, textY + textShadow,
width, (_sprites[spriteId]->_ink == kInkTypeReverse ? 255 : 0), (Graphics::TextAlign)alignment);
- height -= textShadow;
+ if (_vm->getVersion() > 3)
+ height -= (textShadow - 1);
}
} else {
textY += 2;