aboutsummaryrefslogtreecommitdiff
path: root/saga/actor.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2005-10-10 02:09:08 +0000
committerEugene Sandulenko2005-10-10 02:09:08 +0000
commitb5b6b6ebb736e860a2063d774aa2d2e98f5886e7 (patch)
tree8d474184ccd90a2890a4b83718a2ed7428fb7219 /saga/actor.cpp
parentfc11b60674103b569b9df2599b60f7d99dbdd909 (diff)
downloadscummvm-rg350-b5b6b6ebb736e860a2063d774aa2d2e98f5886e7.tar.gz
scummvm-rg350-b5b6b6ebb736e860a2063d774aa2d2e98f5886e7.tar.bz2
scummvm-rg350-b5b6b6ebb736e860a2063d774aa2d2e98f5886e7.zip
Eliminate font substitution ugliness.
svn-id: r18995
Diffstat (limited to 'saga/actor.cpp')
-rw-r--r--saga/actor.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 1770cadcb6..0461cf9d96 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -1012,12 +1012,13 @@ void Actor::handleSpeech(int msec) {
_activeSpeech.drawRect.top = _speechBoxScript.top;
_activeSpeech.drawRect.bottom = _speechBoxScript.bottom;
} else {
+ FontId font = (_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont);
width = _activeSpeech.speechBox.width();
- height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
+ height = _vm->_font->getHeight(font, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
if (height > 40 && width < _vm->getDisplayWidth() - 100) {
width = _vm->getDisplayWidth() - 100;
- height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
+ height = _vm->_font->getHeight(font, _activeSpeech.strings[0], width - 2, _activeSpeech.getFontFlags(0)) + 1;
}
_activeSpeech.speechBox.setWidth(width);
@@ -1626,9 +1627,11 @@ void Actor::drawSpeech(void) {
outputString = _activeSpeech.strings[0];
}
+ FontId font = (_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont);
+
if (_activeSpeech.actorsCount > 1) {
- height = _vm->_font->getHeight((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont));
- width = _vm->_font->getStringWidth((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), _activeSpeech.strings[0], 0, kFontNormal);
+ height = _vm->_font->getHeight(font);
+ width = _vm->_font->getStringWidth(font, _activeSpeech.strings[0], 0, kFontNormal);
for (i = 0; i < _activeSpeech.actorsCount; i++) {
actor = getActor(_activeSpeech.actorIds[i]);
@@ -1637,11 +1640,11 @@ void Actor::drawSpeech(void) {
textPoint.x = clamp( 10, actor->_screenPosition.x - width / 2, _vm->getDisplayWidth() - 10 - width);
textPoint.y = clamp( 10, actor->_screenPosition.y - 58, _vm->_scene->getHeight() - 10 - height);
- _vm->_font->textDraw((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), backBuffer, _activeSpeech.strings[0], textPoint,
+ _vm->_font->textDraw(font, backBuffer, _activeSpeech.strings[0], textPoint,
_activeSpeech.speechColor[i], _activeSpeech.outlineColor[i], _activeSpeech.getFontFlags(i));
}
} else {
- _vm->_font->textDrawRect((_vm->getGameType() == GType_ITE ? kMediumFont : kIHNMMainFont), backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
+ _vm->_font->textDrawRect(font, backBuffer, _activeSpeech.strings[0], _activeSpeech.drawRect, _activeSpeech.speechColor[0],
_activeSpeech.outlineColor[0], _activeSpeech.getFontFlags(0));
}
}