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

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Wed Jan 19 19:57:43 CET 2011


Revision: 55333
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55333&view=rev
Author:   drmccoy
Date:     2011-01-19 18:57:43 +0000 (Wed, 19 Jan 2011)

Log Message:
-----------
GOB: Implement "live" (non-blocking) videos

Many thanks to SylvainTV. :)
Urban Runner might actually be completeable now.
One caveat: Hotspots at that hotel sequence are a bit glitchy...

Modified Paths:
--------------
    scummvm/trunk/engines/gob/inter_v6.cpp
    scummvm/trunk/engines/gob/util.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-19 18:02:53 UTC (rev 55332)
+++ scummvm/trunk/engines/gob/inter_v6.cpp	2011-01-19 18:57:43 UTC (rev 55333)
@@ -176,10 +176,15 @@
 		return;
 	}
 
+	if(!(props.flags & 0x1000) && !(props.flags & VideoPlayer::kFlagNoVideo))
+		props.flags |= VideoPlayer::kFlagNonBlocking;
+	else
+		props.flags &= ~0x1000;
+
 	if (props.startFrame >= 0)
 		_vm->_vidPlayer->play(slot, props);
 
-	if (close)
+	if (close && !(props.flags & VideoPlayer::kFlagNonBlocking))
 		_vm->_vidPlayer->closeVideo(slot);
 }
 

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2011-01-19 18:02:53 UTC (rev 55332)
+++ scummvm/trunk/engines/gob/util.cpp	2011-01-19 18:57:43 UTC (rev 55333)
@@ -31,6 +31,7 @@
 #include "gob/draw.h"
 #include "gob/game.h"
 #include "gob/video.h"
+#include "gob/videoplayer.h"
 #include "gob/sound/sound.h"
 
 #include "common/events.h"
@@ -94,6 +95,8 @@
 	int16 x = 0, y = 0;
 	bool hasMove = false;
 
+	_vm->_vidPlayer->updateLive();
+
 	while (eventMan->pollEvent(event)) {
 		switch (event.type) {
 		case Common::EVENT_MOUSEMOVE:

Modified: scummvm/trunk/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.cpp	2011-01-19 18:02:53 UTC (rev 55332)
+++ scummvm/trunk/engines/gob/videoplayer.cpp	2011-01-19 18:57:43 UTC (rev 55333)
@@ -45,7 +45,7 @@
 }
 
 
-VideoPlayer::Video::Video() : decoder(0) {
+VideoPlayer::Video::Video() : decoder(0), live(false) {
 }
 
 bool VideoPlayer::Video::isEmpty() const {
@@ -58,6 +58,8 @@
 	decoder = 0;
 	fileName.clear();
 	surface.reset();
+
+	live = false;
 }
 
 
@@ -240,6 +242,13 @@
 
 	properties.canceled = false;
 
+	if (primary && (properties.flags & kFlagNonBlocking)) {
+		video->live = true;
+		properties.waitEndFrame = false;
+		_liveProperties = properties;
+		return true;
+	}
+
 	while ((properties.startFrame != properties.lastFrame) &&
 	       (properties.startFrame < (int32)(video->decoder->getFrameCount() - 1))) {
 
@@ -274,6 +283,35 @@
 		_vm->_util->delay(video->decoder->getTimeToNextFrame());
 }
 
+void VideoPlayer::updateLive() {
+	Video *video = getVideoBySlot(0);
+	if (!video || !video->live)
+		return;
+
+	if ((_liveProperties.startFrame == _liveProperties.lastFrame) ||
+	    (_liveProperties.startFrame >= (int32)(video->decoder->getFrameCount() - 1))) {
+
+		WRITE_VAR_OFFSET(212, (uint32)-1);
+		_vm->_vidPlayer->closeVideo();
+		return;
+	}
+
+	if (video->decoder->getTimeToNextFrame() > 0)
+		return;
+
+	WRITE_VAR_OFFSET(212, _liveProperties.startFrame + 1);
+
+	bool backwards = _liveProperties.startFrame > _liveProperties.lastFrame;
+	playFrame(0, _liveProperties);
+
+	_liveProperties.startFrame += backwards ? -1 : 1;
+
+	if (_liveProperties.fade) {
+		_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, -2, 0);
+		_liveProperties.fade = false;
+	}
+}
+
 bool VideoPlayer::playFrame(int slot, Properties &properties) {
 	Video *video = getVideoBySlot(slot);
 	if (!video)
@@ -387,7 +425,7 @@
 
 		}
 
-		if ((video->decoder->getCurFrame() - 1) == properties.startFrame)
+		if (!video->live && ((video->decoder->getCurFrame() - 1) == properties.startFrame))
 			// Only retrace if we're playing the frame we actually want to play
 			_vm->_video->retrace();
 

Modified: scummvm/trunk/engines/gob/videoplayer.h
===================================================================
--- scummvm/trunk/engines/gob/videoplayer.h	2011-01-19 18:02:53 UTC (rev 55332)
+++ scummvm/trunk/engines/gob/videoplayer.h	2011-01-19 18:57:43 UTC (rev 55333)
@@ -50,6 +50,7 @@
 		kFlagFrontSurface          = 0x000080, ///< Draw directly into the front surface.
 		kFlagNoVideo               = 0x000100, ///< Only sound.
 		kFlagOtherSurface          = 0x000800, ///< Draw into a specific sprite.
+		kFlagNonBlocking           = 0x001000, ///< "Live" video playing while scripts continue.
 		kFlagScreenSurface         = 0x400000  ///< Draw into a newly created sprite of screen dimensions.
 	};
 
@@ -109,6 +110,8 @@
 	bool play(int slot, Properties &properties);
 	void waitEndFrame(int slot, bool onlySound = false);
 
+	void updateLive();
+
 	bool slotIsOpen(int slot = 0) const;
 
 	Common::String getFileName(int slot = 0) const;
@@ -141,6 +144,8 @@
 
 		SurfacePtr surface;
 
+		bool live;
+
 		Video();
 
 		bool isEmpty() const;
@@ -151,6 +156,8 @@
 
 	static const char *_extensions[];
 
+	Properties _liveProperties;
+
 	GobEngine *_vm;
 
 	// _videoSlots[0] is reserved for the "primary" video


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