aboutsummaryrefslogtreecommitdiff
path: root/engines/draci/game.cpp
diff options
context:
space:
mode:
authorRobert Špalek2009-11-08 03:16:22 +0000
committerRobert Špalek2009-11-08 03:16:22 +0000
commit354d7f6366d11628030bcfde9186fc6e1c819f9a (patch)
treec20613c1cb70306887b64f91b7d63480d70bfdc6 /engines/draci/game.cpp
parent286e71fdcf8b41599891a073a42d20f9dae5294f (diff)
downloadscummvm-rg350-354d7f6366d11628030bcfde9186fc6e1c819f9a.tar.gz
scummvm-rg350-354d7f6366d11628030bcfde9186fc6e1c819f9a.tar.bz2
scummvm-rg350-354d7f6366d11628030bcfde9186fc6e1c819f9a.zip
Debugged smooth walking except for 1 bug.
Adjusting to the edge is done such that it respects slight sideways movements of the dragon. Fixed rounding issues in the whole game. Improved debug messages. Made sure that the dragon does not turn like crazy around when clicking on the same pixel: the final point is always the clicked one although the middle points made by shifted to make the animations smooth, and preserve the dragons direction if he has not walked. There is a bug with running turning animations as they seem to disappear for 1 frame and have incorrect Z coordinate. Will investigate it next. svn-id: r45742
Diffstat (limited to 'engines/draci/game.cpp')
-rw-r--r--engines/draci/game.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index f18b2fda32..23a037e5e7 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -1482,8 +1482,8 @@ void Game::positionAnimAsHero(Animation *anim) {
// click but sprites are drawn from their top-left corner so we subtract
// the current height of the dragon's sprite
Common::Point p = _hero;
- p.x -= (int)(scale * frame->getWidth() / 2);
- p.y -= (int)(scale * frame->getHeight());
+ p.x -= scummvm_lround(scale * frame->getWidth() / 2);
+ p.y -= scummvm_lround(scale * frame->getHeight());
// Since _persons[] is used for placing talking text, we use the non-adjusted x value
// so the text remains centered over the dragon.
@@ -1511,8 +1511,8 @@ void Game::positionHeroAsAnim(Animation *anim) {
// elsewhere).
// TODO: what about rounding errors?
Drawable *frame = anim->getCurrentFrame();
- _hero.x += (int) (anim->getScaleX() * frame->getWidth() / 2);
- _hero.y += (int) (anim->getScaleY() * frame->getHeight());
+ _hero.x += scummvm_lround(anim->getScaleX() * frame->getWidth() / 2);
+ _hero.y += scummvm_lround(anim->getScaleY() * frame->getHeight());
}
void Game::pushNewRoom() {