[Scummvm-cvs-logs] SF.net SVN: scummvm: [25120] scummvm/trunk/engines/scumm/smush

eriktorbjorn at users.sourceforge.net eriktorbjorn at users.sourceforge.net
Thu Jan 18 23:08:02 CET 2007


Revision: 25120
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25120&view=rev
Author:   eriktorbjorn
Date:     2007-01-18 14:08:02 -0800 (Thu, 18 Jan 2007)

Log Message:
-----------
Hopefully fixed the SAN seeking (used by Full Throttle's bike fighting) that I
accidentally broke when removing the timer callback from the SMUSH player.

Modified Paths:
--------------
    scummvm/trunk/engines/scumm/smush/smush_player.cpp
    scummvm/trunk/engines/scumm/smush/smush_player.h

Modified: scummvm/trunk/engines/scumm/smush/smush_player.cpp
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.cpp	2007-01-18 21:48:23 UTC (rev 25119)
+++ scummvm/trunk/engines/scumm/smush/smush_player.cpp	2007-01-18 22:08:02 UTC (rev 25120)
@@ -1101,6 +1101,8 @@
 
 		_base->seek(_seekPos, SEEK_SET);
 		_frame = _seekFrame;
+		_startFrame = _frame;
+		_startTime = _vm->_system->getMillis();
 
 		_seekPos = -1;
 	}
@@ -1307,18 +1309,24 @@
 	setupAnim(filename);
 	init(speed);
 
-	uint32 startTime = _vm->_system->getMillis();
+	_startTime = _vm->_system->getMillis();
+	_startFrame = startFrame;
+	_frame = startFrame;
 
 	_pauseTime = 0;
-	uint frameNo = 0;
 
 	int skipped = 0;
 
 	for (;;) {
-		uint32 elapsed;
+		uint32 now, elapsed;
 		bool skipFrame = false;
 
-		if (_vm->_mixer->isSoundHandleActive(_compressedFileSoundHandle)) {
+		if (_insanity) {
+			// Seeking makes a mess of trying to sync the audio to
+			// the sound. Synt to time instead.
+			now = _vm->_system->getMillis() - _pauseTime;
+			elapsed = now - _startTime;
+		} else if (_vm->_mixer->isSoundHandleActive(_compressedFileSoundHandle)) {
 			// Compressed SMUSH files.
 			elapsed = _vm->_mixer->getSoundElapsedTime(_compressedFileSoundHandle);
 		} else if (_vm->_mixer->isSoundHandleActive(_IACTchannel)) {
@@ -1328,12 +1336,12 @@
 			// For other SMUSH files, we don't necessarily have any
 			// one channel to sync against, so we have to use
 			// elapsed real time.
-			uint32 now = _vm->_system->getMillis() - _pauseTime;
-			elapsed = now - startTime;
+			now = _vm->_system->getMillis() - _pauseTime;
+			elapsed = now - _startTime;
 		}
 
-		if (elapsed >= (frameNo * 1000) / _speed) {
-			if (elapsed >= ((frameNo + 1) * 1000) / _speed)
+		if (elapsed >= ((_frame - _startFrame) * 1000) / _speed) {
+			if (elapsed >= ((_frame + 1) * 1000) / _speed)
 				skipFrame = true;
 			else
 				skipFrame = false;
@@ -1392,7 +1400,6 @@
 			_inTimer = false;
 			_inTimerCount = 0;
 #endif
-			frameNo++;
 		}
 		if (_endOfFile)
 			break;

Modified: scummvm/trunk/engines/scumm/smush/smush_player.h
===================================================================
--- scummvm/trunk/engines/scumm/smush/smush_player.h	2007-01-18 21:48:23 UTC (rev 25119)
+++ scummvm/trunk/engines/scumm/smush/smush_player.h	2007-01-18 22:08:02 UTC (rev 25120)
@@ -53,11 +53,13 @@
 	byte *_specialBuffer;
 
 	Common::String _seekFile;
+	uint32 _startFrame;
+	uint32 _startTime;
 	int32 _seekPos;
-	int32 _seekFrame;
+	uint32 _seekFrame;
 
 	bool _skipNext;
-	int32 _frame;
+	uint32 _frame;
 
 	Audio::SoundHandle _IACTchannel;
 	Audio::AppendableAudioStream *_IACTstream;


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