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)
{
case 0:
set(ATTACH_PARACHUTE,
int(kp->getParachuteDuration()*stk_config->m_physics_fps)
+ leftover_ticks );
set(ATTACH_PARACHUTE, kp->getParachuteDuration() + leftover_ticks);
m_initial_speed = m_kart->getSpeed();
// if going very slowly or backwards,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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