From aba58e6042a1247f36379e69b3338eae1d58c999 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 28 Sep 2016 20:24:27 -0400 Subject: [PATCH] TITANIC: Clarify movie secondary video tracks as a transparency mask --- engines/titanic/support/avi_surface.cpp | 9 +++++---- engines/titanic/support/avi_surface.h | 4 ++-- engines/titanic/support/mouse_cursor.cpp | 2 +- engines/titanic/support/movie.cpp | 6 +++--- engines/titanic/support/video_surface.cpp | 18 +++++++++--------- engines/titanic/support/video_surface.h | 14 +++++++------- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/engines/titanic/support/avi_surface.cpp b/engines/titanic/support/avi_surface.cpp index d4ebd5cef1be..2cc32971aebb 100644 --- a/engines/titanic/support/avi_surface.cpp +++ b/engines/titanic/support/avi_surface.cpp @@ -39,15 +39,16 @@ Video::AVIDecoder::AVIVideoTrack &AVIDecoder::getVideoTrack() { } /** - * Track filter for AVIDecoder that filters out any secondary video track + * Track filter for AVIDecoder that filters out any secondary + * video track some videos have to hold transparency masks */ static bool primaryTrackSelect(bool isVideo, int trackCounter) { return !isVideo || trackCounter == 0; } /** - * Track filter for AVIDecoder that only accepts the secondary video track - * for a video, if present + * Track filter for AVIDecoder that only accepts the secondary + * transparency msak video track for a video, if present */ static bool secondaryTrackSelect(bool isVideo, int trackCounter) { return isVideo && trackCounter > 0; @@ -348,7 +349,7 @@ Graphics::ManagedSurface *AVISurface::getSecondarySurface() { return _streamCount <= 1 ? nullptr : _movieFrameSurface[1]; } -Graphics::ManagedSurface *AVISurface::duplicateSecondaryFrame() const { +Graphics::ManagedSurface *AVISurface::duplicateTransparency() const { if (_streamCount <= 1) { return nullptr; } else { diff --git a/engines/titanic/support/avi_surface.h b/engines/titanic/support/avi_surface.h index 54b0155bddbb..0acf7ab23be1 100644 --- a/engines/titanic/support/avi_surface.h +++ b/engines/titanic/support/avi_surface.h @@ -168,9 +168,9 @@ class AVISurface { } /** - * Duplicates the secondary frame, if the movie has a second video track + * Duplicates the transparency mask for the frame, if the movie includes it */ - Graphics::ManagedSurface *duplicateSecondaryFrame() const; + Graphics::ManagedSurface *duplicateTransparency() const; /** * Returns true if it's time for the next diff --git a/engines/titanic/support/mouse_cursor.cpp b/engines/titanic/support/mouse_cursor.cpp index d342e6cccbc0..0cefc368fa4d 100644 --- a/engines/titanic/support/mouse_cursor.cpp +++ b/engines/titanic/support/mouse_cursor.cpp @@ -84,7 +84,7 @@ void CMouseCursor::loadCursorImages() { Graphics::ManagedSurface *frameSurface = movie.duplicateFrame(); _cursors[idx]._frameSurface = frameSurface; - surface->setMovieFrameSurface(frameSurface); + surface->setTransparencySurface(frameSurface); } } diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index e863185f8459..a605cc3465b4 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -157,7 +157,7 @@ void OSMovie::addEvent(int frameNumber, CGameObject *obj) { void OSMovie::setFrame(uint frameNumber) { _aviSurface.setFrame(frameNumber); - _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); + _videoSurface->setTransparencySurface(_aviSurface.getSecondarySurface()); } bool OSMovie::handleEvents(CMovieEventList &events) { @@ -169,7 +169,7 @@ bool OSMovie::handleEvents(CMovieEventList &events) { // Handle updating the frame while (_aviSurface.isPlaying() && _aviSurface.isNextFrame()) { _aviSurface.handleEvents(events); - _videoSurface->setMovieFrameSurface(_aviSurface.getSecondarySurface()); + _videoSurface->setTransparencySurface(_aviSurface.getSecondarySurface()); } // Flag there's a video frame @@ -204,7 +204,7 @@ void OSMovie::setFrameRate(double rate) { } Graphics::ManagedSurface *OSMovie::duplicateFrame() const { - return _aviSurface.duplicateSecondaryFrame(); + return _aviSurface.duplicateTransparency(); } } // End of namespace Titanic diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index b5f668793a8a..50a5ca5f1695 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -32,8 +32,8 @@ int CVideoSurface::_videoSurfaceCounter = 0; CVideoSurface::CVideoSurface(CScreenManager *screenManager) : _screenManager(screenManager), _rawSurface(nullptr), _movie(nullptr), _pendingLoad(false), _transBlitFlag(false), _fastBlitFlag(false), - _movieFrameSurface(nullptr), _transparencyMode(TRANS_DEFAULT), - _freeMovieSurface(DisposeAfterUse::NO), _hasFrame(true), _lockCount(0) { + _transparencySurface(nullptr), _transparencyMode(TRANS_DEFAULT), + _freeTransparencySurface(DisposeAfterUse::NO), _hasFrame(true), _lockCount(0) { _videoSurfaceNum = _videoSurfaceCounter++; } @@ -42,8 +42,8 @@ CVideoSurface::~CVideoSurface() { _videoSurfaceCounter -= freeSurface(); --_videoSurfaceCounter; - if (_freeMovieSurface == DisposeAfterUse::YES) - delete _movieFrameSurface; + if (_freeTransparencySurface == DisposeAfterUse::YES) + delete _transparencySurface; } void CVideoSurface::setSurface(CScreenManager *screenManager, DirectDrawSurface *surface) { @@ -138,8 +138,8 @@ void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoS if (src->_fastBlitFlag) { _rawSurface->blitFrom(*src->_rawSurface, srcRect, Point(destRect.left, destRect.top)); - } else if (getMovieFrameSurface()) { - movieBlitRect(srcRect, destRect, src); + } else if (getTransparencySurface()) { + transBlitRect(srcRect, destRect, src); } else { _rawSurface->transBlitFrom(*src->_rawSurface, srcRect, destRect, src->getTransparencyColor()); } @@ -149,8 +149,8 @@ void CVideoSurface::blitRect1(const Rect &srcRect, const Rect &destRect, CVideoS } void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { - if (getMovieFrameSurface()) { - movieBlitRect(srcRect, destRect, src); + if (getTransparencySurface()) { + transBlitRect(srcRect, destRect, src); } else { src->lock(); lock(); @@ -162,7 +162,7 @@ void CVideoSurface::blitRect2(const Rect &srcRect, const Rect &destRect, CVideoS } } -void CVideoSurface::movieBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { +void CVideoSurface::transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src) { if (lock()) { if (src->lock()) { Graphics::ManagedSurface *srcSurface = src->_rawSurface; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 053eabb0f9a6..c21149333d22 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -57,15 +57,15 @@ class CVideoSurface : public ListItem { void blitRect1(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); void blitRect2(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); - void movieBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); + void transBlitRect(const Rect &srcRect, const Rect &destRect, CVideoSurface *src); protected: static int _videoSurfaceCounter; protected: CScreenManager *_screenManager; Graphics::ManagedSurface *_rawSurface; bool _pendingLoad; - Graphics::ManagedSurface *_movieFrameSurface; - DisposeAfterUse::Flag _freeMovieSurface; + Graphics::ManagedSurface *_transparencySurface; + DisposeAfterUse::Flag _freeTransparencySurface; int _videoSurfaceNum; bool _hasFrame; int _lockCount; @@ -295,14 +295,14 @@ class CVideoSurface : public ListItem { void blitFrom(const Point &destPos, const Graphics::Surface *src); /** - * Sets the movie frame surface containing frame data from an active movie + * Sets a raw surface to use as a transparency mask for the surface */ - void setMovieFrameSurface(Graphics::ManagedSurface *frameSurface) { _movieFrameSurface = frameSurface; } + void setTransparencySurface(Graphics::ManagedSurface *surface) { _transparencySurface = surface; } /** - * Get the previously set movie frame surface + * Get the previously set transparency mask surface */ - Graphics::ManagedSurface *getMovieFrameSurface() const { return _movieFrameSurface; } + Graphics::ManagedSurface *getTransparencySurface() const { return _transparencySurface; } /** * Get the pixels associated with the surface. Only valid when the