Remove more outdated variables

This commit is contained in:
Flakebi 2015-07-12 01:29:17 +02:00
parent 1317714ba1
commit ffca848a33
12 changed files with 55 additions and 84 deletions

View File

@ -151,18 +151,13 @@ void STKConfig::load(const std::string &filename)
*/
void STKConfig::init_defaults()
{
m_anvil_weight = m_parachute_friction =
m_parachute_time = m_parachute_lbound_fraction =
m_parachute_time_other = m_anvil_speed_factor =
m_bomb_time = m_bomb_time_increase =
m_anvil_time = m_music_credit_time =
m_bomb_time = m_bomb_time_increase =
m_explosion_impulse_objects = m_music_credit_time =
m_delay_finish_time = m_skid_fadeout_time =
m_near_ground = m_item_switch_time =
m_smooth_angle_limit = m_parachute_ubound_fraction =
m_penalty_time = m_explosion_impulse_objects =
m_parachute_max_speed = UNDEFINED;
m_smooth_angle_limit = m_penalty_time =
UNDEFINED;
m_bubblegum_counter = -100;
m_bubblegum_shield_time = -100;
m_shield_restrict_weapos = false;
m_max_karts = -100;
m_max_skidmarks = -100;
@ -290,23 +285,6 @@ void STKConfig::getAllData(const XMLNode * root)
credits_node->get("music", &m_music_credit_time);
if(const XMLNode *anvil_node= root->getNode("anvil"))
{
anvil_node->get("weight", &m_anvil_weight );
anvil_node->get("speed-factor", &m_anvil_speed_factor);
anvil_node->get("time", &m_anvil_time );
}
if(const XMLNode *parachute_node= root->getNode("parachute"))
{
parachute_node->get("friction", &m_parachute_friction );
parachute_node->get("time", &m_parachute_time );
parachute_node->get("time-other", &m_parachute_time_other );
parachute_node->get("lbound-fraction", &m_parachute_lbound_fraction);
parachute_node->get("ubound-fraction", &m_parachute_ubound_fraction);
parachute_node->get("max-speed", &m_parachute_max_speed );
}
if(const XMLNode *bomb_node= root->getNode("bomb"))
{
bomb_node->get("time", &m_bomb_time);
@ -339,7 +317,6 @@ void STKConfig::getAllData(const XMLNode * root)
if(const XMLNode *bubblegum_node= root->getNode("bubblegum"))
{
bubblegum_node->get("disappear-counter", &m_bubblegum_counter );
bubblegum_node->get("shield-time", &m_bubblegum_shield_time );
bubblegum_node->get("restrict-weapons", &m_shield_restrict_weapos);
}

View File

@ -63,26 +63,12 @@ public:
m_same_powerup_mode;
static float UNDEFINED;
float m_anvil_weight; /**<Additional kart weight if anvil is
attached. */
float m_anvil_speed_factor; /**<Speed decrease when attached first. */
float m_parachute_friction; /**<Increased parachute air friction. */
float m_parachute_ubound_fraction; /**<Upper bound fraction of speed when
lost will detach parachute. */
float m_parachute_lbound_fraction; /**<Lower bound fraction of speed when
lost will detach parachute. */
float m_parachute_max_speed; /**<Max speed to rate current speed */
float m_parachute_time; /**<Time a parachute is active. */
float m_parachute_time_other; /**<Time a parachute attached to other
karts is active. */
float m_bomb_time; /**<Time before a bomb explodes. */
float m_bomb_time_increase; /**<Time added to bomb timer when it's
passed on. */
float m_anvil_time; /**<Time an anvil is active. */
float m_item_switch_time; /**< Time items will be switched. */
int m_bubblegum_counter; /**< How many times bubble gums must be
driven over before they disappear. */
float m_bubblegum_shield_time; /**<How long a bubble gum shield lasts. */
bool m_shield_restrict_weapos; /**<Wether weapon usage is punished. */
float m_explosion_impulse_objects; /**<Impulse of explosion on moving
objects, e.g. road cones, ... */

View File

@ -81,16 +81,16 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id,
// Scale the values so they look better
m_skills[SKILL_MASS]->setValue((int)
((kp->getCombinedCharacteristic()->getMass() - 20) / 4));
((props->getCombinedCharacteristic()->getMass() - 20) / 4));
m_skills[SKILL_MASS]->setLabel(_("WEIGHT"));
m_skills[SKILL_MASS]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_mass", m_player_id);
m_skills[SKILL_SPEED]->setValue((int)
((kp->getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6));
((props->getCombinedCharacteristic()->getEngineMaxSpeed() - 15) * 6));
m_skills[SKILL_SPEED]->setLabel(_("SPEED"));
m_skills[SKILL_SPEED]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_speed", m_player_id);
m_skills[SKILL_POWER]->setValue((int) ((kp->getAvgPower() - 30) / 20));
m_skills[SKILL_POWER]->setValue((int) ((props->getAvgPower() - 30) / 20));
m_skills[SKILL_POWER]->setLabel(_("POWER"));
m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id);

