From 96585f24d97f548d63652585fcfaf6d1599a1aac Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 15 Oct 2010 10:52:23 +0000 Subject: SWORD25: Fix unloading of movies so the menu animation properly loops svn-id: r53474 --- engines/sword25/fmv/movieplayer.cpp | 18 +++++++++++------- engines/sword25/fmv/theora_decoder.cpp | 3 +-- 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'engines') diff --git a/engines/sword25/fmv/movieplayer.cpp b/engines/sword25/fmv/movieplayer.cpp index 164f46eb09..d58c630759 100644 --- a/engines/sword25/fmv/movieplayer.cpp +++ b/engines/sword25/fmv/movieplayer.cpp @@ -130,17 +130,21 @@ bool MoviePlayer::pause() { void MoviePlayer::update() { if (_decoder.isVideoLoaded()) { Graphics::Surface *s = _decoder.decodeNextFrame(); - - // Transfer the next frame - assert(s->bytesPerPixel == 4); + if (s) { + // Transfer the next frame + assert(s->bytesPerPixel == 4); #if INDIRECTRENDERING - byte *frameData = (byte *)s->getBasePtr(0, 0); - _outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch); + byte *frameData = (byte *)s->getBasePtr(0, 0); + _outputBitmap->setContent(frameData, s->pitch * s->h, 0, s->pitch); #else - g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h)); - g_system->updateScreen(); + g_system->copyRectToScreen((byte *)s->getBasePtr(0, 0), s->pitch, _outX, _outY, MIN(s->w, _backSurface->w), MIN(s->h, _backSurface->h)); + g_system->updateScreen(); #endif + } else { + // Movie complete, so unload the movie + unloadMovie(); + } } } diff --git a/engines/sword25/fmv/theora_decoder.cpp b/engines/sword25/fmv/theora_decoder.cpp index c5c29a8160..8d30aa07ea 100644 --- a/engines/sword25/fmv/theora_decoder.cpp +++ b/engines/sword25/fmv/theora_decoder.cpp @@ -399,8 +399,7 @@ Graphics::Surface *TheoraDecoder::decodeNextFrame() { } if (!_videobufReady && !_audiobufReady && _fileStream->eos()) { - close(); - return _surface; + return NULL; } if (!_videobufReady || !_audiobufReady) { -- cgit v1.2.3