Added a minimum skidding speed (below which a kart can't skid),

which also fixes #716.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11759 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-10-25 06:03:59 +00:00
parent 8a66199676
commit bbf071aec5
4 changed files with 14 additions and 3 deletions

View File

@ -185,6 +185,8 @@
revert-visual-time: how long it takes when stopping a skid to revert
the visual skid and bring visuals and physics in sync again.
angular-velocity: Angular velocity to be used for the kart when skidding.
min-speed: Minimum speed a kart must have before it can skid. Must be
>0, otherwise the kart can skid at the start of the race.
time-till-bonus: How long a kart needs to skid in order to get a bonus.
bonus-force: A speedup applied to the kart whick skidded for a while.
bonus-time: How long the bonus-force is applied.
@ -207,7 +209,7 @@
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
time-till-bonus="1.0 3.0"
min-speed="10" time-till-bonus="1.0 3.0"
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
bonus-force="250 350"
physical-jump-time="0" graphical-jump-time="0.4"

View File

@ -199,6 +199,7 @@ void Skidding::update(float dt, bool is_on_ground,
if (is_on_ground)
{
if((fabs(steering) > 0.001f) &&
m_kart->getSpeed()>m_min_skid_speed &&
(skidding==KartControl::SC_LEFT||skidding==KartControl::SC_RIGHT))
{
m_skid_factor += m_skid_increase *dt/m_time_till_max_skid;
@ -268,8 +269,10 @@ void Skidding::update(float dt, bool is_on_ground,
skidding!=KartControl::SC_RIGHT)
break;
// Don't allow skidding while the kart is (apparently)
// still in the air.
if(m_remaining_jump_time>0) break;
// still in the air, or when the kart is too slow
if(m_remaining_jump_time>0 ||
m_kart->getSpeed() <m_min_skid_speed) break;
m_skid_state = skidding==KartControl::SC_RIGHT
? SKID_ACCUMULATE_RIGHT
: SKID_ACCUMULATE_LEFT;

View File

@ -38,6 +38,7 @@ SkiddingProperties::SkiddingProperties()
m_skid_reduce_turn_max = UNDEFINED;
m_physical_jump_time = UNDEFINED;
m_graphical_jump_time = UNDEFINED;
m_min_skid_speed = UNDEFINED;
m_has_skidmarks = true;
m_skid_bonus_time.clear();
@ -66,6 +67,7 @@ void SkiddingProperties::load(const XMLNode *skid_node)
skid_node->get("bonus-force", &m_skid_bonus_force );
skid_node->get("physical-jump-time", &m_physical_jump_time );
skid_node->get("graphical-jump-time", &m_graphical_jump_time );
skid_node->get("min-speed", &m_min_skid_speed );
} // load
// ----------------------------------------------------------------------------
@ -87,6 +89,7 @@ void SkiddingProperties::checkAllSet(const std::string &filename) const
CHECK_NEG(m_skid_reduce_turn_max, "skid reduce-turn-max" );
CHECK_NEG(m_physical_jump_time, "skid physical-jump-time" );
CHECK_NEG(m_graphical_jump_time, "skid graphical-jump-time" );
CHECK_NEG(m_min_skid_speed, "skid min-speed" );
if(m_skid_time_till_bonus.size()==0)
fprintf(stderr, "Warning: no skid time declared, can be ignored.\n");

View File

@ -75,6 +75,9 @@ protected:
* feel better). */
float m_post_skid_rotate_factor;
/*** Minimum speed a kart must have before it can skid. */
float m_min_skid_speed;
/** Time of skidding before you get a bonus boost. It's possible to
* define more than one time, i.e. longer skidding gives more bonus. */
std::vector<float> m_skid_time_till_bonus;