Partially fixed #886.

There is still an issue when the kart doesn't move. Function isInRest doesn't work well in this case.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14170 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
deveee 2013-09-28 21:53:47 +00:00
parent 351e75a9e8
commit b1c375528e

View File

@ -1405,6 +1405,21 @@ void Kart::handleMaterialSFX(const Material *material)
m_terrain_sound = NULL;
}
}
if(m_terrain_sound)
{
if((m_flying || dynamic_cast<RescueAnimation*>(getKartAnimation())) &&
m_terrain_sound->getStatus()!=SFXManager::SFX_PAUSED)
{
m_terrain_sound->pause();
}
else if(m_terrain_sound->getStatus()==SFXManager::SFX_PAUSED &&
!m_flying && !dynamic_cast<RescueAnimation*>(getKartAnimation()))
{
m_terrain_sound->resume();
}
}
if(m_previous_terrain_sound &&
m_previous_terrain_sound->getStatus()==SFXManager::SFX_STOPPED)
{
@ -1417,9 +1432,7 @@ void Kart::handleMaterialSFX(const Material *material)
// terrain sound is not necessarily a looping sound so check its status before
// setting its speed, to avoid 'ressuscitating' sounds that had already stopped
if(m_terrain_sound
&& (m_terrain_sound->getStatus() == SFXManager::SFX_PLAYING
|| m_terrain_sound->getStatus() == SFXManager::SFX_PAUSED))
if(m_terrain_sound && m_terrain_sound->getStatus()==SFXManager::SFX_PLAYING)
{
m_terrain_sound->position(getXYZ());
material->setSFXSpeed(m_terrain_sound, m_speed);