Fix annoyingly high terrain sounds in multiplayer mode

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8586 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-05-15 18:20:24 +00:00
parent c3a0007bd5
commit 424f176497

View File

@ -946,15 +946,28 @@ void Kart::handleMaterialSFX(const Material *material)
m_previous_terrain_sound->setLoop(false); m_previous_terrain_sound->setLoop(false);
const std::string s = material->getSFXName(); const std::string s = material->getSFXName();
if(s!="") if (s != "")
{ {
m_terrain_sound = sfx_manager->createSoundSource(s); m_terrain_sound = sfx_manager->createSoundSource(s);
// in multiplayer mode, sounds are NOT positional (because we have multiple listeners)
// so the sounds of all AIs would be constantly heard. So silence AI karts.
if (race_manager->getNumLocalPlayers() > 1)
{
if (!m_controller->isPlayerController())
{
m_terrain_sound->volume( 0.0f );
}
}
m_terrain_sound->play(); m_terrain_sound->play();
m_terrain_sound->setLoop(true); m_terrain_sound->setLoop(true);
} }
else else
{
m_terrain_sound = NULL; m_terrain_sound = NULL;
} }
}
if(m_previous_terrain_sound && if(m_previous_terrain_sound &&
m_previous_terrain_sound->getStatus()==SFXManager::SFX_STOPPED) m_previous_terrain_sound->getStatus()==SFXManager::SFX_STOPPED)
{ {