mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 06:53:53 +00:00
Pickup sounds for potions, repair, gold, lights, rings
This commit is contained in:
parent
34e18df0fe
commit
7c1475b723
8 changed files with 88 additions and 0 deletions
|
@ -79,11 +79,25 @@ namespace MWClass
|
|||
|
||||
std::string Clothing::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->data.type == 8)
|
||||
{
|
||||
return std::string("Item Ring Up");
|
||||
}
|
||||
return std::string("Item Clothes Up");
|
||||
}
|
||||
|
||||
std::string Clothing::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Clothing, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Clothing>();
|
||||
|
||||
if (ref->base->data.type == 8)
|
||||
{
|
||||
return std::string("Item Ring Down");
|
||||
}
|
||||
return std::string("Item Clothes Down");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,8 @@ namespace MWClass
|
|||
if (!(ref->base->data.flags & ESM::Light::Carry))
|
||||
return boost::shared_ptr<MWWorld::Action> (new MWWorld::NullAction);
|
||||
|
||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
}
|
||||
|
@ -100,4 +102,14 @@ namespace MWClass
|
|||
|
||||
registerClass (typeid (ESM::Light).name(), instance);
|
||||
}
|
||||
|
||||
std::string Light::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return std::string("Item Misc Up");
|
||||
}
|
||||
|
||||
std::string Light::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return std::string("Item Misc Down");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,12 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return the pick up sound Id
|
||||
|
||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return the put down sound Id
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -79,11 +79,25 @@ namespace MWClass
|
|||
|
||||
std::string Miscellaneous::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
if (ref->base->name =="Gold")
|
||||
{
|
||||
return std::string("Item Gold Up");
|
||||
}
|
||||
return std::string("Item Misc Up");
|
||||
}
|
||||
|
||||
std::string Miscellaneous::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
ESMS::LiveCellRef<ESM::Miscellaneous, MWWorld::RefData> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
|
||||
if (ref->base->name =="Gold")
|
||||
{
|
||||
return std::string("Item Gold Down");
|
||||
}
|
||||
return std::string("Item Misc Down");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Potion::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -53,6 +56,8 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Potion::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||
{
|
||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
}
|
||||
|
@ -71,4 +76,14 @@ namespace MWClass
|
|||
|
||||
registerClass (typeid (ESM::Potion).name(), instance);
|
||||
}
|
||||
|
||||
std::string Potion::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return std::string("Item Potion Up");
|
||||
}
|
||||
|
||||
std::string Potion::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return std::string("Item Potion Down");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return the pick up sound Id
|
||||
|
||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return the put down sound Id
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,12 @@
|
|||
|
||||
#include "../mwworld/ptr.hpp"
|
||||
#include "../mwworld/actiontake.hpp"
|
||||
#include "../mwworld/environment.hpp"
|
||||
|
||||
#include "../mwrender/objects.hpp"
|
||||
|
||||
#include "../mwsound/soundmanager.hpp"
|
||||
|
||||
namespace MWClass
|
||||
{
|
||||
void Repair::insertObjectRendering (const MWWorld::Ptr& ptr, MWRender::RenderingInterface& renderingInterface) const
|
||||
|
@ -53,6 +56,8 @@ namespace MWClass
|
|||
boost::shared_ptr<MWWorld::Action> Repair::activate (const MWWorld::Ptr& ptr,
|
||||
const MWWorld::Ptr& actor, const MWWorld::Environment& environment) const
|
||||
{
|
||||
environment.mSoundManager->playSound3D (ptr, getUpSoundId(ptr), 1.0, 1.0, false, true);
|
||||
|
||||
return boost::shared_ptr<MWWorld::Action> (
|
||||
new MWWorld::ActionTake (ptr));
|
||||
}
|
||||
|
@ -71,4 +76,14 @@ namespace MWClass
|
|||
|
||||
registerClass (typeid (ESM::Repair).name(), instance);
|
||||
}
|
||||
|
||||
std::string Repair::getUpSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return std::string("Item Repair Up");
|
||||
}
|
||||
|
||||
std::string Repair::getDownSoundId (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
return std::string("Item Repair Down");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,12 @@ namespace MWClass
|
|||
///< Return name of the script attached to ptr
|
||||
|
||||
static void registerSelf();
|
||||
|
||||
virtual std::string getUpSoundId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return the pick up sound Id
|
||||
|
||||
virtual std::string getDownSoundId (const MWWorld::Ptr& ptr) const;
|
||||
///< Return the put down sound Id
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue