[Scummvm-cvs-logs] SF.net SVN: scummvm:[55443] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat Jan 22 20:28:23 CET 2011


Revision: 55443
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55443&view=rev
Author:   drmccoy
Date:     2011-01-22 19:28:23 +0000 (Sat, 22 Jan 2011)

Log Message:
-----------
GOB: Hacking in multiple live videos

Needed for Bambou. The narrator voice and the "Do you want to quit?"
voices are live videos that should continue while the live video
buttons are playing.

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter_v6.cpp
    scummvm/trunk/engines/gob/videoplayer.cpp
    scummvm/trunk/engines/gob/videoplayer.h

Modified: scummvm/trunk/engines/gob/inter_v6.cpp
===================================================================
--- scummvm/trunk/engines/gob/inter_v6.cpp	2011-01-22 18:09:06 UTC (rev 55442)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2011-01-22 19:28:23 UTC (rev 55443)
@@ -125,6 +125,11 @@
 			props.x, props.y, props.startFrame, props.lastFrame,
 			props.palCmd, props.palStart, props.palEnd, props.flags);
 
+	if (!strcmp(fileName, "RIEN")) {
+		_vm->_vidPlayer->closeAll();
+		return;
+	}
+
 	close = false;
 	if (props.lastFrame == -1) {
 		close = true;
@@ -152,7 +157,10 @@
 		return;
 	} else if (props.lastFrame <= -10) {
 		_vm->_vidPlayer->closeVideo();
-		props.loop = true;
+
+		if (!(props.flags & VideoPlayer::kFlagNoVideo))
+			props.loop = true;
+
 	} else if (props.lastFrame < 0) {
 		warning("Urban/Playtoons Stub: Unknown Video/Music command: %d, %s", props.lastFrame, fileName);
 		return;
@@ -166,8 +174,14 @@
 
 	_vm->_vidPlayer->evaluateFlags(props);
 
+	bool primary = true;
+	if (props.noBlock && (props.flags & VideoPlayer::kFlagNoVideo)) {
+		_vm->_vidPlayer->closeLiveSound();
+		primary = false;
+	}
+
 	int slot = 0;
-	if ((fileName[0] != 0) && ((slot = _vm->_vidPlayer->openVideo(true, fileName, props)) < 0)) {
+	if ((fileName[0] != 0) && ((slot = _vm->_vidPlayer->openVideo(primary, fileName, props)) < 0)) {
 		WRITE_VAR(11, (uint32) -1);
 		return;
 	}

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2011-01-22 18:09:06 UTC (rev 55442)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2011-01-22 19:28:23 UTC (rev 55443)
@@ -222,6 +222,22 @@
 	return true;
 }
 
+void VideoPlayer::closeLiveSound() {
+	for (int i = 1; i < kVideoSlotCount; i++) {
+		Video *video = getVideoBySlot(i);
+		if (!video)
+			continue;
+
+		if (video->live)
+			closeVideo(i);
+	}
+}
+
+void VideoPlayer::closeAll() {
+	for (int i = 0; i < kVideoSlotCount; i++)
+		closeVideo(i);
+}
+
 bool VideoPlayer::play(int slot, Properties &properties) {
 	Video *video = getVideoBySlot(slot);
 	if (!video)
@@ -253,11 +269,13 @@
 
 	properties.canceled = false;
 
-	if (primary && properties.noBlock) {
-		video->live = true;
+	if (properties.noBlock) {
 		properties.waitEndFrame = false;
-		_liveProperties = properties;
-		updateLive(true);
+
+		video->live       = true;
+		video->properties = properties;
+
+		updateLive(slot, true);
 		return true;
 	}
 
@@ -311,40 +329,47 @@
 }
 
 void VideoPlayer::updateLive(bool force) {
-	Video *video = getVideoBySlot(0);
+	for (int i = 0; i < kVideoSlotCount; i++)
+		updateLive(i, force);
+}
+
+void VideoPlayer::updateLive(int slot, bool force) {
+	Video *video = getVideoBySlot(slot);
 	if (!video || !video->live)
 		return;
 
-	if (_liveProperties.startFrame >= (int32)(video->decoder->getFrameCount() - 1)) {
+	if (video->properties.startFrame >= (int32)(video->decoder->getFrameCount() - 1)) {
 		// Video ended
 
-		if (!_liveProperties.loop) {
-			WRITE_VAR_OFFSET(212, (uint32)-1);
+		if (!video->properties.loop) {
+			if (!(video->properties.flags & kFlagNoVideo))
+				WRITE_VAR_OFFSET(212, (uint32)-1);
 			_vm->_vidPlayer->closeVideo();
 			return;
 		} else {
 			video->decoder->seek(0, SEEK_SET, true);
-			_liveProperties.startFrame = -1;
+			video->properties.startFrame = -1;
 		}
 	}
 
-	if (_liveProperties.startFrame == _liveProperties.lastFrame)
+	if (video->properties.startFrame == video->properties.lastFrame)
 		// Current video sequence ended
 		return;
 
 	if (!force && (video->decoder->getTimeToNextFrame() > 0))
 		return;
 
-	WRITE_VAR_OFFSET(212, _liveProperties.startFrame + 1);
+	if (!(video->properties.flags & kFlagNoVideo))
+		WRITE_VAR_OFFSET(212, video->properties.startFrame + 1);
 
-	bool backwards = _liveProperties.startFrame > _liveProperties.lastFrame;
-	playFrame(0, _liveProperties);
+	bool backwards = video->properties.startFrame > video->properties.lastFrame;
+	playFrame(slot, video->properties);
 
-	_liveProperties.startFrame += backwards ? -1 : 1;
+	video->properties.startFrame += backwards ? -1 : 1;
 
-	if (_liveProperties.fade) {
+	if (video->properties.fade) {
 		_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0);
-		_liveProperties.fade = false;
+		video->properties.fade = false;
 	}
 }
 

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2011-01-22 18:09:06 UTC (rev 55442)
+++ scummvm/trunk/engines/gob/videoplayer.h	2011-01-22 19:28:23 UTC (rev 55443)
@@ -110,6 +110,9 @@
 	int  openVideo(bool primary, const Common::String &file, Properties &properties);
 	bool closeVideo(int slot = 0);
 
+	void closeLiveSound();
+	void closeAll();
+
 	bool play(int slot, Properties &properties);
 	void waitEndFrame(int slot, bool onlySound = false);
 
@@ -149,6 +152,8 @@
 
 		SurfacePtr surface;
 
+		Properties properties;
+
 		bool live;
 
 		Video();
@@ -161,8 +166,6 @@
 
 	static const char *_extensions[];
 
-	Properties _liveProperties;
-
 	GobEngine *_vm;
 
 	// _videoSlots[0] is reserved for the "primary" video
@@ -188,6 +191,8 @@
 	void evalBgShading(Video &video);
 
 	void copyPalette(const Video &video, int16 palStart, int16 palEnd);
+
+	void updateLive(int slot, bool force = false);
 };
 
 } // End of namespace Gob


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