mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:53:50 +00:00
Play player sounds (except footsteps) local to the listener
This commit is contained in:
parent
82f3651f81
commit
5f8a09df97
3 changed files with 24 additions and 12 deletions
|
@ -38,15 +38,17 @@ namespace MWBase
|
||||||
played by the PlayLoopSound family of script functions. Perhaps we
|
played by the PlayLoopSound family of script functions. Perhaps we
|
||||||
can make this cut off a more subtle fade later, but have to
|
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. */
|
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_LoopNoEnv = Play_Loop | Play_NoEnv,
|
||||||
Play_LoopRemoveAtDistance = Play_Loop | Play_RemoveAtDistance
|
Play_LoopRemoveAtDistance = Play_Loop | Play_RemoveAtDistance
|
||||||
};
|
};
|
||||||
enum PlayType {
|
enum PlayType {
|
||||||
Play_TypeSfx = 1<<3, /* Normal SFX sound */
|
Play_TypeSfx = 1<<4, /* Normal SFX sound */
|
||||||
Play_TypeVoice = 1<<4, /* Voice sound */
|
Play_TypeVoice = 1<<5, /* Voice sound */
|
||||||
Play_TypeFoot = 1<<5, /* Footstep sound */
|
Play_TypeFoot = 1<<6, /* Footstep sound */
|
||||||
Play_TypeMusic = 1<<6, /* Music track */
|
Play_TypeMusic = 1<<7, /* Music track */
|
||||||
Play_TypeMovie = 1<<7, /* Movie audio track */
|
Play_TypeMovie = 1<<8, /* Movie audio track */
|
||||||
Play_TypeMask = Play_TypeSfx|Play_TypeVoice|Play_TypeFoot|Play_TypeMusic|Play_TypeMovie
|
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())
|
if(!sound.empty())
|
||||||
{
|
{
|
||||||
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
|
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)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,6 +517,11 @@ namespace MWSound
|
||||||
if((mode&Play_RemoveAtDistance) && (mListenerPos-objpos).length2() > 2000*2000)
|
if((mode&Play_RemoveAtDistance) && (mListenerPos-objpos).length2() > 2000*2000)
|
||||||
return MWBase::SoundPtr();
|
return MWBase::SoundPtr();
|
||||||
|
|
||||||
|
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,
|
sound = mOutput->playSound3D(sfx->mHandle,
|
||||||
objpos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist,
|
objpos, volume * sfx->mVolume, basevol, pitch, sfx->mMinDist, sfx->mMaxDist,
|
||||||
mode|type|Play_3D, offset
|
mode|type|Play_3D, offset
|
||||||
|
|
Loading…
Reference in a new issue