diff --git a/src/kart.cpp b/src/kart.cpp index e00f99a28..68ce3f0ff 100644 --- a/src/kart.cpp +++ b/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 //----------------------------------------------------------------------------- diff --git a/src/kart.hpp b/src/kart.hpp index 094e8bb2b..df6ebea5d 100644 --- a/src/kart.hpp +++ b/src/kart.hpp @@ -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; diff --git a/src/robots/default_robot.cpp b/src/robots/default_robot.cpp index 8d0c57ccc..097e627fa 100755 --- a/src/robots/default_robot.cpp +++ b/src/robots/default_robot.cpp @@ -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(); } diff --git a/src/robots/default_robot.hpp b/src/robots/default_robot.hpp index 559cdb5e5..17f14cc44 100755 --- a/src/robots/default_robot.hpp +++ b/src/robots/default_robot.hpp @@ -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