summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sound.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/sound.cpp b/src/sound.cpp
index a8090f84..c64e10d8 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -253,6 +253,10 @@ void Sound::playSfx(const std::string &path, int x, int y)
if (dy < 0)
dy = -dy;
int dist = dx > dy ? dx : dy;
+
+ // Check for negative values
+ if (dist * 8 > vol)
+ return;
vol -= dist * 8;
}
sample->play(0, vol);