diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 56 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 6 | ||||
-rw-r--r-- | engines/titanic/core/tree_item.h | 2 | ||||
-rw-r--r-- | engines/titanic/support/movie.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/support/movie.h | 20 | ||||
-rw-r--r-- | engines/titanic/support/movie_clip.cpp | 2 | ||||
-rw-r--r-- | engines/titanic/support/movie_range_info.cpp | 14 | ||||
-rw-r--r-- | engines/titanic/support/movie_range_info.h | 4 | ||||
-rw-r--r-- | engines/titanic/support/video_surface.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/support/video_surface.h | 15 |
10 files changed, 107 insertions, 27 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 29ad735a66..a5657f583a 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -82,7 +82,49 @@ CGameObject::~CGameObject() { void CGameObject::save(SimpleFile *file, int indent) { file->writeNumberLine(7, indent); - error("TODO: CGameObject::save"); + _movieRangeInfoList.destroyContents(); + + if (_surface) { + Common::List<CMovieRangeInfo *> 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; + } + } + + _movieRangeInfoList.save(file, indent); + _movieRangeInfoList.destroyContents(); + + file->writeNumberLine(getMovieFrame(), indent + 1); + file->writeNumberLine(_cursorId, indent + 1); + _movieClips.save(file, indent + 1); + file->writeNumberLine(_field60, indent + 1); + file->writeNumberLine(_field40, indent + 1); + file->writeQuotedLine(_resource, indent + 1); + file->writeBounds(_bounds, indent + 1); + + file->writeFloatLine(_field34, indent + 1); + file->writeFloatLine(_field38, indent + 1); + file->writeFloatLine(_field3C, indent + 1); + + file->writeNumberLine(_field44, indent + 1); + file->writeNumberLine(_field48, indent + 1); + file->writeNumberLine(_field4C, indent + 1); + file->writeNumberLine(_fieldB8, indent + 1); + file->writeNumberLine(_visible, indent + 1); + file->writeNumberLine(_isMail, indent + 1); + file->writeNumberLine(_id, indent + 1); + file->writeNumberLine(_roomFlags, indent + 1); + + if (_surface) { + _surface->_resourceKey.save(file, indent); + } else { + CResourceKey resourceKey; + resourceKey.save(file, indent); + } + file->writeNumberLine(_surface != nullptr, indent); CNamedItem::save(file, indent); } @@ -93,7 +135,7 @@ void CGameObject::load(SimpleFile *file) { switch (val) { case 7: - _movieRangeInfo.load(file); + _movieRangeInfoList.load(file); _frameNumber = file->readNumber(); // Deliberate fall-through @@ -179,7 +221,7 @@ void CGameObject::draw(CScreenManager *screenManager) { _frameNumber = -1; } - if (!_movieRangeInfo.empty()) + if (!_movieRangeInfoList.empty()) processMoveRangeInfo(); if (_bounds.intersects(getGameManager()->_bounds)) { @@ -377,10 +419,10 @@ void CGameObject::playMovie(int v1, int v2) { } void CGameObject::processMoveRangeInfo() { - for (CMovieRangeInfoList::iterator i = _movieRangeInfo.begin(); i != _movieRangeInfo.end(); ++i) + for (CMovieRangeInfoList::iterator i = _movieRangeInfoList.begin(); i != _movieRangeInfoList.end(); ++i) (*i)->process(this); - _movieRangeInfo.destroyContents(); + _movieRangeInfoList.destroyContents(); } void CGameObject::makeDirty(const Rect &r) { @@ -1071,12 +1113,12 @@ bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { return _movieClips.existsByEnd(name, endFrame); } -void CGameObject::checkPlayMovie(const CString &name, int flags) { +void CGameObject::checkPlayMovie(int fieldC, int field10, int frameNumber, int flags) { if (!_surface && !_resource.empty()) loadResource(_resource); if (_surface ) { - _surface->proc35(name, flags, (flags & CLIPFLAG_4) ? this : nullptr); + _surface->proc35(fieldC, field10, frameNumber, flags, (flags & CLIPFLAG_4) ? this : nullptr); if (flags & CLIPFLAG_PLAY) getGameManager()->_gameState.addMovie(_surface->_movie); } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index 1afe834876..8c53e159be 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -90,7 +90,7 @@ protected: int _field4C; CMovieClipList _movieClips; int _initialFrame; - CMovieRangeInfoList _movieRangeInfo; + CMovieRangeInfoList _movieRangeInfoList; int _frameNumber; CPetText *_text; uint _textBorder; @@ -533,7 +533,7 @@ public: /** * Returns the clip list, if any, associated with the item */ - virtual const CMovieClipList *getClipList() const { return &_movieClips; } + virtual const CMovieClipList *getMovieClips() const { return &_movieClips; } /** * Allows the item to draw itself @@ -594,7 +594,7 @@ public: /** * Checks and plays a pending clip */ - void checkPlayMovie(const CString &name, int flags); + void checkPlayMovie(int fieldC, int field10, int frameNumber, int flags); /** * Returns true if the object has a currently active movie diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h index a15a5ae52f..49a3fa7a65 100644 --- a/engines/titanic/core/tree_item.h +++ b/engines/titanic/core/tree_item.h @@ -134,7 +134,7 @@ public: /** * Returns the clip list, if any, associated with the item */ - virtual const CMovieClipList *getClipList() const { return nullptr; } + virtual const CMovieClipList *getMovieClips() const { return nullptr; } /** * Returns true if the given item connects to another specified view diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp index 27bcb97ae9..361bf6e1fa 100644 --- a/engines/titanic/support/movie.cpp +++ b/engines/titanic/support/movie.cpp @@ -99,7 +99,7 @@ void OSMovie::proc11() { warning("TODO: OSMovie::proc11"); } -void OSMovie::proc12(const CString &name, int flags, CGameObject *obj) { +void OSMovie::proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj) { warning("TODO: OSMovie::proc12"); } @@ -121,8 +121,9 @@ void OSMovie::proc16() { warning("TODO: OSMovie::proc16"); } -void OSMovie::proc17() { - warning("TODO: OSMovie::proc17"); +const Common::List<CMovieRangeInfo *> OSMovie::getMovieRangeInfo() const { + warning("TODO: OSMovie::getMovieRangeInfo"); + return Common::List<CMovieRangeInfo *>(); } void OSMovie::proc18() { diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h index da3285547d..2d7bdc9c6d 100644 --- a/engines/titanic/support/movie.h +++ b/engines/titanic/support/movie.h @@ -23,9 +23,11 @@ #ifndef TITANIC_MOVIE_H #define TITANIC_MOVIE_H +#include "common/list.h" #include "video/video_decoder.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" +#include "titanic/support/movie_range_info.h" namespace Titanic { @@ -72,7 +74,7 @@ public: virtual void playClip(const Rect &rect, uint startFrame, uint endFrame) = 0; virtual void proc11() = 0; - virtual void proc12(const CString &name, int flags, CGameObject *obj) = 0; + virtual void proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj) = 0; /** * Stops the movie @@ -82,7 +84,12 @@ public: virtual void proc14() = 0; virtual void setFrame(uint frameNumber) = 0; virtual void proc16() = 0; - virtual void proc17() = 0; + + /** + * Return any movie range info associated with the movie + */ + virtual const Common::List<CMovieRangeInfo *> getMovieRangeInfo() const = 0; + virtual void proc18() = 0; /** @@ -139,7 +146,7 @@ public: virtual void playClip(const Rect &rect, uint startFrame, uint endFrame); virtual void proc11(); - virtual void proc12(const CString &name, int flags, CGameObject *obj); + virtual void proc12(int v1, int v2, int frameNumber, int flags, CGameObject *obj); /** * Stops the movie @@ -154,7 +161,12 @@ public: virtual void setFrame(uint frameNumber); virtual void proc16(); - virtual void proc17(); + + /** + * Return any movie range info associated with the movie + */ + virtual const Common::List<CMovieRangeInfo *> getMovieRangeInfo() const; + virtual void proc18(); /** diff --git a/engines/titanic/support/movie_clip.cpp b/engines/titanic/support/movie_clip.cpp index 2d3187b000..1f2ef66428 100644 --- a/engines/titanic/support/movie_clip.cpp +++ b/engines/titanic/support/movie_clip.cpp @@ -65,6 +65,8 @@ void CMovieClip::load(SimpleFile *file) { ListItem::load(file); } +/*------------------------------------------------------------------------*/ + CMovieClip *CMovieClipList::findByName(const Common::String &name) const { for (const_iterator i = begin(); i != end(); ++i) { CMovieClip *clip = *i; diff --git a/engines/titanic/support/movie_range_info.cpp b/engines/titanic/support/movie_range_info.cpp index d48bab1df6..e6b28ce4e8 100644 --- a/engines/titanic/support/movie_range_info.cpp +++ b/engines/titanic/support/movie_range_info.cpp @@ -34,7 +34,9 @@ CMovieRangeInfo::~CMovieRangeInfo() { } CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { - _movieName = src->_movieName; + _fieldC = src->_fieldC; + _field10 = src->_field10; + _frameNumber = src->_frameNumber; _startFrame = src->_startFrame; _endFrame = src->_endFrame; @@ -47,7 +49,9 @@ CMovieRangeInfo::CMovieRangeInfo(const CMovieRangeInfo *src) : ListItem() { void CMovieRangeInfo::save(SimpleFile *file, int indent) { file->writeNumberLine(0, indent); - file->writeQuotedLine(_movieName, indent + 1); + file->writeNumberLine(_fieldC, indent + 1); + file->writeNumberLine(_field10, indent + 1); + file->writeNumberLine(_frameNumber, indent + 1); file->writeNumberLine(_endFrame, indent + 1); file->writeNumberLine(_startFrame, indent + 1); _events.save(file, indent + 1); @@ -56,7 +60,9 @@ void CMovieRangeInfo::save(SimpleFile *file, int indent) { void CMovieRangeInfo::load(SimpleFile *file) { int val = file->readNumber(); if (!val) { - _movieName = file->readString(); + _fieldC = file->readNumber(); + _field10 = file->readNumber(); + _frameNumber = file->readNumber(); _endFrame = file->readNumber(); _startFrame = file->readNumber(); _events.load(file); @@ -94,7 +100,7 @@ void CMovieRangeInfo::process(CGameObject *owner) { } } - owner->checkPlayMovie(_movieName, flags); + owner->checkPlayMovie(_fieldC, _field10, _frameNumber, flags); for (CMovieEventList::iterator i = _events.begin(); i != _events.end(); ++i) { CMovieEvent *movieEvent = *i; diff --git a/engines/titanic/support/movie_range_info.h b/engines/titanic/support/movie_range_info.h index 2776ac2851..be04975cbf 100644 --- a/engines/titanic/support/movie_range_info.h +++ b/engines/titanic/support/movie_range_info.h @@ -34,7 +34,9 @@ class CGameObject; class CMovieRangeInfo : public ListItem { public: - CString _movieName; + int _fieldC; + int _field10; + int _frameNumber; uint _startFrame; uint _endFrame; CMovieEventList _events; diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp index c1af869e1e..9293b03f02 100644 --- a/engines/titanic/support/video_surface.cpp +++ b/engines/titanic/support/video_surface.cpp @@ -402,9 +402,9 @@ void OSVideoSurface::playMovie(uint startFrame, uint endFrame, int v3, bool v4) } } -void OSVideoSurface::proc35(const CString &name, int flags, CGameObject *owner) { +void OSVideoSurface::proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner) { if (loadIfReady() && _movie) { - _movie->proc12(name, flags, owner); + _movie->proc12(v1, v2, frameNumber, flags, owner); } } @@ -426,6 +426,10 @@ void OSVideoSurface::proc39(int v1, int v2) { warning("OSVideoSurface::proc39"); } +const Common::List<CMovieRangeInfo *> OSVideoSurface::getMovieRangeInfo() const { + return _movie ? _movie->getMovieRangeInfo() : Common::List<CMovieRangeInfo *>(); +} + bool OSVideoSurface::loadIfReady() { _videoSurfaceNum = _videoSurfaceCounter; diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h index 2b66b269e7..e5d904f6d6 100644 --- a/engines/titanic/support/video_surface.h +++ b/engines/titanic/support/video_surface.h @@ -28,6 +28,7 @@ #include "titanic/support/font.h" #include "titanic/support/direct_draw.h" #include "titanic/support/movie.h" +#include "titanic/support/movie_range_info.h" #include "titanic/support/rect.h" #include "titanic/core/list.h" #include "titanic/core/resource_key.h" @@ -166,7 +167,7 @@ public: */ virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4) = 0; - virtual void proc35(const CString &name, int flags, CGameObject *owner) = 0; + virtual void proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner) = 0; /** * Stops any movie currently attached to the surface @@ -183,6 +184,11 @@ public: virtual void proc39(int v1, int v2) = 0; /** + * Return any movie range info associated with the surface's movie + */ + virtual const Common::List<CMovieRangeInfo *> getMovieRangeInfo() const = 0; + + /** * Loads the surface's resource if there's one pending */ virtual bool loadIfReady() = 0; @@ -335,7 +341,7 @@ public: */ virtual void playMovie(uint startFrame, uint endFrame, int v3, bool v4); - virtual void proc35(const CString &name, int flags, CGameObject *owner); + virtual void proc35(int v1, int v2, int frameNumber, int flags, CGameObject *owner); /** * Stops any movie currently attached to the surface @@ -352,6 +358,11 @@ public: virtual void proc39(int v1, int v2); /** + * Return any movie range info associated with the surface's movie + */ + virtual const Common::List<CMovieRangeInfo *> getMovieRangeInfo() const; + + /** * Loads the surface's resource if there's one pending */ virtual bool loadIfReady(); |