aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/core/game_object.cpp7
-rw-r--r--engines/titanic/core/game_object.h12
-rw-r--r--engines/titanic/core/movie_clip.cpp28
-rw-r--r--engines/titanic/core/movie_clip.h16
4 files changed, 62 insertions, 1 deletions
diff --git a/engines/titanic/core/game_object.cpp b/engines/titanic/core/game_object.cpp
index 6d9f60d306..5e601f97b3 100644
--- a/engines/titanic/core/game_object.cpp
+++ b/engines/titanic/core/game_object.cpp
@@ -730,4 +730,11 @@ void CGameObject::dragMove(const Point &pt) {
setPosition(Point(pt.x - _bounds.width() / 2, pt.y - _bounds.height() / 2));
}
+bool CGameObject::clipExistsByStart(const CString &name, int startFrame) const {
+ return _clipList1.existsByStart(name, startFrame);
+}
+
+bool CGameObject::clipExistsByEnd(const CString &name, int endFrame) const {
+ return _clipList1.existsByEnd(name, endFrame);
+}
} // End of namespace Titanic
diff --git a/engines/titanic/core/game_object.h b/engines/titanic/core/game_object.h
index 847d6cd484..5264d0c8e6 100644
--- a/engines/titanic/core/game_object.h
+++ b/engines/titanic/core/game_object.h
@@ -326,6 +326,18 @@ public:
* Marks the area occupied by the object as dirty, requiring re-rendering
*/
void makeDirty();
+
+ /**
+ * Returns true if a clip exists in the list with a given name
+ * and starting frame number
+ */
+ bool clipExistsByStart(const CString &name, int startFrame = 0) const;
+
+ /**
+ * Returns true if a clip exists in the list with a given name
+ * and ending frame number
+ */
+ bool clipExistsByEnd(const CString &name, int endFrame = 0) const;
};
} // End of namespace Titanic
diff --git a/engines/titanic/core/movie_clip.cpp b/engines/titanic/core/movie_clip.cpp
index fdf329ac13..a0a6386df8 100644
--- a/engines/titanic/core/movie_clip.cpp
+++ b/engines/titanic/core/movie_clip.cpp
@@ -24,7 +24,13 @@
namespace Titanic {
-CMovieClip::CMovieClip() {
+CMovieClip::CMovieClip(): ListItem(), _startFrame(0), _endFrame(0),
+ _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) {
+}
+
+CMovieClip::CMovieClip(const CString &name, int startFrame, int endFrame):
+ ListItem(), _name(name), _startFrame(startFrame), _endFrame(endFrame),
+ _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0) {
}
void CMovieClip::save(SimpleFile *file, int indent) const {
@@ -76,4 +82,24 @@ CMovieClip *CMovieClipList::findByName(const Common::String &name) const {
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
index 7eccc47bea..9ee88fd7a7 100644
--- a/engines/titanic/core/movie_clip.h
+++ b/engines/titanic/core/movie_clip.h
@@ -46,6 +46,7 @@ public:
public:
CLASSDEF
CMovieClip();
+ CMovieClip(const CString &name, int startFrame, int endFrame);
/**
* Save the data for the class to file
@@ -63,7 +64,22 @@ public:
*/
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