summaryrefslogtreecommitdiff
path: root/src/sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sound.cpp')
-rw-r--r--src/sound.cpp7
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)