diff options
author | Paul Gilbert | 2016-06-29 13:08:17 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-15 19:25:50 -0400 |
commit | ce0be01e317996c0454a85dd9a24b896e13ddc8e (patch) | |
tree | d1038c4a2f3fe5085359714392d7f842aa0e5ef8 /engines/titanic/core | |
parent | 123966554abab05646f666b85a29726b02342661 (diff) | |
download | scummvm-rg350-ce0be01e317996c0454a85dd9a24b896e13ddc8e.tar.gz scummvm-rg350-ce0be01e317996c0454a85dd9a24b896e13ddc8e.tar.bz2 scummvm-rg350-ce0be01e317996c0454a85dd9a24b896e13ddc8e.zip |
TITANIC: Cleanup CGameObject list from CMovieClipList to CMovieRangeInfoList
Diffstat (limited to 'engines/titanic/core')
-rw-r--r-- | engines/titanic/core/game_object.cpp | 22 | ||||
-rw-r--r-- | engines/titanic/core/game_object.h | 14 | ||||
-rw-r--r-- | engines/titanic/core/game_object_desc_item.h | 2 | ||||
-rw-r--r-- | engines/titanic/core/link_item.h | 2 | ||||
-rw-r--r-- | engines/titanic/core/movie_clip.cpp | 112 | ||||
-rw-r--r-- | engines/titanic/core/movie_clip.h | 94 | ||||
-rw-r--r-- | engines/titanic/core/room_item.h | 2 | ||||
-rw-r--r-- | engines/titanic/core/saveable_object.cpp | 2 |
8 files changed, 24 insertions, 226 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp index 9e155908d5..2a2c6cf772 100644 --- a/engines/titanic/core/game_object.cpp +++ b/engines/titanic/core/game_object.cpp @@ -93,7 +93,7 @@ void CGameObject::load(SimpleFile *file) { switch (val) { case 7: - _clipList2.load(file); + _movieRangeInfo.load(file); _frameNumber = file->readNumber(); // Deliberate fall-through @@ -102,7 +102,7 @@ void CGameObject::load(SimpleFile *file) { // Deliberate fall-through case 5: - _clipList1.load(file); + _movieClips.load(file); // Deliberate fall-through case 4: @@ -179,8 +179,8 @@ void CGameObject::draw(CScreenManager *screenManager) { _frameNumber = -1; } - if (!_clipList2.empty()) - processClipList2(); + if (!_movieRangeInfo.empty()) + processMoveRangeInfo(); if (_bounds.intersects(getGameManager()->_bounds)) { if (_surface) { @@ -376,11 +376,11 @@ void CGameObject::playMovie(int v1, int v2) { } } -void CGameObject::processClipList2() { - for (CMovieClipList::iterator i = _clipList2.begin(); i != _clipList2.end(); ++i) +void CGameObject::processMoveRangeInfo() { + for (CMovieRangeInfoList::iterator i = _movieRangeInfo.begin(); i != _movieRangeInfo.end(); ++i) (*i)->process(this); - _clipList2.destroyContents(); + _movieRangeInfo.destroyContents(); } void CGameObject::makeDirty(const Rect &r) { @@ -499,7 +499,7 @@ void CGameObject::playMovie(uint startFrame, uint endFrame, uint flags) { void CGameObject::playClip(const CString &name, uint flags) { _frameNumber = -1; - CMovieClip *clip = _clipList1.findByName(name); + CMovieClip *clip = _movieClips.findByName(name); if (clip) playMovie(clip->_startFrame, clip->_endFrame, flags); } @@ -1064,11 +1064,11 @@ void CGameObject::performAction(int actionNum, CViewItem *view) { } bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const { - return _clipList1.existsByStart(name, startFrame); + return _movieClips.existsByStart(name, startFrame); } bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const { - return _clipList1.existsByEnd(name, endFrame); + return _movieClips.existsByEnd(name, endFrame); } void CGameObject::checkPlayMovie(const CString &name, int flags) { @@ -1208,7 +1208,7 @@ void CGameObject::movie38(int v1) { } int CGameObject::getClipDuration(const CString &name, int frameRate) const { - CMovieClip *clip = _clipList1.findByName(name); + CMovieClip *clip = _movieClips.findByName(name); return clip ? (clip->_endFrame - clip->_startFrame) * 1000 / frameRate : 0; } diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h index ade8800e5d..553367378c 100644 --- a/engines/titanic/core/game_object.h +++ b/engines/titanic/core/game_object.h @@ -25,9 +25,10 @@ #include "titanic/support/mouse_cursor.h" #include "titanic/support/credit_text.h" +#include "titanic/support/movie_range_info.h" #include "titanic/support/proximity.h" #include "titanic/support/rect.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/named_item.h" #include "titanic/pet_control/pet_section.h" #include "titanic/pet_control/pet_text.h" @@ -68,7 +69,10 @@ private: */ void loadImage(const CString &name, bool pendingFlag = true); - void processClipList2(); + /** + * Process and remove any registered movie range info + */ + void processMoveRangeInfo(); /** * Merges one rect into another, and returns true if there was @@ -84,9 +88,9 @@ protected: int _field44; int _field48; int _field4C; - CMovieClipList _clipList1; + CMovieClipList _movieClips; int _initialFrame; - CMovieClipList _clipList2; + CMovieRangeInfoList _movieRangeInfo; int _frameNumber; CPetText *_text; uint _textBorder; @@ -533,7 +537,7 @@ public: /** * Returns the clip list, if any, associated with the item */ - virtual const CMovieClipList *getClipList() const { return &_clipList1; } + virtual const CMovieClipList *getClipList() const { return &_movieClips; } /** * Allows the item to draw itself diff --git a/engines/titanic/core/game_object_desc_item.h b/engines/titanic/core/game_object_desc_item.h index 4ac5816dbc..5bfc483b44 100644 --- a/engines/titanic/core/game_object_desc_item.h +++ b/engines/titanic/core/game_object_desc_item.h @@ -23,7 +23,7 @@ #ifndef TITANIC_GAME_OBJECT_DESK_ITEM_H #define TITANIC_GAME_OBJECT_DESK_ITEM_H -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/tree_item.h" #include "titanic/core/list.h" diff --git a/engines/titanic/core/link_item.h b/engines/titanic/core/link_item.h index 9c376396f7..328d5bcc06 100644 --- a/engines/titanic/core/link_item.h +++ b/engines/titanic/core/link_item.h @@ -25,7 +25,7 @@ #include "titanic/support/mouse_cursor.h" #include "titanic/core/named_item.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" namespace Titanic { diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp deleted file mode 100644 index 9e5df67bd7..0000000000 --- a/engines/titanic/core/movie_clip.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#include "titanic/core/movie_clip.h" -#include "titanic/core/game_object.h" - -namespace Titanic { - -CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0) { -} - -CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame): - ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame) { -} - -void CMovieClip::save(SimpleFile *file, int indent) const { - file->writeNumberLine(2, indent); - file->writeQuotedLine("Clip", indent); - file->writeQuotedLine(_name, indent); - file->writeNumberLine(_startFrame, indent); - file->writeNumberLine(_endFrame, indent); - - ListItem::save(file, indent); -} - -void CMovieClip::load(SimpleFile *file) { - int val = file->readNumber(); - - switch (val) { - case 1: - // This should never be used - assert(0); - break; - - case 2: - file->readString(); - _name = file->readString(); - _startFrame = file->readNumber(); - _endFrame = file->readNumber(); - break; - - default: - break; - } - - ListItem::load(file); -} - -void CMovieClip::process(CGameObject *owner) { - int flags = 0; - if (_endFrame) - flags |= CLIPFLAG_HAS_END_FRAME; - if (_startFrame) - flags |= CLIPFLAG_HAS_START_FRAME; - - warning("TODO: CMovieClip::process"); - - owner->checkPlayMovie(_name, flags); - - -} - -CMovieClip *CMovieClipList::findByName(const Common::String &name) const { - for (const_iterator i = begin(); i != end(); ++i) { - CMovieClip *clip = *i; - if (clip->_name == name) - return clip; - } - - return nullptr; -} - -bool CMovieClipList::existsByStart(const CString &name, int startFrame) const { - for (const_iterator i = begin(); i != end(); ++i) { - CMovieClip *clip = *i; - if (clip->_startFrame == startFrame && clip->_name == name) - return true; - } - - return false; -} - -bool CMovieClipList::existsByEnd(const CString &name, int endFrame) const { - for (const_iterator i = begin(); i != end(); ++i) { - CMovieClip *clip = *i; - if (clip->_endFrame == endFrame && clip->_name == name) - return true; - } - - return false; -} - -} // End of namespace Titanic diff --git a/engines/titanic/core/movie_clip.h b/engines/titanic/core/movie_clip.h deleted file mode 100644 index 6486259c3b..0000000000 --- a/engines/titanic/core/movie_clip.h +++ /dev/null @@ -1,94 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef TITANIC_MOVIE_CLIP_H -#define TITANIC_MOVIE_CLIP_H - -#include "titanic/core/list.h" - -namespace Titanic { - -enum ClipFlag { - CLIPFLAG_HAS_END_FRAME = 1, - CLIPFLAG_4 = 4, - CLIPFLAG_HAS_START_FRAME = 8, - CLIPFLAG_PLAY = 0x10 -}; - -class CGameObject; - -/** - * Movie clip - */ -class CMovieClip : public ListItem { -private: - Common::List<void *> _items; - CString _string2; - CString _string3; -public: - CString _name; - int _startFrame; - int _endFrame; -public: - CLASSDEF - CMovieClip(); - CMovieClip(const CString &name, int startFrame, int endFrame); - - /** - * Save the data for the class to file - */ - virtual void save(SimpleFile *file, int indent) const; - - /** - * Load the data for the class from file - */ - virtual void load(SimpleFile *file); - - void process(CGameObject *owner); -}; - -/** - * Movie clip list - */ -class CMovieClipList: public List<CMovieClip> { -public: - /** - * Finds and returns a movie clip in the list by name - */ - CMovieClip *findByName(const Common::String &name) const; - - /** - * Returns true if a clip exists in the list with a given name - * and starting frame number - */ - bool existsByStart(const CString &name, int startFrame = 0) const; - - /** - * Returns true if a clip exists in the list with a given name - * and starting frame number - */ - bool existsByEnd(const CString &name, int endFrame = 0) const; -}; - -} // End of namespace Titanic - -#endif /* TITANIC_MOVIE_CLIP_H */ diff --git a/engines/titanic/core/room_item.h b/engines/titanic/core/room_item.h index f44a525b60..eb7f4c43bf 100644 --- a/engines/titanic/core/room_item.h +++ b/engines/titanic/core/room_item.h @@ -25,7 +25,7 @@ #include "titanic/support/rect.h" #include "titanic/core/list.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/named_item.h" #include "titanic/core/resource_key.h" diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp index 300d9718bd..ad98ac4dfd 100644 --- a/engines/titanic/core/saveable_object.cpp +++ b/engines/titanic/core/saveable_object.cpp @@ -70,7 +70,7 @@ #include "titanic/core/list.h" #include "titanic/core/mail_man.h" #include "titanic/core/message_target.h" -#include "titanic/core/movie_clip.h" +#include "titanic/support/movie_clip.h" #include "titanic/core/multi_drop_target.h" #include "titanic/core/node_item.h" #include "titanic/core/project_item.h" |