From cb712411e053825771ddf4d932886db2f20856ee Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 23 Feb 2018 10:01:22 +1100 Subject: [PATCH] Converte some pararchute values to use ticks. --- src/items/attachment.cpp | 4 +--- src/items/powerup.cpp | 6 +++--- src/karts/abstract_characteristic.cpp | 9 +++++---- src/karts/abstract_characteristic.hpp | 4 ++-- src/karts/kart_properties.cpp | 4 ++-- src/karts/kart_properties.hpp | 4 ++-- src/utils/debug.cpp | 3 +-- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/items/attachment.cpp b/src/items/attachment.cpp index 3da9e0822..e11115e44 100644 --- a/src/items/attachment.cpp +++ b/src/items/attachment.cpp @@ -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, diff --git a/src/items/powerup.cpp b/src/items/powerup.cpp index 668afec29..ecd97dec8 100644 --- a/src/items/powerup.cpp +++ b/src/items/powerup.cpp @@ -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; diff --git a/src/karts/abstract_characteristic.cpp b/src/karts/abstract_characteristic.cpp index 688982c8d..cd654ec5b 100644 --- a/src/karts/abstract_characteristic.cpp +++ b/src/karts/abstract_characteristic.cpp @@ -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 // ---------------------------------------------------------------------------- diff --git a/src/karts/abstract_characteristic.hpp b/src/karts/abstract_characteristic.hpp index d1b608fa1..7cdc897f8 100644 --- a/src/karts/abstract_characteristic.hpp +++ b/src/karts/abstract_characteristic.hpp @@ -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; diff --git a/src/karts/kart_properties.cpp b/src/karts/kart_properties.cpp index 881890571..c29a1d718 100644 --- a/src/karts/kart_properties.cpp +++ b/src/karts/kart_properties.cpp @@ -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 diff --git a/src/karts/kart_properties.hpp b/src/karts/kart_properties.hpp index a25b3cdec..235ed561c 100644 --- a/src/karts/kart_properties.hpp +++ b/src/karts/kart_properties.hpp @@ -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; diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp index e9335d5b8..6c33c37c1 100644 --- a/src/utils/debug.cpp +++ b/src/utils/debug.cpp @@ -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) {