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

bgk at users.sourceforge.net bgk at users.sourceforge.net
Tue Jan 11 20:52:59 CET 2011


Revision: 55208
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55208&view=rev
Author:   bgk
Date:     2011-01-11 19:52:58 +0000 (Tue, 11 Jan 2011)

Log Message:
-----------
MOHAWK: Implement Myst imager videos seeking / looping

Modified Paths:
--------------
    scummvm/trunk/engines/mohawk/myst_areas.cpp
    scummvm/trunk/engines/mohawk/myst_areas.h
    scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp

Modified: scummvm/trunk/engines/mohawk/myst_areas.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.cpp	2011-01-11 19:44:55 UTC (rev 55207)
+++ scummvm/trunk/engines/mohawk/myst_areas.cpp	2011-01-11 19:52:58 UTC (rev 55208)
@@ -197,19 +197,23 @@
 	debugC(kDebugResource, "\tplayBlocking: %d", _playBlocking);
 	debugC(kDebugResource, "\tplayOnCardChange: %d", _playOnCardChange);
 	debugC(kDebugResource, "\tu3: %d", _u3);
-
-	_videoRunning = false;
 }
 
-void MystResourceType6::playMovie() {
-	if (!_videoRunning) {
-		if (_playBlocking)
+VideoHandle MystResourceType6::playMovie() {
+	// Check if the video is already running
+	VideoHandle handle = _vm->_video->findVideoHandle(_videoFile);
+
+	// If the video is not running, play it
+	if (handle == NULL_VID_HANDLE || _vm->_video->endOfVideo(handle)) {
+		if (_playBlocking) {
 			_vm->_video->playMovie(_videoFile, _left, _top);
-		else
-			_vm->_video->playBackgroundMovie(_videoFile, _left, _top, _loop);
+			handle = NULL_VID_HANDLE;
+		} else {
+			handle = _vm->_video->playBackgroundMovie(_videoFile, _left, _top, _loop);
+		}
+	}
 
-		_videoRunning = true;
-	}
+	return handle;
 }
 
 void MystResourceType6::handleCardChange() {
@@ -218,12 +222,8 @@
 }
 
 bool MystResourceType6::isPlaying() {
-	if (_videoRunning) {
-		VideoHandle handle = _vm->_video->findVideoHandle(_videoFile);
-		return handle != NULL_VID_HANDLE && !_vm->_video->endOfVideo(handle);
-	}
-
-	return false;
+	VideoHandle handle = _vm->_video->findVideoHandle(_videoFile);
+	return handle != NULL_VID_HANDLE && !_vm->_video->endOfVideo(handle);
 }
 
 MystResourceType7::MystResourceType7(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent) : MystResource(vm, rlstStream, parent) {

Modified: scummvm/trunk/engines/mohawk/myst_areas.h
===================================================================
--- scummvm/trunk/engines/mohawk/myst_areas.h	2011-01-11 19:44:55 UTC (rev 55207)
+++ scummvm/trunk/engines/mohawk/myst_areas.h	2011-01-11 19:52:58 UTC (rev 55208)
@@ -24,6 +24,7 @@
  */
 
 #include "mohawk/myst.h"
+#include "mohawk/video.h"
 
 #ifndef MYST_AREAS_H
 #define MYST_AREAS_H
@@ -104,9 +105,10 @@
 class MystResourceType6 : public MystResourceType5 {
 public:
 	MystResourceType6(MohawkEngine_Myst *vm, Common::SeekableReadStream *rlstStream, MystResource *parent);
-	void playMovie();
+	VideoHandle playMovie();
 	void handleCardChange();
 	bool isPlaying();
+	void setBlocking(bool blocking) { _playBlocking = blocking; }
 
 protected:
 	static Common::String convertMystVideoName(Common::String name);
@@ -118,9 +120,6 @@
 	uint16 _playBlocking;
 	uint16 _playOnCardChange;
 	uint16 _u3;
-
-private:
-	bool _videoRunning;
 };
 
 class MystResourceType7 : public MystResource {
@@ -177,6 +176,7 @@
 	uint16 getList2(uint16 index);
 	uint16 getList3(uint16 index);
 
+	uint16 getStepsH() { return _stepsH; }
 	uint16 getStepsV() { return _stepsV; }
 
 	Common::Point _pos;

Modified: scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp
===================================================================
--- scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2011-01-11 19:44:55 UTC (rev 55207)
+++ scummvm/trunk/engines/mohawk/myst_stacks/myst.cpp	2011-01-11 19:52:58 UTC (rev 55208)
@@ -1153,32 +1153,44 @@
 		break;
 	case 1: // Mountain
 		if (_state.imagerActive) {
-			// TODO: Play from 11180 to 16800
+			// Mountains disappearing
 			Common::String file = _vm->wrapMovieFilename("vltmntn", kMystStack);
-			_vm->_video->playBackgroundMovie(file, 159, 96, false);
+			VideoHandle mountain = _vm->_video->playBackgroundMovie(file, 159, 96, false);
+			_vm->_video->setVideoBounds(mountain, Graphics::VideoTimestamp(11180, 600), Graphics::VideoTimestamp(16800, 600));
 
 			_state.imagerActive = 0;
 		} else {
-			// TODO: Play from 0 to 11180
+			// Mountains appearing
 			Common::String file = _vm->wrapMovieFilename("vltmntn", kMystStack);
-			_vm->_video->playBackgroundMovie(file, 159, 96, false);
+			VideoHandle mountain = _vm->_video->playBackgroundMovie(file, 159, 96, false);
+			_vm->_video->setVideoBounds(mountain, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(11180, 600));
 
 			_state.imagerActive = 1;
 		}
 		break;
 	case 2: // Water
+		_imagerMovie->setBlocking(false);
+
 		if (_state.imagerActive) {
 			_vm->_sound->replaceSound(argv[1]);
 
-			// TODO: Play from 4204 to 6040
-			_imagerMovie->playMovie();
+			// Water disappearing
+			VideoHandle water = _imagerMovie->playMovie();
+			_vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(4204, 600), Graphics::VideoTimestamp(6040, 600));
+			_vm->_video->setVideoLooping(water, false);
 
 			_state.imagerActive = 0;
 		} else {
-			// TODO: Play from 0 to 1814
-			// Then play from 1814 to 4204, looping
-			_imagerMovie->playMovie();
+			// Water appearing
+			VideoHandle water = _imagerMovie->playMovie();
+			_vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(0, 600), Graphics::VideoTimestamp(1814, 600));
+			_vm->_video->waitUntilMovieEnds(water);
 
+			// Water looping
+			water = _imagerMovie->playMovie();
+			_vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(1814, 600), Graphics::VideoTimestamp(4204, 600));
+			_vm->_video->setVideoLooping(water, true);
+
 			_state.imagerActive = 1;
 		}
 		break;
@@ -2937,8 +2949,9 @@
 	_imagerRunning = false;
 
 	if (_state.imagerActive && _state.imagerSelection == 67) {
-		// TODO: play between 1814 and 4204 looping
-		_imagerMovie->playMovie();
+		VideoHandle water = _imagerMovie->playMovie();
+		_vm->_video->setVideoBounds(water, Graphics::VideoTimestamp(1814, 600), Graphics::VideoTimestamp(4204, 600));
+		_vm->_video->setVideoLooping(water, true);
 	}
 }
 


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