[Scummvm-cvs-logs] scummvm master -> 273ba73d5fae0dd0d3b3f7c5f15f03d02c0af1b4

clone2727 clone2727 at gmail.com
Mon Mar 21 23:35:56 CET 2011


This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
94c27e4657 VIDEO: Add a getDuration() function to SeekableVideoDecoder
cdc4c3bfa8 MOHAWK: Add a getDuration() function to the VideoManager
6b80d25f6e MOHAWK: Implement the prison viewer
273ba73d5f MOHAWK: Minor cleanup and consistency fixes


Commit: 94c27e4657279aaae8c98aee58477265625b7a27
    https://github.com/scummvm/scummvm/commit/94c27e4657279aaae8c98aee58477265625b7a27
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-21T15:27:10-07:00

Commit Message:
VIDEO: Add a getDuration() function to SeekableVideoDecoder

This function returns the total duration of the video

Changed paths:
    video/qt_decoder.h
    video/video_decoder.h



diff --git a/video/qt_decoder.h b/video/qt_decoder.h
index e876097..f11689e 100644
--- a/video/qt_decoder.h
+++ b/video/qt_decoder.h
@@ -122,6 +122,7 @@ public:
 	// SeekableVideoDecoder API
 	void seekToFrame(uint32 frame);
 	void seekToTime(Audio::Timestamp time);
+	uint32 getDuration() const { return _duration * 1000 / _timeScale; }
 
 private:
 	// This is the file handle from which data is read from. It can be the actual file handle or a decompressed stream.
diff --git a/video/video_decoder.h b/video/video_decoder.h
index 97cd133..348b5dc 100644
--- a/video/video_decoder.h
+++ b/video/video_decoder.h
@@ -266,6 +266,11 @@ public:
 	 * Implementation of RewindableVideoDecoder::rewind().
 	 */
 	virtual void rewind() { seekToTime(0); }
+
+	/**
+	 * Get the total duration of the video (in ms).
+	 */
+	virtual uint32 getDuration() const = 0;
 };
 
 } // End of namespace Video


Commit: cdc4c3bfa88a3d94d3c75c9766e97fd87053241f
    https://github.com/scummvm/scummvm/commit/cdc4c3bfa88a3d94d3c75c9766e97fd87053241f
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-21T15:27:49-07:00

Commit Message:
MOHAWK: Add a getDuration() function to the VideoManager

Changed paths:
    engines/mohawk/video.cpp
    engines/mohawk/video.h



diff --git a/engines/mohawk/video.cpp b/engines/mohawk/video.cpp
index 9bf2020..f481b5c 100644
--- a/engines/mohawk/video.cpp
+++ b/engines/mohawk/video.cpp
@@ -490,6 +490,11 @@ uint32 VideoManager::getElapsedTime(VideoHandle handle) {
 	return _videoStreams[handle]->getElapsedTime();
 }
 
