summaryrefslogtreecommitdiff
path: root/src/itemsoundmanager.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-04 19:19:53 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-04 19:19:53 +0300
commitdb43ad3b72fe207e6cc03a1fd341ea598d123319 (patch)
tree6d338e9e0bff66e7751d6d0866f32388bdcfe59c /src/itemsoundmanager.cpp
parent65a88f27b994f7ade178368c569d466f6344ded6 (diff)
downloadmv-db43ad3b72fe207e6cc03a1fd341ea598d123319.tar.gz
mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.tar.bz2
mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.tar.xz
mv-db43ad3b72fe207e6cc03a1fd341ea598d123319.zip
add pickup and drop sound effects.
Works like equip/unequip effects.
Diffstat (limited to 'src/itemsoundmanager.cpp')
-rw-r--r--src/itemsoundmanager.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/itemsoundmanager.cpp b/src/itemsoundmanager.cpp
index 0e8b33d11..c77f0a08f 100644
--- a/src/itemsoundmanager.cpp
+++ b/src/itemsoundmanager.cpp
@@ -20,6 +20,7 @@
#include "itemsoundmanager.h"
+#include "flooritem.h"
#include "item.h"
#include "logger.h"
#include "soundmanager.h"
@@ -48,3 +49,20 @@ void ItemSoundManager::playSfx(const Item *const item,
}
soundManager.playGuiSfx(sfx);
}
+
+void ItemSoundManager::playSfx(const FloorItem *const item,
+ const ItemSoundEvent sound)
+{
+ if (!item)
+ return;
+ const ItemInfo &info = ItemDB::get(item->getItemId());
+ std::string sfx = info.getSound(sound).sound;
+ if (sfx.empty())
+ {
+ // fallback to player race sound if no item sound.
+ const int id = -100 - player_node->getSubType();
+ const ItemInfo &info2 = ItemDB::get(id);
+ sfx = info2.getSound(sound).sound;
+ }
+ soundManager.playGuiSfx(sfx);
+}