Use has_animation_before to avoid immediately rescue from previous material

This commit is contained in:
Benau 2018-07-08 16:23:39 +08:00
parent 35e2916981
commit 8a25edf2cc

View File

@ -1558,7 +1558,7 @@ void Kart::update(int ticks)
Track::getCurrentTrack()->getAABB(&min, &max); Track::getCurrentTrack()->getAABB(&min, &max);
if((min->getY() - getXYZ().getY() > 17 || dist_to_sector > 25) && !m_flying && if((min->getY() - getXYZ().getY() > 17 || dist_to_sector > 25) && !m_flying &&
!getKartAnimation()) !has_animation_before)
{ {
new RescueAnimation(this); new RescueAnimation(this);
m_last_factor_engine_sound = 0.0f; m_last_factor_engine_sound = 0.0f;
@ -1579,7 +1579,7 @@ void Kart::update(int ticks)
} }
body->setGravity(gravity); body->setGravity(gravity);
} // if !flying } // if !flying
if (material->isDriveReset() && isOnGround()) if (!has_animation_before && material->isDriveReset() && isOnGround())
{ {
new RescueAnimation(this); new RescueAnimation(this);
m_last_factor_engine_sound = 0.0f; m_last_factor_engine_sound = 0.0f;
@ -1610,7 +1610,7 @@ void Kart::update(int ticks)
ItemManager::get()->checkItemHit(this); ItemManager::get()->checkItemHit(this);
const bool emergency = getKartAnimation()!=NULL; const bool emergency = has_animation_before;
if (emergency) if (emergency)
{ {
@ -1628,7 +1628,7 @@ void Kart::update(int ticks)
// is rescued isOnGround might still be true, since the kart rigid // is rescued isOnGround might still be true, since the kart rigid
// body was removed from the physics, but still retain the old // body was removed from the physics, but still retain the old
// values for the raycasts). // values for the raycasts).
if (!isOnGround() && !getKartAnimation()) if (!isOnGround() && !has_animation_before)
{ {
const Material *m = getMaterial(); const Material *m = getMaterial();
const Material *last_m = getLastMaterial(); const Material *last_m = getLastMaterial();
@ -1663,7 +1663,7 @@ void Kart::update(int ticks)
m_is_jumping = false; m_is_jumping = false;
m_kart_model->setAnimation(KartModel::AF_DEFAULT); m_kart_model->setAnimation(KartModel::AF_DEFAULT);
if (!getKartAnimation()) if (!has_animation_before)
{ {
HitEffect *effect = new Explosion(getXYZ(), "jump", HitEffect *effect = new Explosion(getXYZ(), "jump",
"jump_explosion.xml"); "jump_explosion.xml");