From c8c83145a8dc90c8ea340b258999e32db56e40a0 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 11 Sep 2017 19:35:21 -0400 Subject: TITANIC: The hasAudioTiming code was just an isActive flag --- engines/titanic/core/game_object.cpp | 4 ++-- engines/titanic/core/game_object.h | 4 ++-- engines/titanic/game/end_sequence_control.cpp | 2 +- engines/titanic/sound/music_room_instrument.cpp | 4 ++-- engines/titanic/sound/titania_speech.cpp | 2 +- engines/titanic/support/avi_surface.h | 7 +++++++ engines/titanic/support/movie.cpp | 7 +++++-- engines/titanic/support/movie.h | 11 ++++++++++- 8 files changed, 30 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index ae517a2689..ef7a8c2bca 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -1374,14 +1374,14 @@ void CGameObject::setToggleColor(byte r, byte g, byte b) { _toggleB = b; } -void CGameObject::movieSetAudioTiming(bool flag) { +void CGameObject::movieSetPlaying(bool flag) { if (!_surface && !_resource.empty()) { loadResource(_resource); _resource.clear(); } if (_surface && _surface->_movie) - _surface->_movie->_hasAudioTiming = flag; + _surface->_movie->setPlaying(flag); } void CGameObject::movieEvent(int frameNumber) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index f79c9e1d1e..b592806977 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -653,9 +653,9 @@ public: void stopMovie(); /** - * Overrides whether the object's movie has audio timing + * Overrides whether the object's movie is playing or paused */ - void movieSetAudioTiming(bool flag); + void movieSetPlaying(bool flag); /** * Get the current movie frame diff --git a/engines/titanic/game/end_sequence_control.cpp b/engines/titanic/game/end_sequence_control.cpp index 52151f353e..7041874368 100644 --- a/engines/titanic/game/end_sequence_control.cpp +++ b/engines/titanic/game/end_sequence_control.cpp @@ -76,8 +76,8 @@ bool CEndSequenceControl::EnterRoomMsg(CEnterRoomMsg *msg) { } bool CEndSequenceControl::EnterViewMsg(CEnterViewMsg *msg) { - movieSetAudioTiming(true); playMovie(MOVIE_NOTIFY_OBJECT | MOVIE_WAIT_FOR_FINISH); + movieSetPlaying(true); return true; } diff --git a/engines/titanic/sound/music_room_instrument.cpp b/engines/titanic/sound/music_room_instrument.cpp index b92329850b..15ac2cd192 100644 --- a/engines/titanic/sound/music_room_instrument.cpp +++ b/engines/titanic/sound/music_room_instrument.cpp @@ -115,7 +115,7 @@ void CMusicRoomInstrument::start() { case MV_BELLS: _gameObjects[0]->loadFrame(0); - _gameObjects[0]->movieSetAudioTiming(true); + _gameObjects[0]->movieSetPlaying(true); break; case MV_SNAKE: @@ -210,8 +210,8 @@ void CMusicRoomInstrument::update(int val) { case MV_BELLS: switch (val) { case 60: - _gameObjects[0]->movieSetAudioTiming(true); _gameObjects[0]->playMovie(0, 512, MOVIE_STOP_PREVIOUS); + _gameObjects[0]->movieSetPlaying(true); _animTime = 0.6; break; diff --git a/engines/titanic/sound/titania_speech.cpp b/engines/titanic/sound/titania_speech.cpp index bd41845712..c6365a828b 100644 --- a/engines/titanic/sound/titania_speech.cpp +++ b/engines/titanic/sound/titania_speech.cpp @@ -57,10 +57,10 @@ bool CTitaniaSpeech::ActMsg(CActMsg *msg) { CProximity prox(Audio::Mixer::kSpeechSoundType); switch (_actionNum) { case 1: - movieSetAudioTiming(true); loadSound("a#12.wav"); sleep(1000); playMovie(0, 187, MOVIE_WAIT_FOR_FINISH | MOVIE_NOTIFY_OBJECT); + movieSetPlaying(true); movieEvent(0); break; diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 03f8f24cfe..4e9166c0f0 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -183,6 +183,13 @@ public: return _decoder->isPlaying(); } + /** + * Sets whether the video is playing (versus paused) + */ + virtual void setPlaying(bool playingFlag) { + _decoder->pauseVideo(!playingFlag); + } + /** * Handle any movie events relevent for the frame */ diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 56e7b7e6f2..8c130ddb6f 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -40,8 +40,7 @@ namespace Titanic { CMovieList *CMovie::_playingMovies; CVideoSurface *CMovie::_movieSurface; -CMovie::CMovie() : ListItem(), _handled(false), _hasVideoFrame(false), - _hasAudioTiming(false) { +CMovie::CMovie() : ListItem(), _handled(false), _hasVideoFrame(false) { } CMovie::~CMovie() { @@ -200,6 +199,10 @@ void OSMovie::setFrameRate(double rate) { _aviSurface.setFrameRate(rate); } +void OSMovie::setPlaying(bool playingFlag) { + _aviSurface.setPlaying(playingFlag); +} + Graphics::ManagedSurface *OSMovie::duplicateTransparency() const { return _aviSurface.duplicateTransparency(); } diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index cedf7c4d20..36a76654e4 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -50,7 +50,6 @@ protected: public: bool _handled; bool _hasVideoFrame; - bool _hasAudioTiming; public: static CMovieList *_playingMovies; static CVideoSurface *_movieSurface; @@ -138,6 +137,11 @@ public: */ virtual void setFrameRate(double rate) = 0; + /** + * Sets whether the video is playing (versus paused) + */ + virtual void setPlaying(bool playingFlag) = 0; + /** * Creates a duplicate of the transparency surface */ @@ -246,6 +250,11 @@ public: */ virtual void setFrameRate(double rate); + /** + * Sets whether the video is playing (versus paused) + */ + virtual void setPlaying(bool playingFlag); + /** * Creates a duplicate of the transparency surface */ -- cgit v1.2.3