View File

@ -295,7 +295,8 @@ void Attachment::hitBanana(Item *item, int new_attachment)
switch (new_attachment)
{
case 0:
set( ATTACH_PARACHUTE,stk_config->m_parachute_time+leftover_time);
set(ATTACH_PARACHUTE, m_kart->getCharacteristic()->
getParachuteDuration() + leftover_time);
m_initial_speed = m_kart->getSpeed();
// if going very slowly or backwards,
@ -309,12 +310,13 @@ void Attachment::hitBanana(Item *item, int new_attachment)
// sound -> playSfx ( SOUND_SHOOMF ) ;
break ;
case 2:
set( ATTACH_ANVIL, stk_config->m_anvil_time+leftover_time);
set(ATTACH_ANVIL, m_kart->getCharacteristic()->
getAnvilDuration() + leftover_time);
// if ( m_kart == m_kart[0] )
// sound -> playSfx ( SOUND_SHOOMF ) ;
// Reduce speed once (see description above), all other changes are
// handled in Kart::updatePhysics
m_kart->adjustSpeed(stk_config->m_anvil_speed_factor);
m_kart->adjustSpeed(m_kart->getCharacteristic()->getAnvilSpeedFactor());
m_kart->updateWeight();
break ;
} // switch
@ -419,12 +421,12 @@ void Attachment::update(float dt)
// This percentage is based on the ratio of
// initial_speed / initial_max_speed
float f = m_initial_speed / stk_config->m_parachute_max_speed;
float f = m_initial_speed / m_kart->getCharacteristic()->getParachuteMaxSpeed();
if (f > 1.0f) f = 1.0f; // cap fraction
if (m_kart->getSpeed() <= m_initial_speed *
(stk_config->m_parachute_lbound_fraction +
f * ( stk_config->m_parachute_ubound_fraction
- stk_config->m_parachute_lbound_fraction)))
(m_kart->getCharacteristic()->getParachuteLboundFraction() +
f * ( m_kart->getCharacteristic()->getParachuteUboundFraction()
- m_kart->getCharacteristic()->getParachuteLboundFraction())))
{
m_time_left = -1;
}
@ -506,6 +508,12 @@ void Attachment::update(float dt)
clear();
} // update
// ----------------------------------------------------------------------------
float Attachment::weightAdjust() const
{
return m_type == ATTACH_ANVIL ? m_kart->getCharacteristic()->getAnvilWeight() : 0.0f;
}
// ----------------------------------------------------------------------------
/** Inform any eventual plugin when an animation is done. */
void Attachment::OnAnimationEnd(scene::IAnimatedMeshSceneNode* node)

View File

@ -130,8 +130,7 @@ public:
AbstractKart* getPreviousOwner() const { return m_previous_owner; }
// ------------------------------------------------------------------------
/** Returns additional weight for the kart. */
float weightAdjust() const {
return m_type==ATTACH_ANVIL ? stk_config->m_anvil_weight : 0.0f; }
float weightAdjust() const;
// ------------------------------------------------------------------------
/** Return the currently associated scene node (used by e.g the swatter) */
scene::IAnimatedMeshSceneNode* getNode() {return m_node;}

View File