+uint32 VideoManager::getDuration(VideoHandle handle) {
+	assert(handle != NULL_VID_HANDLE);
+	return _videoStreams[handle]->getDuration();
+}
+
 bool VideoManager::endOfVideo(VideoHandle handle) {
 	assert(handle != NULL_VID_HANDLE);
 	return _videoStreams[handle].endOfVideo();
diff --git a/engines/mohawk/video.h b/engines/mohawk/video.h
index 6b9cfa2..e65629a 100644
--- a/engines/mohawk/video.h
+++ b/engines/mohawk/video.h
@@ -104,6 +104,7 @@ public:
 	int32 getCurFrame(VideoHandle handle);
 	uint32 getFrameCount(VideoHandle handle);
 	uint32 getElapsedTime(VideoHandle handle);
+	uint32 getDuration(VideoHandle videoHandle);
 	bool endOfVideo(VideoHandle handle);
 	void setVideoBounds(VideoHandle handle, Audio::Timestamp start, Audio::Timestamp end);
 	void seekToTime(VideoHandle handle, Audio::Timestamp time);


Commit: 6b80d25f6e1eca3cca15a58aa8016c5c3fc5ee78
    https://github.com/scummvm/scummvm/commit/6b80d25f6e1eca3cca15a58aa8016c5c3fc5ee78
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-21T15:28:02-07:00

Commit Message:
MOHAWK: Implement the prison viewer

Changed paths:
    engines/mohawk/riven_external.cpp



diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index e393324..db4428d 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -1446,12 +1446,105 @@ void RivenExternal::xglview_villageoff(uint16 argc, uint16 *argv) {
 	_vm->_gfx->updateScreen();
 }
 
+static void catherineViewerIdleTimer(MohawkEngine_Riven *vm) {
+	uint32 *cathState = vm->getVar("gcathstate");
+	uint16 movie;
+
+	// Choose a new movie
+	if (*cathState == 1) {
+		static const int movieList[] = { 9, 10, 19, 19, 21, 21 };
+		movie = movieList[vm->_rnd->getRandomNumber(5)];
+	} else if (*cathState == 2) {
+		static const int movieList[] = { 18, 20, 22 };
+		movie = movieList[vm->_rnd->getRandomNumber(2)];
+	} else {
+		static const int movieList[] = { 11, 11, 12, 17, 17, 17, 17, 23 };
+		movie = movieList[vm->_rnd->getRandomNumber(7)];
+	}
+
+	// Update Catherine's state
+	if (movie == 10 || movie == 17 || movie == 18 || movie == 20)
+		*cathState = 1;
+	else if (movie == 19 || movie == 21 || movie == 23)
+		*cathState = 2;
+	else
+		*cathState = 3;
+
+	// Begin playing the new movie
+	vm->_video->activateMLST(movie, vm->getCurCard());
+	VideoHandle videoHandle = vm->_video->playMovieRiven(30);
+
+	// Reset the timer
+	vm->installTimer(&catherineViewerIdleTimer, vm->_video->getDuration(videoHandle) + vm->_rnd->getRandomNumber(60) * 1000);
+}
+
 void RivenExternal::xglview_prisonon(uint16 argc, uint16 *argv) {
-	// TODO: Activate random background Catherine videos
+	// Activate random background Catherine videos
+
+	// Turn on the left viewer to 'prison mode'
+	*_vm->getVar("glview") = 1;
+
+	// Get basic starting states
+	uint16 cathMovie = _vm->_rnd->getRandomNumberRng(8, 23);
+	uint16 turnOnMovie = 4;
+	uint32 *cathState = _vm->getVar("gcathstate");
+
+	// Adjust the turn on movie
+	if (cathMovie == 14)
+		turnOnMovie = 6;
+	else if (cathMovie == 15)
+		turnOnMovie = 7;
+
+	// Adjust Catherine's state
+	if (cathMovie == 9 || cathMovie == 11 || cathMovie == 12 || cathMovie == 22)
+		*cathState = 3;
+	else if (cathMovie == 19 || cathMovie == 21 || cathMovie == 23 || cathMovie == 14)
+		*cathState = 2;
+	else
+		*cathState = 1;
+
+	// Turn on the viewer
+	_vm->_cursor->hideCursor();
+	_vm->_video->playMovieBlockingRiven(turnOnMovie);
+	_vm->_cursor->showCursor();
+
+	uint32 timeUntilNextMovie;
+
+	// Begin playing a movie immediately if Catherine is already in the viewer
+	if (cathMovie == 8 || (cathMovie >= 13 && cathMovie <= 16)) {
+		_vm->_video->activateMLST(cathMovie, _vm->getCurCard());
+		VideoHandle videoHandle = _vm->_video->playMovieRiven(30);
+
+		timeUntilNextMovie = _vm->_video->getDuration(videoHandle) + _vm->_rnd->getRandomNumber(60) * 1000;
+	} else {
+		// Otherwise, just redraw the imager
+		timeUntilNextMovie = _vm->_rnd->getRandomNumberRng(10, 20) * 1000;
+		_vm->_gfx->drawPLST(8);
+		_vm->_gfx->updateScreen();
+	}
+
+	// Create the timer for the next video
+	_vm->installTimer(&catherineViewerIdleTimer, timeUntilNextMovie);
 }
 
 void RivenExternal::xglview_prisonoff(uint16 argc, uint16 *argv) {
-	// TODO: Deactivate random background Catherine videos
+	// Deactivate random background Catherine videos
+
+	// Update the viewer state (now off)
+	*_vm->getVar("glview") = 0;
+
+	// Remove the timer we set in xglview_prisonon()
+	_vm->removeTimer();
+
+	// Play the 'turn off' movie after stopping any videos still playing
+	_vm->_video->stopVideos();
+	_vm->_cursor->hideCursor();
+	_vm->_video->playMovieBlockingRiven(5);
+	_vm->_cursor->showCursor();
+
+	// Redraw the viewer
+	_vm->_gfx->drawPLST(1);
+	_vm->_gfx->updateScreen();
 }
 
 // ------------------------------------------------------------------------------------


Commit: 273ba73d5fae0dd0d3b3f7c5f15f03d02c0af1b4
    https://github.com/scummvm/scummvm/commit/273ba73d5fae0dd0d3b3f7c5f15f03d02c0af1b4
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-03-21T15:33:48-07:00

Commit Message:
MOHAWK: Minor cleanup and consistency fixes

Changed paths:
    engines/mohawk/riven.cpp
    engines/mohawk/riven_external.cpp



diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp
index e5d4480..1d47d45 100644
--- a/engines/mohawk/riven.cpp
+++ b/engines/mohawk/riven.cpp
@@ -813,11 +813,23 @@ static void catherineIdleTimer(MohawkEngine_Riven *vm) {
 }
 
 void MohawkEngine_Riven::installCardTimer() {
-	// TODO: Handle sunners hardcoded videos
-
-	if (getCurStack() == pspit && getCurCardRMAP() == 0x3a85) {
+	switch (getCurCardRMAP()) {
+	case 0x3a85: // Top of elevator on prison island
 		// Handle Catherine hardcoded videos
 		installTimer(&catherineIdleTimer, _rnd->getRandomNumberRng(1, 33) * 1000);
+		break;
+	case 0x77d6: // Sunners, top of stairs
+		// TODO: Background Sunner videos
+		break;
+	case 0x79bd: // Sunners, middle of stairs
+		// TODO: Background Sunner videos
+		break;
+	case 0x7beb: // Sunners, bottom of stairs
+		// TODO: Background Sunner videos
+		break;
+	case 0xb6ca: // Sunners, shoreline
+		// TODO: Background Sunner videos
+		break;
 	}
 }
 
diff --git a/engines/mohawk/riven_external.cpp b/engines/mohawk/riven_external.cpp
index db4428d..2fc0c4e 100644
--- a/engines/mohawk/riven_external.cpp
+++ b/engines/mohawk/riven_external.cpp
@@ -882,7 +882,7 @@ void RivenExternal::xbsettrap(uint16 argc, uint16 *argv) {
 	// Set the Ytram trap
 
 	// We can catch the Ytram between 10 seconds and 3 minutes from now
-	uint32 timeUntilCatch = _vm->_rnd->getRandomNumberRng(1000 * 10, 1000 * 60 * 3);
+	uint32 timeUntilCatch = _vm->_rnd->getRandomNumberRng(10, 60 * 3) * 1000;
 	*_vm->getVar("bytramtime") = timeUntilCatch + _vm->getTotalPlayTime();
 
 	// And set the timer too






More information about the Scummvm-git-logs mailing list