aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/walking.cpp
diff options
context:
space:
mode:
authorRobert Špalek2009-11-05 23:59:26 +0000
committerRobert Špalek2009-11-05 23:59:26 +0000
commit73cf7a55fcc75712f1c9944f425af2f2d31454b9 (patch)
tree6bd3b2d41708c215c612b2ad61cfd72c2fbd176d /engines/draci/walking.cpp
parent45aa06a83fc043bd9a4878b32387da54fc6e8cc8 (diff)
downloadscummvm-rg350-73cf7a55fcc75712f1c9944f425af2f2d31454b9.tar.gz
scummvm-rg350-73cf7a55fcc75712f1c9944f425af2f2d31454b9.tar.bz2
scummvm-rg350-73cf7a55fcc75712f1c9944f425af2f2d31454b9.zip
Fixed several gross walking bugs.
- SIGSEGV by not stopping walking when changing rooms - reset of the mouse cursor and object title during gate scripts - updating the previous animation phase, also when starting new animation - swapped up and down animations svn-id: r45690
Diffstat (limited to 'engines/draci/walking.cpp')
-rw-r--r--engines/draci/walking.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/engines/draci/walking.cpp b/engines/draci/walking.cpp
index 1400471f04..4a0e65c9b3 100644
--- a/engines/draci/walking.cpp
+++ b/engines/draci/walking.cpp
@@ -516,6 +516,7 @@ bool WalkingState::continueWalking() {
if (!wasUpdated) {
return true;
}
+ _lastAnimPhase = animPhase;
debugC(3, kDraciWalkingDebugLevel, "Continuing walking in segment %d and position %d/%d", _segment, _position, _length);
@@ -573,7 +574,14 @@ void WalkingState::heroAnimationFinished() {
// walking/staying/talking animations are cyclic.
Movement nextAnim = directionForNextPhase();
_vm->_game->playHeroAnimation(nextAnim);
- _lastAnimPhase = 0;
+
+ // Retrieve the current animation phase. Don't just use 0, because we
+ // cannot assume that nextAnim has just started. If it was already
+ // playing before, then playHeroAnimation(nextAnim) does nothing.
+ const GameObject *dragon = _vm->_game->getObject(kDragonObject);
+ const int animID = dragon->_anim[nextAnim];
+ Animation *anim = _vm->_anims->getAnimation(animID);
+ _lastAnimPhase = anim->currentFrameNum();
debugC(2, kDraciWalkingDebugLevel, "Turned for segment %d, starting animation %d", _segment+1, nextAnim);
@@ -596,7 +604,7 @@ Movement WalkingState::animationForDirection(const Common::Point &here, const Co
if (abs(dx) >= abs(dy)) {
return dx >= 0 ? kMoveRight : kMoveLeft;
} else {
- return dy >= 0 ? kMoveUp : kMoveDown;
+ return dy >= 0 ? kMoveDown : kMoveUp;
}
}