@ -258,12 +258,12 @@ void Powerup::use()
if (m_owner->getIdent() == "nolok")
{
m_owner->getAttachment()->set(Attachment::ATTACH_NOLOK_BUBBLEGUM_SHIELD,
stk_config->m_bubblegum_shield_time);
m_owner->getCharacteristic()->getBubblegumShieldDuration());
}
else
{
m_owner->getAttachment()->set(Attachment::ATTACH_BUBBLEGUM_SHIELD,
stk_config->m_bubblegum_shield_time);
m_owner->getCharacteristic()->getBubblegumShieldDuration());
}
}
else // using a bubble gum while still having a shield
@ -271,12 +271,12 @@ void Powerup::use()
if (m_owner->getIdent() == "nolok")
{
m_owner->getAttachment()->set(Attachment::ATTACH_NOLOK_BUBBLEGUM_SHIELD,
stk_config->m_bubblegum_shield_time + m_owner->getShieldTime());
m_owner->getCharacteristic()->getBubblegumShieldDuration() + m_owner->getShieldTime());
}
else
{
m_owner->getAttachment()->set(Attachment::ATTACH_BUBBLEGUM_SHIELD,
stk_config->m_bubblegum_shield_time + m_owner->getShieldTime());
m_owner->getCharacteristic()->getBubblegumShieldDuration() + m_owner->getShieldTime());
}
}
@ -300,9 +300,9 @@ void Powerup::use()
if(kart->getPosition() == 1)
{
kart->getAttachment()->set(Attachment::ATTACH_ANVIL,
stk_config->m_anvil_time);
m_owner->getCharacteristic()->getAnvilDuration());
kart->updateWeight();
kart->adjustSpeed(stk_config->m_anvil_speed_factor*0.5f);
kart->adjustSpeed(m_owner->getCharacteristic()->getAnvilSpeedFactor() * 0.5f);
// should we position the sound at the kart that is hit,
// or the kart "throwing" the anvil? Ideally it should be both.
@ -339,7 +339,7 @@ void Powerup::use()
{
kart->getAttachment()
->set(Attachment::ATTACH_PARACHUTE,
stk_config->m_parachute_time_other);
m_owner->getCharacteristic()->getParachuteDurationOther());
if(kart->getController()->isPlayerController())
player_kart = kart;

View File

@ -122,9 +122,9 @@ AbstractCharacteristic::ValueType AbstractCharacteristic::getType(Characteristic
return TYPE_FLOAT;
case PARACHUTE_DURATION_OTHER:
return TYPE_FLOAT;
case PARACHUTE_LBOUND_FRANCTION:
case PARACHUTE_LBOUND_FRACTION:
return TYPE_FLOAT;
case PARACHUTE_UBOUND_FRANCTION:
case PARACHUTE_UBOUND_FRACTION:
return TYPE_FLOAT;
case PARACHUTE_MAX_SPEED:
return TYPE_FLOAT;
@ -306,10 +306,10 @@ std::string AbstractCharacteristic::getName(CharacteristicType type)
return "PARACHUTE_DURATION";
case PARACHUTE_DURATION_OTHER:
return "PARACHUTE_DURATION_OTHER";
case PARACHUTE_LBOUND_FRANCTION:
return "PARACHUTE_LBOUND_FRANCTION";
case PARACHUTE_UBOUND_FRANCTION:
return "PARACHUTE_UBOUND_FRANCTION";
case PARACHUTE_LBOUND_FRACTION:
return "PARACHUTE_LBOUND_FRACTION";
case PARACHUTE_UBOUND_FRACTION:
return "PARACHUTE_UBOUND_FRACTION";
case PARACHUTE_MAX_SPEED:
return "PARACHUTE_MAX_SPEED";
case BUBBLEGUM_DURATION:
@ -788,23 +788,23 @@ float AbstractCharacteristic::getParachuteDurationOther() const
return result;
}
float AbstractCharacteristic::getParachuteLboundFranction() const
float AbstractCharacteristic::getParachuteLboundFraction() const
{
float result;
bool is_set = false;
process(PARACHUTE_LBOUND_FRANCTION, &result, &is_set);
process(PARACHUTE_LBOUND_FRACTION, &result, &is_set);
if (!is_set)
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", getName(PARACHUTE_LBOUND_FRANCTION).c_str());
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", getName(PARACHUTE_LBOUND_FRACTION).c_str());
return result;
}
float AbstractCharacteristic::getParachuteUboundFranction() const
float AbstractCharacteristic::getParachuteUboundFraction() const
{
float result;
bool is_set = false;
process(PARACHUTE_UBOUND_FRANCTION, &result, &is_set);
process(PARACHUTE_UBOUND_FRACTION, &result, &is_set);
if (!is_set)
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", getName(PARACHUTE_UBOUND_FRANCTION).c_str());
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", getName(PARACHUTE_UBOUND_FRACTION).c_str());
return result;
}

