Converte some pararchute values to use ticks.

This commit is contained in:
hiker 2018-02-23 10:01:22 +11:00
parent 81342ddd00
commit cb712411e0
7 changed files with 16 additions and 18 deletions

View File

@ -393,9 +393,7 @@ void Attachment::hitBanana(Item *item, int new_attachment)
switch (new_attachment) switch (new_attachment)
{ {
case 0: case 0:
set(ATTACH_PARACHUTE, set(ATTACH_PARACHUTE, kp->getParachuteDuration() + leftover_ticks);
int(kp->getParachuteDuration()*stk_config->m_physics_fps)
+ leftover_ticks );
m_initial_speed = m_kart->getSpeed(); m_initial_speed = m_kart->getSpeed();
// if going very slowly or backwards, // if going very slowly or backwards,

View File

@ -414,12 +414,12 @@ void Powerup::use()
position_factor = 1.0f - rank_factor; position_factor = 1.0f - rank_factor;
} }
rank_mult = 1 + (position_factor * (kp->getParachuteDurationRankMult() - 1)); rank_mult = 1 + (position_factor *
(kp->getParachuteDurationRankMult() - 1));
kart->getAttachment() kart->getAttachment()
->set(Attachment::ATTACH_PARACHUTE, ->set(Attachment::ATTACH_PARACHUTE,
int(kp->getParachuteDurationOther() * rank_mult int(kp->getParachuteDurationOther()*rank_mult) );
* stk_config->m_physics_fps) );
if(kart->getController()->isLocalPlayerController()) if(kart->getController()->isLocalPlayerController())
player_kart = kart; player_kart = kart;

View File

@ -18,6 +18,7 @@
#include "karts/abstract_characteristic.hpp" #include "karts/abstract_characteristic.hpp"
#include "config/stk_config.hpp"
#include "utils/log.hpp" #include "utils/log.hpp"
#include "utils/interpolation_array.hpp" #include "utils/interpolation_array.hpp"
@ -931,7 +932,7 @@ float AbstractCharacteristic::getParachuteFriction() const
} // getParachuteFriction } // getParachuteFriction
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
float AbstractCharacteristic::getParachuteDuration() const int AbstractCharacteristic::getParachuteDuration() const
{ {
float result; float result;
bool is_set = false; bool is_set = false;
@ -939,11 +940,11 @@ float AbstractCharacteristic::getParachuteDuration() const
if (!is_set) if (!is_set)
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
getName(PARACHUTE_DURATION).c_str()); getName(PARACHUTE_DURATION).c_str());
return result; return int(result*stk_config->m_physics_fps);
} // getParachuteDuration } // getParachuteDuration
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
float AbstractCharacteristic::getParachuteDurationOther() const int AbstractCharacteristic::getParachuteDurationOther() const
{ {
float result; float result;
bool is_set = false; bool is_set = false;
@ -951,7 +952,7 @@ float AbstractCharacteristic::getParachuteDurationOther() const
if (!is_set) if (!is_set)
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", Log::fatal("AbstractCharacteristic", "Can't get characteristic %s",
getName(PARACHUTE_DURATION_OTHER).c_str()); getName(PARACHUTE_DURATION_OTHER).c_str());
return result; return int(result*stk_config->m_physics_fps);
} // getParachuteDurationOther } // getParachuteDurationOther
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -305,8 +305,8 @@ public:
float getAnvilSpeedFactor() const; float getAnvilSpeedFactor() const;
float getParachuteFriction() const; float getParachuteFriction() const;
float getParachuteDuration() const; int getParachuteDuration() const;
float getParachuteDurationOther() const; int getParachuteDurationOther() const;
float getParachuteDurationRankMult() const; float getParachuteDurationRankMult() const;
float getParachuteDurationSpeedMult() const; float getParachuteDurationSpeedMult() const;
float getParachuteLboundFraction() const; float getParachuteLboundFraction() const;

View File

@ -773,13 +773,13 @@ float KartProperties::getParachuteFriction() const
} // getParachuteFriction } // getParachuteFriction
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
float KartProperties::getParachuteDuration() const int KartProperties::getParachuteDuration() const
{ {
return m_cached_characteristic->getParachuteDuration(); return m_cached_characteristic->getParachuteDuration();
} // getParachuteDuration } // getParachuteDuration
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
float KartProperties::getParachuteDurationOther() const int KartProperties::getParachuteDurationOther() const
{ {
return m_cached_characteristic->getParachuteDurationOther(); return m_cached_characteristic->getParachuteDurationOther();
} // getParachuteDurationOther } // getParachuteDurationOther

View File

@ -427,8 +427,8 @@ public:
float getAnvilSpeedFactor() const; float getAnvilSpeedFactor() const;
float getParachuteFriction() const; float getParachuteFriction() const;
float getParachuteDuration() const; int getParachuteDuration() const;
float getParachuteDurationOther() const; int getParachuteDurationOther() const;
float getParachuteDurationRankMult() const; float getParachuteDurationRankMult() const;
float getParachuteDurationSpeedMult() const; float getParachuteDurationSpeedMult() const;
float getParachuteLboundFraction() const; float getParachuteLboundFraction() const;

View File

@ -176,8 +176,7 @@ void addAttachment(Attachment::AttachmentType type)
else if (type == Attachment::ATTACH_PARACHUTE) else if (type == Attachment::ATTACH_PARACHUTE)
{ {
kart->getAttachment() kart->getAttachment()
->set(type, int(kart->getKartProperties()->getParachuteDuration() ->set(type, kart->getKartProperties()->getParachuteDuration() );
*stk_config->m_physics_fps) );
} }
else if (type == Attachment::ATTACH_BOMB) else if (type == Attachment::ATTACH_BOMB)
{ {