diff options
Diffstat (limited to 'engines/simon/animation.cpp')
-rw-r--r-- | engines/simon/animation.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/engines/simon/animation.cpp b/engines/simon/animation.cpp index dd383ca596..5a54f1ccb3 100644 --- a/engines/simon/animation.cpp +++ b/engines/simon/animation.cpp @@ -45,7 +45,7 @@ MoviePlayer::MoviePlayer(SimonEngine *vm, Audio::Mixer *mixer) MoviePlayer::~MoviePlayer() { } -bool MoviePlayer::open(const char *filename) { +bool MoviePlayer::load(const char *filename) { char filename2[100]; uint32 tag; @@ -60,13 +60,6 @@ bool MoviePlayer::open(const char *filename) { if (_fd.open(filename2) == false) return false; - _mixer->stopAll(); - - _currentFrame = 0; - - _leftButtonDown = false; - _rightButtonDown = false; - tag = _fd.readUint32BE(); assert(tag == MKID_BE('DEXA')); @@ -86,6 +79,24 @@ bool MoviePlayer::open(const char *filename) { error("error allocating frame tables, size %d\n", _frameSize); } + return true; +} + +void MoviePlayer::play() { + uint32 tag; + + if (_fd.isOpen() == false) { + debug(0, "MoviePlayer::play: No file loaded"); + return; + } + + _mixer->stopAll(); + + _currentFrame = 0; + + _leftButtonDown = false; + _rightButtonDown = false; + tag = _fd.readUint32BE(); assert(tag == MKID_BE('WAVE')); @@ -102,7 +113,11 @@ bool MoviePlayer::open(const char *filename) { if (_width != 640 && _height != 480) g_system->clearScreen(); - play(); + while (_currentFrame < _framesCount) { + handleNextFrame(); + ++_currentFrame; + } + close(); _vm->o_killAnimate(); @@ -112,8 +127,6 @@ bool MoviePlayer::open(const char *filename) { } else { g_system->clearScreen(); } - - return true; } void MoviePlayer::close() { @@ -122,13 +135,6 @@ void MoviePlayer::close() { free(_frameBuffer2); } -void MoviePlayer::play() { - while (_currentFrame < _framesCount) { - handleNextFrame(); - ++_currentFrame; - } -} - void MoviePlayer::handleNextFrame() { uint32 tag = _fd.readUint32BE(); if (tag == MKID_BE('CMAP')) { |