Moved the variable m_time_since_stuck from the kart.hpp/kart.cpp files to the default robot. Since there is other code to catch the same situation, the code dealing with the m_time_since_stuck variable is disabled for now as a test.
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1377 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
49dc3abc5b
commit
298a81da04
20
src/kart.cpp
20
src/kart.cpp
@ -137,7 +137,6 @@ Kart::Kart (const KartProperties* kartProperties_, int position_ ,
|
||||
m_finish_time = 0.0f;
|
||||
m_prev_accel = 0.0f;
|
||||
m_wheelie_angle = 0.0f;
|
||||
m_time_since_stuck = 0.0f;
|
||||
m_smokepuff = NULL;
|
||||
m_smoke_system = NULL;
|
||||
m_exhaust_pipe = NULL;
|
||||
@ -555,17 +554,6 @@ void Kart::handleExplosion(const sgVec3& pos, bool direct_hit)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Kart::update (float dt)
|
||||
{
|
||||
// check if kart is stuck
|
||||
if(!isPlayerKart() && getVehicle()->getRigidBody()->getLinearVelocity().length()<2.0f
|
||||
&& !m_rescue && world->getPhase() != World::START_PHASE)
|
||||
{
|
||||
m_time_since_stuck += dt;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_time_since_stuck = 0.0f;
|
||||
}
|
||||
|
||||
m_zipper_time_left = m_zipper_time_left>0.0f ? m_zipper_time_left-dt : 0.0f;
|
||||
|
||||
//m_wheel_position gives the rotation around the X-axis, and since velocity's
|
||||
@ -1196,14 +1184,6 @@ void Kart::placeModel ()
|
||||
m_model_transform->setTransform(&c);
|
||||
Moveable::placeModel();
|
||||
|
||||
// Check if a kart needs to be rescued.
|
||||
if((fabs(m_curr_pos.hpr[2])>60 && getSpeed()<3.0f) ||
|
||||
m_time_since_stuck > 2.0f)
|
||||
{
|
||||
m_rescue=true;
|
||||
m_time_since_stuck=0.0f;
|
||||
}
|
||||
|
||||
} // placeModel
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -104,7 +104,6 @@ protected:
|
||||
btVehicleRaycaster *m_vehicle_raycaster;
|
||||
btRaycastVehicle *m_vehicle;
|
||||
float m_kart_height;
|
||||
float m_time_since_stuck;
|
||||
|
||||
private:
|
||||
int m_num_herrings_gobbled;
|
||||
|
@ -46,8 +46,6 @@ DefaultRobot::DefaultRobot( const KartProperties *kart_properties,
|
||||
AutoKart( kart_properties, position, init_pos )
|
||||
{
|
||||
m_kart_properties = kart_properties;
|
||||
m_time_since_last_shot = 0.0f;
|
||||
m_start_kart_crash_direction = 0;
|
||||
reset();
|
||||
|
||||
switch( world->m_race_setup.m_difficulty )
|
||||
@ -480,6 +478,30 @@ void DefaultRobot::handle_rescue(const float DELTA)
|
||||
m_rescue = true;
|
||||
m_crash_time = 0.0f;
|
||||
}
|
||||
|
||||
#if 0
|
||||
//FIXME: this is from the kart.cpp; since we already have a way to rescue,
|
||||
//I don't know if this is needed.
|
||||
|
||||
// check if kart is stuck
|
||||
if(!isPlayerKart() && getVehicle()->getRigidBody()->getLinearVelocity().length()<2.0f
|
||||
&& !m_rescue && world->getPhase() != World::START_PHASE)
|
||||
{
|
||||
m_time_since_stuck += dt;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_time_since_stuck = 0.0f;
|
||||
}
|
||||
|
||||
// Check if a kart needs to be rescued.
|
||||
if((fabs(m_curr_pos.hpr[2])>60 &&
|
||||
sgLengthVec3(m_velocity.xyz)<3.0f) || m_time_since_stuck > 2.0f)
|
||||
{
|
||||
m_rescue=true;
|
||||
m_time_since_stuck=0.0f;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -725,6 +747,9 @@ void DefaultRobot::find_non_crashing_point( sgVec2 result )
|
||||
//-----------------------------------------------------------------------------
|
||||
void DefaultRobot::reset()
|
||||
{
|
||||
m_time_since_last_shot = 0.0f;
|
||||
m_start_kart_crash_direction = 0;
|
||||
|
||||
m_sector = Track::UNKNOWN_SECTOR;
|
||||
m_inner_curve = 0;
|
||||
m_curve_target_speed = getMaxSpeed();
|
||||
@ -738,6 +763,10 @@ void DefaultRobot::reset()
|
||||
|
||||
m_crash_time = 0.0f;
|
||||
|
||||
#if 0
|
||||
m_time_since_stuck = 0.0f;
|
||||
#endif
|
||||
|
||||
AutoKart::reset();
|
||||
}
|
||||
|
||||
|
@ -93,6 +93,10 @@ private:
|
||||
float m_curve_target_speed;
|
||||
float m_curve_angle;
|
||||
|
||||
#if 0
|
||||
float m_time_since_stuck;
|
||||
#endif
|
||||
|
||||
int m_start_kart_crash_direction; //-1 = left, 1 = right, 0 = no crash.
|
||||
|
||||
/*Functions called directly from update(). They all represent an action
|
||||
|
Loading…
Reference in New Issue
Block a user