diff options
author | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-11 20:54:12 +0100 |
---|---|---|
committer | Yohann Ferreira <yohann_dot_ferreira_at_orange_dot_efer> | 2011-01-11 20:54:12 +0100 |
commit | 94692dd2abd30d36175fb3cb5225e03787713820 (patch) | |
tree | 8c03227da5f1facc95bc15c5f895978f9b1f66f9 /src/being.cpp | |
parent | e0f98a1650a844a5941b5cb0c11a8097f86903cc (diff) | |
download | mana-94692dd2abd30d36175fb3cb5225e03787713820.tar.gz mana-94692dd2abd30d36175fb3cb5225e03787713820.tar.bz2 mana-94692dd2abd30d36175fb3cb5225e03787713820.tar.xz mana-94692dd2abd30d36175fb3cb5225e03787713820.zip |
Added a distance based positional sfx sound system. Thanks to 4144.
Based on:
http://gitorious.org/manaplus/manaplus/commit/ef7f53e43ce4306080efae3b86443a6016a3e66a
Resolves: TMW-Mantis #536
Reviewed-by: 4144.
Diffstat (limited to 'src/being.cpp')
-rw-r--r-- | src/being.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/being.cpp b/src/being.cpp index 570d8b22..4d682ab8 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -362,7 +362,18 @@ void Being::takeDamage(Being *attacker, int amount, AttackType type) if (amount > 0) { - sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT)); + if (mInfo) + { + if (attacker) + { + sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT), + attacker->getTileX(), attacker->getTileY()); + } + else + { + sound.playSfx(mInfo->getSound(SOUND_EVENT_HURT)); + } + } if (getType() == MONSTER) { @@ -394,7 +405,7 @@ void Being::handleAttack(Being *victim, int damage, AttackType type) } 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) @@ -619,7 +630,7 @@ void Being::setAction(Action action, int attackType) break; case DEAD: currentAction = SpriteAction::DEAD; - sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE)); + sound.playSfx(mInfo->getSound(SOUND_EVENT_DIE), mX, mY); break; case STAND: currentAction = SpriteAction::STAND; |