aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorRobert Špalek2009-11-22 05:10:31 +0000
committerRobert Špalek2009-11-22 05:10:31 +0000
commit0ee8f879fa718a7507f1b22108b7d173edd7bdb5 (patch)
tree40538b56c5dbcbab83d5ba3201414e85340de7ba /engines/draci/game.cpp
parent509444cc9135e7d0bf7212ce01a1d61f8dcf0680 (diff)
downloadscummvm-rg350-0ee8f879fa718a7507f1b22108b7d173edd7bdb5.tar.gz
scummvm-rg350-0ee8f879fa718a7507f1b22108b7d173edd7bdb5.tar.bz2
scummvm-rg350-0ee8f879fa718a7507f1b22108b7d173edd7bdb5.zip
Fix positioning of one-time hero animations.
With the previous code, the position of the animation was doubled (due to counting the position twice, the second time being a relative shift), which put it mostly outside the screen. This is because one-time hero animations are actually stored using absolute coordinates. svn-id: r46057
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index a170cc2948..1862ceb22d 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -1290,16 +1290,24 @@ void Game::positionAnimAsHero(Animation *anim) {
_persons[kDragonObject]._x = _hero.x;
_persons[kDragonObject]._y = p.y;
- // Set the per-animation scaling factor
- anim->setScaleFactors(scale, scale);
-
- anim->setRelative(p.x, p.y);
-
- // Clear the animation's shift so that the real sprite stays at place
- // regardless of what the current phase is. If the animation starts
- // from the beginning, the shift is already [0,0], but if it is in the
- // middle, it may be different.
- anim->clearShift();
+ if (anim->isRelative()) {
+ // Set the per-animation scaling factor and relative position
+ anim->setScaleFactors(scale, scale);
+ anim->setRelative(p.x, p.y);
+
+ // Clear the animation's shift so that the real sprite stays at place
+ // regardless of what the current phase is. If the animation starts
+ // from the beginning, the shift is already [0,0], but if it is in the
+ // middle, it may be different.
+ anim->clearShift();
+
+ // Otherwise this dragon animation is used at exactly one place
+ // in the game (such as jumping into the secret entrance),
+ // which can is recognized by it using absolute coordinates.
+ // Bypass our animation positioning system, otherwise there two
+ // shifts will get summed and the animation will be placed
+ // outside the screen.
+ }
}
void Game::positionHeroAsAnim(Animation *anim) {