diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/draci/animation.cpp | 4 | ||||
-rw-r--r-- | engines/draci/animation.h | 4 | ||||
-rw-r--r-- | engines/draci/script.cpp | 16 | ||||
-rw-r--r-- | engines/draci/script.h | 2 |
4 files changed, 19 insertions, 7 deletions
diff --git a/engines/draci/animation.cpp b/engines/draci/animation.cpp index ea310c1bb6..3121cc2a40 100644 --- a/engines/draci/animation.cpp +++ b/engines/draci/animation.cpp @@ -38,6 +38,7 @@ Animation::Animation(DraciEngine *vm, int index) : _vm(vm) { _playing = false; _looping = false; _paused = false; + _canBeQuick = false; _tick = _vm->_system->getMillis(); _currentFrame = 0; _hasChangedFrame = true; @@ -95,7 +96,8 @@ void Animation::nextFrame(bool force) { const Drawable *frame = getConstCurrentFrame(); Surface *surface = _vm->_screen->getSurface(); - if (force || (_tick + frame->getDelay() <= _vm->_system->getMillis())) { + if (force || (_tick + frame->getDelay() <= _vm->_system->getMillis()) || + _canBeQuick && _vm->_game->getEnableQuickHero() && _vm->_game->getWantQuickHero()) { // If we are at the last frame and not looping, stop the animation // The animation is also restarted to frame zero if ((_currentFrame == getFrameCount() - 1) && !_looping) { diff --git a/engines/draci/animation.h b/engines/draci/animation.h index 1fe5d4c814..aff2680c37 100644 --- a/engines/draci/animation.h +++ b/engines/draci/animation.h @@ -101,6 +101,8 @@ public: Displacement getCurrentFrameDisplacement() const; // displacement of the current frame (includes _shift) Common::Point getCurrentFramePosition() const; // with displacement and shift applied + void supportsQuickAnimation(bool val) { _canBeQuick = val; } + int getIndex() const { return _index; } void setIndex(int index) { _index = index; } @@ -148,6 +150,8 @@ private: bool _looping; bool _paused; + bool _canBeQuick; + /** Array of frames of the animation. The animation object owns these pointers. */ Common::Array<Drawable *> _frames; diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp index 340942a7e2..70b6c19f0a 100644 --- a/engines/draci/script.cpp +++ b/engines/draci/script.cpp @@ -365,10 +365,16 @@ void Script::play(Common::Queue<int> ¶ms) { _vm->_game->loop(kInnerUntilExit, true); } -Animation *Script::loadObjectAnimation(GameObject *obj, int animID) { +Animation *Script::loadObjectAnimation(int objID, GameObject *obj, int animID) { _vm->_game->loadAnimation(animID, obj->_z); obj->_anim.push_back(animID); - return _vm->_anims->getAnimation(animID); + Animation *anim = _vm->_anims->getAnimation(animID); + if (objID == kDragonObject && obj->_anim.size() - 1 <= kLastTurning) { + // obj->_anim.size() is the Movement type. All walking and + // turning movements can be accelerated. + anim->supportsQuickAnimation(true); + } + return anim; } void Script::load(Common::Queue<int> ¶ms) { @@ -393,7 +399,7 @@ void Script::load(Common::Queue<int> ¶ms) { // AnimationManager while not being registered in the object's array of // animations. This cannot legally happen and an assertion will be // thrown by loadAnimation(). - loadObjectAnimation(obj, animID); + loadObjectAnimation(objID, obj, animID); } void Script::start(Common::Queue<int> ¶ms) { @@ -426,7 +432,7 @@ void Script::start(Common::Queue<int> ¶ms) { // to apply the hedgehog, but there is no way that the game // player would load the requested animation by itself. // See objekty:5077 and parezy.txt:27. - anim = loadObjectAnimation(obj, animID); + anim = loadObjectAnimation(objID, obj, animID); debugC(1, kDraciBytecodeDebugLevel, "start(%d=%s) cannot find animation %d. Loading.", objID, obj->_title.c_str(), animID); } @@ -456,7 +462,7 @@ void Script::startPlay(Common::Queue<int> ¶ms) { Animation *anim = _vm->_anims->getAnimation(animID); if (!anim) { - anim = loadObjectAnimation(obj, animID); + anim = loadObjectAnimation(objID, obj, animID); debugC(1, kDraciBytecodeDebugLevel, "startPlay(%d=%s) cannot find animation %d. Loading.", objID, obj->_title.c_str(), animID); } diff --git a/engines/draci/script.h b/engines/draci/script.h index 45e05393a8..d145172240 100644 --- a/engines/draci/script.h +++ b/engines/draci/script.h @@ -189,7 +189,7 @@ private: DraciEngine *_vm; // Auxilliary functions - Animation *loadObjectAnimation(GameObject *obj, int animID); + Animation *loadObjectAnimation(int objID, GameObject *obj, int animID); }; } // End of namespace Draci |