aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/game_manager.cpp9
-rw-r--r--engines/titanic/game_state.cpp13
-rw-r--r--engines/titanic/module.mk1
-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
-rw-r--r--engines/titanic/titanic.cpp3
-rw-r--r--engines/titanic/titanic.h4
11 files changed, 167 insertions, 26 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp
index c5f0f111f9..7e8531fe68 100644
--- a/engines/titanic/game_manager.cpp
+++ b/engines/titanic/game_manager.cpp
@@ -128,7 +128,7 @@ void CGameManager::roomTransition(CRoomItem *oldRoom, CRoomItem *newRoom) {
CString filename = movieKey.exists();
if (g_vm->_filesManager->fileExists(filename)) {
_movieSurface->freeSurface();
- _movie = new OSMovie(filename, _movieSurface);
+ _movie = g_vm->_movieManager.createMovie(filename, _movieSurface);
}
}
@@ -194,8 +194,8 @@ void CGameManager::update() {
void CGameManager::updateMovies() {
// TODO: Make this more like the original, if I can figuring out
// what's it doing with temporary lists and the OSMovie methods
- for (CMovieList::iterator i = g_vm->_activeMovies.begin();
- i != g_vm->_activeMovies.end(); ) {
+ for (CMovieList::iterator i = CMovie::_activeMovies->begin();
+ i != CMovie::_activeMovies->end(); ) {
OSMovie *movie = static_cast<OSMovie *>(*i);
assert(movie && movie->_gameObject);
@@ -205,7 +205,8 @@ void CGameManager::updateMovies() {
CMovieEndMsg endMsg;
endMsg.execute(movie->_gameObject);
- i = g_vm->_activeMovies.erase(i);
+ i = CMovie::_activeMovies->erase(i);
+ delete movie;
continue;
}
diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp
index d129767e10..6c81bc8699 100644
--- a/engines/titanic/game_state.cpp
+++ b/engines/titanic/game_state.cpp
@@ -28,17 +28,8 @@
namespace Titanic {
bool CGameStateMovieList::clear() {
- for (iterator i = begin(); i != end(); ) {
- CMovieListItem *listItem = *i;
- ++i;
-
- if (!g_vm->_activeMovies.contains(listItem->_item)) {
- remove(listItem);
- delete listItem;
- }
- }
-
- return size() > 0;
+ // TODO
+ return false;
}
/*------------------------------------------------------------------------*/
diff --git a/engines/titanic/module.mk b/engines/titanic/module.mk
index f1392f165b..71db594f5e 100644
--- a/engines/titanic/module.mk
+++ b/engines/titanic/module.mk
@@ -448,6 +448,7 @@ MODULE_OBJS := \
support/movie_clip.o \
support/movie_event.o \
support/movie_range_info.o \
+ support/movie_manager.o \
support/credit_text.o \
support/proximity.o \
support/rect.o \
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
diff --git a/engines/titanic/titanic.cpp b/engines/titanic/titanic.cpp
index ab734d9eeb..7b91a1a630 100644
--- a/engines/titanic/titanic.cpp
+++ b/engines/titanic/titanic.cpp
@@ -67,7 +67,6 @@ TitanicEngine::~TitanicEngine() {
delete _screenManager;
delete _filesManager;
CSaveableObject::freeClassList();
- _activeMovies.clear();
}
void TitanicEngine::initializePath(const Common::FSNode &gamePath) {
@@ -87,6 +86,7 @@ void TitanicEngine::initialize() {
CGameObject::init();
CGetLiftEye2::init();
CHose::init();
+ CMovie::init();
CParrotLobbyObject::init();
CSGTNavigation::init();
CSGTStateRoom::init();
@@ -112,6 +112,7 @@ void TitanicEngine::deinitialize() {
CEnterExitFirstClassState::deinit();
CGetLiftEye2::deinit();
CHose::deinit();
+ CMovie::deinit();
CSGTNavigation::deinit();
CSGTStateRoom::deinit();
CExitPellerator::deinit();
diff --git a/engines/titanic/titanic.h b/engines/titanic/titanic.h
index 9acf78cbf2..dd289714c9 100644
--- a/engines/titanic/titanic.h
+++ b/engines/titanic/titanic.h
@@ -36,7 +36,7 @@
#include "titanic/support/files_manager.h"
#include "titanic/main_game_window.h"
#include "titanic/support/exe_resources.h"
-#include "titanic/support/movie.h"
+#include "titanic/support/movie_manager.h"
#include "titanic/support/screen_manager.h"
#include "titanic/support/string.h"
#include "titanic/true_talk/tt_script_base.h"
@@ -106,6 +106,7 @@ public:
Debugger *_debugger;
Events *_events;
CFilesManager *_filesManager;
+ CMovieManager _movieManager;
Graphics::Screen *_screen;
OSScreenManager *_screenManager;
CMainGameWindow *_window;
@@ -114,7 +115,6 @@ public:
TTscriptBase *_script;
CTrueTalkManager *_trueTalkManager;
CExeResources _exeResources;
- CMovieList _activeMovies;
StringArray _itemNames;
StringArray _itemDescriptions;
CString _itemObjects[TOTAL_ITEMS];