diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-04-26 23:40:37 +0200 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-04-26 23:40:37 +0200 |
commit | 2d0e84449b14615bdacb6f897791628662bbfd39 (patch) | |
tree | 08019ae6c24c6da25e25da027d04ad008c25d6a2 /src/sound.cpp | |
parent | 42605753159d7b63276351311e0fd43874a3366b (diff) | |
parent | 0056412ed33b941d72a175dcd3f025abcd8fc02b (diff) | |
download | mana-client-2d0e84449b14615bdacb6f897791628662bbfd39.tar.gz mana-client-2d0e84449b14615bdacb6f897791628662bbfd39.tar.bz2 mana-client-2d0e84449b14615bdacb6f897791628662bbfd39.tar.xz mana-client-2d0e84449b14615bdacb6f897791628662bbfd39.zip |
Made the client use a unique kind of movement code.
This is fixng many issues and (hopefully) will make the movement
rendering much smoother.
Merge branch 'master' of gitorious.org:~bertram/mana/mana-movement-code-merge
Conflicts:
src/being.cpp
src/net/manaserv/beinghandler.cpp
Resolves: TMW-Mantis #946.
Reviewed-by: Thorbjorn.
Diffstat (limited to 'src/sound.cpp')
-rw-r--r-- | src/sound.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/sound.cpp b/src/sound.cpp index 636da7c7..4216c8fa 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -22,6 +22,7 @@ #include <SDL.h> #include "configuration.h" +#include "game.h" #include "localplayer.h" #include "log.h" #include "sound.h" @@ -291,8 +292,10 @@ void Sound::playSfx(const std::string &path, int x, int y) int vol = 120; if (player_node && x > 0 && y > 0) { - int dx = player_node->getTileX() - x; - int dy = player_node->getTileY() - y; + Vector pos = player_node->getPosition(); + Map *map = Game::instance()->getCurrentMap(); + int dx = ((int)pos.x - x) / map->getTileWidth(); + int dy = ((int)pos.y - y) / map->getTileHeight(); if (dx < 0) dx = -dx; if (dy < 0) |