View File

@ -128,8 +128,8 @@ public:
PARACHUTE_FRICTION,
PARACHUTE_DURATION,
PARACHUTE_DURATION_OTHER,
PARACHUTE_LBOUND_FRANCTION,
PARACHUTE_UBOUND_FRANCTION,
PARACHUTE_LBOUND_FRACTION,
PARACHUTE_UBOUND_FRACTION,
PARACHUTE_MAX_SPEED,
// Bubblegum
@ -278,8 +278,8 @@ public:
float getParachuteFriction() const;
float getParachuteDuration() const;
float getParachuteDurationOther() const;
float getParachuteLboundFranction() const;
float getParachuteUboundFranction() const;
float getParachuteLboundFraction() const;
float getParachuteUboundFraction() const;
float getParachuteMaxSpeed() const;
float getBubblegumDuration() const;

View File

@ -1368,13 +1368,13 @@ void SkiddingAI::handleItems(const float dt)
case PowerupManager::POWERUP_PARACHUTE:
// Wait one second more than a previous parachute
if(m_time_since_last_shot > stk_config->m_parachute_time_other+1.0f)
if(m_time_since_last_shot > m_kart->getCharacteristic()->getParachuteDurationOther() + 1.0f)
m_controls->m_fire = true;
break; // POWERUP_PARACHUTE
case PowerupManager::POWERUP_ANVIL:
// Wait one second more than a previous anvil
if(m_time_since_last_shot < stk_config->m_anvil_time+1.0f) break;
if(m_time_since_last_shot < m_kart->getCharacteristic()->getAnvilDuration() + 1.0f) break;
if(race_manager->getMinorMode()==RaceManager::MINOR_MODE_FOLLOW_LEADER)
{

View File

@ -354,8 +354,8 @@ void XmlCharacteristic::load(const XMLNode *node)
sub_node->get("friction", &m_values[PARACHUTE_FRICTION]);
sub_node->get("duration", &m_values[PARACHUTE_DURATION]);
sub_node->get("duration-other", &m_values[PARACHUTE_DURATION_OTHER]);
sub_node->get("lbound-franction", &m_values[PARACHUTE_LBOUND_FRANCTION]);
sub_node->get("ubound-franction", &m_values[PARACHUTE_UBOUND_FRANCTION]);
sub_node->get("lbound-fraction", &m_values[PARACHUTE_LBOUND_FRACTION]);
sub_node->get("ubound-fraction", &m_values[PARACHUTE_UBOUND_FRACTION]);
sub_node->get("max-speed", &m_values[PARACHUTE_MAX_SPEED]);
}

View File

@ -25,6 +25,7 @@
#include "graphics/shaders.hpp"
#include "items/powerup_manager.hpp"
#include "items/attachment.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/controller/controller.hpp"
#include "modes/world.hpp"
@ -135,14 +136,14 @@ void addAttachment(Attachment::AttachmentType type)
if (type == Attachment::ATTACH_ANVIL)
{
kart->getAttachment()
->set(type, stk_config->m_anvil_time);
kart->adjustSpeed(stk_config->m_anvil_speed_factor);
->set(type, kart->getCharacteristic()->getAnvilDuration());
kart->adjustSpeed(kart->getCharacteristic()->getAnvilSpeedFactor());
kart->updateWeight();
}
else if (type == Attachment::ATTACH_PARACHUTE)
{
kart->getAttachment()
->set(type, stk_config->m_parachute_time);
->set(type, kart->getCharacteristic()->getParachuteDuration());
}
else if (type == Attachment::ATTACH_BOMB)
{

View File

@ -36,7 +36,7 @@ Camera: distance, forwardUpAngle, backwardUpAngle
Jump: animationTime
Lean: max, speed
Anvil: duration, weight, speedFactor
Parachute: friction, duration, durationOther, lboundFranction, uboundFranction, maxSpeed
Parachute: friction, duration, durationOther, lboundFraction, uboundFraction, maxSpeed
Bubblegum: duration, speedFraction, torque, fadeInTime, shieldDuration
Zipper: duration, force, speedGain, maxSpeedIncrease, fadeOutTime
Swatter: duration, distance, squashDuration, squashSlowdown