diff options
author | whiterandrek | 2018-05-13 18:28:48 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2018-06-28 23:51:32 +0200 |
commit | 956643968383f6294ead85cebc506d25e68b4690 (patch) | |
tree | c378391cd296cae0c2d44dc5a43c61384f6d7524 | |
parent | f03d5811ec87b916ea8a7c08ad9c31fa1a292b1f (diff) | |
download | scummvm-rg350-956643968383f6294ead85cebc506d25e68b4690.tar.gz scummvm-rg350-956643968383f6294ead85cebc506d25e68b4690.tar.bz2 scummvm-rg350-956643968383f6294ead85cebc506d25e68b4690.zip |
PINK: fixed sprites which start playing with delay
-rw-r--r-- | engines/pink/cel_decoder.cpp | 33 | ||||
-rw-r--r-- | engines/pink/cel_decoder.h | 2 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_play.cpp | 5 | ||||
-rw-r--r-- | engines/pink/objects/actions/action_still.cpp | 5 | ||||
-rw-r--r-- | engines/pink/pink.h | 1 |
5 files changed, 41 insertions, 5 deletions
diff --git a/engines/pink/cel_decoder.cpp b/engines/pink/cel_decoder.cpp index 39b797b348..e143885491 100644 --- a/engines/pink/cel_decoder.cpp +++ b/engines/pink/cel_decoder.cpp @@ -102,6 +102,11 @@ void CelDecoder::setY(int32 y) { track->setY(y); } +void CelDecoder::skipFrame() { + CelVideoTrack *track = (CelVideoTrack*) getTrack(0); + track->skipFrame(); +} + 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(); @@ -177,6 +182,34 @@ Common::Rect &CelDecoder::CelVideoTrack::getRect() { #define FRAME_TYPE 0xF1FA +void CelDecoder::CelVideoTrack::skipFrame() { + // Read chunk + /*uint32 frameSize = */ _fileStream->readUint32LE(); + uint16 frameType = _fileStream->readUint16LE(); + + switch (frameType) { + case FRAME_TYPE: + handleFrame(); + break; + default: + error("FlicDecoder::decodeFrame(): unknown main chunk type (type = 0x%02X)", frameType); + break; + } + + _curFrame++; + //_nextFrameStartTime += _frameDelay; + + if (_atRingFrame) { + // If we decoded the ring frame, seek to the second frame + _atRingFrame = false; + _fileStream->seek(_offsetFrame2); + } + + if (_curFrame == 0) + _transparentColourIndex = *(byte*)_surface->getBasePtr(0,0); + +} + const Graphics::Surface *CelDecoder::CelVideoTrack::decodeNextFrame() { // Read chunk /*uint32 frameSize = */ _fileStream->readUint32LE(); diff --git a/engines/pink/cel_decoder.h b/engines/pink/cel_decoder.h index d52318bfda..d49c6e22e4 100644 --- a/engines/pink/cel_decoder.h +++ b/engines/pink/cel_decoder.h @@ -39,6 +39,7 @@ public: Common::Point getCenter(); Common::Rect &getRectangle(); const Graphics::Surface *getCurrentFrame(); + void skipFrame(); void setX(int32 x); void setY(int32 y); @@ -60,6 +61,7 @@ protected: void setX(int32 x); void setY(int32 y); + void skipFrame(); private: const Graphics::Surface *decodeNextFrame(); void readPrefixChunk(); diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp index 7749bc65e8..bf73e8d014 100644 --- a/engines/pink/objects/actions/action_play.cpp +++ b/engines/pink/objects/actions/action_play.cpp @@ -46,9 +46,10 @@ void ActionPlay::end() { void ActionPlay::onStart() { debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str()); _decoder->start(); - for (int i = 0; i <= _startFrame; ++i) { - _decoder->decodeNextFrame(); + for (int i = 0; i < _startFrame; ++i) { + _decoder->skipFrame(); } + _decoder->decodeNextFrame(); } void ActionPlay::update() { diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp index fc835f1af5..f1c26cdd4a 100644 --- a/engines/pink/objects/actions/action_still.cpp +++ b/engines/pink/objects/actions/action_still.cpp @@ -45,9 +45,10 @@ void ActionStill::end() { void ActionStill::onStart() { debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str()); - for (int i = 0; i <= _startFrame; ++i) { - _decoder->decodeNextFrame(); + for (int i = 0; i < _startFrame; ++i) { + _decoder->skipFrame(); } + _decoder->decodeNextFrame(); _decoder->stop(); _actor->endAction(); } diff --git a/engines/pink/pink.h b/engines/pink/pink.h index ecd8928857..56686fc0db 100644 --- a/engines/pink/pink.h +++ b/engines/pink/pink.h @@ -57,7 +57,6 @@ * Walking sprites don't recalculate position * Walking can't be skipped * PDA doesn't work - * Sprites, which has not zero startFrame start playing with delay * */ |