diff options
-rw-r--r-- | engines/titanic/core/game_object.cpp | 6 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 6 | ||||
-rw-r--r-- | engines/titanic/pet_control/pet_gfx_element.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/support/movie.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/support/movie.h | 7 | ||||
-rw-r--r-- | engines/titanic/support/video_surface.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/support/video_surface.h | 7 |
7 files changed, 33 insertions, 20 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 3dad7c2c7f..5d913ebf1f 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -240,7 +240,7 @@ void CGameObject::draw(CScreenManager *screenManager) { } Rect CGameObject::getBounds() const { - return (_surface && _surface->proc45()) ? _bounds : Rect(); + return (_surface && _surface->hasFrame()) ? _bounds : Rect(); } void CGameObject::viewChange() { @@ -618,8 +618,8 @@ int CGameObject::getMovieFrame() const { return _initialFrame; } -int CGameObject::getSurface45() const { - return _surface ? _surface->proc45() : 0; +bool CGameObject::surfaceHasFrame() const { + return _surface ? _surface->hasFrame() : false; } void CGameObject::loadSound(const CString &name) { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index b74c35f524..3f77776bf5 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -639,7 +639,11 @@ public: */ int getPriorClass() const; - int getSurface45() const; + /** + * Returns true if there's an attached surface which has a frame + * ready for display + */ + bool surfaceHasFrame() const; /** * Finds an item in various system areas diff --git a/engines/titanic/pet_control/pet_gfx_element.cpp b/engines/titanic/pet_control/pet_gfx_element.cpp index 511fb5e4de..9fc0c2a57d 100644 --- a/engines/titanic/pet_control/pet_gfx_element.cpp +++ b/engines/titanic/pet_control/pet_gfx_element.cpp @@ -81,7 +81,7 @@ Rect CPetGfxElement::getBounds() const { if (!obj) obj = _object0; - if (obj && obj->getSurface45()) + if (obj && obj->surfaceHasFrame()) return _bounds; else return Rect(); diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 2943ee1a84..3856c44e7f 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -36,7 +36,7 @@ namespace Titanic { CMovieList *CMovie::_playingMovies; CVideoSurface *CMovie::_movieSurface; -CMovie::CMovie() : ListItem(), _handled(false), _field10(0), +CMovie::CMovie() : ListItem(), _handled(false), _hasVideoFrame(false), _field14(0) { } @@ -67,9 +67,9 @@ bool CMovie::isActive() const { return _playingMovies->contains(this); } -bool CMovie::get10() { - if (_field10) { - _field10 = 0; +bool CMovie::hasVideoFrame() { + if (_hasVideoFrame) { + _hasVideoFrame = 0; return true; } else { return false; @@ -171,6 +171,9 @@ bool OSMovie::handleEvents(CMovieEventList &events) { _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); } + // Flag there's a video frame + _hasVideoFrame = true; + return _aviSurface._isPlaying; } @@ -192,7 +195,7 @@ void OSMovie::movieStarted() { // Register the movie in the playing list addToPlayingMovies(); - _field10 = 1; + _hasVideoFrame = true; } void OSMovie::setFrameRate(double rate) { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index feb320f0b2..2a7d589194 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -49,7 +49,7 @@ protected: void addToPlayingMovies(); public: bool _handled; - int _field10; + bool _hasVideoFrame; int _field14; public: static CMovieList *_playingMovies; @@ -143,7 +143,10 @@ public: */ bool isActive() const; - bool get10(); + /** + * Returns true if there's a video frame + */ + bool hasVideoFrame(); }; class OSMovie : public CMovie { diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index 4169a80b4b..49388b64d8 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -33,7 +33,7 @@ CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false), _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), - _field48(0), _field50(1), _lockCount(0) { + _field48(0), _hasFrame(true), _lockCount(0) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -170,12 +170,12 @@ uint CVideoSurface::getTransparencyColor() { return val; } -bool CVideoSurface::proc45() { - if (_field50) { - _field50 = 0; +bool CVideoSurface::hasFrame() { + if (_hasFrame) { + _hasFrame = false; return true; } else if (_movie) { - return _movie->get10(); + return _movie->hasVideoFrame(); } else { return false; } @@ -519,7 +519,7 @@ bool OSVideoSurface::loadIfReady() { if (hasSurface()) { return true; } else if (_pendingLoad) { - _field50 = 1; + _hasFrame = true; load(); return true; } else { diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 040161fe8e..0e777bac1e 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -67,7 +67,7 @@ protected: Graphics::ManagedSurface *_movieFrameSurface; int _field48; int _videoSurfaceNum; - int _field50; + bool _hasFrame; int _lockCount; public: CMovie *_movie; @@ -257,7 +257,10 @@ public: */ virtual void transPixelate() = 0; - virtual bool proc45(); + /** + * Returns true if there's a frame to display on the video surface + */ + virtual bool hasFrame(); /** * Duplicates movie frame surface |