Merge branch 'properties' of https://github.com/solistice/stk-code into properties
This commit is contained in:
commit
736c7264b9
@ -95,14 +95,14 @@ KartStatsWidget::KartStatsWidget(core::recti area, const int player_id,
|
||||
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_ACCEL]->setValue((int)((props->getMaxSpeed()-20)*20));
|
||||
m_skills[SKILL_ACCEL]->setLabel("ACCEL");
|
||||
m_skills[SKILL_ACCEL]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_accel", m_player_id);
|
||||
|
||||
m_skills[SKILL_SPEED]->setValue((int)(props->getMaxPower()/10));
|
||||
m_skills[SKILL_SPEED]->setLabel("POWER");
|
||||
m_skills[SKILL_SPEED]->setValue((int)((props->getAbsMaxSpeed()-20)*20));
|
||||
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)(props->getAvgPower()));
|
||||
m_skills[SKILL_POWER]->setLabel("POWER");
|
||||
m_skills[SKILL_POWER]->m_properties[PROP_ID] = StringUtils::insertValues("@p%i_power", m_player_id);
|
||||
|
||||
} // KartStatsWidget
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -63,7 +63,7 @@ class KartStatsWidget : public Widget
|
||||
{
|
||||
SKILL_MASS,
|
||||
SKILL_SPEED,
|
||||
SKILL_ACCEL,
|
||||
SKILL_POWER,
|
||||
SKILL_COUNT
|
||||
};
|
||||
|
||||
|
@ -780,4 +780,15 @@ float KartProperties::getStartupBoost() const
|
||||
}
|
||||
return 0;
|
||||
} // getStartupBoost
|
||||
|
||||
const float KartProperties::getAvgPower() const
|
||||
{
|
||||
float avg = 0.0;
|
||||
for (int i = 0; i < m_gear_power_increase.size(); ++i)
|
||||
{
|
||||
avg += (m_gear_power_increase[i]*m_max_speed[0])/m_gear_power_increase.size();
|
||||
}
|
||||
return avg;
|
||||
} // getAvgPower
|
||||
|
||||
/* EOF */
|
||||
|
@ -574,6 +574,12 @@ public:
|
||||
float getMaxSpeed () const {return
|
||||
m_max_speed[race_manager->getDifficulty()];}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Return the absolute maximum speed, independent on the difficulty. */
|
||||
float getAbsMaxSpeed () const {return
|
||||
m_max_speed[m_max_speed.size()-1];
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the nitro consumption. */
|
||||
float getNitroConsumption () const {return m_nitro_consumption; }
|
||||
@ -829,6 +835,10 @@ public:
|
||||
const std::vector<float>&
|
||||
getGearPowerIncrease () const {return m_gear_power_increase; }
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the average power of the kart (in all gears). */
|
||||
const float getAvgPower () const;
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns distance between kart and camera. */
|
||||
float getCameraDistance () const {return m_camera_distance; }
|
||||
|
@ -1527,8 +1527,8 @@ void KartSelectionScreen::updateKartStats(uint8_t widget_id,
|
||||
if (kp != NULL)
|
||||
{
|
||||
w->setValue(KartStatsWidget::SKILL_MASS, (int)(kp->getMass()/5));
|
||||
w->setValue(KartStatsWidget::SKILL_SPEED, (int)(kp->getMaxPower()/10));
|
||||
w->setValue(KartStatsWidget::SKILL_ACCEL, (int)((kp->getMaxSpeed()-20)*20));
|
||||
w->setValue(KartStatsWidget::SKILL_SPEED, (int)((kp->getAbsMaxSpeed()-20)*9));
|
||||
w->setValue(KartStatsWidget::SKILL_POWER, (int)(kp->getAvgPower()));
|
||||
w->update(0);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user