[Scummvm-cvs-logs] SF.net SVN: scummvm:[49377] scummvm/trunk/engines/mohawk

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Tue Jun 1 19:01:23 CEST 2010


Revision: 49377
          http://scummvm.svn.sourceforge.net/scummvm/?rev=49377&view=rev
Author:   mthreepwood
Date:     2010-06-01 17:01:22 +0000 (Tue, 01 Jun 2010)

Log Message:
-----------
Fix videos in Riven activated from a different card from which they are played; minor cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/riven.cpp
    scummvm/trunk/engines/mohawk/video.cpp
    scummvm/trunk/engines/mohawk/video.h

Modified: scummvm/trunk/engines/mohawk/riven.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/riven.cpp	2010-06-01 15:48:17 UTC (rev 49376)
+++ scummvm/trunk/engines/mohawk/riven.cpp	2010-06-01 17:01:22 UTC (rev 49377)
@@ -233,6 +233,7 @@
 
 	// 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 @@
 	_gfx->clearWaterEffects();
 	_gfx->_activatedPLSTs.clear();
 	_video->stopVideos();
-	_video->_mlstRecords.clear();
 	_gfx->drawPLST(1);
 	_activatedSLST = false;
 

Modified: scummvm/trunk/engines/mohawk/video.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/video.cpp	2010-06-01 15:48:17 UTC (rev 49376)
+++ scummvm/trunk/engines/mohawk/video.cpp	2010-06-01 17:01:22 UTC (rev 49377)
@@ -35,7 +35,6 @@
 }
 
 VideoManager::~VideoManager() {
-	_mlstRecords.clear();
 	stopVideos();
 }
 
@@ -125,7 +124,7 @@
 	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 @@
 				delete _videoStreams[i].video;
 				_videoStreams[i].video = 0;
 				_videoStreams[i].id = 0;
-				_videoStreams[i].filename = "";
+				_videoStreams[i].filename.clear();
 				continue;
 			}
 		}
@@ -245,7 +244,15 @@
 		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 @@
 	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) {

Modified: scummvm/trunk/engines/mohawk/video.h
===================================================================
--- scummvm/trunk/engines/mohawk/video.h	2010-06-01 15:48:17 UTC (rev 49376)
+++ scummvm/trunk/engines/mohawk/video.h	2010-06-01 17:01:22 UTC (rev 49377)
@@ -82,6 +82,7 @@
 
 	// 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 @@
 	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 @@
 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


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list