From 02524d81c8727ebcb61100df6b88eb25a77bed41 Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Tue, 12 Jun 2018 11:16:52 +0300 Subject: PINK: remove sprite unnecessary updating by another hack --- engines/pink/cel_decoder.cpp | 5 +++++ engines/pink/cel_decoder.h | 3 +++ engines/pink/objects/actions/action_play.cpp | 5 ++++- engines/pink/objects/actions/action_still.cpp | 2 +- engines/pink/objects/actions/action_talk.cpp | 3 ++- engines/pink/objects/actions/walk_action.cpp | 4 +++- 6 files changed, 18 insertions(+), 4 deletions(-) (limited to 'engines') diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp index fc8918e23e..960403733d 100644 --- a/engines/pink/cel_decoder.cpp +++ b/engines/pink/cel_decoder.cpp @@ -80,6 +80,11 @@ void CelDecoder::skipFrame() { track->skipFrame(); } +void CelDecoder::setEndOfTrack() { + CelVideoTrack *track = (CelVideoTrack*) getTrack(0); + track->setEndOfTrack(); +} + CelDecoder::CelVideoTrack::CelVideoTrack(Common::SeekableReadStream *stream, uint16 frameCount, uint16 width, uint16 height, bool skipHeader) : FlicVideoTrack(stream, frameCount, width, height, 1), _center(0,0), _transparentColourIndex(0){ readHeader(); diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h index be67f35c07..1e9cb411a9 100644 --- a/engines/pink/cel_decoder.h +++ b/engines/pink/cel_decoder.h @@ -37,6 +37,8 @@ public: const Graphics::Surface *getCurrentFrame(); void skipFrame(); + void setEndOfTrack(); + protected: class CelVideoTrack : public FlicVideoTrack { public: @@ -48,6 +50,7 @@ protected: uint16 getTransparentColourIndex(); // Hack. Pink needs so that Track needed an update after lastFrame delay ends + void setEndOfTrack() { _curFrame = _frameCount; } bool endOfTrack() const override { return getCurFrame() >= getFrameCount(); } Common::Point getCenter(); diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp index 629e52f27e..bc93eba13c 100644 --- a/engines/pink/objects/actions/action_play.cpp +++ b/engines/pink/objects/actions/action_play.cpp @@ -46,8 +46,11 @@ void ActionPlay::end() { void ActionPlay::update() { ActionCEL::update(); - if (_decoder.getCurFrame() >= _stopFrame) + if (_decoder.getCurFrame() >= _stopFrame) { + _decoder.setEndOfTrack(); + assert(!_decoder.needsUpdate()); _actor->endAction(); + } else decodeNext(); } diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp index 109ec15471..5bd645b3cc 100644 --- a/engines/pink/objects/actions/action_still.cpp +++ b/engines/pink/objects/actions/action_still.cpp @@ -55,7 +55,7 @@ void ActionStill::onStart() { setFrame(_startFrame); // seek to frame before startFrame decodeNext(); // decode startFrame - _decoder.pauseVideo(1); // pause so that decoder doesn't need updates. + _decoder.setEndOfTrack(); assert(!_decoder.needsUpdate()); _actor->endAction(); diff --git a/engines/pink/objects/actions/action_talk.cpp b/engines/pink/objects/actions/action_talk.cpp index 2fe0e0f0d1..2144d8a8de 100644 --- a/engines/pink/objects/actions/action_talk.cpp +++ b/engines/pink/objects/actions/action_talk.cpp @@ -43,7 +43,8 @@ void ActionTalk::toConsole() { void ActionTalk::update() { ActionLoop::update(); if (!_sound.isPlaying()) { - _decoder.pauseVideo(1); + _decoder.setEndOfTrack(); + assert(!_decoder.needsUpdate()); _actor->endAction(); } } diff --git a/engines/pink/objects/actions/walk_action.cpp b/engines/pink/objects/actions/walk_action.cpp index f798f9d036..24b43dbdcc 100644 --- a/engines/pink/objects/actions/walk_action.cpp +++ b/engines/pink/objects/actions/walk_action.cpp @@ -46,8 +46,10 @@ void WalkAction::update() { ActionCEL::update(); if (_decoder.getCurFrame() < (int)_decoder.getFrameCount() - 1) decodeNext(); - else + else { + _decoder.setEndOfTrack(); _actor->endAction(); + } } } // End of namespace Pink -- cgit v1.2.3