diff options
author | Paul Gilbert | 2016-04-09 14:24:52 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-04-09 14:24:52 -0400 |
commit | 3d166fb8a91a4d56bc1abac6f1e3899a0379cd31 (patch) | |
tree | d17c4fc95bb6c828741ad40076b8d9e62ca9f90d /engines | |
parent | 09a3ca07287b77d4abd5713b6c34548ebd8b84a8 (diff) | |
download | scummvm-rg350-3d166fb8a91a4d56bc1abac6f1e3899a0379cd31.tar.gz scummvm-rg350-3d166fb8a91a4d56bc1abac6f1e3899a0379cd31.tar.bz2 scummvm-rg350-3d166fb8a91a4d56bc1abac6f1e3899a0379cd31.zip |
TITANIC: More implementation code for movie playback
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 5 | ||||
-rw-r--r-- | engines/titanic/game_manager.cpp | 31 | ||||
-rw-r--r-- | engines/titanic/game_manager.h | 5 | ||||
-rw-r--r-- | engines/titanic/support/movie.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/support/movie.h | 3 |
5 files changed, 42 insertions, 5 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index d7c93b9524..a7bbbd80cc 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -238,7 +238,7 @@ void CGameObject::loadMovie(const CString &name, bool pendingFlag) { // Create the surface if it doesn't already exist if (!_surface) { CGameManager *gameManager = getGameManager(); - _surface = new OSVideoSurface(CScreenManager::setCurrent(), nullptr); + _surface = new OSVideoSurface(gameManager->setScreenManager(), nullptr); } // Load the new movie resource @@ -359,6 +359,9 @@ void CGameObject::fn1(int val1, int val2, int val3) { } if (_surface) { + // TODO: Figure out where to do this legitimately + static_cast<OSMovie *>(_surface->_movie)->_gameObject = this; + _surface->proc34(val1, val2, val3, val3 != 0); if (val3 & 0x10) diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index 3e15bb0e2c..a4e3420702 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -195,11 +195,32 @@ void CGameManager::updateMovies() { // TODO: Make this more like the original, if I can figuring out // what's it doing with temporary lists and the OSMovie methods for (CMovieList::iterator i = g_vm->_activeMovies.begin(); - i != g_vm->_activeMovies.end(); ++i) { + i != g_vm->_activeMovies.end(); ) { + OSMovie *movie = static_cast<OSMovie *>(*i); + assert(movie && movie->_gameObject); + + movie->update(); + switch (movie->getState()) { + case MOVIE_FINISHED: { + CMovieEndMsg endMsg; + endMsg.execute(movie->_gameObject); + + i = g_vm->_activeMovies.erase(i); + continue; + } - } + case MOVIE_FRAME: { + CMovieFrameMsg frameMsg; + frameMsg.execute(movie->_gameObject); + break; + } - + default: + break; + } + + ++i; + } } void CGameManager::updateDiskTicksCount() { @@ -245,4 +266,8 @@ void CGameManager::extendBounds(const Rect &r) { _bounds.combine(r); } +CScreenManager *CGameManager::setScreenManager() const { + return CScreenManager::setCurrent(); +} + } // End of namespace Titanic diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 5004c777fe..5a2787daf2 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -206,6 +206,11 @@ public: * to include the passed rect */ void extendBounds(const Rect &r); + + /** + * Set and return the current screen manager + */ + CScreenManager *setScreenManager() const; }; } // End of namespace Titanic diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index d614ea7d9b..f2c5643f78 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -45,7 +45,8 @@ bool CMovie::get10() { /*------------------------------------------------------------------------*/ -OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : _videoSurface(surface) { +OSMovie::OSMovie(const CResourceKey &name, CVideoSurface *surface) : + _videoSurface(surface), _gameObject(nullptr) { _video = new AVIDecoder(); if (!_video->loadFile(name.getString())) error("Could not open video - %s", name.getString().c_str()); diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index dfb0ca108a..0772635908 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -35,6 +35,7 @@ enum MovieState { class CVideoSurface; class CMovie; +class CGameObject; class CMovieList : public List<CMovie> { public: @@ -81,6 +82,8 @@ private: */ void decodeFrame(); public: + CGameObject *_gameObject; +public: OSMovie(const CResourceKey &name, CVideoSurface *surface); virtual ~OSMovie(); |