aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute
diff options
context:
space:
mode:
authorTobia Tesan2014-02-08 13:53:14 +0100
committerTobia Tesan2014-10-15 21:36:45 +0200
commit40c5b01aad085f1cf69792f1ef945f54d5e844e1 (patch)
tree7a2bdde3c3d5aec80a0a59c4b4d1699817345746 /engines/wintermute
parent7c6f9772d37e3ab7724d20c838883ee8abc2c2b3 (diff)
downloadscummvm-rg350-40c5b01aad085f1cf69792f1ef945f54d5e844e1.tar.gz
scummvm-rg350-40c5b01aad085f1cf69792f1ef945f54d5e844e1.tar.bz2
scummvm-rg350-40c5b01aad085f1cf69792f1ef945f54d5e844e1.zip
WINTERMUTE: Preserve const when handing chars over to drawText
Diffstat (limited to 'engines/wintermute')
-rw-r--r--engines/wintermute/video/video_subtitler.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/engines/wintermute/video/video_subtitler.cpp b/engines/wintermute/video/video_subtitler.cpp
index 8f3032a95a..a8ce86853a 100644
--- a/engines/wintermute/video/video_subtitler.cpp
+++ b/engines/wintermute/video/video_subtitler.cpp
@@ -64,7 +64,6 @@ bool VideoSubtitler::loadSubtitles(const Common::String &filename, const Common:
_currentSubtitle = 0;
_showSubtitle = false;
-
Common::String newFile;
if (subtitleFile.size() != 0) {
@@ -174,18 +173,28 @@ bool VideoSubtitler::loadSubtitles(const Common::String &filename, const Common:
bool VideoSubtitler::display() {
if (_showSubtitle) {
- BaseFont *font = _gameRef->getVideoFont() ? _gameRef->getVideoFont() : _gameRef->getSystemFont();
- int textHeight = font->getTextHeight((byte *)_subtitles[_currentSubtitle]->getText().c_str(), _gameRef->_renderer->getWidth());
- font->drawText((byte *)_subtitles[_currentSubtitle]->getText().c_str(),
+
+ BaseFont *font;
+
+ if (_gameRef->getVideoFont() == nullptr) {
+ font = _gameRef->getSystemFont();
+ } else {
+ font = _gameRef->getVideoFont();
+ }
+
+ int textHeight = font->getTextHeight(
+ (const byte *)_subtitles[_currentSubtitle]->getText().c_str(),
+ _gameRef->_renderer->getWidth());
+ font->drawText((const byte *)_subtitles[_currentSubtitle]->getText().c_str(),
0,
(_gameRef->_renderer->getHeight() - textHeight - 5),
- (_gameRef->_renderer->getWidth(), TAL_CENTER));
+ (_gameRef->_renderer->getWidth()),
+ TAL_CENTER);
}
return false;
}
bool VideoSubtitler::update(uint frame) {
-
if (_subtitles.size() == 0) {
// Edge case: we have loaded subtitles early on... from a blank file.
return false;
@@ -242,7 +251,6 @@ bool VideoSubtitler::update(uint frame) {
if (currentStarted && !overdue && currentValid) {
_showSubtitle = true;
}
-
}
return false;
}