diff --git a/src/gui/char_sel.cpp b/src/gui/char_sel.cpp index 0eb1895ce..7979a6e32 100644 --- a/src/gui/char_sel.cpp +++ b/src/gui/char_sel.cpp @@ -37,21 +37,11 @@ enum WidgetTokens { - WTOK_RACER0, - WTOK_RACER1, - WTOK_RACER2, - WTOK_RACER3, - WTOK_RACER4, - WTOK_RACER5, - WTOK_RACER6, - WTOK_RACER7, - WTOK_RACER8, - WTOK_RACER9, - WTOK_TITLE, WTOK_NAME, - WTOK_QUIT + WTOK_QUIT, + WTOK_RACER0 }; CharSel::CharSel(int whichPlayer) diff --git a/src/highscore_manager.hpp b/src/highscore_manager.hpp index 22bfbd16a..a1f77ab2c 100644 --- a/src/highscore_manager.hpp +++ b/src/highscore_manager.hpp @@ -31,8 +31,6 @@ class HighscoreManager { public: private: - static const int HIGHSCORE_LEN = 3; // It's a top 3 list - typedef std::vector type_all_scores; type_all_scores m_allScores; diff --git a/src/kart.cpp b/src/kart.cpp index 4fbd3c4d8..386646f9c 100644 --- a/src/kart.cpp +++ b/src/kart.cpp @@ -376,6 +376,8 @@ void Kart::reset() world->m_track->spatialToTrack( m_curr_track_coords, m_curr_pos.xyz, m_track_sector ); + m_vehicle->applyEngineForce (0.0f, 2); + m_vehicle->applyEngineForce (0.0f, 3); // Set heading: m_transform.setRotation(btQuaternion(btVector3(0.0f, 0.0f, 1.0f), DEGREE_TO_RAD(m_reset_pos.hpr[0])) ); @@ -383,8 +385,6 @@ void Kart::reset() m_transform.setOrigin(btVector3(m_reset_pos.xyz[0], m_reset_pos.xyz[1], m_reset_pos.xyz[2]+0.5f*m_kart_height)); - m_vehicle->applyEngineForce (0.0f, 2); - m_vehicle->applyEngineForce (0.0f, 3); m_body->setCenterOfMassTransform(m_transform); m_body->setLinearVelocity (btVector3(0.0f,0.0f,0.0f)); m_body->setAngularVelocity(btVector3(0.0f,0.0f,0.0f)); @@ -575,7 +575,8 @@ void Kart::update (float dt) } m_curr_pos.xyz[2] += rescue_height*dt/rescue_time; - m_transform.setOrigin(btVector3(m_curr_pos.xyz[0],m_curr_pos.xyz[1],m_curr_pos.xyz[2])); + m_transform.setOrigin(btVector3(m_curr_pos.xyz[0],m_curr_pos.xyz[1], + m_curr_pos.xyz[2])); btQuaternion q_roll (btVector3(0.f, 1.f, 0.f), -m_rescue_roll*dt/rescue_time*M_PI/180.0f); btQuaternion q_pitch(btVector3(1.f, 0.f, 0.f), @@ -916,7 +917,6 @@ void Kart::endRescue() m_curr_pos.hpr[0] = world->m_track->m_angle[m_track_sector] ; m_rescue = false ; - world->getPhysics()->addKart(this, m_vehicle); m_body->setLinearVelocity (btVector3(0.0f,0.0f,0.0f)); m_body->setAngularVelocity(btVector3(0.0f,0.0f,0.0f)); // FIXME: This code positions the kart correctly back on the track @@ -924,14 +924,18 @@ void Kart::endRescue() // it feels better if the kart is left where it was. Perhaps // this code should only be used if a rescue was not triggered // by the kart being upside down?? - btTransform pos=m_body->getCenterOfMassTransform(); + btTransform pos; + // A certain epsilon is added here to the Z coordinate (0.1), in case + // that the drivelines are somewhat under the track. Otherwise, the + // kart will be placed a little bit under the track, triggering + // a rescue, ... pos.setOrigin(btVector3(m_curr_pos.xyz[0],m_curr_pos.xyz[1], - m_curr_pos.xyz[2]+0.5f*m_kart_height)); + m_curr_pos.xyz[2]+0.5f*m_kart_height+0.1f)); pos.setRotation(btQuaternion(btVector3(0.0f, 0.0f, 1.0f), DEGREE_TO_RAD(world->m_track->m_angle[m_track_sector]))); m_body->setCenterOfMassTransform(pos); + world->getPhysics()->addKart(this, m_vehicle); setTrans(pos); - } // endRescue //----------------------------------------------------------------------------- diff --git a/src/moveable.cpp b/src/moveable.cpp index d5f64f07c..605eccf52 100644 --- a/src/moveable.cpp +++ b/src/moveable.cpp @@ -82,7 +82,6 @@ void Moveable::createBody(float mass, btTransform& trans, UserPointer::UserPointerType t) { btVector3 inertia; - m_transform = trans; shape->calculateLocalInertia(mass, inertia); m_motion_state = new btDefaultMotionState(trans); @@ -155,7 +154,7 @@ void Moveable::update (float dt) sgCopyCoord(&(m_history_position[history->GetCurrentIndex()]), &m_curr_pos); } } // if m_history_position - + m_velocityLC = getVelocity()*getTrans().getBasis(); placeModel(); m_first_time = false ; diff --git a/src/moveable.hpp b/src/moveable.hpp index 2f919aca3..168851405 100644 --- a/src/moveable.hpp +++ b/src/moveable.hpp @@ -82,8 +82,9 @@ public: void createBody(float mass, btTransform& trans, btCollisionShape *shape, UserPointer::UserPointerType t); - const btTransform& getTrans () const {return m_transform;} - void setTrans (btTransform& t){m_motion_state->setWorldTransform(t);} + //void getTrans (btTransform& t) const {m_motion_state->getWorldTransform(t);} + const btTransform& getTrans() const {return m_transform;} + void setTrans (btTransform& t){m_transform=t;m_motion_state->setWorldTransform(t);} } ; // class Moveable diff --git a/src/spark.cpp b/src/spark.cpp index 8e85e82b9..ab4f18f19 100644 --- a/src/spark.cpp +++ b/src/spark.cpp @@ -83,7 +83,6 @@ void Spark::update(float dt) { // spark lost energy (less than 80%), i.e. it's too slow - speed it up: if(vlen==0.0f) { v = btVector3(.5f, .5f, .5f); // avoid 0 div. - vlen = 0.75; } else {