Smooth rotating when skidding was stopped.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14310 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
c04396e1c1
commit
6dd109dab0
@ -115,6 +115,16 @@ void Skidding::updateSteering(float steer, float dt)
|
||||
m_visual_rotation = f;
|
||||
}
|
||||
break;
|
||||
case SKID_BREAK:
|
||||
m_real_steering = steer;
|
||||
if (m_visual_rotation > 0.05f) m_visual_rotation -= 0.05;
|
||||
else if (m_visual_rotation < -0.05f) m_visual_rotation += 0.05;
|
||||
else
|
||||
{
|
||||
m_visual_rotation = 0;
|
||||
reset();
|
||||
}
|
||||
break;
|
||||
case SKID_ACCUMULATE_RIGHT:
|
||||
{
|
||||
float f = (1.0f+steer)*0.5f; // map [-1,1] --> [0, 1]
|
||||
@ -139,6 +149,8 @@ void Skidding::updateSteering(float steer, float dt)
|
||||
m_visual_rotation = m_skid_visual * m_real_steering;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
} // switch m_skid_state
|
||||
|
||||
} // updateSteering
|
||||
@ -160,6 +172,7 @@ float Skidding::getSteeringWhenSkidding(float steering) const
|
||||
case SKID_OLD: assert(false); break;
|
||||
case SKID_SHOW_GFX_LEFT:
|
||||
case SKID_SHOW_GFX_RIGHT:
|
||||
case SKID_BREAK:
|
||||
case SKID_NONE: return steering;
|
||||
break;
|
||||
case SKID_ACCUMULATE_RIGHT:
|
||||
@ -201,7 +214,9 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
// No skidding backwards or while stopped
|
||||
if(m_kart->getSpeed() < 0.001f)
|
||||
{
|
||||
reset();
|
||||
m_skid_state = SKID_BREAK;
|
||||
m_kart->getKartGFX()->setCreationRateAbsolute(KartGFX::KGFX_SKIDL, 0);
|
||||
m_kart->getKartGFX()->setCreationRateAbsolute(KartGFX::KGFX_SKIDR, 0);
|
||||
}
|
||||
|
||||
m_skid_bonus_ready = false;
|
||||
@ -337,6 +352,11 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
#endif
|
||||
m_skid_time = 0; // fallthrough
|
||||
}
|
||||
case SKID_BREAK:
|
||||
{
|
||||
updateSteering(steering, dt);
|
||||
break;
|
||||
}
|
||||
case SKID_ACCUMULATE_LEFT:
|
||||
case SKID_ACCUMULATE_RIGHT:
|
||||
{
|
||||
|
@ -81,10 +81,11 @@ public:
|
||||
* SKID_ACCUMULATE_RIGHT: Similar for turning right
|
||||
* SKID_SHOW_GFX_LEFT: Shows the gfx, while the bonus is active,
|
||||
* and the kart was turning left.
|
||||
* SKID_SHOW_GFX_RIGHT: Similar for turning right. */
|
||||
* SKID_SHOW_GFX_RIGHT: Similar for turning right.
|
||||
* SKID_BREAK: Skidding was stopped without bonus */
|
||||
enum SkidState {SKID_OLD, SKID_NONE, SKID_ACCUMULATE_LEFT,
|
||||
SKID_ACCUMULATE_RIGHT, SKID_SHOW_GFX_LEFT,
|
||||
SKID_SHOW_GFX_RIGHT} ;
|
||||
SKID_SHOW_GFX_RIGHT, SKID_BREAK} ;
|
||||
|
||||
private:
|
||||
/** The current skidding state. */
|
||||
|
Loading…
Reference in New Issue
Block a user