diff options
author | Marisa-Chan | 2014-01-17 16:56:49 +0700 |
---|---|---|
committer | Marisa-Chan | 2014-01-17 16:56:49 +0700 |
commit | 9c9f59d57060617d1acec71bd0d4066504f17c7a (patch) | |
tree | 76841b43ac518225c1715ebfada75a6d86b701c3 /engines | |
parent | ff2a20889cfead5075c252dd5cdcdba658a40844 (diff) | |
download | scummvm-rg350-9c9f59d57060617d1acec71bd0d4066504f17c7a.tar.gz scummvm-rg350-9c9f59d57060617d1acec71bd0d4066504f17c7a.tar.bz2 scummvm-rg350-9c9f59d57060617d1acec71bd0d4066504f17c7a.zip |
ZVISION: Move lever code to use MetaAnimation.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/zvision/lever_control.cpp | 34 | ||||
-rw-r--r-- | engines/zvision/lever_control.h | 12 |
2 files changed, 11 insertions, 35 deletions
diff --git a/engines/zvision/lever_control.cpp b/engines/zvision/lever_control.cpp index 9cd36cf653..e96c873033 100644 --- a/engines/zvision/lever_control.cpp +++ b/engines/zvision/lever_control.cpp @@ -28,8 +28,7 @@ #include "zvision/script_manager.h" #include "zvision/render_manager.h" #include "zvision/cursor_manager.h" -#include "zvision/rlf_animation.h" -#include "zvision/zork_avi_decoder.h" +#include "zvision/meta_animation.h" #include "zvision/utility.h" #include "common/stream.h" @@ -79,11 +78,8 @@ LeverControl::LeverControl(ZVision *engine, uint32 key, Common::SeekableReadStre } LeverControl::~LeverControl() { - if (_fileType == AVI) { - delete _animation.avi; - } else if (_fileType == RLF) { - delete _animation.rlf; - } + if (_animation) + delete _animation; delete[] _frameInfo; } @@ -106,14 +102,9 @@ void LeverControl::parseLevFile(const Common::String &fileName) { Common::String animationFileName(fileNameBuffer); - if (animationFileName.hasSuffix(".avi")) { - _animation.avi = new ZorkAVIDecoder(); - _animation.avi->loadFile(animationFileName); - _fileType = AVI; - } else if (animationFileName.hasSuffix(".rlf")) { - _animation.rlf = new RlfAnimation(animationFileName, false); - _fileType = RLF; - } + if (animationFileName.hasSuffix(".avi") || animationFileName.hasSuffix(".rlf")) + _animation = new MetaAnimation(animationFileName); + } else if (line.matchString("*skipcolor*", true)) { // Not used } else if (line.matchString("*anim_coords*", true)) { @@ -379,16 +370,9 @@ void LeverControl::renderFrame(uint frameNumber) { int x = _animationCoords.left; int y = _animationCoords.top; - if (_fileType == RLF) { - // getFrameData() will automatically optimize to getNextFrame() / getPreviousFrame() if it can - frameData = _animation.rlf->getFrameData(frameNumber); - } else if (_fileType == AVI) { - _animation.avi->seekToFrame(frameNumber); - const Graphics::Surface *surface = _animation.avi->decodeNextFrame(); - frameData = surface; - } - - _engine->getRenderManager()->blitSurfaceToBkg(*frameData, x, y); + frameData = _animation->getFrameData(frameNumber); + if (frameData) + _engine->getRenderManager()->blitSurfaceToBkg(*frameData, x, y); } } // End of namespace ZVision diff --git a/engines/zvision/lever_control.h b/engines/zvision/lever_control.h index 19ecc7b9ac..591d64e949 100644 --- a/engines/zvision/lever_control.h +++ b/engines/zvision/lever_control.h @@ -32,7 +32,7 @@ namespace ZVision { class ZorkAVIDecoder; -class RlfAnimation; +class MetaAnimation; class LeverControl : public Control { public: @@ -40,10 +40,6 @@ public: ~LeverControl(); private: - enum FileType { - RLF = 1, - AVI = 2 - }; struct Direction { Direction(uint a, uint t) : angle(a), toFrame(t) {} @@ -64,11 +60,7 @@ private: }; private: - union { - RlfAnimation *rlf; - ZorkAVIDecoder *avi; - } _animation; - FileType _fileType; + MetaAnimation *_animation; Common::String _cursorName; Common::Rect _animationCoords; |