diff options
author | Paul Gilbert | 2016-07-09 11:32:15 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:27:33 -0400 |
commit | cc9bf88ed56a4c5fbb14c05d30395b1688f5ebe7 (patch) | |
tree | 7a3a9a9fb8f0ce6fa15ab71a12c1144893c45811 /engines/titanic/core | |
parent | 341cf1866168a8e270ed08b38cd43aa83387ea5a (diff) | |
download | scummvm-rg350-cc9bf88ed56a4c5fbb14c05d30395b1688f5ebe7.tar.gz scummvm-rg350-cc9bf88ed56a4c5fbb14c05d30395b1688f5ebe7.tar.bz2 scummvm-rg350-cc9bf88ed56a4c5fbb14c05d30395b1688f5ebe7.zip |
TITANIC: Major implementation of OSMovie and AVISurface classes
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 112 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 30 |
2 files changed, 64 insertions, 78 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index dcc66f569d..78b91c3375 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -85,12 +85,14 @@ void CGameObject::save(SimpleFile *file, int indent) { _movieRangeInfoList.destroyContents(); if (_surface) { - Common::List<CMovieRangeInfo *> rangeList = _surface->getMovieRangeInfo(); + const CMovieRangeInfoList *rangeList = _surface->getMovieRangeInfo(); - for (Common::List<CMovieRangeInfo *>::const_iterator i = rangeList.begin(); - i != rangeList.end(); ++i) { - CMovieRangeInfo *rangeInfo = new CMovieRangeInfo(*i); - rangeInfo->_frameNumber = (i == rangeList.begin()) ? getMovieFrame() : -1; + if (rangeList) { + for (CMovieRangeInfoList::const_iterator i = rangeList->begin(); + i != rangeList->end(); ++i) { + CMovieRangeInfo *rangeInfo = new CMovieRangeInfo(*i); + rangeInfo->_initialFrame = (i == rangeList->begin()) ? getMovieFrame() : -1; + } } } @@ -403,21 +405,6 @@ void CGameObject::loadFrame(int frameNumber) { makeDirty(); } -void CGameObject::playMovie(int v1, int v2) { - if (_surface && !_resource.empty()) { - loadResource(_resource); - _resource.clear(); - } - - if (_surface && _surface->loadIfReady()) { - if (_surface->_movie) { - disableMouse(); - _surface->_movie->play(_bounds, v1, v2); - enableMouse(); - } - } -} - void CGameObject::processMoveRangeInfo() { for (CMovieRangeInfoList::iterator i = _movieRangeInfoList.begin(); i != _movieRangeInfoList.end(); ++i) (*i)->process(this); @@ -518,23 +505,53 @@ void CGameObject::petSetRemoteTarget() { pet->setRemoteTarget(this); } -void CGameObject::playMovie(uint startFrame, uint endFrame, uint flags) { +void CGameObject::playMovie(uint flags) { _frameNumber = -1; + + if (_surface && !_resource.empty()) { + loadResource(_resource); + _resource.clear(); + } + + CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + if (_surface) { + _surface->playMovie(flags, obj); + if (flags & MOVIE_GAMESTATE) + getGameManager()->_gameState.addMovie(_surface->_movie); + } +} + +void CGameObject::playMovie(int startFrame, int endFrame, uint flags) { + _frameNumber = -1; + if (!_surface) { if (!_resource.empty()) loadResource(_resource); _resource.clear(); } + CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; if (_surface) { - // TODO: Figure out where to do this legitimately - OSMovie *movie = static_cast<OSMovie *>(_surface->_movie); - if (movie) - movie->_gameObject = this; + _surface->playMovie(startFrame, endFrame, flags, obj); + if (flags & MOVIE_GAMESTATE) + getGameManager()->_gameState.addMovie(_surface->_movie); + } +} + - _surface->playMovie(startFrame, endFrame, flags, flags != 0); +void CGameObject::playMovie(int startFrame, int endFrame, int initialFrame, uint flags) { + _frameNumber = -1; - if (flags & 0x10) + if (!_surface) { + if (!_resource.empty()) + loadResource(_resource); + _resource.clear(); + } + + CGameObject *obj = (flags & MOVIE_NO_OBJECT) ? nullptr : this; + if (_surface) { + _surface->playMovie(startFrame, endFrame, initialFrame, flags, obj); + if (flags & MOVIE_GAMESTATE) getGameManager()->_gameState.addMovie(_surface->_movie); } } @@ -565,28 +582,6 @@ void CGameObject::playRandomClip(const char **names, uint flags) { playClip(name, flags); } -void CGameObject::playMovie(uint flags) { - _frameNumber = -1; - if (!_surface && !_resource.empty()) { - loadResource(_resource); - _resource.clear(); - } - - CVideoSurface *surface = (flags & 4) ? _surface : nullptr; - if (_surface) { - _surface->playMovie(flags, surface); - - // TODO: Figure out where to do this legitimately - OSMovie *movie = static_cast<OSMovie *>(_surface->_movie); - if (movie) - movie->_gameObject = this; - - if (flags & 0x10) { - getGameManager()->_gameState.addMovie(_surface->_movie); - } - } -} - void CGameObject::savePosition() { _savedPos = _bounds; } @@ -1109,17 +1104,6 @@ bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { return _movieClips.existsByEnd(name, endFrame); } -void CGameObject::checkPlayMovie(int fieldC, int field10, int frameNumber, int flags) { - if (!_surface && !_resource.empty()) - loadResource(_resource); - - if (_surface ) { - _surface->proc35(fieldC, field10, frameNumber, flags, (flags & CLIPFLAG_4) ? this : nullptr); - if (flags & CLIPFLAG_PLAY) - getGameManager()->_gameState.addMovie(_surface->_movie); - } -} - void CGameObject::petClear() const { CPetControl *petControl = getPetControl(); if (petControl) @@ -1235,14 +1219,14 @@ void CGameObject::setMovie14(int v) { _surface->_movie->_field14 = v; } -void CGameObject::surface38(int v1, int v2) { +void CGameObject::movieEvent(int frameNumber) { if (_surface) - _surface->proc38(v1, v2); + _surface->addMovieEvent(frameNumber, this); } -void CGameObject::surface38(int v1) { +void CGameObject::movieEvent() { if (_surface) - _surface->proc38(-1, v1); + _surface->addMovieEvent(-1, this); } int CGameObject::getClipDuration(const CString &name, int frameRate) const { diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 20059539d9..58ae4c6123 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -294,11 +294,6 @@ protected: Point getControid() const; /** - * Plays a movie - */ - void playMovie(int v1, int v2); - - /** * Play an arbitrary clip */ void playClip(const CString &name, uint flags); @@ -561,11 +556,6 @@ public: virtual bool isPet() const; /** - * Play the movie specified in _resource - */ - void playMovie(uint startFrame, uint endFrame, uint flags); - - /** * Checks the passed point is validly in the object, * with extra checking of object flags status */ @@ -582,9 +572,14 @@ public: void playMovie(uint flags); /** - * Checks and plays a pending clip + * Play the movie specified in _resource + */ + void playMovie(int startFrame, int endFrame, uint flags); + + /** + * Play the movie specified in _resource */ - void checkPlayMovie(int fieldC, int field10, int frameNumber, int flags); + void playMovie(int startFrame, int endFrame, int initialFrame, uint flags); /** * Returns true if the object has a currently active movie @@ -842,9 +837,16 @@ public: /*--- CVideoSurface Methods ---*/ - void surface38(int v1, int v2); + /** + * Signal a movie event for the given frame + */ + void movieEvent(int frameNumber); - void surface38(int v1); + /** + * Signal a movie event at the end of all currently + * playing ranges + */ + void movieEvent(); }; } // End of namespace Titanic |