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

@ -292,6 +292,7 @@ void Kart::createPhysics()
wheel.m_wheelsDampingCompression = m_kart_properties->getWheelDampingCompression(); wheel.m_wheelsDampingCompression = m_kart_properties->getWheelDampingCompression();
wheel.m_frictionSlip = m_kart_properties->getFrictionSlip(); wheel.m_frictionSlip = m_kart_properties->getFrictionSlip();
wheel.m_rollInfluence = m_kart_properties->getRollInfluence(); 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 // Obviously these allocs have to be properly managed/freed
btTransform t; btTransform t;

View File

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

View File

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