1) Cleanup of unused data in stk_config/kart_properties
2) Removed 'magic' constant 0.0044 from steering computation; replaced by DEGREE_TO_RAD, which means that steering values in stk_config.data and .kart files have to be divided by about 3.9 3) Added early cancellation of parachute when a slow down of 30% is reached (defined in stk_config.data). This allows karts to brake and get rid of the parachute earlier. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1641 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
29a8b1b338
commit
fac59355c0
@ -17,6 +17,7 @@
|
||||
(parachute-friction 2.0 ) ;; friction increase when a parachute is sttached
|
||||
(parachute-time 4.0 ) ;; time an attached parachute is active
|
||||
(parachute-time-other 8.0 ) ;; time a parachute attached from other kart is active
|
||||
(parachute-done-fraction 0.7 ) ;; fraction of speed when lost will detach parachute
|
||||
(bomb-time 30.0 ) ;; time till a bomb explodes
|
||||
(bomb-time-increase -5.0 ) ;; time added to timer when bomb is passed on
|
||||
(anvil-time 2.0 ) ;; time an anvil is active
|
||||
@ -38,11 +39,6 @@
|
||||
(kart-defaults
|
||||
(wheel-base 1.2 )
|
||||
(heightCOG 0.2 )
|
||||
(engine-power 400 )
|
||||
(brake-factor 2.75)
|
||||
(brake-force 2.5 )
|
||||
(mass 125 )
|
||||
(max-steer-angle 55 )
|
||||
(time-full-steer 0.3 )
|
||||
(corn-f 4 )
|
||||
(corn-r 4 )
|
||||
@ -61,9 +57,10 @@
|
||||
(inertia 5.0 )
|
||||
|
||||
;; Bullet physics attributes
|
||||
(bullet-engine-power 400 )
|
||||
(bullet-mass 225 )
|
||||
(bullet-max-steer-angle 25 )
|
||||
(brake-factor 2.75 )
|
||||
(max-steer-angle 6.4 )
|
||||
(engine-power 400 )
|
||||
(mass 225 )
|
||||
(suspension-stiffness 8.0 )
|
||||
(wheel-damping-relaxation 2.3 )
|
||||
(wheel-damping-compression 4.4 )
|
||||
|
@ -95,6 +95,7 @@ void Attachment::hitGreenHerring()
|
||||
switch (random_attachment)
|
||||
{
|
||||
case 0: set( ATTACH_PARACHUTE, stk_config->m_parachute_time+leftover_time);
|
||||
m_initial_speed = m_kart->getSpeed();
|
||||
// if ( m_kart == m_kart[0] )
|
||||
// sound -> playSfx ( SOUND_SHOOMF ) ;
|
||||
break ;
|
||||
@ -130,7 +131,15 @@ void Attachment::update(float dt)
|
||||
|
||||
switch (m_type)
|
||||
{
|
||||
case ATTACH_PARACHUTE: // handled in Kart::updatePhysics
|
||||
case ATTACH_PARACHUTE: // Partly handled in Kart::updatePhysics
|
||||
// Otherwise: disable if a certain percantage of
|
||||
// initial speed was lost
|
||||
if(m_kart->getSpeed()<=
|
||||
m_initial_speed*stk_config->m_parachute_done_fraction)
|
||||
{
|
||||
m_time_left = -1;
|
||||
}
|
||||
break;
|
||||
case ATTACH_ANVIL: // handled in Kart::updatePhysics
|
||||
case ATTACH_NOTHING: // Nothing to do, but complete all cases for switch
|
||||
case ATTACH_MAX: break;
|
||||
|
@ -38,6 +38,7 @@ private:
|
||||
attachmentType m_type; // attachment type
|
||||
Kart *m_kart; // kart the attachment is attached to
|
||||
float m_time_left; // time left till attachment expires
|
||||
float m_initial_speed; // for parachutes only
|
||||
ssgSelector *m_holder; // where the attachment is put on the kart
|
||||
Kart *m_previous_owner; // used by bombs so that it's not passed
|
||||
// back to previous owner
|
||||
|
@ -846,7 +846,7 @@ void Kart::updatePhysics (float dt)
|
||||
getBody()->setLinearVelocity( velocity );
|
||||
|
||||
}
|
||||
const float steering = getMaxSteerAngle() * m_controls.lr * 0.00444f;
|
||||
const float steering = DEGREE_TO_RAD(getMaxSteerAngle()) * m_controls.lr;
|
||||
m_vehicle->setSteeringValue(steering, 0);
|
||||
m_vehicle->setSteeringValue(steering, 1);
|
||||
|
||||
@ -1136,7 +1136,7 @@ void Kart::placeModel ()
|
||||
sgMat4 wheel_rot;
|
||||
|
||||
sgMakeRotMat4( wheel_rot, 0, RAD_TO_DEGREE(-m_wheel_rotation), 0);
|
||||
sgMakeRotMat4( wheel_steer, getSteerAngle()/getMaxSteerAngle() * 30.0f , 0, 0);
|
||||
sgMakeRotMat4( wheel_steer, m_controls.lr * 30.0f , 0, 0);
|
||||
|
||||
sgMultMat4(wheel_front, wheel_steer, wheel_rot);
|
||||
|
||||
|
@ -186,9 +186,6 @@ public:
|
||||
float getHeightCOG () const {return m_kart_properties->getHeightCOG();}
|
||||
float getFrictionSlip () const {return m_kart_properties->getFrictionSlip();}
|
||||
float getMaxSteerAngle () const {return m_kart_properties->getMaxSteerAngle();}
|
||||
float getCornerStiffF () const {return m_kart_properties->getCornerStiffF();}
|
||||
float getCornerStiffR () const {return m_kart_properties->getCornerStiffR();}
|
||||
float getInertia () const {return m_kart_properties->getInertia(); }
|
||||
float getGravityCenterShift () const
|
||||
{return m_kart_properties->getGravityCenterShift(); }
|
||||
float getWheelieMaxSpeedRatio () const
|
||||
|
@ -134,15 +134,11 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
|
||||
|
||||
lisp->get("wheel-base", m_wheel_base);
|
||||
lisp->get("heightCOG", m_height_cog);
|
||||
lisp->get("bullet-engine-power", m_engine_power);
|
||||
lisp->get("engine-power", m_engine_power);
|
||||
lisp->get("time-full-steer", m_time_full_steer);
|
||||
lisp->get("brake-factor", m_brake_factor);
|
||||
lisp->get("bullet-mass", m_mass);
|
||||
lisp->get("tire-grip", m_tire_grip);
|
||||
lisp->get("bullet-max-steer-angle", m_max_steer_angle);
|
||||
lisp->get("corn-f", m_corn_f);
|
||||
lisp->get("corn-r", m_corn_r);
|
||||
lisp->get("inertia", m_inertia);
|
||||
lisp->get("mass", m_mass);
|
||||
lisp->get("max-steer-angle", m_max_steer_angle);
|
||||
lisp->get("wheelie-max-speed-ratio", m_wheelie_max_speed_ratio );
|
||||
lisp->get("wheelie-max-pitch", m_wheelie_max_pitch );
|
||||
lisp->get("wheelie-pitch-rate", m_wheelie_pitch_rate );
|
||||
@ -198,11 +194,7 @@ void KartProperties::init_defaults()
|
||||
m_time_full_steer = stk_config->m_time_full_steer;
|
||||
m_brake_factor = stk_config->m_brake_factor;
|
||||
m_mass = stk_config->m_mass;
|
||||
m_tire_grip = stk_config->m_tire_grip;
|
||||
m_max_steer_angle = stk_config->m_max_steer_angle;
|
||||
m_corn_f = stk_config->m_corn_f;
|
||||
m_corn_r = stk_config->m_corn_r;
|
||||
m_inertia = stk_config->m_inertia;
|
||||
m_wheelie_max_speed_ratio = stk_config->m_wheelie_max_speed_ratio;
|
||||
m_wheelie_max_pitch = stk_config->m_wheelie_max_pitch;
|
||||
m_wheelie_pitch_rate = stk_config->m_wheelie_pitch_rate;
|
||||
|
@ -57,12 +57,8 @@ protected:
|
||||
float m_height_cog; // height of center of gravity
|
||||
float m_engine_power; // maximum force from engine
|
||||
float m_brake_factor; // braking factor * engine_power = braking force
|
||||
float m_tire_grip; // grip of tires in longitudinal direction
|
||||
float m_max_steer_angle; // maximum steering angle
|
||||
float m_time_full_steer; // time for player karts to reach full steer angle
|
||||
float m_corn_f;
|
||||
float m_corn_r;
|
||||
float m_inertia;
|
||||
float m_wheelie_max_speed_ratio; // percentage of maximum speed for wheelies
|
||||
float m_wheelie_max_pitch; // maximum pitch for wheelies
|
||||
float m_wheelie_pitch_rate; // rate/sec with which kart goes up
|
||||
@ -122,9 +118,6 @@ public:
|
||||
float getWheelBase () const {return m_wheel_base; }
|
||||
float getHeightCOG () const {return m_height_cog; }
|
||||
float getMaxSteerAngle () const {return m_max_steer_angle; }
|
||||
float getCornerStiffF () const {return m_corn_f; }
|
||||
float getCornerStiffR () const {return m_corn_r; }
|
||||
float getInertia () const {return m_inertia; }
|
||||
float getMaxSpeedReverseRatio() const {return m_max_speed_reverse_ratio;}
|
||||
float getWheelieMaxSpeedRatio() const {return m_wheelie_max_speed_ratio;}
|
||||
float getWheelieMaxPitch () const {return m_wheelie_max_pitch; }
|
||||
|
@ -59,11 +59,7 @@ void STKConfig::load(const std::string filename)
|
||||
CHECK_NEG(m_max_karts, "max-karts" );
|
||||
CHECK_NEG(m_grid_order, "grid-order" );
|
||||
|
||||
CHECK_NEG(m_corn_r, "m_corn_r" );
|
||||
CHECK_NEG(m_corn_f, "m_corn_f" );
|
||||
|
||||
CHECK_NEG(m_mass, "mass" );
|
||||
CHECK_NEG(m_inertia, "m_inertia" );
|
||||
CHECK_NEG(m_height_cog, "heightCOG" );
|
||||
CHECK_NEG(m_wheel_base, "wheel-base" );
|
||||
CHECK_NEG(m_engine_power, "engine-power" );
|
||||
@ -82,6 +78,10 @@ void STKConfig::load(const std::string filename)
|
||||
CHECK_NEG(m_wheelie_power_boost, "wheelie-power-boost" );
|
||||
|
||||
CHECK_NEG(m_parachute_friction, "parachute-friction" );
|
||||
CHECK_NEG(m_parachute_done_fraction, "parachute-done-fraction" );
|
||||
CHECK_NEG(m_parachute_time, "parachute-time" );
|
||||
CHECK_NEG(m_parachute_time_other, "parachute-time-other" );
|
||||
|
||||
CHECK_NEG(m_time_full_steer, "time-full-steer" );
|
||||
|
||||
//bullet physics data
|
||||
@ -97,8 +97,6 @@ void STKConfig::load(const std::string filename)
|
||||
CHECK_NEG(m_maximum_speed, "maximum-speed" );
|
||||
CHECK_NEG(m_max_speed_reverse_ratio, "max-speed-reverse-ratio" );
|
||||
CHECK_NEG(m_gravity_center_shift, "gravity-center-shift" );
|
||||
CHECK_NEG(m_parachute_time, "parachute-time" );
|
||||
CHECK_NEG(m_parachute_time_other, "parachute-time-other" );
|
||||
CHECK_NEG(m_bomb_time, "bomb-time" );
|
||||
CHECK_NEG(m_bomb_time_increase, "bomb-time-increase" );
|
||||
CHECK_NEG(m_anvil_time, "anvil-time" );
|
||||
@ -120,16 +118,16 @@ void STKConfig::load(const std::string filename)
|
||||
*/
|
||||
void STKConfig::init_defaults()
|
||||
{
|
||||
m_wheel_base = m_height_cog = m_mass =
|
||||
m_corn_r = m_max_steer_angle =
|
||||
m_corn_f = m_inertia = m_anvil_weight = m_parachute_friction =
|
||||
m_wheel_base = m_height_cog = m_mass = m_max_steer_angle =
|
||||
m_anvil_weight = m_parachute_friction =
|
||||
m_parachute_time = m_parachute_done_fraction = m_parachute_time_other =
|
||||
m_engine_power = m_jump_impulse = m_brake_factor =
|
||||
m_anvil_speed_factor = m_time_full_steer = m_wheelie_max_pitch =
|
||||
m_wheelie_max_speed_ratio = m_wheelie_pitch_rate = m_wheelie_restore_rate =
|
||||
m_wheelie_speed_boost =
|
||||
m_parachute_time = m_bomb_time = m_bomb_time_increase= m_anvil_time =
|
||||
m_bomb_time = m_bomb_time_increase= m_anvil_time =
|
||||
m_zipper_time = m_zipper_force = m_zipper_speed_gain =
|
||||
m_parachute_time_other = m_shortcut_segments =
|
||||
m_shortcut_segments =
|
||||
//bullet physics data
|
||||
m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_damping_compression =
|
||||
m_friction_slip = m_roll_influence = m_wheel_radius = m_wheel_width =
|
||||
@ -154,9 +152,10 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("shortcut-skipped-segments", m_shortcut_segments );
|
||||
lisp->get("anvil-speed-factor", m_anvil_speed_factor );
|
||||
lisp->get("parachute-friction", m_parachute_friction );
|
||||
lisp->get("jump-impulse", m_jump_impulse );
|
||||
lisp->get("parachute-time", m_parachute_time );
|
||||
lisp->get("parachute-time-other", m_parachute_time_other );
|
||||
lisp->get("parachute-done-fraction", m_parachute_done_fraction );
|
||||
lisp->get("jump-impulse", m_jump_impulse );
|
||||
lisp->get("bomb-time", m_bomb_time );
|
||||
lisp->get("bomb-time-increase", m_bomb_time_increase );
|
||||
lisp->get("anvil-time", m_anvil_time );
|
||||
|
@ -29,9 +29,10 @@ public:
|
||||
float m_anvil_weight; // Additional kart weight if anvil is attached
|
||||
float m_anvil_speed_factor; // To decrease speed once when attached
|
||||
float m_parachute_friction; // Increased air friction when parachute
|
||||
float m_jump_impulse; // percentage of gravity when jumping
|
||||
float m_parachute_done_fraction; // fraction of speed when lost will detach parachute
|
||||
float m_parachute_time; // time a parachute is active
|
||||
float m_parachute_time_other; // time a parachute attached to other karts is active
|
||||
float m_jump_impulse; // percentage of gravity when jumping
|
||||
float m_bomb_time; // time before a bomb explodes
|
||||
float m_bomb_time_increase; // time added to bomb timer when it's passed on
|
||||
float m_anvil_time; // time an anvil is active
|
||||
|
Loading…
Reference in New Issue
Block a user