aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/animation.cpp
diff options
context:
space:
mode:
authorDenis Kasak2009-07-12 19:32:01 +0000
committerDenis Kasak2009-07-12 19:32:01 +0000
commit77a810c0c9beed930a4b0ffe8e715bd22d7be448 (patch)
treed8bd831705b8959818705c685e3acc630f3ae8ba /engines/draci/animation.cpp
parenteef64cc737fd9a4877822281c88395b73f0720f7 (diff)
downloadscummvm-rg350-77a810c0c9beed930a4b0ffe8e715bd22d7be448.tar.gz
scummvm-rg350-77a810c0c9beed930a4b0ffe8e715bd22d7be448.tar.bz2
scummvm-rg350-77a810c0c9beed930a4b0ffe8e715bd22d7be448.zip
Moved the delay mechanism from Animation to Drawable since each frame in an animation can have a different delay.
svn-id: r42427
Diffstat (limited to 'engines/draci/animation.cpp')
-rw-r--r--engines/draci/animation.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp
index d48560a550..c3f5a2dc95 100644
--- a/engines/draci/animation.cpp
+++ b/engines/draci/animation.cpp
@@ -33,7 +33,6 @@ Animation::Animation(DraciEngine *vm) : _vm(vm) {
_z = 0;
_playing = false;
_looping = false;
- _delay = 0;
_tick = _vm->_system->getMillis();
_currentFrame = 0;
}
@@ -52,12 +51,6 @@ void Animation::setLooping(bool looping) {
looping, _id);
}
-void Animation::setDelay(uint delay) {
- _delay = delay;
- debugC(7, kDraciAnimationDebugLevel, "Setting delay to %u on animation %d",
- delay, _id);
-}
-
void Animation::nextFrame(bool force) {
// If there's only one or no frames, return
@@ -65,8 +58,9 @@ void Animation::nextFrame(bool force) {
return;
Common::Rect frameRect = _frames[_currentFrame]->getRect();
+ Drawable *frame = _frames[_currentFrame];
- if (force || (_tick + _delay <= _vm->_system->getMillis())) {
+ if (force || (_tick + frame->getDelay() <= _vm->_system->getMillis())) {
// If we are at the last frame and not looping, stop the animation
// The animation is also restarted to frame zero
if ((_currentFrame == getFramesNum() - 1) && !_looping) {
@@ -75,13 +69,14 @@ void Animation::nextFrame(bool force) {
} else {
_vm->_screen->getSurface()->markDirtyRect(frameRect);
_currentFrame = nextFrameNum();
- _tick += _delay;
+ _tick += frame->getDelay();
}
}
debugC(6, kDraciAnimationDebugLevel,
"anim=%d tick=%d delay=%d tick+delay=%d currenttime=%d frame=%d framenum=%d",
- _id, _tick, _delay, _tick + _delay, _vm->_system->getMillis(), _currentFrame, _frames.size());
+ _id, _tick, frame->getDelay(), _tick + frame->getDelay(), _vm->_system->getMillis(),
+ _currentFrame, _frames.size());
}
uint Animation::nextFrameNum() {