Changes to stk_config to make 3 groups of karts, which will default to the medium, and can be set in the kart.xml
This commit is contained in:
parent
a9de201874
commit
0fa746c805
@ -145,6 +145,7 @@
|
||||
<!-- Default values for all karts
|
||||
============================ -->
|
||||
<general-kart-defaults>
|
||||
<properties group= "medium" />
|
||||
|
||||
<!-- Camera: Distance between kart and camera.
|
||||
forward-up-angle: Angle between camera and plane of kart (pitch)
|
||||
@ -166,8 +167,6 @@
|
||||
it receives the corresponding bonus from 'boost'. Those
|
||||
fields must have the same size, and must be sorted by
|
||||
increasing times. -->
|
||||
<startup time = "0.3 0.5"
|
||||
boost = "6 3" />
|
||||
|
||||
<!-- Rescue: time: How long it takes the kart to be raised.
|
||||
height: how height the kart will be raised before it is
|
||||
@ -176,7 +175,6 @@
|
||||
releasing them on the ground after a rescue. Used to avoid
|
||||
resetting karts into the track. Not sure if this is still
|
||||
necessary. -->
|
||||
<rescue vert-offset="0.0" time="1.2" height="2"/>
|
||||
|
||||
<!-- Nitro: engine-force: additional engine power
|
||||
consumption: nitro consumption - heavier characters can be set
|
||||
@ -191,8 +189,6 @@
|
||||
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="20"/>
|
||||
|
||||
<!-- Bubble gum data:
|
||||
time: How long the bubblegum lasts.
|
||||
@ -200,7 +196,6 @@
|
||||
torque: To rotate the kart somewhat.
|
||||
fade-in-time: How quick the slowdown takes effect.
|
||||
-->
|
||||
<bubblegum time="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"/>
|
||||
|
||||
<!-- time: Time a zipper is active.
|
||||
force: Additional zipper force.
|
||||
@ -210,8 +205,6 @@
|
||||
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" />
|
||||
|
||||
<!-- Skidding: increase: multiplicative increase of skidding factor in each frame.
|
||||
decrease: multiplicative decrease of skidding factor in each frame.
|
||||
@ -246,15 +239,6 @@
|
||||
of the turn the kart is doing somewhat by steering to the left and right,
|
||||
but you will always keep on doing a left turn, just more or less. -->
|
||||
|
||||
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
|
||||
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
|
||||
min-speed="10" time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
bonus-force="250 350"
|
||||
physical-jump-time="0" graphical-jump-time="0.4"
|
||||
post-skid-rotate-factor="1"
|
||||
reduce-turn-min="0.2" reduce-turn-max="0.8"/>
|
||||
|
||||
<!-- Kart-specific settings used by the AI.
|
||||
use-slipstream: if the AI should try to overtake karts using slipstream.
|
||||
disable-slipstream-usage: even if the AI is not trying to use slipstream,
|
||||
@ -406,9 +390,6 @@
|
||||
working.
|
||||
fade-out-time: How long the slip stream speed increase will
|
||||
gradually be reduced. -->
|
||||
<slipstream length="10" width="2" collect-time="2" use-time="5"
|
||||
add-power="3" min-speed="10"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2"/>
|
||||
|
||||
<!-- Kart-specific settings for the swatter:
|
||||
duration: how long can the swatter be active.
|
||||
@ -416,14 +397,12 @@
|
||||
squash-duration: How long a kart will remain squashed.
|
||||
squash-slowdown: percentage of max speed that a kart is
|
||||
restricted to. -->
|
||||
<swatter duration="10" distance="3" squash-duration="5"
|
||||
squash-slowdown="0.5"/>
|
||||
|
||||
<!-- Leaning related parameters, i.e. slightly leaning the karts when
|
||||
driving a fast curve.
|
||||
max: maximum leaning (i.e. when steering as much as possible at highest
|
||||
speed), in degrees.
|
||||
sped: Speed with which the leaning changes (in degree/second). -->
|
||||
<lean max="8.6" speed="5.0" />
|
||||
|
||||
<!-- turn-radius defines the turn radius of the kart at
|
||||
a given speed. The actual steering angle is dependent on the
|
||||
@ -446,16 +425,11 @@
|
||||
0.5 * 0.25 + 0.5 * 0.15 = 0.2 ... which is overall the same
|
||||
time we had previously.
|
||||
-->
|
||||
<turn turn-radius="0:2.0 10:7.5 25:15 45:30"
|
||||
time-full-steer ="0:0.15 0.5:0.15 0.5:0.25 1.0:0.25"
|
||||
time-reset-steer="0.1" />
|
||||
|
||||
<!-- Speed and acceleration related values: power and max-speed (in m/s)
|
||||
have 3 values, one for low, medium, and hard.
|
||||
brake-factor: Value used when braking. max-speed-reverse-ratio is
|
||||
the percentage of max speed for reverse gear. -->
|
||||
<engine power="450 475 500 510" max-speed="17 21 23 25" brake-factor="11.0"
|
||||
max-speed-reverse-ratio="0.3"/>
|
||||
|
||||
<!-- Simulated gears: switch-ratio defines at what ratio of the maximum
|
||||
speed what gear is selected, e.g. 0.25 means that if the speed is
|
||||
@ -464,10 +438,8 @@
|
||||
gear-power-increase contains the increase in max power (to simulate
|
||||
different gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1
|
||||
| first | second | third | . -->
|
||||
<gear switch-ratio="0.25 0.7 1.0" power-increase="2.2 1.7 1.3"/>
|
||||
|
||||
<!-- mass -->
|
||||
<mass value="225"/>
|
||||
|
||||
<!-- Suspension related values. stiffness: kart's suspension stiffness.
|
||||
rest: Length of suspension when at rest.
|
||||
@ -556,9 +528,6 @@
|
||||
duration is the duration a rubber band acts.
|
||||
in-face-time determines how long it takes before a plunger
|
||||
in your face is removed. -->
|
||||
<plunger band-max-length="50" band-force="1500" band-duration="1"
|
||||
band-speed-increase="7" band-fade-out-time="3"
|
||||
in-face-time="3 4 4.5 4.5"/>
|
||||
|
||||
<!-- Kart-specific explosion parameters.
|
||||
Time: how long it takes before the kart can drive again (this
|
||||
@ -567,8 +536,162 @@
|
||||
after being hit by an explosion.
|
||||
radius: Kart closer to this value will be affected by
|
||||
an explosion as well. -->
|
||||
<explosion time="2" radius="5"
|
||||
invulnerability-time="6" />
|
||||
|
||||
<kart-type>
|
||||
<light>
|
||||
<startup time = "0.3 0.5"
|
||||
boost = "6 3" />
|
||||
|
||||
<rescue vert-offset="0.0" time="1.2" height="2"/>
|
||||
|
||||
<nitro engine-force="500" consumption="1" small-container="1" big-container="3"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2" max="20"/>
|
||||
|
||||
<bubblegum time="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"/>
|
||||
|
||||
<zipper time="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
|
||||
fade-out-time="1.0" />
|
||||
|
||||
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
|
||||
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
|
||||
min-speed="10" time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
bonus-force="250 350"
|
||||
physical-jump-time="0" graphical-jump-time="0.4"
|
||||
post-skid-rotate-factor="1"
|
||||
reduce-turn-min="0.2" reduce-turn-max="0.8"/>
|
||||
|
||||
<slipstream length="10" width="2" collect-time="2" use-time="5"
|
||||
add-power="3" min-speed="10"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2"/>
|
||||
|
||||
<swatter duration="10" distance="3" squash-duration="5"
|
||||
squash-slowdown="0.5"/>
|
||||
|
||||
<lean max="8.6" speed="5.0" />
|
||||
|
||||
<turn turn-radius="0:2.0 10:7.5 25:15 45:30"
|
||||
time-full-steer ="0:0.15 0.5:0.15 0.5:0.25 1.0:0.25"
|
||||
time-reset-steer="0.1" />
|
||||
|
||||
<engine power="450 475 500 510" max-speed="17 21 23 25" brake-factor="11.0"
|
||||
max-speed-reverse-ratio="0.3"/>
|
||||
|
||||
<gear switch-ratio="0.25 0.7 1.0" power-increase="2.2 1.7 1.3"/>
|
||||
|
||||
<mass value="225"/>
|
||||
|
||||
<plunger band-max-length="50" band-force="1500" band-duration="1"
|
||||
band-speed-increase="7" band-fade-out-time="3"
|
||||
in-face-time="3 4 4.5 4.5"/>
|
||||
|
||||
<explosion time="2" radius="5"
|
||||
invulnerability-time="6" />
|
||||
|
||||
|
||||
</light>
|
||||
|
||||
<medium>
|
||||
<startup time = "0.3 0.5"
|
||||
boost = "6 3" />
|
||||
|
||||
<rescue vert-offset="0.0" time="1.2" height="2"/>
|
||||
|
||||
<nitro engine-force="500" consumption="1" small-container="1" big-container="3"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2" max="20"/>
|
||||
|
||||
<bubblegum time="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"/>
|
||||
|
||||
<zipper time="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
|
||||
fade-out-time="1.0" />
|
||||
|
||||
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
|
||||
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
|
||||
min-speed="10" time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
bonus-force="250 350"
|
||||
physical-jump-time="0" graphical-jump-time="0.4"
|
||||
post-skid-rotate-factor="1"
|
||||
reduce-turn-min="0.2" reduce-turn-max="0.8"/>
|
||||
|
||||
<slipstream length="10" width="2" collect-time="2" use-time="5"
|
||||
add-power="3" min-speed="10"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2"/>
|
||||
|
||||
<swatter duration="10" distance="3" squash-duration="5"
|
||||
squash-slowdown="0.5"/>
|
||||
|
||||
<lean max="8.6" speed="5.0" />
|
||||
|
||||
<turn turn-radius="0:2.0 10:7.5 25:15 45:30"
|
||||
time-full-steer ="0:0.15 0.5:0.15 0.5:0.25 1.0:0.25"
|
||||
time-reset-steer="0.1" />
|
||||
|
||||
<engine power="450 475 500 510" max-speed="17 21 23 25" brake-factor="11.0"
|
||||
max-speed-reverse-ratio="0.3"/>
|
||||
|
||||
<gear switch-ratio="0.25 0.7 1.0" power-increase="2.2 1.7 1.3"/>
|
||||
|
||||
<mass value="225"/>
|
||||
|
||||
<plunger band-max-length="50" band-force="1500" band-duration="1"
|
||||
band-speed-increase="7" band-fade-out-time="3"
|
||||
in-face-time="3 4 4.5 4.5"/>
|
||||
|
||||
<explosion time="2" radius="5"
|
||||
invulnerability-time="6" />
|
||||
</medium>
|
||||
|
||||
<heavy>
|
||||
<startup time = "0.3 0.5"
|
||||
boost = "6 3" />
|
||||
|
||||
<rescue vert-offset="0.0" time="1.2" height="2"/>
|
||||
|
||||
<nitro engine-force="500" consumption="1" small-container="1" big-container="3"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2" max="20"/>
|
||||
|
||||
<bubblegum time="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"/>
|
||||
|
||||
<zipper time="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
|
||||
fade-out-time="1.0" />
|
||||
|
||||
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
|
||||
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
|
||||
min-speed="10" time-till-bonus="1.0 3.0"
|
||||
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
|
||||
bonus-force="250 350"
|
||||
physical-jump-time="0" graphical-jump-time="0.4"
|
||||
post-skid-rotate-factor="1"
|
||||
reduce-turn-min="0.2" reduce-turn-max="0.8"/>
|
||||
|
||||
<slipstream length="10" width="2" collect-time="2" use-time="5"
|
||||
add-power="3" min-speed="10"
|
||||
max-speed-increase="5" duration="1" fade-out-time="2"/>
|
||||
|
||||
<swatter duration="10" distance="3" squash-duration="5"
|
||||
squash-slowdown="0.5"/>
|
||||
|
||||
<lean max="8.6" speed="5.0" />
|
||||
|
||||
<turn turn-radius="0:2.0 10:7.5 25:15 45:30"
|
||||
time-full-steer ="0:0.15 0.5:0.15 0.5:0.25 1.0:0.25"
|
||||
time-reset-steer="0.1" />
|
||||
|
||||
<engine power="450 475 500 510" max-speed="17 21 23 25" brake-factor="11.0"
|
||||
max-speed-reverse-ratio="0.3"/>
|
||||
|
||||
<gear switch-ratio="0.25 0.7 1.0" power-increase="2.2 1.7 1.3"/>
|
||||
|
||||
<mass value="225"/>
|
||||
|
||||
<plunger band-max-length="50" band-force="1500" band-duration="1"
|
||||
band-speed-increase="7" band-fade-out-time="3"
|
||||
in-face-time="3 4 4.5 4.5"/>
|
||||
|
||||
<explosion time="2" radius="5"
|
||||
invulnerability-time="6" />
|
||||
</heavy>
|
||||
</kart-type>
|
||||
</general-kart-defaults>
|
||||
</config>
|
||||
|
@ -172,7 +172,9 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
||||
{
|
||||
// Get the default values from STKConfig. This will also allocate any
|
||||
// pointers used in KartProperties
|
||||
|
||||
copyFrom(&stk_config->getDefaultKartProperties());
|
||||
|
||||
// m_kart_model must be initialised after assigning the default
|
||||
// values from stk_config (otherwise all kart_properties will
|
||||
// share the same KartModel
|
||||
@ -286,7 +288,7 @@ void KartProperties::load(const std::string &filename, const std::string &node)
|
||||
*/
|
||||
void KartProperties::getAllData(const XMLNode * root)
|
||||
{
|
||||
root->get("version", &m_version);
|
||||
root->get("version", &m_version);
|
||||
|
||||
root->get("name", &m_name );
|
||||
|
||||
@ -307,50 +309,32 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
root->get("shadow-x-offset", &m_shadow_x_offset );
|
||||
root->get("shadow-y-offset", &m_shadow_y_offset );
|
||||
|
||||
if(const XMLNode *props_group = root->getNode("properties")) {
|
||||
props_group->get("group", &m_kart_type );
|
||||
}
|
||||
else
|
||||
{
|
||||
root->get("kart-type", &m_kart_type );
|
||||
}
|
||||
|
||||
if(const XMLNode *kart_type = root->getNode("kart-type"))
|
||||
{
|
||||
getProperties(kart_type->getNode(m_kart_type));
|
||||
}
|
||||
else
|
||||
{
|
||||
//When we load in kart.xml values, we first set the correct type
|
||||
//After we have done that, we can still enter kart-specific values
|
||||
const XMLNode* config_root = new XMLNode(file_manager->getAsset("stk_config.xml"));
|
||||
getProperties(config_root->getNode("general-kart-defaults")->getNode("kart-type")->getNode(m_kart_type));
|
||||
getProperties(root);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(const XMLNode *dimensions_node = root->getNode("center"))
|
||||
dimensions_node->get("gravity-shift", &m_gravity_center_shift);
|
||||
|
||||
if(const XMLNode *nitro_node = root->getNode("nitro"))
|
||||
{
|
||||
nitro_node->get("consumption", &m_nitro_consumption );
|
||||
nitro_node->get("small-container", &m_nitro_small_container );
|
||||
nitro_node->get("big-container", &m_nitro_big_container );
|
||||
nitro_node->get("max-speed-increase", &m_nitro_max_speed_increase);
|
||||
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 );
|
||||
nitro_node->get("min-consumption-time", &m_nitro_min_consumption );
|
||||
}
|
||||
|
||||
if(const XMLNode *bubble_node = root->getNode("bubblegum"))
|
||||
{
|
||||
bubble_node->get("time", &m_bubblegum_time );
|
||||
bubble_node->get("speed-fraction", &m_bubblegum_speed_fraction);
|
||||
bubble_node->get("fade-in-time", &m_bubblegum_fade_in_time );
|
||||
bubble_node->get("torque", &m_bubblegum_torque );
|
||||
}
|
||||
|
||||
if(const XMLNode *rescue_node = root->getNode("rescue"))
|
||||
{
|
||||
rescue_node->get("vert-offset", &m_rescue_vert_offset);
|
||||
rescue_node->get("time", &m_rescue_time );
|
||||
rescue_node->get("height", &m_rescue_height );
|
||||
}
|
||||
|
||||
if(const XMLNode *explosion_node = root->getNode("explosion"))
|
||||
{
|
||||
explosion_node->get("time", &m_explosion_time );
|
||||
explosion_node->get("radius", &m_explosion_radius);
|
||||
explosion_node->get("invulnerability-time",
|
||||
&m_explosion_invulnerability_time);
|
||||
}
|
||||
|
||||
if(const XMLNode *skid_node = root->getNode("skid"))
|
||||
{
|
||||
m_skidding_properties->load(skid_node);
|
||||
}
|
||||
|
||||
if(const XMLNode *ai_node = root->getNode("ai"))
|
||||
{
|
||||
const XMLNode *easy = ai_node->getNode("easy");
|
||||
@ -363,59 +347,6 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
m_ai_properties[RaceManager::DIFFICULTY_BEST]->load(best);
|
||||
}
|
||||
|
||||
if(const XMLNode *slipstream_node = root->getNode("slipstream"))
|
||||
{
|
||||
slipstream_node->get("length", &m_slipstream_length );
|
||||
slipstream_node->get("width", &m_slipstream_width );
|
||||
slipstream_node->get("collect-time", &m_slipstream_collect_time );
|
||||
slipstream_node->get("use-time", &m_slipstream_use_time );
|
||||
slipstream_node->get("add-power", &m_slipstream_add_power );
|
||||
slipstream_node->get("min-speed", &m_slipstream_min_speed );
|
||||
slipstream_node->get("max-speed-increase",
|
||||
&m_slipstream_max_speed_increase);
|
||||
slipstream_node->get("duration", &m_slipstream_duration );
|
||||
slipstream_node->get("fade-out-time",&m_slipstream_fade_out_time );
|
||||
}
|
||||
|
||||
if(const XMLNode *turn_node = root->getNode("turn"))
|
||||
{
|
||||
turn_node->get("time-full-steer", &m_time_full_steer );
|
||||
turn_node->get("time-reset-steer", &m_time_reset_steer );
|
||||
turn_node->get("turn-radius", &m_turn_angle_at_speed );
|
||||
// For now store the turn radius in turn angle, the correct
|
||||
// value can only be determined later in ::load
|
||||
}
|
||||
|
||||
if(const XMLNode *engine_node = root->getNode("engine"))
|
||||
{
|
||||
engine_node->get("brake-factor", &m_brake_factor);
|
||||
engine_node->get("max-speed-reverse-ratio", &m_max_speed_reverse_ratio);
|
||||
engine_node->get("power", &m_engine_power);
|
||||
if(m_engine_power.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("[KartProperties]",
|
||||
"Incorrect engine-power specifications for kart '%s'",
|
||||
getIdent().c_str());
|
||||
}
|
||||
engine_node->get("max-speed", &m_max_speed);
|
||||
if(m_max_speed.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("[KartProperties]",
|
||||
"Incorrect max-speed specifications for kart '%s'",
|
||||
getIdent().c_str());
|
||||
}
|
||||
} // if getNode("engine")
|
||||
|
||||
if(const XMLNode *gear_node = root->getNode("gear"))
|
||||
{
|
||||
gear_node->get("switch-ratio", &m_gear_switch_ratio );
|
||||
gear_node->get("power-increase", &m_gear_power_increase);
|
||||
}
|
||||
|
||||
if(const XMLNode *mass_node = root->getNode("mass"))
|
||||
mass_node->get("value", &m_mass);
|
||||
|
||||
|
||||
if(const XMLNode *suspension_node = root->getNode("suspension"))
|
||||
{
|
||||
suspension_node->get("stiffness", &m_suspension_stiffness);
|
||||
@ -488,50 +419,6 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
//TODO: listed as an attribute in the xml file after wheel-radius
|
||||
//TODO: same goes for their rear equivalents
|
||||
|
||||
if(const XMLNode *plunger_node= root->getNode("plunger"))
|
||||
{
|
||||
plunger_node->get("band-max-length", &m_rubber_band_max_length );
|
||||
plunger_node->get("band-force", &m_rubber_band_force );
|
||||
plunger_node->get("band-duration", &m_rubber_band_duration );
|
||||
plunger_node->get("band-speed-increase",&m_rubber_band_speed_increase);
|
||||
plunger_node->get("band-fade-out-time", &m_rubber_band_fade_out_time );
|
||||
plunger_node->get("in-face-time", &m_plunger_in_face_duration);
|
||||
if(m_plunger_in_face_duration.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Invalid plunger in-face-time specification.");
|
||||
}
|
||||
}
|
||||
|
||||
if(const XMLNode *zipper_node= root->getNode("zipper"))
|
||||
{
|
||||
zipper_node->get("time", &m_zipper_time );
|
||||
zipper_node->get("fade-out-time", &m_zipper_fade_out_time );
|
||||
zipper_node->get("force", &m_zipper_force );
|
||||
zipper_node->get("speed-gain", &m_zipper_speed_gain );
|
||||
zipper_node->get("max-speed-increase", &m_zipper_max_speed_increase);
|
||||
}
|
||||
|
||||
if(const XMLNode *swatter_node= root->getNode("swatter"))
|
||||
{
|
||||
swatter_node->get("duration", &m_swatter_duration );
|
||||
swatter_node->get("squash-duration", &m_squash_duration );
|
||||
swatter_node->get("squash-slowdown", &m_squash_slowdown );
|
||||
if(swatter_node->get("distance", &m_swatter_distance2) )
|
||||
{
|
||||
// Avoid squaring if distance is not defined, so that
|
||||
// distance2 remains UNDEFINED (which is a negative value)
|
||||
m_swatter_distance2 *= m_swatter_distance2;
|
||||
}
|
||||
}
|
||||
|
||||
if(const XMLNode *lean_node= root->getNode("lean"))
|
||||
{
|
||||
lean_node->get("max", &m_max_lean );
|
||||
lean_node->get("speed", &m_lean_speed);
|
||||
m_max_lean *= DEGREE_TO_RAD;
|
||||
m_lean_speed *= DEGREE_TO_RAD;
|
||||
}
|
||||
|
||||
if(const XMLNode *jump_node= root->getNode("jump"))
|
||||
{
|
||||
@ -547,12 +434,6 @@ void KartProperties::getAllData(const XMLNode * root)
|
||||
m_camera_backward_up_angle *= DEGREE_TO_RAD;
|
||||
}
|
||||
|
||||
if(const XMLNode *startup_node= root->getNode("startup"))
|
||||
{
|
||||
startup_node->get("time", &m_startup_times);
|
||||
startup_node->get("boost", &m_startup_boost);
|
||||
}
|
||||
|
||||
if(const XMLNode *sounds_node= root->getNode("sounds"))
|
||||
{
|
||||
std::string s;
|
||||
@ -755,6 +636,156 @@ bool KartProperties::isInGroup(const std::string &group) const
|
||||
return std::find(m_groups.begin(), m_groups.end(), group) != m_groups.end();
|
||||
} // isInGroups
|
||||
|
||||
void KartProperties::getProperties(const XMLNode* root)
|
||||
{
|
||||
|
||||
if(const XMLNode *nitro_node = root->getNode("nitro"))
|
||||
{
|
||||
nitro_node->get("consumption", &m_nitro_consumption );
|
||||
nitro_node->get("small-container", &m_nitro_small_container );
|
||||
nitro_node->get("big-container", &m_nitro_big_container );
|
||||
nitro_node->get("max-speed-increase", &m_nitro_max_speed_increase);
|
||||
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 );
|
||||
nitro_node->get("min-consumption-time", &m_nitro_min_consumption );
|
||||
}
|
||||
|
||||
if(const XMLNode *bubble_node = root->getNode("bubblegum"))
|
||||
{
|
||||
bubble_node->get("time", &m_bubblegum_time );
|
||||
bubble_node->get("speed-fraction", &m_bubblegum_speed_fraction);
|
||||
bubble_node->get("fade-in-time", &m_bubblegum_fade_in_time );
|
||||
bubble_node->get("torque", &m_bubblegum_torque );
|
||||
}
|
||||
|
||||
if(const XMLNode *rescue_node = root->getNode("rescue"))
|
||||
{
|
||||
rescue_node->get("vert-offset", &m_rescue_vert_offset);
|
||||
rescue_node->get("time", &m_rescue_time );
|
||||
rescue_node->get("height", &m_rescue_height );
|
||||
}
|
||||
|
||||
if(const XMLNode *explosion_node = root->getNode("explosion"))
|
||||
{
|
||||
explosion_node->get("time", &m_explosion_time );
|
||||
explosion_node->get("radius", &m_explosion_radius);
|
||||
explosion_node->get("invulnerability-time",
|
||||
&m_explosion_invulnerability_time);
|
||||
}
|
||||
|
||||
if(const XMLNode *skid_node = root->getNode("skid"))
|
||||
{
|
||||
m_skidding_properties->load(skid_node);
|
||||
}
|
||||
|
||||
|
||||
if(const XMLNode *slipstream_node = root->getNode("slipstream"))
|
||||
{
|
||||
slipstream_node->get("length", &m_slipstream_length );
|
||||
slipstream_node->get("width", &m_slipstream_width );
|
||||
slipstream_node->get("collect-time", &m_slipstream_collect_time );
|
||||
slipstream_node->get("use-time", &m_slipstream_use_time );
|
||||
slipstream_node->get("add-power", &m_slipstream_add_power );
|
||||
slipstream_node->get("min-speed", &m_slipstream_min_speed );
|
||||
slipstream_node->get("max-speed-increase",
|
||||
&m_slipstream_max_speed_increase);
|
||||
slipstream_node->get("duration", &m_slipstream_duration );
|
||||
slipstream_node->get("fade-out-time",&m_slipstream_fade_out_time );
|
||||
}
|
||||
|
||||
if(const XMLNode *turn_node = root->getNode("turn"))
|
||||
{
|
||||
turn_node->get("time-full-steer", &m_time_full_steer );
|
||||
turn_node->get("time-reset-steer", &m_time_reset_steer );
|
||||
turn_node->get("turn-radius", &m_turn_angle_at_speed );
|
||||
// For now store the turn radius in turn angle, the correct
|
||||
// value can only be determined later in ::load
|
||||
}
|
||||
|
||||
if(const XMLNode *engine_node = root->getNode("engine"))
|
||||
{
|
||||
engine_node->get("brake-factor", &m_brake_factor);
|
||||
engine_node->get("max-speed-reverse-ratio", &m_max_speed_reverse_ratio);
|
||||
engine_node->get("power", &m_engine_power);
|
||||
if(m_engine_power.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("[KartProperties]",
|
||||
"Incorrect engine-power specifications for kart '%s'",
|
||||
getIdent().c_str());
|
||||
}
|
||||
engine_node->get("max-speed", &m_max_speed);
|
||||
if(m_max_speed.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("[KartProperties]",
|
||||
"Incorrect max-speed specifications for kart '%s'",
|
||||
getIdent().c_str());
|
||||
}
|
||||
} // if getNode("engine")
|
||||
|
||||
if(const XMLNode *gear_node = root->getNode("gear"))
|
||||
{
|
||||
gear_node->get("switch-ratio", &m_gear_switch_ratio );
|
||||
gear_node->get("power-increase", &m_gear_power_increase);
|
||||
}
|
||||
|
||||
if(const XMLNode *mass_node = root->getNode("mass"))
|
||||
mass_node->get("value", &m_mass);
|
||||
|
||||
if(const XMLNode *plunger_node= root->getNode("plunger"))
|
||||
{
|
||||
plunger_node->get("band-max-length", &m_rubber_band_max_length );
|
||||
plunger_node->get("band-force", &m_rubber_band_force );
|
||||
plunger_node->get("band-duration", &m_rubber_band_duration );
|
||||
plunger_node->get("band-speed-increase",&m_rubber_band_speed_increase);
|
||||
plunger_node->get("band-fade-out-time", &m_rubber_band_fade_out_time );
|
||||
plunger_node->get("in-face-time", &m_plunger_in_face_duration);
|
||||
if(m_plunger_in_face_duration.size()!=RaceManager::DIFFICULTY_COUNT)
|
||||
{
|
||||
Log::fatal("KartProperties",
|
||||
"Invalid plunger in-face-time specification.");
|
||||
}
|
||||
}
|
||||
|
||||
if(const XMLNode *zipper_node= root->getNode("zipper"))
|
||||
{
|
||||
zipper_node->get("time", &m_zipper_time );
|
||||
zipper_node->get("fade-out-time", &m_zipper_fade_out_time );
|
||||
zipper_node->get("force", &m_zipper_force );
|
||||
zipper_node->get("speed-gain", &m_zipper_speed_gain );
|
||||
zipper_node->get("max-speed-increase", &m_zipper_max_speed_increase);
|
||||
}
|
||||
|
||||
if(const XMLNode *swatter_node= root->getNode("swatter"))
|
||||
{
|
||||
swatter_node->get("duration", &m_swatter_duration );
|
||||
swatter_node->get("squash-duration", &m_squash_duration );
|
||||
swatter_node->get("squash-slowdown", &m_squash_slowdown );
|
||||
if(swatter_node->get("distance", &m_swatter_distance2) )
|
||||
{
|
||||
// Avoid squaring if distance is not defined, so that
|
||||
// distance2 remains UNDEFINED (which is a negative value)
|
||||
m_swatter_distance2 *= m_swatter_distance2;
|
||||
}
|
||||
}
|
||||
|
||||
if(const XMLNode *lean_node= root->getNode("lean"))
|
||||
{
|
||||
lean_node->get("max", &m_max_lean );
|
||||
lean_node->get("speed", &m_lean_speed);
|
||||
m_max_lean *= DEGREE_TO_RAD;
|
||||
m_lean_speed *= DEGREE_TO_RAD;
|
||||
}
|
||||
|
||||
if(const XMLNode *startup_node= root->getNode("startup"))
|
||||
{
|
||||
startup_node->get("time", &m_startup_times);
|
||||
startup_node->get("boost", &m_startup_boost);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Called the first time a kart accelerates after 'ready-set-go'. It searches
|
||||
* through m_startup_times to find the appropriate slot, and returns the
|
||||
|
@ -181,6 +181,9 @@ private:
|
||||
*/
|
||||
float m_nitro_min_consumption;
|
||||
|
||||
/** Type of the kart (for the properties) */
|
||||
std::string m_kart_type;
|
||||
|
||||
/** Filename of the wheel models. */
|
||||
std::string m_wheel_filename[4];
|
||||
/** Radius of the graphical wheels. */
|
||||
@ -389,6 +392,7 @@ public:
|
||||
float getStartupBoost () const;
|
||||
bool isInGroup (const std::string &group) const;
|
||||
bool operator<(const KartProperties &other) const;
|
||||
void getProperties (const XMLNode * root);
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns the (maximum) speed for a given turn radius.
|
||||
|
Loading…
Reference in New Issue
Block a user