mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-25 15:35:23 +00:00
Play player sounds (except footsteps) local to the listener
This commit is contained in:
parent
82f3651f81
commit
5f8a09df97
@ -38,15 +38,17 @@ namespace MWBase
|
||||
played by the PlayLoopSound family of script functions. Perhaps we
|
||||
can make this cut off a more subtle fade later, but have to
|
||||
be careful to not change the overall volume of areas by too much. */
|
||||
Play_NoPlayerLocal = 1<<3, /* (3D only) Don't play the sound local to the listener even if the
|
||||
player is making it. */
|
||||
Play_LoopNoEnv = Play_Loop | Play_NoEnv,
|
||||
Play_LoopRemoveAtDistance = Play_Loop | Play_RemoveAtDistance
|
||||
};
|
||||
enum PlayType {
|
||||
Play_TypeSfx = 1<<3, /* Normal SFX sound */
|
||||
Play_TypeVoice = 1<<4, /* Voice sound */
|
||||
Play_TypeFoot = 1<<5, /* Footstep sound */
|
||||
Play_TypeMusic = 1<<6, /* Music track */
|
||||
Play_TypeMovie = 1<<7, /* Movie audio track */
|
||||
Play_TypeSfx = 1<<4, /* Normal SFX sound */
|
||||
Play_TypeVoice = 1<<5, /* Voice sound */
|
||||
Play_TypeFoot = 1<<6, /* Footstep sound */
|
||||
Play_TypeMusic = 1<<7, /* Music track */
|
||||
Play_TypeMovie = 1<<8, /* Movie audio track */
|
||||
Play_TypeMask = Play_TypeSfx|Play_TypeVoice|Play_TypeFoot|Play_TypeMusic|Play_TypeMovie
|
||||
};
|
||||
|
||||
|
@ -777,10 +777,15 @@ void CharacterController::handleTextKey(const std::string &groupname, const std:
|
||||
if(!sound.empty())
|
||||
{
|
||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
||||
MWBase::SoundManager::PlayType type = MWBase::SoundManager::Play_TypeSfx;
|
||||
if(evt.compare(10, evt.size()-10, "left") == 0 || evt.compare(10, evt.size()-10, "right") == 0 || evt.compare(10, evt.size()-10, "land") == 0)
|
||||
type = MWBase::SoundManager::Play_TypeFoot;
|
||||
sndMgr->playSound3D(mPtr, sound, volume, pitch, type);
|
||||
{
|
||||
// Don't make foot sounds local for the player, it makes sense to keep them
|
||||
// positioned on the ground.
|
||||
sndMgr->playSound3D(mPtr, sound, volume, pitch, MWBase::SoundManager::Play_TypeFoot,
|
||||
MWBase::SoundManager::Play_NoPlayerLocal);
|
||||
}
|
||||
else
|
||||
sndMgr->playSound3D(mPtr, sound, volume, pitch);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -517,10 +517,15 @@ namespace MWSound
|
||||
if((mode&Play_RemoveAtDistance) && (mListenerPos-objpos).length2() > 2000*2000)
|
||||
return MWBase::SoundPtr();
|
||||
|
||||
sound = mOutput->playSound3D(sfx->mHandle,
|
||||
objpos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist,
|
||||
mode|type|Play_3D, offset
|
||||
);
|
||||
if(!(mode&Play_NoPlayerLocal) && ptr == MWMechanics::getPlayer())
|
||||
sound = mOutput->playSound(sfx->mHandle,
|
||||
volume * sfx->mVolume, basevol, pitch, mode|type|Play_2D, offset
|
||||
);
|
||||
else
|
||||
sound = mOutput->playSound3D(sfx->mHandle,
|
||||
objpos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist,
|
||||
mode|type|Play_3D, offset
|
||||
);
|
||||
if(sfx->mUses++ == 0)
|
||||
{
|
||||
SoundList::iterator iter = std::find(mUnusedBuffers.begin(), mUnusedBuffers.end(), sfx);
|
||||
|
Loading…
x
Reference in New Issue
Block a user