Apply parts of patch by Deveee to better indicate new nitro consumption rules, with additions by myself for the race GUI

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@13338 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria
2013-07-24 23:14:22 +00:00
parent 27a1509532
commit dfb9de9733
4 changed files with 12 additions and 2 deletions

View File

@@ -317,6 +317,11 @@ public:
// ------------------------------------------------------------------------
virtual void setEnergy(float val) = 0;
// ------------------------------------------------------------------------
/** Return whether nitro is being used despite the nitro button not being
* pressed due to minimal use time requirements
*/
virtual float isOnMinNitroTime() const = 0;
// ------------------------------------------------------------------------
/** Returns the current material the kart is on. */
virtual const Material *getMaterial() const = 0;
// ------------------------------------------------------------------------

View File

@@ -2302,7 +2302,7 @@ void Kart::updateGraphics(float dt, const Vec3& offset_xyz,
y += m_skidding->getGraphicalJumpOffset();
center_shift.setY(y);
if (m_controls.m_nitro && isOnGround() && m_collected_energy > 0)
if ((m_controls.m_nitro || m_min_nitro_time > 0.0f) && isOnGround() && m_collected_energy > 0)
{
// fabs(speed) is important, otherwise the negative number will
// become a huge unsigned number in the particle scene node!

View File

@@ -403,6 +403,11 @@ public:
/** Sets the energy the kart has collected. */
virtual void setEnergy(float val) { m_collected_energy = val; }
// ------------------------------------------------------------------------
/** Return whether nitro is being used despite the nitro button not being
* pressed due to minimal use time requirements
*/
virtual float isOnMinNitroTime() const { return m_min_nitro_time > 0.0f; }
// ------------------------------------------------------------------------
/** Returns if the kart is currently being squashed. */
virtual bool isSquashed() const { return m_squash_time >0; }
// ------------------------------------------------------------------------

View File

@@ -526,7 +526,7 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
video::SMaterial m;
if(kart->getControls().m_nitro)
if(kart->getControls().m_nitro || kart->isOnMinNitroTime())
m.setTexture(0, m_gauge_full_bright);
else
m.setTexture(0, m_gauge_full);