Replace the fricition material flag with a simpler boolean (anyway the previous value was only used like a boolean)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9116 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-07-01 00:23:57 +00:00
parent 5bb1a133cb
commit 6e78d93437
3 changed files with 6 additions and 7 deletions

View File

@ -76,7 +76,7 @@ Material::Material(const XMLNode *node, int index)
node->get("alpha", &m_alpha_blending ); node->get("alpha", &m_alpha_blending );
node->get("light", &m_lighting ); node->get("light", &m_lighting );
node->get("sphere", &m_sphere_map ); node->get("sphere", &m_sphere_map );
node->get("friction", &m_friction ); node->get("high-adhesion", &m_high_tire_adhesion);
node->get("reset", &m_drive_reset ); node->get("reset", &m_drive_reset );
node->get("crash-reset", &m_crash_reset ); node->get("crash-reset", &m_crash_reset );
node->get("below-surface", &m_below_surface ); node->get("below-surface", &m_below_surface );
@ -228,7 +228,7 @@ void Material::init(unsigned int index)
m_lighting = true; m_lighting = true;
m_backface_culling = true; m_backface_culling = true;
m_sphere_map = false; m_sphere_map = false;
m_friction = 1.0f; m_high_tire_adhesion = false;
m_below_surface = false; m_below_surface = false;
m_falling_effect = false; m_falling_effect = false;
m_surface = false; m_surface = false;

View File

@ -115,7 +115,7 @@ private:
m_adjust_image; m_adjust_image;
/** True if lightmapping is enabled for this material. */ /** True if lightmapping is enabled for this material. */
bool m_lightmap; bool m_lightmap;
float m_friction; bool m_high_tire_adhesion;
/** How much the top speed is reduced per second. */ /** How much the top speed is reduced per second. */
float m_slowdown_time; float m_slowdown_time;
/** Maximum speed at which no more slow down occurs. */ /** Maximum speed at which no more slow down occurs. */
@ -176,7 +176,7 @@ public:
/** Returns if this material should trigger a rescue if a kart /** Returns if this material should trigger a rescue if a kart
* crashes against it. */ * crashes against it. */
bool isCrashReset () const { return m_crash_reset; } bool isCrashReset () const { return m_crash_reset; }
float getFriction () const { return m_friction; } bool highTireAdhesion () const { return m_high_tire_adhesion; }
const std::string& const std::string&
getTexFname () const { return m_texname; } getTexFname () const { return m_texname; }
int getIndex () const { return m_index; } int getIndex () const { return m_index; }

View File

@ -1591,15 +1591,14 @@ void Kart::updatePhysics(float dt)
float friction = 1.0f; float friction = 1.0f;
bool enable_skidding = false; bool enable_skidding = false;
// If a material has friction of more than 10000 treat this // This way the current skidding
// as no-skidding possible. This way the current skidding
// handling can be disabled for certain material (e.g. the // handling can be disabled for certain material (e.g. the
// curve in skyline on which otherwise karts could not drive). // curve in skyline on which otherwise karts could not drive).
// We also had a crash reported here, which was caused by not // We also had a crash reported here, which was caused by not
// having a material here - no idea how this could have happened, // having a material here - no idea how this could have happened,
// but this problem is now avoided by testing if there is a material // but this problem is now avoided by testing if there is a material
if (isOnGround() && if (isOnGround() &&
(!getMaterial() || getMaterial()->getFriction()<10000.0f)) (!getMaterial() || !getMaterial()->highTireAdhesion()))
{ {
const btMatrix3x3 &m = m_vehicle->getChassisWorldTransform().getBasis(); const btMatrix3x3 &m = m_vehicle->getChassisWorldTransform().getBasis();
// To get the angle between up=(0,1,0), we have to do: // To get the angle between up=(0,1,0), we have to do: