aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/video
diff options
context:
space:
mode:
authorTobia Tesan2014-02-06 01:00:19 +0100
committerTobia Tesan2014-10-15 21:36:44 +0200
commitf2441da3da9ce4802ce12dc5c815095098e57ee2 (patch)
tree07027833a5a9c664963b95c3c94d91285d85bdcc /engines/wintermute/video
parent6d16fdbf4ab9139d368ab7585f9ad1fae5c8a523 (diff)
downloadscummvm-rg350-f2441da3da9ce4802ce12dc5c815095098e57ee2.tar.gz
scummvm-rg350-f2441da3da9ce4802ce12dc5c815095098e57ee2.tar.bz2
scummvm-rg350-f2441da3da9ce4802ce12dc5c815095098e57ee2.zip
WINTERMUTE: Make sure subtitle files could be found before anything else
Diffstat (limited to 'engines/wintermute/video')
-rw-r--r--engines/wintermute/video/video_subtitler.cpp3
-rw-r--r--engines/wintermute/video/video_theora_player.cpp28
-rw-r--r--engines/wintermute/video/video_theora_player.h3
3 files changed, 22 insertions, 12 deletions
diff --git a/engines/wintermute/video/video_subtitler.cpp b/engines/wintermute/video/video_subtitler.cpp
index e4c55feb03..06b8bab1f4 100644
--- a/engines/wintermute/video/video_subtitler.cpp
+++ b/engines/wintermute/video/video_subtitler.cpp
@@ -177,8 +177,9 @@ bool VideoSubtitler::loadSubtitles(const char *filename, const char *subtitleFil
}
delete[] buffer;
+ // Succeeded loading subtitles!
- return false;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/video/video_theora_player.cpp b/engines/wintermute/video/video_theora_player.cpp
index 600eae8349..2af3ac1638 100644
--- a/engines/wintermute/video/video_theora_player.cpp
+++ b/engines/wintermute/video/video_theora_player.cpp
@@ -86,6 +86,7 @@ void VideoTheoraPlayer::SetDefaults() {
_theoraDecoder = nullptr;
_subtitler = new VideoSubtitler(_gameRef);
+ _subtitles = false;
}
//////////////////////////////////////////////////////////////////////////
@@ -134,7 +135,13 @@ bool VideoTheoraPlayer::initialize(const Common::String &filename, const Common:
#endif
- _subtitler->loadSubtitles(_filename.c_str(), subtitleFile.c_str());
+ if (_subtitler->loadSubtitles(_filename.c_str(), subtitleFile.c_str())) {
+ // We have subtitles
+ _subtitles = true;
+ } else {
+ // We couldn't load subtitles...
+ _subtitles = false;
+ }
_theoraDecoder->loadStream(_file);
@@ -220,8 +227,10 @@ bool VideoTheoraPlayer::play(TVideoPlayback type, int x, int y, bool freezeGame,
_state = THEORA_STATE_PLAYING;
_looping = looping;
_playbackType = type;
- _subtitler->update(_theoraDecoder->getFrameCount());
- _subtitler->display();
+ if (_subtitler && _subtitles && _gameRef->_subtitles) {
+ _subtitler->update(_theoraDecoder->getFrameCount());
+ _subtitler->display();
+ }
_startTime = startTime;
_volume = volume;
_posX = x;
@@ -296,8 +305,9 @@ bool VideoTheoraPlayer::update() {
}
if (_theoraDecoder) {
-
- _subtitler->update(_theoraDecoder->getCurFrame());
+ if (_subtitler && _subtitles && _gameRef->_subtitles) {
+ _subtitler->update(_theoraDecoder->getCurFrame());
+ }
if (_theoraDecoder->endOfVideo() && _looping) {
warning("Should loop movie %s, hacked for now", _filename.c_str());
@@ -422,12 +432,10 @@ bool VideoTheoraPlayer::display(uint32 alpha) {
} else {
res = STATUS_FAILED;
}
- // TODO: Add subtitles-support
-/* if (m_Subtitler && _gameRef->m_VideoSubtitles) {
- m_Subtitler->display();
- }*/
- _subtitler->display();
+ if (_subtitler && _subtitles && _gameRef->_subtitles) {
+ _subtitler->display();
+ }
return res;
}
diff --git a/engines/wintermute/video/video_theora_player.h b/engines/wintermute/video/video_theora_player.h
index 698326c29c..48f75efd20 100644
--- a/engines/wintermute/video/video_theora_player.h
+++ b/engines/wintermute/video/video_theora_player.h
@@ -138,9 +138,10 @@ private:
bool _playbackStarted;
+ bool _subtitles;
+
// helpers
void SetDefaults();
-
};
} // End of namespace Wintermute