somehwat nicer shortcut detection based on distance rather than sectors. can still be wrongly triggered if you drive just next to the road for a while (but that can probably wait for checkpoints)
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2322 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
739436fff9
commit
695255d9b6
@ -27,8 +27,8 @@
|
||||
(zipper-force 250.0 ) ;; additional zipper force
|
||||
(zipper-speed-gain 4.5 ) ;; one time additional speed
|
||||
|
||||
(shortcut-skipped-segments 5 ) ;; skipping more than this number of segments
|
||||
;; is considered to be a shortcut
|
||||
(shortcut-length 120 ) ;; leaving the road and coming back on it more than
|
||||
;; 120 'meters" later is considered to be a shortcut
|
||||
(explosion-impulse 10000.0 ) ;; explosion impulse on not directly hit karts
|
||||
(explosion-impulse-objects 500.0 ) ;; explosion impulse for physics objects (smaller
|
||||
;; else a cone e.g. will be pushed way too far)
|
||||
|
@ -477,6 +477,9 @@ void LinearWorld::moveKartAfterRescue(Kart* kart, btRigidBody* body)
|
||||
KartInfo& info = m_kart_info[kart->getWorldKartId()];
|
||||
|
||||
if ( info.m_track_sector > 0 ) info.m_track_sector-- ;
|
||||
info.m_last_valid_sector = info.m_track_sector;
|
||||
if ( info.m_last_valid_sector > 0 ) info.m_last_valid_sector --;
|
||||
|
||||
kart->setXYZ( RaceManager::getTrack()->trackToSpatial(info.m_track_sector) );
|
||||
|
||||
btQuaternion heading(btVector3(0.0f, 0.0f, 1.0f),
|
||||
@ -493,6 +496,7 @@ void LinearWorld::moveKartAfterRescue(Kart* kart, btRigidBody* body)
|
||||
DEGREE_TO_RAD(RaceManager::getTrack()->m_angle[info.m_track_sector])));
|
||||
|
||||
body->setCenterOfMassTransform(pos);
|
||||
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Find the position (rank) of 'kart' and update it accordingly
|
||||
|
@ -116,7 +116,7 @@ void STKConfig::load(const std::string filename)
|
||||
CHECK_NEG(m_zipper_time, "zipper-time" );
|
||||
CHECK_NEG(m_zipper_force, "zipper-force" );
|
||||
CHECK_NEG(m_zipper_speed_gain, "zipper-speed-gain" );
|
||||
CHECK_NEG(m_shortcut_segments, "shortcut-skipped-segments" );
|
||||
CHECK_NEG(m_shortcut_length, "shortcut-length" );
|
||||
CHECK_NEG(m_suspension_rest, "suspension-rest" );
|
||||
CHECK_NEG(m_suspension_travel_cm, "suspension-travel-cm" );
|
||||
CHECK_NEG(m_jump_velocity, "jump-velocity" );
|
||||
@ -147,7 +147,7 @@ void STKConfig::init_defaults()
|
||||
m_wheelie_restore_rate = m_wheelie_speed_boost =
|
||||
m_bomb_time = m_bomb_time_increase= m_anvil_time =
|
||||
m_zipper_time = m_zipper_force = m_zipper_speed_gain =
|
||||
m_shortcut_segments =
|
||||
m_shortcut_length =
|
||||
//bullet physics data
|
||||
m_suspension_stiffness = m_wheel_damping_relaxation =
|
||||
m_wheel_damping_compression = m_friction_slip = m_roll_influence =
|
||||
@ -176,7 +176,7 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
|
||||
// Get the values which are not part of the default KartProperties
|
||||
// ---------------------------------------------------------------
|
||||
lisp->get("anvil-weight", m_anvil_weight );
|
||||
lisp->get("shortcut-skipped-segments", m_shortcut_segments );
|
||||
lisp->get("shortcut-length", m_shortcut_length );
|
||||
lisp->get("anvil-speed-factor", m_anvil_speed_factor );
|
||||
lisp->get("parachute-friction", m_parachute_friction );
|
||||
lisp->get("parachute-time", m_parachute_time );
|
||||
|
@ -41,7 +41,7 @@ public:
|
||||
float m_zipper_time; // duration a zipper is active
|
||||
float m_zipper_force; // additional force added to the acceleration
|
||||
float m_zipper_speed_gain; // initial one time speed gain
|
||||
float m_shortcut_segments; // skipping more than this number of segments is
|
||||
float m_shortcut_length; // skipping more than this number of segments is
|
||||
// considered to be a shortcut
|
||||
float m_explosion_impulse; // impulse affecting each non-hit kart
|
||||
float m_explosion_impulse_objects;// impulse of explosion on moving objects, e.g. road cones, ...
|
||||
|
@ -450,12 +450,14 @@ bool Track::isShortcut(const int OLDSEC, const int NEWSEC) const
|
||||
{
|
||||
// If the kart was off the road, don't do any shortcuts
|
||||
if(OLDSEC==UNKNOWN_SECTOR || NEWSEC==UNKNOWN_SECTOR) return false;
|
||||
unsigned int distance_sectors = abs(OLDSEC-NEWSEC);
|
||||
// Handle 'wrap around': if the distance is more than half the
|
||||
// number of driveline points, assume it's a 'wrap around'
|
||||
if(2*distance_sectors > (unsigned int)m_driveline.size())
|
||||
distance_sectors = (unsigned int)m_driveline.size() - distance_sectors;
|
||||
return (distance_sectors>stk_config->m_shortcut_segments);
|
||||
int distance_sectors = m_distance_from_start[std::max(NEWSEC, OLDSEC)] - m_distance_from_start[std::min(NEWSEC, OLDSEC)];
|
||||
|
||||
// Handle 'warp around'
|
||||
const int track_length = m_distance_from_start[m_driveline.size()-1];
|
||||
if( distance_sectors < 0 ) distance_sectors += track_length;
|
||||
else if( distance_sectors > track_length/2) distance_sectors -= track_length;
|
||||
|
||||
return (distance_sectors > stk_config->m_shortcut_length);
|
||||
} // isShortcut
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user