summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-01-06 21:25:25 +0200
committerAndrei Karas <akaras@inbox.ru>2011-01-06 21:32:01 +0200
commitef7f53e43ce4306080efae3b86443a6016a3e66a (patch)
tree64dcb0229a5d0a5e75c77712743748d8a374e6a0 /src/being.cpp
parent61f8436a6ea04fcdede91ca26ebec6d558ac5cd0 (diff)
downloadplus-ef7f53e43ce4306080efae3b86443a6016a3e66a.tar.gz
plus-ef7f53e43ce4306080efae3b86443a6016a3e66a.tar.bz2
plus-ef7f53e43ce4306080efae3b86443a6016a3e66a.tar.xz
plus-ef7f53e43ce4306080efae3b86443a6016a3e66a.zip
Set sound volume depends on distance to object.
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 2372cfe1b..1d8178670 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -568,7 +568,15 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type)
mDamageTaken += amount;
if (mInfo)
{
- sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT));
+ if (attacker)
+ {
+ sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT),
+ attacker->getTileX(), attacker->getTileY());
+ }
+ else
+ {
+ sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT));
+ }
if (!mInfo->isStaticMaxHP())
{
if (!mHP && mInfo->getMaxHP() < mDamageTaken)
@@ -618,7 +626,7 @@ void Being::handleAttack(Being *victim, int damage,
}
sound.playSfx(mInfo->getSound((damage > 0) ?
- SOUND_EVENT_HIT : SOUND_EVENT_MISS));
+ SOUND_EVENT_HIT : SOUND_EVENT_MISS), mX, mY);
}
void Being::setName(const std::string &name)
@@ -904,7 +912,7 @@ void Being::setAction(Action action, int attackType _UNUSED_)
case DEAD:
currentAction = SpriteAction::DEAD;
if (mInfo)
- sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE));
+ sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE), mX, mY);
break;
case STAND:
currentAction = SpriteAction::STAND;