aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/mohawk/riven.cpp2
-rw-r--r--engines/mohawk/video.cpp17
-rw-r--r--engines/mohawk/video.h8
3 files changed, 19 insertions, 8 deletions
diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index 744b3f2d2c..f3e4703c11 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -233,6 +233,7 @@ void MohawkEngine_Riven::changeToStack(uint16 n) {
// Stop any videos playing
_video->stopVideos();
+ _video->clearMLST();
// Clear the old stack files out
for (uint32 i = 0; i < _mhk.size(); i++)
@@ -310,7 +311,6 @@ void MohawkEngine_Riven::refreshCard() {
_gfx->clearWaterEffects();
_gfx->_activatedPLSTs.clear();
_video->stopVideos();
- _video->_mlstRecords.clear();
_gfx->drawPLST(1);
_activatedSLST = false;
diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index deeb5daabf..ed1fc6b2c6 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -35,7 +35,6 @@ VideoManager::VideoManager(MohawkEngine* vm) : _vm(vm) {
}
VideoManager::~VideoManager() {
- _mlstRecords.clear();
stopVideos();
}
@@ -125,7 +124,7 @@ void VideoManager::waitUntilMovieEnds(VideoHandle videoHandle) {
delete _videoStreams[videoHandle].video;
_videoStreams[videoHandle].video = 0;
_videoStreams[videoHandle].id = 0;
- _videoStreams[videoHandle].filename = "";
+ _videoStreams[videoHandle].filename.clear();
}
void VideoManager::playBackgroundMovie(Common::String filename, int16 x, int16 y, bool loop) {
@@ -158,7 +157,7 @@ bool VideoManager::updateBackgroundMovies() {
delete _videoStreams[i].video;
_videoStreams[i].video = 0;
_videoStreams[i].id = 0;
- _videoStreams[i].filename = "";
+ _videoStreams[i].filename.clear();
continue;
}
}
@@ -245,7 +244,15 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) {
if (mlstRecord.u1 != 1)
warning("mlstRecord.u1 not 1");
+ // We've found a match, add it
if (mlstRecord.index == mlstId) {
+ // Make sure we don't have a duplicate
+ for (uint32 j = 0; j < _mlstRecords.size(); j++)
+ if (_mlstRecords[j].index == mlstId) {
+ _mlstRecords.remove_at(j);
+ break;
+ }
+
_mlstRecords.push_back(mlstRecord);
break;
}
@@ -254,6 +261,10 @@ void VideoManager::activateMLST(uint16 mlstId, uint16 card) {
delete mlstStream;
}
+void VideoManager::clearMLST() {
+ _mlstRecords.clear();
+}
+
void VideoManager::playMovie(uint16 id) {
for (uint16 i = 0; i < _mlstRecords.size(); i++)
if (_mlstRecords[i].code == id) {
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 5620a5412a..6aa553e26b 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -82,6 +82,7 @@ public:
// Riven-related functions
void activateMLST(uint16 mlstId, uint16 card);
+ void clearMLST();
void enableMovie(uint16 id);
void disableMovie(uint16 id);
void disableAllMovies();
@@ -89,9 +90,6 @@ public:
void stopMovie(uint16 id);
void playMovieBlocking(uint16 id);
- // Riven-related variables
- Common::Array<MLSTRecord> _mlstRecords;
-
// Handle functions
VideoHandle findVideoHandle(uint16 id);
int32 getCurFrame(const VideoHandle &handle);
@@ -100,13 +98,15 @@ public:
private:
MohawkEngine *_vm;
- void waitUntilMovieEnds(VideoHandle videoHandle);
+ // Riven-related variables
+ Common::Array<MLSTRecord> _mlstRecords;
// Keep tabs on any videos playing
Common::Array<VideoEntry> _videoStreams;
VideoHandle createVideoHandle(uint16 id, uint16 x, uint16 y, bool loop);
VideoHandle createVideoHandle(Common::String filename, uint16 x, uint16 y, bool loop);
+ void waitUntilMovieEnds(VideoHandle videoHandle);
};
} // End of namespace Mohawk