Added ability to have karts have random wheel rotation; see beagle/kart.xml for example.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9205 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
computerfreak97 2011-07-09 18:06:00 +00:00
parent cdee7461a3
commit c2cbbbeee1
3 changed files with 8 additions and 1 deletions

View File

@ -119,7 +119,7 @@ Kart::Kart (const std::string& ident, Track* track, int position, bool is_first_
// Set position and heading:
m_reset_transform = init_transform;
m_speed = 0.0f;
m_wheel_rotation = 0;
m_wheel_rotation = 0;
m_kart_model->setKart(this);
@ -292,6 +292,7 @@ void Kart::createPhysics()
wheel.m_wheelsDampingCompression = m_kart_properties->getWheelDampingCompression();
wheel.m_frictionSlip = m_kart_properties->getFrictionSlip();
wheel.m_rollInfluence = m_kart_properties->getRollInfluence();
wheel.m_rotation = int(m_kart_properties->hasRandomWheels()) * (rand() % 360);
}
// Obviously these allocs have to be properly managed/freed
btTransform t;

View File

@ -101,6 +101,7 @@ KartProperties::KartProperties(const std::string &filename)
m_shape = 32; // close enough to a circle.
m_engine_sfx_type = "engine_small";
m_kart_model = NULL;
m_has_rand_wheels = false;
// The default constructor for stk_config uses filename=""
if (filename != "") load(filename, "kart");
} // KartProperties
@ -238,6 +239,8 @@ void KartProperties::getAllData(const XMLNode * root)
root->get("groups", &m_groups );
root->get("RandomWheelRot", &m_has_rand_wheels );
if(const XMLNode *dimensions_node = root->getNode("center"))
dimensions_node->get("gravity-shift", &m_gravity_center_shift);

View File

@ -304,6 +304,8 @@ private:
void load (const std::string &filename,
const std::string &node);
/** If the kart is supposed to have random wheel rotation at start. */
bool m_has_rand_wheels;
public:
KartProperties (const std::string &filename="");
@ -630,6 +632,7 @@ public:
/** Returns how long it takes for the swatter to swat at an item. */
float getSwatterItemAnimationTime() const
{return m_swatter_item_animation_time; }
bool hasRandomWheels() const { return m_has_rand_wheels; }
}; // KartProperties
#endif