diff options
Diffstat (limited to 'engines/zvision/scripting/controls/input_control.cpp')
-rw-r--r-- | engines/zvision/scripting/controls/input_control.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/engines/zvision/scripting/controls/input_control.cpp b/engines/zvision/scripting/controls/input_control.cpp index c541693ec3..60dcd37453 100644 --- a/engines/zvision/scripting/controls/input_control.cpp +++ b/engines/zvision/scripting/controls/input_control.cpp @@ -34,6 +34,7 @@ #include "common/str.h" #include "common/stream.h" #include "common/rect.h" +#include "video/video_decoder.h" namespace ZVision { @@ -96,7 +97,7 @@ InputControl::InputControl(ZVision *engine, uint32 key, Common::SeekableReadStre sscanf(values.c_str(), "%25s %*u", fileName); - _animation = new MetaAnimation(fileName, _engine); + _animation = _engine->loadAnimation(fileName); _frame = -1; _frameDelay = 0; } else if (param.matchString("focus", true)) { @@ -213,16 +214,17 @@ bool InputControl::process(uint32 deltaTimeInMillis) { bool needDraw = true;// = _textChanged; _frameDelay -= deltaTimeInMillis; if (_frameDelay <= 0) { - _frame = (_frame + 1) % _animation->frameCount(); - _frameDelay = _animation->frameTime(); + _frame = (_frame + 1) % _animation->getFrameCount(); + _frameDelay = 1000.0 / _animation->getDuration().framerate(); needDraw = true; } if (needDraw) { - const Graphics::Surface *srf = _animation->getFrameData(_frame); + _animation->seekToFrame(_frame); + const Graphics::Surface *srf = _animation->decodeNextFrame(); uint32 xx = _textRectangle.left + _txtWidth; - if (xx >= _textRectangle.left + (_textRectangle.width() - _animation->width())) - xx = _textRectangle.left + _textRectangle.width() - _animation->width(); + if (xx >= _textRectangle.left + (_textRectangle.width() - (int16)_animation->getWidth())) + xx = _textRectangle.left + _textRectangle.width() - (int16)_animation->getWidth(); _engine->getRenderManager()->blitSurfaceToBkg(*srf, xx, _textRectangle.top); } } |