diff options
author | Sylvain Dupont | 2011-01-29 20:12:27 +0000 |
---|---|---|
committer | Sylvain Dupont | 2011-01-29 20:12:27 +0000 |
commit | 96f4cc4b8a4273ec728419645363952d35f8ebe0 (patch) | |
tree | da8f5f888419a5aade402eb3e3d79b7832e8c17a /engines/toon/drew.cpp | |
parent | d925e38acfaa646e7191a4fd6e5197f323df491d (diff) | |
download | scummvm-rg350-96f4cc4b8a4273ec728419645363952d35f8ebe0.tar.gz scummvm-rg350-96f4cc4b8a4273ec728419645363952d35f8ebe0.tar.bz2 scummvm-rg350-96f4cc4b8a4273ec728419645363952d35f8ebe0.zip |
TOON: Pathfinding & walking improvements
Use direct line path if possible
Smooth facing direction to avoid flickering (entering zanidu shuttle for example)
Fix possible lockups
svn-id: r55624
Diffstat (limited to 'engines/toon/drew.cpp')
-rw-r--r-- | engines/toon/drew.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/engines/toon/drew.cpp b/engines/toon/drew.cpp index 36ca17dd70..eefb4b8efa 100644 --- a/engines/toon/drew.cpp +++ b/engines/toon/drew.cpp @@ -33,6 +33,7 @@ CharacterDrew::CharacterDrew(ToonEngine *vm) : Character(vm) { _animationInstance = vm->getAnimationManager()->createNewInstance(kAnimationCharacter); _animationInstance->setUseMask(true); vm->getAnimationManager()->addInstance(_animationInstance); + _currentScale = 1024; } CharacterDrew::~CharacterDrew() { @@ -104,6 +105,15 @@ void CharacterDrew::playWalkAnim(int32 start, int32 end) { void CharacterDrew::update(int32 timeIncrement) { debugC(5, kDebugCharacter, "update(%d)", timeIncrement); Character::update(timeIncrement); + if (_currentScale > _scale) { + _scale += timeIncrement * 2; + if (_scale > _currentScale) + _scale = _currentScale; + } else if (_currentScale < _scale) { + _scale -= timeIncrement * 2; + if (_scale < _currentScale) + _scale = _currentScale; + } setPosition(_x, _y); } @@ -114,5 +124,11 @@ int32 CharacterDrew::getRandomIdleAnim() { static const int32 idle[] = { 6, 9, 10, 11, 12 }; return idle[_vm->randRange(0, 4)]; } + +void CharacterDrew::resetScale() +{ + _scale = _currentScale; + setPosition(_x, _y); +} } // End of namespace Toon |