[Scummvm-cvs-logs] SF.net SVN: scummvm: [27371] scummvm/trunk

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Tue Jun 12 08:08:48 CEST 2007


Revision: 27371
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27371&view=rev
Author:   Kirben
Date:     2007-06-11 23:08:47 -0700 (Mon, 11 Jun 2007)

Log Message:
-----------
Add support for pausing/resume cutscenes shown on the OmniTV in The Feeble Files.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/animation.cpp
    scummvm/trunk/engines/agos/animation.h
    scummvm/trunk/engines/scumm/he/animation_he.cpp
    scummvm/trunk/engines/sword1/animation.cpp
    scummvm/trunk/engines/sword2/animation.cpp
    scummvm/trunk/graphics/dxa_player.cpp
    scummvm/trunk/graphics/dxa_player.h

Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/engines/agos/animation.cpp	2007-06-12 06:08:47 UTC (rev 27371)
@@ -44,6 +44,8 @@
 	: DXAPlayer(), _vm(vm), _mixer(mixer) {
 	_omniTV = false;
 
+	_omniTVFile = 0;
+
 	_leftButtonDown = false;
 	_rightButtonDown = false;
 
@@ -103,14 +105,21 @@
 
 void MoviePlayer::playOmniTV() {
 	// Load OmniTV video
-	if (!_fd.isOpen()) {
-		_vm->_variableArray[254] = 6747;
-		return;
-	} else {
+	if (_fd) {
 		_vm->setBitFlag(42, false);
 		_omniTV = true;
 		startSound();
-		return;
+	} else {
+		if (_omniTVFile) {
+			// Restore state
+			_fd = _omniTVFile;
+			_mixer->pauseHandle(_omniTVSound, false);
+
+			_vm->setBitFlag(42, false);
+			_omniTV = true;
+		} else {
+			_vm->_variableArray[254] = 6747;
+		}
 	}
 }
 
@@ -120,7 +129,7 @@
 		return;
 	}
 
-	if (!_fd.isOpen()) {
+	if (!_fd) {
 		return;
 	}
 
@@ -161,14 +170,14 @@
 	byte *buffer;
 	uint32 offset, size, tag;
 
-	tag = _fd.readUint32BE();
+	tag = _fd->readUint32BE();
 	if (tag == MKID_BE('WAVE')) {
-		size = _fd.readUint32BE();
+		size = _fd->readUint32BE();
 
 		if (_sequenceNum) {
 			Common::File in;
 
-			_fd.seek(size, SEEK_CUR);
+			_fd->seek(size, SEEK_CUR);
 
 			in.open((const char *)"audio.wav");
 			if (!in.isOpen()) {
@@ -185,7 +194,7 @@
 			in.close();
 		} else {
 			buffer = (byte *)malloc(size);
-			_fd.read(buffer, size);
+			_fd->read(buffer, size);
 		}
 
 		Common::MemoryReadStream stream(buffer, size);
@@ -196,8 +205,13 @@
 	}
 
 	if (_bgSoundStream != NULL) {
-		_mixer->stopHandle(_bgSound);
-		_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
+		if (_omniTV) {
+			_mixer->stopHandle(_omniTVSound);
+			_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_omniTVSound, _bgSoundStream);
+		} else {
+			_mixer->stopHandle(_bgSound);
+			_mixer->playInputStream(Audio::Mixer::kSFXSoundType, &_bgSound, _bgSoundStream);
+		}
 	}
 }
 
@@ -206,8 +220,12 @@
 		return;
 
 	if (_vm->getBitFlag(42)) {
+		// Save state
+		 _omniTVFile = _fd;
+		_mixer->pauseHandle(_omniTVSound, true);
+
+		_fd = 0;
 		_omniTV = false;
-		closeFile();
 		return;
 	}
 
@@ -222,6 +240,7 @@
 		_frameNum++;
 	} else {
 		_omniTV = false;
+		_omniTVFile = 0;
 		closeFile();
 		_vm->_variableArray[254] = 6747;
 	}

Modified: scummvm/trunk/engines/agos/animation.h
===================================================================
--- scummvm/trunk/engines/agos/animation.h	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/engines/agos/animation.h	2007-06-12 06:08:47 UTC (rev 27371)
@@ -44,6 +44,9 @@
 	Audio::SoundHandle _bgSound;
 	Audio::AudioStream *_bgSoundStream;
 
+	Audio::SoundHandle _omniTVSound;
+	Common::SeekableReadStream *_omniTVFile;
+
 	bool _omniTV;
 	bool _leftButtonDown;
 	bool _rightButtonDown;

Modified: scummvm/trunk/engines/scumm/he/animation_he.cpp
===================================================================
--- scummvm/trunk/engines/scumm/he/animation_he.cpp	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/engines/scumm/he/animation_he.cpp	2007-06-12 06:08:47 UTC (rev 27371)
@@ -40,7 +40,7 @@
 }
 
 int MoviePlayer::getImageNum() {
-	if (!_fd.isOpen())
+	if (!_fd)
 		return 0;
 	return _wizResNum;
 }
