1) Made invulnerability time after being hit configurable.

2) Bugfix: there was no invulnerabilty time if graphical
   effects were disabled. While it is not ideal that in 
   this case there is no visual indication that the kart
   is invulnerable, the game play should be consistent
   and not depend on graphics settings.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8833 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2011-06-05 12:05:40 +00:00
parent 62e60b94fc
commit 38a3ece5dd
4 changed files with 24 additions and 5 deletions

View File

@ -279,8 +279,12 @@
<!-- Kart-specific explosion parameters. Height: how high this
this kart is being pushed in the sky by an explosion.
Time: how long it takes before the kart can drive again. -->
<explosion time="2" radius="5" />
Time: how long it takes before the kart can drive again.
Invulnerability-time: how long a kart will be invulnerable
after being hit by an explosion. -->
<explosion time="2" radius="5"
invulnerability-time="6" />
<!-- Kart-specific settings used by the AI.
steering-variation: make each kart steer towards slightly
different driveline points, so that AI don't create trains.

View File

@ -172,11 +172,14 @@ void EmergencyAnimation::handleExplosion(const Vec3 &pos, bool direct_hit)
m_add_rotation.setPitch( (rand()%(2*max_rotation+1)-max_rotation)*f );
m_add_rotation.setRoll( (rand()%(2*max_rotation+1)-max_rotation)*f );
// Set invulnerable time, and graphical effects
float t = m_kart->getKartProperties()->getExplosionInvulnerabilityTime();
m_kart->setInvulnerableTime(t);
if ( UserConfigParams::m_graphical_effects )
{
m_stars_effect->showFor(6.0f);
m_kart->setInvulnerableTime(6.0f);
m_stars_effect->showFor(t);
}
m_kart->getAttachment()->clear();
} // handleExplosion

View File

@ -86,7 +86,7 @@ KartProperties::KartProperties(const std::string &filename)
m_slipstream_min_speed = m_slipstream_max_speed_increase =
m_slipstream_duration = m_slipstream_fade_out_time =
m_camera_distance = m_camera_forward_up_angle =
m_camera_backward_up_angle =
m_camera_backward_up_angle = m_explosion_invulnerability_time =
m_rescue_time = m_rescue_height = m_explosion_time =
m_explosion_radius = m_ai_steering_variation = UNDEFINED;
m_gravity_center_shift = Vec3(UNDEFINED);
@ -259,6 +259,8 @@ void KartProperties::getAllData(const XMLNode * root)
{
explosion_node->get("time", &m_explosion_time );
explosion_node->get("radius", &m_explosion_radius);
explosion_node->get("invulnerability-time",
&m_explosion_invulnerability_time);
}
if(const XMLNode *ai_node = root->getNode("ai"))
@ -596,6 +598,8 @@ void KartProperties::checkAllSet(const std::string &filename)
CHECK_NEG(m_rescue_time, "rescue time" );
CHECK_NEG(m_rescue_vert_offset, "rescue vert-offset" );
CHECK_NEG(m_explosion_time, "explosion time" );
CHECK_NEG(m_explosion_invulnerability_time,
"explosion invulnerability-time");
CHECK_NEG(m_explosion_radius, "explosion radius" );
CHECK_NEG(m_ai_steering_variation, "ai steering-variation" );

View File

@ -137,6 +137,9 @@ private:
/** How far away from an explosion karts will still be affected. */
float m_explosion_radius;
/** How long a kart is invulnerable after it is hit by an explosion. */
float m_explosion_invulnerability_time;
/** Duration a zipper is active. */
float m_zipper_time;
@ -458,6 +461,11 @@ public:
/** Returns the height of the explosion animation. */
float getExplosionRadius () const {return m_explosion_radius; }
/** Returns how long a kart is invulnerable after being hit by an
explosion. */
float getExplosionInvulnerabilityTime() const
{ return m_explosion_invulnerability_time; }
/** Returns how much a kart can roll/pitch before the upright constraint
* counteracts. */
float getUprightTolerance () const {return m_upright_tolerance; }