Properly reset skidding when a kart is rescued or explodes.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11583 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
e64ce8d6f3
commit
ba1fd13a2a
@ -182,6 +182,10 @@ public:
|
||||
* skidding related values). */
|
||||
virtual const Skidding *getSkidding() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the skidding object for this kart (which can be used to query
|
||||
* skidding related values), non-const. */
|
||||
virtual Skidding *getSkidding() = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if the kart is eliminated. */
|
||||
virtual bool isEliminated() const = 0;
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "karts/abstract_kart_animation.hpp"
|
||||
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "physics/physics.hpp"
|
||||
|
||||
@ -46,6 +47,7 @@ AbstractKartAnimation::AbstractKartAnimation(AbstractKart *kart,
|
||||
// later).
|
||||
kart->setKartAnimation(this);
|
||||
World::getWorld()->getPhysics()->removeKart(m_kart);
|
||||
kart->getSkidding()->reset();
|
||||
} // AbstractKartAnimation
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -39,6 +39,8 @@ ExplosionAnimation *ExplosionAnimation::create(AbstractKart *kart,
|
||||
if(kart->isInvulnerable()) return NULL;
|
||||
|
||||
float r = kart->getKartProperties()->getExplosionRadius();
|
||||
|
||||
// Ignore explosion that are too far away.
|
||||
if(!direct_hit && pos.distance2(kart->getXYZ())>r*r) return NULL;
|
||||
|
||||
return new ExplosionAnimation(kart, pos, direct_hit);
|
||||
@ -61,7 +63,6 @@ ExplosionAnimation::ExplosionAnimation(AbstractKart *kart,
|
||||
: AbstractKartAnimation(kart, "ExplosionAnimation")
|
||||
{
|
||||
m_xyz = m_kart->getXYZ();
|
||||
// Ignore explosion that are too far away.
|
||||
|
||||
m_kart->playCustomSFX(SFXManager::CUSTOM_EXPLODE);
|
||||
m_timer = m_kart->getKartProperties()->getExplosionTime();
|
||||
|
@ -346,6 +346,10 @@ public:
|
||||
* skidding related values). */
|
||||
virtual const Skidding *getSkidding() const { return m_skidding; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the skidding object for this kart (which can be used to query
|
||||
* skidding related values) - non-const. */
|
||||
virtual Skidding *getSkidding() { return m_skidding; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the bullet vehicle which represents this kart. */
|
||||
virtual btKart *getVehicle () const {return m_vehicle; }
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -71,6 +71,7 @@ void Skidding::reset()
|
||||
m_gfx_jump_offset = 0.0f;
|
||||
m_remaining_jump_time = 0.0f;
|
||||
m_jump_speed = 0.0f;
|
||||
m_kart->getKartGFX()->setCreationRateAbsolute(KartGFX::KGFX_SKID, 0);
|
||||
} // reset
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user