From c4461cb4c347460fafb3725341ca1a2e712c8f1c Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Tue, 19 Jun 2018 10:25:33 +0300 Subject: PINK: fix playing of sprites which have incorrect stopFrame --- engines/pink/objects/actions/action_play.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp index bc93eba13c..e86ff55c21 100644 --- a/engines/pink/objects/actions/action_play.cpp +++ b/engines/pink/objects/actions/action_play.cpp @@ -50,8 +50,7 @@ void ActionPlay::update() { _decoder.setEndOfTrack(); assert(!_decoder.needsUpdate()); _actor->endAction(); - } - else + } else decodeNext(); } @@ -61,8 +60,9 @@ void ActionPlay::pause(bool paused) { void ActionPlay::onStart() { debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str()); - if (_stopFrame == -1) - _stopFrame = _decoder.getFrameCount() - 1; + int frameCount = _decoder.getFrameCount(); + if (_stopFrame == -1 || _stopFrame >= frameCount) + _stopFrame = frameCount - 1; assert(_startFrame < _decoder.getFrameCount()); setFrame(_startFrame); // doesn't need to decode startFrame here. Update method will decode -- cgit v1.2.3