diff options
author | Paul Gilbert | 2016-06-29 22:05:06 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:26:02 -0400 |
commit | 8ea5d533294193a4d220316152cec59580bbf10c (patch) | |
tree | 82e567f58e70c7fce694bc18d8ce04969545df5b /engines/titanic/core | |
parent | 5ccc0a66da38d23520234e7060efaf966d3345b9 (diff) | |
download | scummvm-rg350-8ea5d533294193a4d220316152cec59580bbf10c.tar.gz scummvm-rg350-8ea5d533294193a4d220316152cec59580bbf10c.tar.bz2 scummvm-rg350-8ea5d533294193a4d220316152cec59580bbf10c.zip |
TITANIC: Added CGameObject saving, and movie range info methods
Diffstat (limited to 'engines/titanic/core')
-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 |
3 files changed, 53 insertions, 11 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 |