Commit 6ef7be3f authored by Capostrophic's avatar Capostrophic

Re-enable using soundgen land for creatures

parent 53ccce18
......@@ -1242,15 +1242,9 @@ namespace MWClass
return "";
}
// Morrowind ignores land soundgen for NPCs
if(name == "land")
{
MWBase::World *world = MWBase::Environment::get().getWorld();
osg::Vec3f pos(ptr.getRefData().getPosition().asVec3());
if (world->isUnderwater(ptr.getCell(), pos) || world->isWalkingOnWater(ptr))
return "DefaultLandWater";
return "DefaultLand";
}
return "";
if(name == "swimleft")
return "Swim Left";
if(name == "swimright")
......
......@@ -979,17 +979,13 @@ void CharacterController::handleTextKey(const std::string &groupname, const std:
}
}
if (soundgen == "land") // Morrowind ignores land soundgen for some reason
return;
std::string sound = mPtr.getClass().getSoundIdFromSndGen(mPtr, soundgen);
if(!sound.empty())
{
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
if(soundgen == "left" || soundgen == "right")
// NB: landing sound is not played for NPCs here
if(soundgen == "left" || soundgen == "right" || soundgen == "land")
{
// 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, MWSound::Type::Foot,
MWSound::PlayMode::NoPlayerLocal);
}
......@@ -2071,11 +2067,17 @@ void CharacterController::update(float duration)
}
}
// Play landing sound
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
std::string sound = cls.getSoundIdFromSndGen(mPtr, "land");
if (!sound.empty())
// Play landing sound for NPCs
if (mPtr.getClass().isNpc())
{
MWBase::SoundManager *sndMgr = MWBase::Environment::get().getSoundManager();
std::string sound = "DefaultLand";
osg::Vec3f pos(mPtr.getRefData().getPosition().asVec3());
if (world->isUnderwater(mPtr.getCell(), pos) || world->isWalkingOnWater(mPtr))
sound = "DefaultLandWater";
sndMgr->playSound3D(mPtr, sound, 1.f, 1.f, MWSound::Type::Foot, MWSound::PlayMode::NoPlayerLocal);
}
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment