From db43ad3b72fe207e6cc03a1fd341ea598d123319 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 4 Oct 2013 19:19:53 +0300 Subject: add pickup and drop sound effects. Works like equip/unequip effects. --- src/itemsoundmanager.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/itemsoundmanager.cpp') 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); +} -- cgit v1.2.3-60-g2f50