Made the bonus speed given for a skidding boost configurable (the values
were for bonuses were changed, but are still not considered to be tweaked). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@10963 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
bdac17c748
commit
288f43d481
@ -183,8 +183,8 @@
|
||||
which is used to reduce the turn angle used to reduce the turn angle. -->
|
||||
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
|
||||
visual="1.0" visual-time="0"
|
||||
time-till-bonus="1.5 2.5"
|
||||
bonus-speed="100 200" bonus-time="3.0 4.0"
|
||||
time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
post-skid-rotate-factor="1" reduce-turn-min="0.3"
|
||||
reduce-turn-max="0.8"/>
|
||||
|
||||
|
@ -1338,15 +1338,9 @@ void Kart::handleZipper(const Material *material, bool play_sound)
|
||||
// Ignore a zipper that's activated while braking
|
||||
if(m_controls.m_brake || m_speed<0) return;
|
||||
|
||||
MaxSpeed::increaseMaxSpeed(MaxSpeed::MS_INCREASE_ZIPPER,
|
||||
max_speed_increase, duration, fade_out_time);
|
||||
// This will result in all max speed settings updated, but no
|
||||
// changes to any slow downs since dt=0
|
||||
MaxSpeed::update(0);
|
||||
float speed = std::min(m_speed + speed_gain,
|
||||
MaxSpeed::getCurrentMaxSpeed() );
|
||||
|
||||
m_vehicle->activateZipper(speed);
|
||||
MaxSpeed::instantSpeedIncrease(MaxSpeed::MS_INCREASE_ZIPPER,
|
||||
max_speed_increase, speed_gain,
|
||||
duration, fade_out_time);
|
||||
// Play custom character sound (weee!)
|
||||
playCustomSFX(SFXManager::CUSTOM_ZIPPER);
|
||||
m_controller->handleZipper(play_sound);
|
||||
@ -1611,10 +1605,9 @@ void Kart::updatePhysics(float dt)
|
||||
{
|
||||
m_has_started = true;
|
||||
float f = m_kart_properties->getStartupBoost();
|
||||
if(f>0)
|
||||
m_vehicle->activateZipper(f);
|
||||
MaxSpeed::increaseMaxSpeed(MS_INCREASE_ZIPPER, 0.9f*f,
|
||||
5.0f, 5.0f);
|
||||
MaxSpeed::instantSpeedIncrease(MS_INCREASE_ZIPPER, 0.9f*f,
|
||||
f, /*duration*/5.0f,
|
||||
/*fade_out_time*/5.0f);
|
||||
}
|
||||
|
||||
m_bounce_back_time-=dt;
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "karts/kart.hpp"
|
||||
#include "physics/btKart.hpp"
|
||||
|
||||
/** This class handles maximum speed for karts. Several factors can influence
|
||||
* the maximum speed a kart can drive, some will decrease the maximum speed,
|
||||
@ -89,6 +90,35 @@ void MaxSpeed::increaseMaxSpeed(unsigned int category, float add_speed,
|
||||
m_speed_increase[category].m_current_speedup = add_speed;
|
||||
} // increaseMaxSpeed
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** This adjusts the top speed using increaseMaxSpeed, but additionally
|
||||
* causes an instant speed boost, which can be smaller than add-max-speed.
|
||||
* (e.g. a zipper can give an instant boost of 5 m/s, but over time would
|
||||
* allow the speed to go up by 10 m/s). Note that bullet does not restrict
|
||||
* speed (e.g. by simulating air resistance), so without capping the speed
|
||||
* (which is done my this object) the speed would go arbitrary high over time
|
||||
* \param category The category for which the speed is increased.
|
||||
* \param add_max_speed Increase of the maximum allowed speed.
|
||||
* \param speed_boost An instant speed increase for this kart.
|
||||
* \param duration Duration of the increased speed.
|
||||
* \param fade_out_time How long the maximum speed will fade out linearly.
|
||||
*/
|
||||
void MaxSpeed::instantSpeedIncrease(unsigned int category,
|
||||
float add_max_speed, float speed_boost,
|
||||
float duration, float fade_out_time)
|
||||
{
|
||||
increaseMaxSpeed(category, add_max_speed, duration, fade_out_time);
|
||||
// This will result in all max speed settings updated, but no
|
||||
// changes to any slow downs since dt=0
|
||||
update(0);
|
||||
float speed = std::min(m_kart->getSpeed()+ speed_boost,
|
||||
MaxSpeed::getCurrentMaxSpeed() );
|
||||
|
||||
m_kart->getVehicle()->instantSpeedIncreaseTo(speed);
|
||||
|
||||
}
|
||||
// instantSpeedIncrease
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Handles the update of speed increase objects. The m_duration variable
|
||||
* contains the remaining time - as long as this variable is positive
|
||||
|
@ -129,6 +129,9 @@ public:
|
||||
|
||||
void increaseMaxSpeed(unsigned int category, float add_speed,
|
||||
float duration, float fade_out_time);
|
||||
void instantSpeedIncrease(unsigned int category,
|
||||
float add_speed, float speed_boost,
|
||||
float duration, float fade_out_time=1.0f);
|
||||
void setSlowdown(unsigned int category, float max_speed_fraction,
|
||||
float fade_in_time);
|
||||
float getSpeedIncreaseTimeLeft(unsigned int category);
|
||||
|
@ -170,9 +170,9 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
case SKID_ACCUMULATE_RIGHT:
|
||||
{
|
||||
m_skid_time += dt;
|
||||
float bonus_time, bonus_force;
|
||||
float bonus_time, bonus_speed;
|
||||
unsigned int level = getSkidBonus(&bonus_time,
|
||||
&bonus_force);
|
||||
&bonus_speed);
|
||||
// If at least level 1 bonus is reached, show appropriate gfx
|
||||
if(level>0) m_kart->getKartGFX()->setSkidLevel(level);
|
||||
// If player stops skidding, trigger bonus, and change state to
|
||||
@ -192,12 +192,13 @@ void Skidding::update(float dt, bool is_on_ground,
|
||||
m_skid_time = t;
|
||||
if(bonus_time>0)
|
||||
{
|
||||
m_kart->MaxSpeed::increaseMaxSpeed(
|
||||
MaxSpeed::MS_INCREASE_SKIDDING, 10, bonus_time, 1);
|
||||
m_kart->getKartGFX()
|
||||
->setCreationRateRelative(KartGFX::KGFX_SKID, 1.0f);
|
||||
// FIXME hiker: for now just misuse the zipper code
|
||||
m_kart->handleZipper(0);
|
||||
m_kart->MaxSpeed::
|
||||
instantSpeedIncrease(MaxSpeed::MS_INCREASE_SKIDDING,
|
||||
bonus_speed, bonus_speed,
|
||||
bonus_time,
|
||||
/*fade-out-time*/ 1.0f);
|
||||
}
|
||||
else
|
||||
m_kart->getKartGFX()
|
||||
|
@ -909,18 +909,12 @@ void btKart::setSliding(bool active)
|
||||
* specified speed.
|
||||
* \param speed The speed to reach.
|
||||
*/
|
||||
void btKart::activateZipper(float speed)
|
||||
void btKart::instantSpeedIncreaseTo(float speed)
|
||||
{
|
||||
m_zipper_active = true;
|
||||
m_zipper_velocity = speed;
|
||||
} // activateZipper
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void btKart::deactivateZipper()
|
||||
{
|
||||
m_zipper_active = false;
|
||||
} // deactivateZipper
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
//Shorter version of above raycast function. This is used when projecting
|
||||
//vehicles towards the ground at the start of a race
|
||||
|
@ -167,8 +167,7 @@ public:
|
||||
virtual void updateFriction(btScalar timeStep);
|
||||
public:
|
||||
void setSliding(bool active);
|
||||
void activateZipper(float speed);
|
||||
void deactivateZipper();
|
||||
void instantSpeedIncreaseTo(float speed);
|
||||
bool projectVehicleToSurface(const btVector3& ray,
|
||||
bool translate_vehicle);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user