aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic/support
diff options
context:
space:
mode:
Diffstat (limited to 'engines/titanic/support')
-rw-r--r--engines/titanic/support/movie.cpp31
-rw-r--r--engines/titanic/support/movie.h26
-rw-r--r--engines/titanic/support/movie_manager.cpp35
-rw-r--r--engines/titanic/support/movie_manager.h53
-rw-r--r--engines/titanic/support/video_surface.cpp8
-rw-r--r--engines/titanic/support/video_surface.h10
6 files changed, 155 insertions, 8 deletions
diff --git a/engines/titanic/support/movie.cpp b/engines/titanic/support/movie.cpp
index 9b6fd01710..869a3518f8 100644
--- a/engines/titanic/support/movie.cpp
+++ b/engines/titanic/support/movie.cpp
@@ -26,16 +26,35 @@
namespace Titanic {
+CMovieList *CMovie::_activeMovies;
+
CMovie::CMovie() : ListItem(), _state(MOVIE_STOPPED), _field10(0),
_field14(0) {
}
CMovie::~CMovie() {
- g_vm->_activeMovies.remove(this);
+ removeFromActiveMovies();
+}
+
+void CMovie::init() {
+ _activeMovies = new CMovieList();
+}
+
+void CMovie::deinit() {
+ delete _activeMovies;
+}
+
+void CMovie::addToActiveMovies() {
+ if (!isActive())
+ _activeMovies->push_back(this);
+}
+
+void CMovie::removeFromActiveMovies() {
+ _activeMovies->remove(this);
}
bool CMovie::isActive() const {
- return g_vm->_activeMovies.contains(this);
+ return _activeMovies->contains(this);
}
bool CMovie::get10() {
@@ -67,7 +86,6 @@ OSMovie::OSMovie(Common::SeekableReadStream *stream, CVideoSurface *surface) :
}
OSMovie::~OSMovie() {
- g_vm->_activeMovies.remove(this);
delete _video;
}
@@ -83,7 +101,7 @@ void OSMovie::play(uint startFrame, uint endFrame, int v3, bool v4) {
_video->seekToFrame(startFrame);
_endFrame = endFrame;
- g_vm->_activeMovies.push_back(this);
+ addToActiveMovies();
_state = MOVIE_NONE;
}
@@ -126,7 +144,10 @@ const Common::List<CMovieRangeInfo *> OSMovie::getMovieRangeInfo() const {
return Common::List<CMovieRangeInfo *>();
}
-void OSMovie::proc18() {
+void OSMovie::proc18(int v) {
+// if (_aviSurface)
+// _aviSurface->_field3C = 0;
+
warning("TODO: OSMovie::proc18");
}
diff --git a/engines/titanic/support/movie.h b/engines/titanic/support/movie.h
index 2d7bdc9c6d..fbbfebc845 100644
--- a/engines/titanic/support/movie.h
+++ b/engines/titanic/support/movie.h
@@ -47,9 +47,31 @@ class CMovie : public ListItem {
protected:
MovieState _state;
int _field10;
+protected:
+ /**
+ * Adds the movie to the active movies list
+ */
+ void addToActiveMovies();
+
+ /**
+ * Removes the movie from the active movies list
+ */
+ void removeFromActiveMovies();
public:
int _field14;
public:
+ static CMovieList *_activeMovies;
+
+ /**
+ * Initializes statics
+ */
+ static void init();
+
+ /**
+ * Deinitializes statics
+ */
+ static void deinit();
+public:
CMovie();
virtual ~CMovie();
@@ -90,7 +112,7 @@ public:
*/
virtual const Common::List<CMovieRangeInfo *> getMovieRangeInfo() const = 0;
- virtual void proc18() = 0;
+ virtual void proc18(int v) = 0;
/**
* Get the current movie frame
@@ -167,7 +189,7 @@ public:
*/
virtual const Common::List<CMovieRangeInfo *> getMovieRangeInfo() const;
- virtual void proc18();
+ virtual void proc18(int v);
/**
* Get the current movie frame
diff --git a/engines/titanic/support/movie_manager.cpp b/engines/titanic/support/movie_manager.cpp
new file mode 100644
index 0000000000..e3330f0080
--- /dev/null
+++ b/engines/titanic/support/movie_manager.cpp
@@ -0,0 +1,35 @@
+/* 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/support/movie_manager.h"
+#include "titanic/support/movie.h"
+#include "titanic/support/video_surface.h"
+
+namespace Titanic {
+
+CMovie *CMovieManager::createMovie(const CResourceKey &key, CVideoSurface *surface) {
+ CMovie *movie = new OSMovie(key, surface);
+ movie->proc18(_field4);
+ return movie;
+}
+
+} // End of namespace Titanic
diff --git a/engines/titanic/support/movie_manager.h b/engines/titanic/support/movie_manager.h
new file mode 100644
index 0000000000..91ea75e49b
--- /dev/null
+++ b/engines/titanic/support/movie_manager.h
@@ -0,0 +1,53 @@
+/* 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_MANAGER_H
+#define TITANIC_MOVIE_MANAGER_H
+
+#include "titanic/core/list.h"
+#include "titanic/core/resource_key.h"
+
+namespace Titanic {
+
+class CMovie;
+class CVideoSurface;
+
+class CMovieManagerBase {
+public:
+ virtual ~CMovieManagerBase() {}
+
+ virtual CMovie *createMovie(const CResourceKey &key, CVideoSurface *surface) = 0;
+};
+
+class CMovieManager : public CMovieManagerBase {
+private:
+ int _field4;
+public:
+ CMovieManager() : CMovieManagerBase(), _field4(0) {}
+ virtual ~CMovieManager() {}
+
+ virtual CMovie *createMovie(const CResourceKey &key, CVideoSurface *surface);
+};
+
+} // End of namespace Titanic
+
+#endif /* TITANIC_MOVIE_MANAGER_H */
diff --git a/engines/titanic/support/video_surface.cpp b/engines/titanic/support/video_surface.cpp
index 85a1aa1c58..0335e7d9b1 100644
--- a/engines/titanic/support/video_surface.cpp
+++ b/engines/titanic/support/video_surface.cpp
@@ -23,6 +23,7 @@
#include "titanic/support/video_surface.h"
#include "titanic/support/image_decoders.h"
#include "titanic/support/screen_manager.h"
+#include "titanic/titanic.h"
namespace Titanic {
@@ -234,6 +235,11 @@ void OSVideoSurface::loadJPEG(const CResourceKey &key) {
_resourceKey = key;
}
+void OSVideoSurface::loadTarga(const CString &name) {
+ CResourceKey key(name);
+ loadTarga(key);
+}
+
void OSVideoSurface::loadMovie(const CResourceKey &key, bool destroyFlag) {
// Delete any prior movie
if (_movie) {
@@ -242,7 +248,7 @@ void OSVideoSurface::loadMovie(const CResourceKey &key, bool destroyFlag) {
}
// Create the new movie and load the first frame to the video surface
- _movie = new OSMovie(key, this);
+ _movie = g_vm->_movieManager.createMovie(key, this);
_movie->setFrame(0);
// If flagged to destroy, then immediately destroy movie instance
diff --git a/engines/titanic/support/video_surface.h b/engines/titanic/support/video_surface.h
index 45c6182fe6..37afccf9e1 100644
--- a/engines/titanic/support/video_surface.h
+++ b/engines/titanic/support/video_surface.h
@@ -94,6 +94,11 @@ public:
virtual void loadJPEG(const CResourceKey &key) = 0;
/**
+ * Loads a Targa image file specified by the given name
+ */
+ virtual void loadTarga(const CString &name) = 0;
+
+ /**
* Loads a movie file specified by the resource key.
* @param key Resource key for movie to load
* @param destroyFlag Immediately destroy movie after decoding first frame
@@ -300,6 +305,11 @@ public:
virtual void loadJPEG(const CResourceKey &key);
/**
+ * Loads a Targa image file specified by the given name
+ */
+ virtual void loadTarga(const CString &name);
+
+ /**
* Loads a movie file specified by the resource key.
* @param key Resource key for movie to load
* @param destroyFlag Immediately destroy movie after decoding first frame