Fix #739: kart remains squashed when rescued etc.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11856 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-11-02 05:30:45 +00:00
parent 42761853d9
commit 2a88016c9a
2 changed files with 11 additions and 4 deletions

View File

@ -48,6 +48,11 @@ AbstractKartAnimation::AbstractKartAnimation(AbstractKart *kart,
kart->setKartAnimation(this);
World::getWorld()->getPhysics()->removeKart(m_kart);
kart->getSkidding()->reset();
if(kart->isSquashed())
{
// A time of 0 reset the squashing
kart->setSquash(0.0f, 0.0f);
}
} // AbstractKartAnimation
// ----------------------------------------------------------------------------

View File

@ -526,7 +526,8 @@ btTransform Kart::getAlignedTransform(const float custom_pitch)
: custom_pitch);
btMatrix3x3 m;
m.setEulerZYX(pitch, getHeading(), 0.0f);
m.setEulerZYX(pitch, getHeading()+m_skidding->getVisualSkidRotation(),
0.0f);
trans.setBasis(m);
return trans;
@ -966,7 +967,7 @@ void Kart::update(float dt)
m_stars_effect->update(dt);
}
if(m_squash_time>0)
if(m_squash_time>=0)
{
m_squash_time-=dt;
// If squasing time ends, reset the model
@ -1213,14 +1214,15 @@ void Kart::showZipperFire()
//-----------------------------------------------------------------------------
/** Squashes this kart: it will scale the kart in up direction, and causes
* a slowdown while this kart is squashed.
* \param time How long the kart will be squashed.
* \param time How long the kart will be squashed. A value of 0 will reset
* the kart to be unsquashed.
* \param slowdown Reduction of max speed.
*/
void Kart::setSquash(float time, float slowdown)
{
if (isInvulnerable()) return;
if(m_attachment->getType()==Attachment::ATTACH_BOMB)
if(m_attachment->getType()==Attachment::ATTACH_BOMB && time>0)
{
ExplosionAnimation::create(this);
return;