Fixed issue with sound which was starting in a loop

This commit is contained in:
Deve 2014-09-25 19:57:35 +02:00
parent 57c14f2c07
commit babe9b0023
2 changed files with 11 additions and 2 deletions

View File

@ -92,6 +92,7 @@ void PlayerController::reset()
m_prev_brake = 0; m_prev_brake = 0;
m_prev_accel = 0; m_prev_accel = 0;
m_prev_nitro = false; m_prev_nitro = false;
m_sound_schedule = false;
m_penalty_time = 0; m_penalty_time = 0;
} // reset } // reset
@ -108,6 +109,7 @@ void PlayerController::resetInputState()
m_prev_brake = 0; m_prev_brake = 0;
m_prev_accel = 0; m_prev_accel = 0;
m_prev_nitro = false; m_prev_nitro = false;
m_sound_schedule = false;
m_controls->reset(); m_controls->reset();
} // resetInputState } // resetInputState
@ -378,14 +380,20 @@ void PlayerController::update(float dt)
// Only accept rescue if there is no kart animation is already playing // Only accept rescue if there is no kart animation is already playing
// (e.g. if an explosion happens, wait till the explosion is over before // (e.g. if an explosion happens, wait till the explosion is over before
// starting any other animation). // starting any other animation).
if ( m_controls->m_rescue && !m_kart->getKartAnimation() ) if (m_controls->m_rescue && !m_kart->getKartAnimation())
{ {
new RescueAnimation(m_kart); new RescueAnimation(m_kart);
m_controls->m_rescue=false; m_controls->m_rescue=false;
} }
if (m_kart->getKartAnimation() &&
if (m_kart->getKartAnimation() && m_sound_schedule == false &&
m_kart->getAttachment()->getType() != Attachment::ATTACH_TINYTUX) m_kart->getAttachment()->getType() != Attachment::ATTACH_TINYTUX)
{ {
m_sound_schedule = true;
}
else if (!m_kart->getKartAnimation() && m_sound_schedule == true)
{
m_sound_schedule = false;
m_bzzt_sound->play(); m_bzzt_sound->play();
} }
} // update } // update

View File

@ -40,6 +40,7 @@ private:
int m_prev_accel; int m_prev_accel;
bool m_prev_brake; bool m_prev_brake;
bool m_prev_nitro; bool m_prev_nitro;
bool m_sound_schedule;
float m_penalty_time; float m_penalty_time;