aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2007-01-18 22:08:02 +0000
committerTorbjörn Andersson2007-01-18 22:08:02 +0000
commit37f94f7cba8135a8ee28a0ce1fe18337f8b764b6 (patch)
tree3a07e0ba81d19e95627de8aede26bc41210a80a1
parent2ac841f18bbffa8ce8f05ce19c78e1d27c7a2296 (diff)
downloadscummvm-rg350-37f94f7cba8135a8ee28a0ce1fe18337f8b764b6.tar.gz
scummvm-rg350-37f94f7cba8135a8ee28a0ce1fe18337f8b764b6.tar.bz2
scummvm-rg350-37f94f7cba8135a8ee28a0ce1fe18337f8b764b6.zip
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. svn-id: r25120
-rw-r--r--engines/scumm/smush/smush_player.cpp25
-rw-r--r--engines/scumm/smush/smush_player.h6
2 files changed, 20 insertions, 11 deletions
diff --git a/engines/scumm/smush/smush_player.cpp b/engines/scumm/smush/smush_player.cpp
index bd4261d60c..dbcde31597 100644
--- a/engines/scumm/smush/smush_player.cpp
+++ b/engines/scumm/smush/smush_player.cpp
@@ -1101,6 +1101,8 @@ void SmushPlayer::parseNextFrame() {
_base->seek(_seekPos, SEEK_SET);
_frame = _seekFrame;
+ _startFrame = _frame;
+ _startTime = _vm->_system->getMillis();
_seekPos = -1;
}
@@ -1307,18 +1309,24 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st
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 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st
// 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 @@ void SmushPlayer::play(const char *filename, int32 speed, int32 offset, int32 st
_inTimer = false;
_inTimerCount = 0;
#endif
- frameNo++;
}
if (_endOfFile)
break;
diff --git a/engines/scumm/smush/smush_player.h b/engines/scumm/smush/smush_player.h
index a6e83ef8ed..d951e3d45d 100644
--- a/engines/scumm/smush/smush_player.h
+++ b/engines/scumm/smush/smush_player.h
@@ -53,11 +53,13 @@ private:
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;