play anvil/parachute sound effects on human players (so you can hear the sound when throwing one)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2920 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2009-01-14 23:20:48 +00:00
parent 419dcd0774
commit e31386966a

View File

@ -166,7 +166,16 @@ void Powerup::use()
kart->attach(ATTACH_ANVIL, stk_config->m_anvil_time);
kart->updatedWeight();
kart->adjustSpeed(stk_config->m_anvil_speed_factor*0.5f);
m_sound_use->position(m_owner->getXYZ());
// should we position the sound at the kart that is hit,
// or the kart "throwing" the anvil? Ideally it should be both.
// Meanwhile, don't play it near AI karts since they obviously
// don't hear anything
if(kart->isPlayerKart())
m_sound_use->position(kart->getXYZ());
else
m_sound_use->position(m_owner->getXYZ());
m_sound_use->play();
break;
}
@ -193,11 +202,15 @@ void Powerup::use()
}
}
if(player_kart)
{
// should we position the sound at the kart that is hit,
// or the kart "throwing" the anvil? Ideally it should be both.
// Meanwhile, don't play it near AI karts since they obviously
// don't hear anything
if(m_owner->isPlayerKart())
m_sound_use->position(m_owner->getXYZ());
else if(player_kart)
m_sound_use->position(player_kart->getXYZ());
m_sound_use->play();
}
m_sound_use->play();
}
break;