Added maximum amount of nitro a kart can collect to stk_config.xml
(instead of "const int MAX_NITRO = 16" in moveable.hpp). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11512 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ecd569b093
commit
ed9b701e53
@ -24,9 +24,6 @@
|
||||
<points from="5" points="1"/>
|
||||
</grand-prix>
|
||||
|
||||
<!-- A value between 0 and 1, change this to handicap AIs -->
|
||||
<ai acceleration="1.0" />
|
||||
|
||||
<!-- Time in follow-the-leader after which karts are removed.
|
||||
The last values applies for all remaining karts.
|
||||
time-per-kart Additional time added to the interval
|
||||
@ -144,23 +141,28 @@
|
||||
|
||||
<!-- Nitro: engine-force: additional engine power
|
||||
consumption: nitro consumption - heavier characters can be set
|
||||
to need more nitro than lighter character.
|
||||
to need more nitro than lighter character.
|
||||
small-container: how much energy a small container gives.
|
||||
big-container: how much energy a big container gives.
|
||||
max-speed-increase: How much the speed of a kart might exceed
|
||||
its maximum speed (in m/s).
|
||||
its maximum speed (in m/s).
|
||||
duration: How long the increased speed will be valid after
|
||||
the kart stops using nitro (and the fade-out-time starts).
|
||||
the kart stops using nitro (and the fade-out-time starts).
|
||||
fade-out-time: Duration during which the increased maximum
|
||||
speed due to nitro fades out. -->
|
||||
speed due to nitro fades out.
|
||||
max: How much nitro a kart can store.
|
||||
-->
|
||||
<nitro engine-force="500" consumption="1" small-container="1" big-container="3"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2"/>
|
||||
max-speed-increase="5" duration="1" fade-out-time="2" max="16"/>
|
||||
|
||||
<!-- time is the time a zipper is active. force is the additional
|
||||
zipper force. speed-gain is the one time additional speed.
|
||||
max-speed-increase is the additional speed allowed on top
|
||||
of the kart-specific maximum kart speed. Fade-out time determines
|
||||
how long it takes for a zipper to fade out (after 'time'). -->
|
||||
<!-- time: Time a zipper is active.
|
||||
force: Additional zipper force.
|
||||
speed-gain: One time additional speed.
|
||||
max-speed-increase: Additional speed allowed on top of the
|
||||
kart-specific maximum kart speed.
|
||||
fade-out-time: determines how long it takes for a zipper
|
||||
to fade out (after 'time').
|
||||
-->
|
||||
<zipper time="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
|
||||
fade-out-time="1.0" />
|
||||
|
||||
@ -345,13 +347,5 @@
|
||||
<explosion time="2" radius="5"
|
||||
invulnerability-time="6" />
|
||||
|
||||
<!-- Kart-specific settings used by the AI.
|
||||
steering-variation: make each kart steer towards slightly
|
||||
different driveline points, so that AI don't create trains.
|
||||
Maximum value should be 1 (steer towards left/right side
|
||||
of driveline), 0 means exactly towards quad center point.
|
||||
Depending on kart id karts will aim at different points.-->
|
||||
<ai steering-variation="0.0" />
|
||||
|
||||
</general-kart-defaults>
|
||||
</config>
|
||||
|
@ -34,14 +34,14 @@ AIBaseController::AIBaseController(AbstractKart *kart,
|
||||
StateManager::ActivePlayer *player)
|
||||
: Controller(kart, player)
|
||||
{
|
||||
m_kart = kart;
|
||||
m_kart_length = m_kart->getKartLength();
|
||||
m_kart_width = m_kart->getKartWidth();
|
||||
m_kart = kart;
|
||||
m_kart_length = m_kart->getKartLength();
|
||||
m_kart_width = m_kart->getKartWidth();
|
||||
|
||||
if(race_manager->getMinorMode()!=RaceManager::MINOR_MODE_3_STRIKES)
|
||||
{
|
||||
m_world = dynamic_cast<LinearWorld*>(World::getWorld());
|
||||
m_track = m_world->getTrack();
|
||||
m_world = dynamic_cast<LinearWorld*>(World::getWorld());
|
||||
m_track = m_world->getTrack();
|
||||
computePath();
|
||||
}
|
||||
else
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "states_screens/state_manager.hpp"
|
||||
|
||||
class AIProperties;
|
||||
class LinearWorld;
|
||||
class QuadGraph;
|
||||
class Track;
|
||||
@ -61,6 +62,9 @@ protected:
|
||||
/** Keep a pointer to world. */
|
||||
LinearWorld *m_world;
|
||||
|
||||
/** A pointer to the AI properties for this kart. */
|
||||
const AIProperties *m_ai_properties;
|
||||
|
||||
/** The current node the kart is on. This can be different from the value
|
||||
* in LinearWorld, since it takes the chosen path of the AI into account
|
||||
* (e.g. the closest point in LinearWorld might be on a branch not
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "items/item.hpp"
|
||||
#include "items/powerup.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/rescue_animation.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/history.hpp"
|
||||
@ -426,8 +427,8 @@ void PlayerController::handleZipper(bool play_sound)
|
||||
*/
|
||||
void PlayerController::collectedItem(const Item &item, int add_info, float old_energy)
|
||||
{
|
||||
if (old_energy < MAX_NITRO &&
|
||||
m_kart->getEnergy() == MAX_NITRO)
|
||||
if (old_energy < m_kart->getKartProperties()->getNitroMax() &&
|
||||
m_kart->getEnergy() == m_kart->getKartProperties()->getNitroMax())
|
||||
{
|
||||
m_full_sound->play();
|
||||
}
|
||||
|
@ -865,8 +865,8 @@ void Kart::collectedItem(Item *item, int add_info)
|
||||
race_state->itemCollected(getWorldKartId(), item->getItemId());
|
||||
}
|
||||
|
||||
if ( m_collected_energy > MAX_NITRO )
|
||||
m_collected_energy = MAX_NITRO;
|
||||
if ( m_collected_energy > m_kart_properties->getNitroMax())
|
||||
m_collected_energy = m_kart_properties->getNitroMax();
|
||||
m_controller->collectedItem(*item, add_info, old_energy);
|
||||
|
||||
} // collectedItem
|
||||
|
@ -65,9 +65,8 @@ KartProperties::KartProperties(const std::string &filename)
|
||||
// if everything is defined properly.
|
||||
m_mass = m_brake_factor = m_engine_power[0] = m_engine_power[1] =
|
||||
m_engine_power[2] = m_max_speed[0] = m_max_speed[1] = m_max_speed[2] =
|
||||
m_time_full_steer = m_time_full_steer_ai =
|
||||
m_nitro_consumption = m_nitro_engine_force =
|
||||
m_nitro_small_container = m_nitro_big_container =
|
||||
m_time_full_steer = m_nitro_consumption = m_nitro_engine_force =
|
||||
m_nitro_small_container = m_nitro_big_container = m_nitro_max =
|
||||
m_nitro_max_speed_increase = m_nitro_duration = m_nitro_fade_out_time =
|
||||
m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_base =
|
||||
m_wheel_damping_compression = m_friction_slip = m_roll_influence =
|
||||
@ -92,7 +91,7 @@ KartProperties::KartProperties(const std::string &filename)
|
||||
m_camera_distance = m_camera_forward_up_angle =
|
||||
m_camera_backward_up_angle = m_explosion_invulnerability_time =
|
||||
m_rescue_time = m_rescue_height = m_explosion_time =
|
||||
m_explosion_radius = m_ai_steering_variation =
|
||||
m_explosion_radius =
|
||||
m_swatter_distance2 = m_swatter_duration = m_squash_slowdown =
|
||||
m_squash_duration = m_downward_impulse_factor = UNDEFINED;
|
||||
|
||||
@ -141,8 +140,8 @@ void KartProperties::copyFrom(const KartProperties *source)
|
||||
// So all pointer variables need to be separately allocated and assigned.
|
||||
m_skidding_properties = new SkiddingProperties();
|
||||
assert(m_skidding_properties);
|
||||
*m_skidding_properties = *source->m_skidding_properties;
|
||||
} // copy
|
||||
*m_skidding_properties = *source->m_skidding_properties;
|
||||
} // copyFrom
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/** Loads the kart properties from a file.
|
||||
@ -296,7 +295,7 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
nitro_node->get("engine-force", &m_nitro_engine_force );
|
||||
nitro_node->get("duration", &m_nitro_duration );
|
||||
nitro_node->get("fade-out-time", &m_nitro_fade_out_time );
|
||||
|
||||
nitro_node->get("max", &m_nitro_max );
|
||||
}
|
||||
|
||||
if(const XMLNode *rescue_node = root->getNode("rescue"))
|
||||
@ -314,10 +313,6 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
&m_explosion_invulnerability_time);
|
||||
}
|
||||
|
||||
if(const XMLNode *ai_node = root->getNode("ai"))
|
||||
{
|
||||
ai_node->get("steering-variation", &m_ai_steering_variation );
|
||||
}
|
||||
if(const XMLNode *skid_node = root->getNode("skid"))
|
||||
{
|
||||
m_skidding_properties->load(skid_node);
|
||||
@ -661,6 +656,7 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
CHECK_NEG(m_nitro_engine_force, "nitro engine-force" );
|
||||
CHECK_NEG(m_nitro_duration, "nitro duration" );
|
||||
CHECK_NEG(m_nitro_fade_out_time, "nitro fade-out-time" );
|
||||
CHECK_NEG(m_nitro_max, "nitro max" );
|
||||
CHECK_NEG(m_swatter_distance2, "swatter distance" );
|
||||
CHECK_NEG(m_swatter_duration, "swatter duration" );
|
||||
CHECK_NEG(m_squash_duration, "squash-duration" );
|
||||
@ -673,7 +669,6 @@ void KartProperties::checkAllSet(const std::string &filename)
|
||||
CHECK_NEG(m_explosion_invulnerability_time,
|
||||
"explosion invulnerability-time");
|
||||
CHECK_NEG(m_explosion_radius, "explosion radius" );
|
||||
CHECK_NEG(m_ai_steering_variation, "ai steering-variation" );
|
||||
|
||||
m_skidding_properties->checkAllSet(filename);
|
||||
} // checkAllSet
|
||||
|
@ -207,6 +207,8 @@ private:
|
||||
/** Duration during which the increased maximum speed
|
||||
* due to nitro fades out. */
|
||||
float m_nitro_fade_out_time;
|
||||
/** Maximum nitro a kart can collect. */
|
||||
float m_nitro_max;
|
||||
/** Square of the maximum distance a swatter can operate. */
|
||||
float m_swatter_distance2;
|
||||
/** How long the swatter lasts. */
|
||||
@ -295,14 +297,6 @@ private:
|
||||
/** How long the slip stream speed increase will gradually be reduced. */
|
||||
float m_slipstream_fade_out_time;
|
||||
|
||||
|
||||
/** Make the AI to steer at slightly different points to make it less
|
||||
* likely that the AI creates 'trains' - the kart behind getting
|
||||
* slipstream. The variation should be a value between 0 (no variation,
|
||||
* all karts steer to the same driveline points) and 1 (karts will aim
|
||||
* all the way to the very edge of the drivelines). */
|
||||
float m_ai_steering_variation;
|
||||
|
||||
float m_camera_distance; /**< Distance of normal camera from kart.*/
|
||||
float m_camera_forward_up_angle; /**< Up angle of the camera in relation to
|
||||
the pitch of the kart when driving
|
||||
@ -485,6 +479,9 @@ public:
|
||||
* due to nitro fades out. */
|
||||
float getNitroFadeOutTime () const {return m_nitro_fade_out_time; }
|
||||
|
||||
/** Returns the maximum amount of nitro a kart can store. */
|
||||
float getNitroMax () const {return m_nitro_max; }
|
||||
|
||||
/** Returns a shift of the center of mass (lowering the center of mass
|
||||
* makes the karts more stable. */
|
||||
const Vec3&getGravityCenterShift() const {return m_gravity_center_shift; }
|
||||
@ -643,9 +640,6 @@ public:
|
||||
float getCameraBackwardUpAngle () const
|
||||
{return m_camera_backward_up_angle; }
|
||||
|
||||
/** Returns AI steering variation value. */
|
||||
float getAISteeringVariation () const {return m_ai_steering_variation; }
|
||||
|
||||
/** Returns the full path where the files for this kart are stored. */
|
||||
const std::string& getKartDir () const {return m_root; }
|
||||
|
||||
|
@ -34,8 +34,6 @@ using namespace irr;
|
||||
|
||||
class Material;
|
||||
|
||||
const int MAX_NITRO = 16;
|
||||
|
||||
/**
|
||||
* \ingroup karts
|
||||
*/
|
||||
|
@ -368,7 +368,8 @@ void MinimalRaceGUI::drawEnergyMeter(const AbstractKart *kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
float state = (float)(kart->getEnergy()) / MAX_NITRO;
|
||||
float state = (float)(kart->getEnergy())
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
if (state < 0.0f) state = 0.0f;
|
||||
else if (state > 1.0f) state = 1.0f;
|
||||
|
||||
@ -396,7 +397,8 @@ void MinimalRaceGUI::drawEnergyMeter(const AbstractKart *kart,
|
||||
// ------
|
||||
if (race_manager->getCoinTarget() > 0)
|
||||
{
|
||||
float coin_target = (float)race_manager->getCoinTarget() / MAX_NITRO;
|
||||
float coin_target = (float)race_manager->getCoinTarget()
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
|
||||
const int EMPTY_TOP_PIXELS = 4;
|
||||
const int EMPTY_BOTTOM_PIXELS = 3;
|
||||
|
@ -39,6 +39,7 @@ using namespace irr;
|
||||
#include "items/powerup_manager.hpp"
|
||||
#include "karts/abstract_kart.hpp"
|
||||
#include "karts/controller/controller.hpp"
|
||||
#include "karts/kart_properties.hpp"
|
||||
#include "karts/kart_properties_manager.hpp"
|
||||
#include "modes/follow_the_leader.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
@ -326,7 +327,8 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
float state = (float)(kart->getEnergy()) / MAX_NITRO;
|
||||
float state = (float)(kart->getEnergy())
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
if (state < 0.0f) state = 0.0f;
|
||||
else if (state > 1.0f) state = 1.0f;
|
||||
|
||||
@ -346,7 +348,8 @@ void RaceGUI::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
// Target
|
||||
if (race_manager->getCoinTarget() > 0)
|
||||
{
|
||||
float coin_target = (float)race_manager->getCoinTarget() / MAX_NITRO;
|
||||
float coin_target = (float)race_manager->getCoinTarget()
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
|
||||
const int EMPTY_TOP_PIXELS = 4;
|
||||
const int EMPTY_BOTTOM_PIXELS = 3;
|
||||
|
@ -468,7 +468,8 @@ void RaceGUIOverworld::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
const core::recti &viewport,
|
||||
const core::vector2df &scaling)
|
||||
{
|
||||
float state = (float)(kart->getEnergy()) / MAX_NITRO;
|
||||
float state = (float)(kart->getEnergy())
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
if (state < 0.0f) state = 0.0f;
|
||||
else if (state > 1.0f) state = 1.0f;
|
||||
|
||||
@ -488,7 +489,8 @@ void RaceGUIOverworld::drawEnergyMeter(int x, int y, const AbstractKart *kart,
|
||||
// Target
|
||||
if (race_manager->getCoinTarget() > 0)
|
||||
{
|
||||
float coin_target = (float)race_manager->getCoinTarget() / MAX_NITRO;
|
||||
float coin_target = (float)race_manager->getCoinTarget()
|
||||
/ kart->getKartProperties()->getNitroMax();
|
||||
|
||||
const int EMPTY_TOP_PIXELS = 4;
|
||||
const int EMPTY_BOTTOM_PIXELS = 3;
|
||||
|
Loading…
x
Reference in New Issue
Block a user