The hayball in farm will now flatten you (exporter still left to do)

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13473 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-08-13 00:36:37 +00:00
parent 614e7893c0
commit 2693043395
6 changed files with 33 additions and 5 deletions

View File

@ -42,8 +42,10 @@ ThreeDAnimation::ThreeDAnimation(const XMLNode &node, TrackObject* object) : Ani
m_crash_reset = false;
m_explode_kart = false;
m_flatten_kart = false;
node.get("reset", &m_crash_reset);
node.get("explode", &m_explode_kart);
node.get("flatten", &m_flatten_kart);
m_important_animation = (World::getWorld()->getIdent() == IDENT_CUSTSCENE);
node.get("important", &m_important_animation);

View File

@ -54,6 +54,8 @@ private:
* "exploding" a kart. */
bool m_explode_kart;
bool m_flatten_kart;
/** We have to store the rotation value as computed in blender, since
* irrlicht uses a different order, so for rotation animations we
* can not use the value returned by getRotation from a scene node. */
@ -75,6 +77,7 @@ public:
* trigger a rescue. */
bool isCrashReset() const { return m_crash_reset; }
bool isExplodeKartObject() const { return m_explode_kart; }
bool isFlattenKartObject() const { return m_flatten_kart; }
}; // ThreeDAnimation
#endif

View File

@ -1512,6 +1512,9 @@ void Skin::drawCheckBox(const core::recti &rect, Widget* widget, bool focused)
0 /* no clipping */, 0,
true /* alpha */);
}
irr_driver->getVideoDriver()->draw2DRectangleOutline(rect, video::SColor(255,255,0,0));
} // drawCheckBox
// ----------------------------------------------------------------------------

View File

@ -51,13 +51,15 @@ PhysicalObject* PhysicalObject::fromXML(bool is_dynamic,
settings.radius = -1;
settings.crash_reset = false;
settings.knock_kart = false;
settings.flatten_kart = false;
std::string shape;
xml_node.get("mass", &settings.mass );
xml_node.get("radius", &settings.radius );
xml_node.get("shape", &shape );
xml_node.get("reset", &settings.crash_reset);
xml_node.get("reset", &settings.crash_reset );
xml_node.get("explode", &settings.knock_kart );
xml_node.get("flatten", &settings.flatten_kart);
settings.reset_when_too_low =
xml_node.get("reset-when-below", &settings.reset_height) == 1;
@ -96,6 +98,7 @@ PhysicalObject::PhysicalObject(bool is_dynamic,
m_radius = -1;
m_crash_reset = false;
m_explode_kart = false;
m_flatten_kart = false;
m_triangle_mesh = NULL;
m_object = object;
@ -109,6 +112,7 @@ PhysicalObject::PhysicalObject(bool is_dynamic,
m_body_type = settings.body_type;
m_crash_reset = settings.crash_reset;
m_explode_kart = settings.knock_kart;
m_flatten_kart = settings.flatten_kart;
m_reset_when_too_low = settings.reset_when_too_low;
m_reset_height = settings.reset_height;

View File

@ -49,6 +49,7 @@ public:
PhysicalObject::bodyTypes body_type;
bool crash_reset;
bool knock_kart;
bool flatten_kart;
bool reset_when_too_low;
float reset_height;
};
@ -107,6 +108,8 @@ private:
/** True if kart should "explode" when touching this */
bool m_explode_kart;
bool m_flatten_kart;
/** True if object should be reset to its initial position if it's
* too low (see m_reset_height). */
bool m_reset_when_too_low;
@ -144,6 +147,7 @@ public:
* hits it. */
bool isCrashReset() const { return m_crash_reset; }
bool isExplodeKartObject () const { return m_explode_kart; }
bool isFlattenKartObject () const { return m_flatten_kart; }
void move(const Vec3& xyz, const core::vector3df& hpr);

View File

@ -181,6 +181,12 @@ void Physics::update(float dt)
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
ExplosionAnimation::create(kart);
}
else if (obj->isFlattenKartObject())
{
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
const KartProperties* kp = kart->getKartProperties();
kart->setSquash(kp->getSquashDuration(), kp->getSquashSlowdown());
}
continue;
}
@ -198,6 +204,12 @@ void Physics::update(float dt)
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
ExplosionAnimation::create(kart);
}
else if (anim->isFlattenKartObject())
{
AbstractKart *kart = p->getUserPointer(1)->getPointerKart();
const KartProperties* kp = kart->getKartProperties();
kart->setSquash(kp->getSquashDuration(), kp->getSquashSlowdown());
}
continue;
}