mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
Track whether a sound is 3D
This commit is contained in:
parent
fc912b135f
commit
8b7587f9a6
3 changed files with 12 additions and 4 deletions
|
@ -43,6 +43,7 @@ namespace MWSound
|
|||
MWBase::SoundManager::PlayType getPlayType() const
|
||||
{ return (MWBase::SoundManager::PlayType)(mFlags&MWBase::SoundManager::Play_TypeMask); }
|
||||
bool getDistanceCull() const { return mFlags&MWBase::SoundManager::Play_RemoveAtDistance; }
|
||||
bool getIs3D() const { return mFlags&Play_3D; }
|
||||
|
||||
Sound(const osg::Vec3f& pos, float vol, float basevol, float pitch, float mindist, float maxdist, int flags)
|
||||
: mPos(pos)
|
||||
|
|
|
@ -483,7 +483,7 @@ namespace MWSound
|
|||
float basevol = volumeFromType(type);
|
||||
|
||||
sound = mOutput->playSound(sfx->mHandle,
|
||||
volume * sfx->mVolume, basevol, pitch, mode|type, offset
|
||||
volume * sfx->mVolume, basevol, pitch, mode|type|Play_2D, offset
|
||||
);
|
||||
if(sfx->mUses++ == 0)
|
||||
{
|
||||
|
@ -518,7 +518,8 @@ namespace MWSound
|
|||
return MWBase::SoundPtr();
|
||||
|
||||
sound = mOutput->playSound3D(sfx->mHandle,
|
||||
objpos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist, mode|type, offset
|
||||
objpos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist,
|
||||
mode|type|Play_3D, offset
|
||||
);
|
||||
if(sfx->mUses++ == 0)
|
||||
{
|
||||
|
@ -548,7 +549,8 @@ namespace MWSound
|
|||
float basevol = volumeFromType(type);
|
||||
|
||||
sound = mOutput->playSound3D(sfx->mHandle,
|
||||
initialPos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist, mode|type, offset
|
||||
initialPos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist,
|
||||
mode|type|Play_3D, offset
|
||||
);
|
||||
if(sfx->mUses++ == 0)
|
||||
{
|
||||
|
@ -822,7 +824,7 @@ namespace MWSound
|
|||
|
||||
bool SoundManager::updateSound(MWBase::SoundPtr sound, const MWWorld::Ptr& ptr, float duration)
|
||||
{
|
||||
if(!ptr.isEmpty())
|
||||
if(!ptr.isEmpty() && sound->getIs3D())
|
||||
{
|
||||
const ESM::Position &pos = ptr.getRefData().getPosition();
|
||||
const osg::Vec3f objpos(pos.asVec3());
|
||||
|
|
|
@ -34,6 +34,11 @@ namespace MWSound
|
|||
Env_Normal,
|
||||
Env_Underwater
|
||||
};
|
||||
// Extra play flags, not intended for caller use
|
||||
enum PlayModeEx {
|
||||
Play_2D = 0,
|
||||
Play_3D = 1<<31
|
||||
};
|
||||
|
||||
class SoundManager : public MWBase::SoundManager
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue