diff --git a/src/karts/abstract_characteristic.cpp b/src/karts/abstract_characteristic.cpp index 3d9f350a8..a298322a3 100755 --- a/src/karts/abstract_characteristic.cpp +++ b/src/karts/abstract_characteristic.cpp @@ -228,6 +228,40 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType( return TYPE_FLOAT; case SLIPSTREAM_FADE_OUT_TIME: return TYPE_FLOAT; + case SKID_INCREASE: + return TYPE_FLOAT; + case SKID_DECREASE: + return TYPE_FLOAT; + case SKID_MAX: + return TYPE_FLOAT; + case SKID_TIME_TILL_MAX: + return TYPE_FLOAT; + case SKID_VISUAL: + return TYPE_FLOAT; + case SKID_VISUAL_TIME: + return TYPE_FLOAT; + case SKID_REVERT_VISUAL_TIME: + return TYPE_FLOAT; + case SKID_MIN_SPEED: + return TYPE_FLOAT; + case SKID_TIME_TILL_BONUS: + return TYPE_FLOAT_VECTOR; + case SKID_BONUS_SPEED: + return TYPE_FLOAT_VECTOR; + case SKID_BONUS_TIME: + return TYPE_FLOAT_VECTOR; + case SKID_BONUS_FORCE: + return TYPE_FLOAT_VECTOR; + case SKID_PHYSICAL_JUMP_TIME: + return TYPE_FLOAT; + case SKID_GRAPHICAL_JUMP_TIME: + return TYPE_FLOAT; + case SKID_POST_SKID_ROTATE_FACTOR: + return TYPE_FLOAT; + case SKID_REDUCE_TURN_MIN: + return TYPE_FLOAT; + case SKID_REDUCE_TURN_MAX: + return TYPE_FLOAT; /* */ } // switch (type) @@ -416,6 +450,40 @@ std::string AbstractCharacteristic::getName(CharacteristicType type) return "SLIPSTREAM_MAX_SPEED_INCREASE"; case SLIPSTREAM_FADE_OUT_TIME: return "SLIPSTREAM_FADE_OUT_TIME"; + case SKID_INCREASE: + return "SKID_INCREASE"; + case SKID_DECREASE: + return "SKID_DECREASE"; + case SKID_MAX: + return "SKID_MAX"; + case SKID_TIME_TILL_MAX: + return "SKID_TIME_TILL_MAX"; + case SKID_VISUAL: + return "SKID_VISUAL"; + case SKID_VISUAL_TIME: + return "SKID_VISUAL_TIME"; + case SKID_REVERT_VISUAL_TIME: + return "SKID_REVERT_VISUAL_TIME"; + case SKID_MIN_SPEED: + return "SKID_MIN_SPEED"; + case SKID_TIME_TILL_BONUS: + return "SKID_TIME_TILL_BONUS"; + case SKID_BONUS_SPEED: + return "SKID_BONUS_SPEED"; + case SKID_BONUS_TIME: + return "SKID_BONUS_TIME"; + case SKID_BONUS_FORCE: + return "SKID_BONUS_FORCE"; + case SKID_PHYSICAL_JUMP_TIME: + return "SKID_PHYSICAL_JUMP_TIME"; + case SKID_GRAPHICAL_JUMP_TIME: + return "SKID_GRAPHICAL_JUMP_TIME"; + case SKID_POST_SKID_ROTATE_FACTOR: + return "SKID_POST_SKID_ROTATE_FACTOR"; + case SKID_REDUCE_TURN_MIN: + return "SKID_REDUCE_TURN_MIN"; + case SKID_REDUCE_TURN_MAX: + return "SKID_REDUCE_TURN_MAX"; /* */ } // switch (type) @@ -1437,6 +1505,210 @@ float AbstractCharacteristic::getSlipstreamFadeOutTime() const return result; } // getSlipstreamFadeOutTime +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidIncrease() const +{ + float result; + bool is_set = false; + process(SKID_INCREASE, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_INCREASE).c_str()); + return result; +} // getSkidIncrease + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidDecrease() const +{ + float result; + bool is_set = false; + process(SKID_DECREASE, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_DECREASE).c_str()); + return result; +} // getSkidDecrease + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidMax() const +{ + float result; + bool is_set = false; + process(SKID_MAX, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_MAX).c_str()); + return result; +} // getSkidMax + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidTimeTillMax() const +{ + float result; + bool is_set = false; + process(SKID_TIME_TILL_MAX, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_TIME_TILL_MAX).c_str()); + return result; +} // getSkidTimeTillMax + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidVisual() const +{ + float result; + bool is_set = false; + process(SKID_VISUAL, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_VISUAL).c_str()); + return result; +} // getSkidVisual + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidVisualTime() const +{ + float result; + bool is_set = false; + process(SKID_VISUAL_TIME, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_VISUAL_TIME).c_str()); + return result; +} // getSkidVisualTime + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidRevertVisualTime() const +{ + float result; + bool is_set = false; + process(SKID_REVERT_VISUAL_TIME, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_REVERT_VISUAL_TIME).c_str()); + return result; +} // getSkidRevertVisualTime + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidMinSpeed() const +{ + float result; + bool is_set = false; + process(SKID_MIN_SPEED, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_MIN_SPEED).c_str()); + return result; +} // getSkidMinSpeed + +// ---------------------------------------------------------------------------- +std::vector AbstractCharacteristic::getSkidTimeTillBonus() const +{ + std::vector result; + bool is_set = false; + process(SKID_TIME_TILL_BONUS, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_TIME_TILL_BONUS).c_str()); + return result; +} // getSkidTimeTillBonus + +// ---------------------------------------------------------------------------- +std::vector AbstractCharacteristic::getSkidBonusSpeed() const +{ + std::vector result; + bool is_set = false; + process(SKID_BONUS_SPEED, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_BONUS_SPEED).c_str()); + return result; +} // getSkidBonusSpeed + +// ---------------------------------------------------------------------------- +std::vector AbstractCharacteristic::getSkidBonusTime() const +{ + std::vector result; + bool is_set = false; + process(SKID_BONUS_TIME, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_BONUS_TIME).c_str()); + return result; +} // getSkidBonusTime + +// ---------------------------------------------------------------------------- +std::vector AbstractCharacteristic::getSkidBonusForce() const +{ + std::vector result; + bool is_set = false; + process(SKID_BONUS_FORCE, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_BONUS_FORCE).c_str()); + return result; +} // getSkidBonusForce + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidPhysicalJumpTime() const +{ + float result; + bool is_set = false; + process(SKID_PHYSICAL_JUMP_TIME, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_PHYSICAL_JUMP_TIME).c_str()); + return result; +} // getSkidPhysicalJumpTime + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidGraphicalJumpTime() const +{ + float result; + bool is_set = false; + process(SKID_GRAPHICAL_JUMP_TIME, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_GRAPHICAL_JUMP_TIME).c_str()); + return result; +} // getSkidGraphicalJumpTime + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidPostSkidRotateFactor() const +{ + float result; + bool is_set = false; + process(SKID_POST_SKID_ROTATE_FACTOR, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_POST_SKID_ROTATE_FACTOR).c_str()); + return result; +} // getSkidPostSkidRotateFactor + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidReduceTurnMin() const +{ + float result; + bool is_set = false; + process(SKID_REDUCE_TURN_MIN, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_REDUCE_TURN_MIN).c_str()); + return result; +} // getSkidReduceTurnMin + +// ---------------------------------------------------------------------------- +float AbstractCharacteristic::getSkidReduceTurnMax() const +{ + float result; + bool is_set = false; + process(SKID_REDUCE_TURN_MAX, &result, &is_set); + if (!is_set) + Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", + getName(SKID_REDUCE_TURN_MAX).c_str()); + return result; +} // getSkidReduceTurnMax + /* */ diff --git a/src/karts/abstract_characteristic.hpp b/src/karts/abstract_characteristic.hpp index 8f08b5b57..1ae9622d1 100755 --- a/src/karts/abstract_characteristic.hpp +++ b/src/karts/abstract_characteristic.hpp @@ -198,6 +198,25 @@ public: SLIPSTREAM_MAX_SPEED_INCREASE, SLIPSTREAM_FADE_OUT_TIME, + // Skid + SKID_INCREASE, + SKID_DECREASE, + SKID_MAX, + SKID_TIME_TILL_MAX, + SKID_VISUAL, + SKID_VISUAL_TIME, + SKID_REVERT_VISUAL_TIME, + SKID_MIN_SPEED, + SKID_TIME_TILL_BONUS, + SKID_BONUS_SPEED, + SKID_BONUS_TIME, + SKID_BONUS_FORCE, + SKID_PHYSICAL_JUMP_TIME, + SKID_GRAPHICAL_JUMP_TIME, + SKID_POST_SKID_ROTATE_FACTOR, + SKID_REDUCE_TURN_MIN, + SKID_REDUCE_TURN_MAX, + /* */ @@ -344,6 +363,24 @@ public: float getSlipstreamMaxSpeedIncrease() const; float getSlipstreamFadeOutTime() const; + float getSkidIncrease() const; + float getSkidDecrease() const; + float getSkidMax() const; + float getSkidTimeTillMax() const; + float getSkidVisual() const; + float getSkidVisualTime() const; + float getSkidRevertVisualTime() const; + float getSkidMinSpeed() const; + std::vector getSkidTimeTillBonus() const; + std::vector getSkidBonusSpeed() const; + std::vector getSkidBonusTime() const; + std::vector getSkidBonusForce() const; + float getSkidPhysicalJumpTime() const; + float getSkidGraphicalJumpTime() const; + float getSkidPostSkidRotateFactor() const; + float getSkidReduceTurnMin() const; + float getSkidReduceTurnMax() const; + /* */ }; diff --git a/src/karts/xml_characteristic.cpp b/src/karts/xml_characteristic.cpp index dd9f38eb9..9c09a602f 100644 --- a/src/karts/xml_characteristic.cpp +++ b/src/karts/xml_characteristic.cpp @@ -557,6 +557,44 @@ void XmlCharacteristic::load(const XMLNode *node) &m_values[SLIPSTREAM_FADE_OUT_TIME]); } + if (const XMLNode *sub_node = node->getNode("skid")) + { + sub_node->get("increase", + &m_values[SKID_INCREASE]); + sub_node->get("decrease", + &m_values[SKID_DECREASE]); + sub_node->get("max", + &m_values[SKID_MAX]); + sub_node->get("time-till-max", + &m_values[SKID_TIME_TILL_MAX]); + sub_node->get("visual", + &m_values[SKID_VISUAL]); + sub_node->get("visual-time", + &m_values[SKID_VISUAL_TIME]); + sub_node->get("revert-visual-time", + &m_values[SKID_REVERT_VISUAL_TIME]); + sub_node->get("min-speed", + &m_values[SKID_MIN_SPEED]); + sub_node->get("time-till-bonus", + &m_values[SKID_TIME_TILL_BONUS]); + sub_node->get("bonus-speed", + &m_values[SKID_BONUS_SPEED]); + sub_node->get("bonus-time", + &m_values[SKID_BONUS_TIME]); + sub_node->get("bonus-force", + &m_values[SKID_BONUS_FORCE]); + sub_node->get("physical-jump-time", + &m_values[SKID_PHYSICAL_JUMP_TIME]); + sub_node->get("graphical-jump-time", + &m_values[SKID_GRAPHICAL_JUMP_TIME]); + sub_node->get("post-skid-rotate-factor", + &m_values[SKID_POST_SKID_ROTATE_FACTOR]); + sub_node->get("reduce-turn-min", + &m_values[SKID_REDUCE_TURN_MIN]); + sub_node->get("reduce-turn-max", + &m_values[SKID_REDUCE_TURN_MAX]); + } + /* */ } // load