@@ -48,7 +48,7 @@
 int MoviePlayer::load(const char *filename, int flags, int image) {
 	char videoName[100];
 
-	if (_fd.isOpen()) {
+	if (_fd) {
 		closeFile();
 	}
 
@@ -66,7 +66,7 @@
 	debug(1, "Playing video %s", videoName);
 
 	// Skip sound tag
-	_fd.readUint32BE();
+	_fd->readUint32BE();
 
 	if (flags & 2) {
 		_vm->_wiz->createWizEmptyImage(image, 0, 0, _width, _height);
@@ -85,7 +85,7 @@
 }
 
 void MoviePlayer::handleNextFrame() {
-	if (_fd.isOpen() == false) {
+	if (_fd == false) {
 		return;
 	}
 

Modified: scummvm/trunk/engines/sword1/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword1/animation.cpp	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/engines/sword1/animation.cpp	2007-06-12 06:08:47 UTC (rev 27371)
@@ -410,7 +410,7 @@
 	snprintf(filename, sizeof(filename), "%s.dxa", sequenceList[id]);
 	if (loadFile(filename)) {
 		// The Broken Sword games always use external audio tracks.
-		if (_fd.readUint32BE() != MKID_BE('NULL'))
+		if (_fd->readUint32BE() != MKID_BE('NULL'))
 			return false;
 		_frameWidth = getWidth();
 		_frameHeight = getHeight();

Modified: scummvm/trunk/engines/sword2/animation.cpp
===================================================================
--- scummvm/trunk/engines/sword2/animation.cpp	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/engines/sword2/animation.cpp	2007-06-12 06:08:47 UTC (rev 27371)
@@ -518,7 +518,7 @@
 
 	if (loadFile(filename)) {
 		// The Broken Sword games always use external audio tracks.
-		if (_fd.readUint32BE() != MKID_BE('NULL'))
+		if (_fd->readUint32BE() != MKID_BE('NULL'))
 			return false;
 
 		_frameBuffer = _vm->_screen->getScreen();

Modified: scummvm/trunk/graphics/dxa_player.cpp
===================================================================
--- scummvm/trunk/graphics/dxa_player.cpp	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/graphics/dxa_player.cpp	2007-06-12 06:08:47 UTC (rev 27371)
@@ -35,6 +35,8 @@
 namespace Graphics {
 
 DXAPlayer::DXAPlayer() {
+	_fd = 0;
+
 	_frameBuffer1 = 0;
 	_frameBuffer2 = 0;
 	_scaledBuffer = 0;
@@ -57,25 +59,25 @@
 }
 
 int DXAPlayer::getWidth() {
-	if (!_fd.isOpen())
+	if (!_fd)
 		return 0;
 	return _width;
 }
 
 int DXAPlayer::getHeight() {
-	if (!_fd.isOpen())
+	if (!_fd)
 		return 0;
 	return _height;
 }
 
 int DXAPlayer::getCurFrame() {
-	if (!_fd.isOpen())
+	if (!_fd)
 		return -1;
 	return _frameNum;
 }
 
 int DXAPlayer::getFrameCount() {
-	if (!_fd.isOpen())
+	if (!_fd)
 		return 0;
 	return _framesCount;
 }
@@ -84,16 +86,19 @@
 	uint32 tag;
 	int32 frameRate;
 
-	if (!_fd.open(filename)) {
+	Common::File *file = new Common::File();
+	if (!file->open(filename)) {
 		return 0;
 	}
 
-	tag = _fd.readUint32BE();
+	_fd = file;
+
+	tag = _fd->readUint32BE();
 	assert(tag == MKID_BE('DEXA'));
 
-	uint8 flags = _fd.readByte();
-	_framesCount = _fd.readUint16BE();
-	frameRate = _fd.readUint32BE();
+	uint8 flags = _fd->readByte();
+	_framesCount = _fd->readUint16BE();
+	frameRate = _fd->readUint32BE();
 
 	if (frameRate > 0)
 		_framesPerSec = 1000 / frameRate;
@@ -107,8 +112,8 @@
 	else
 		_frameTicks = frameRate;
 
-	_width = _fd.readUint16BE();
-	_height = _fd.readUint16BE();
+	_width = _fd->readUint16BE();
+	_height = _fd->readUint16BE();
 
 	if (flags & 0x80) {
 		_scaleMode = S_INTERLACED;
@@ -143,10 +148,10 @@
 }
 
 void DXAPlayer::closeFile() {
-	if (!_fd.isOpen())
+	if (!_fd)
 		return;
 
-	_fd.close();
+	delete _fd;
 	free(_frameBuffer1);
 	free(_frameBuffer2);
 	free(_scaledBuffer);
@@ -478,20 +483,20 @@
 void DXAPlayer::decodeNextFrame() {
 	uint32 tag;
 
-	tag = _fd.readUint32BE();
+	tag = _fd->readUint32BE();
 	if (tag == MKID_BE('CMAP')) {
 		byte rgb[768];
 
-		_fd.read(rgb, ARRAYSIZE(rgb));
+		_fd->read(rgb, ARRAYSIZE(rgb));
 		setPalette(rgb);
 	}
 
-	tag = _fd.readUint32BE();
+	tag = _fd->readUint32BE();
 	if (tag == MKID_BE('FRAM')) {
-		byte type = _fd.readByte();
-		uint32 size = _fd.readUint32BE();
+		byte type = _fd->readByte();
+		uint32 size = _fd->readUint32BE();
 
-		_fd.read(_frameBuffer2, size);
+		_fd->read(_frameBuffer2, size);
 
 		switch (type) {
 		case 2:

Modified: scummvm/trunk/graphics/dxa_player.h
===================================================================
--- scummvm/trunk/graphics/dxa_player.h	2007-06-12 01:30:15 UTC (rev 27370)
+++ scummvm/trunk/graphics/dxa_player.h	2007-06-12 06:08:47 UTC (rev 27371)
@@ -43,8 +43,6 @@
 
 class DXAPlayer {
 protected:
-	Common::File _fd;
-
 	byte *_frameBuffer1;
 	byte *_frameBuffer2;
 	byte *_scaledBuffer;
@@ -63,6 +61,8 @@
 	DXAPlayer();
 	virtual ~DXAPlayer();
 
+	Common::SeekableReadStream *_fd;
+
 	/**
 	 * Returns the width of the video
 	 * @return the width of the 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