Add some documenation and try to get some backwards compatibility
This commit is contained in:
parent
5d36b95c95
commit
ec3083827d
@ -1,6 +1,19 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!-- Format
|
<!-- Format
|
||||||
ATTENTION: - is a special case if it is the first character of a number-
|
It is possible to give relative values (factors and more) for each property.
|
||||||
|
|
||||||
|
The format as a regex is: ([+-*/](%d+|x))*
|
||||||
|
An empty value means no change, a value without sign or with a '-' replaces
|
||||||
|
the previous value. If an operator prefixes the string, e.g. *1.5 (- doesn't
|
||||||
|
work because it's a sign). x will get replaced by the previous value which
|
||||||
|
means *1.5 is equal to x*1.5. It's also possible to combine operations:
|
||||||
|
+1.5*20 means "add 1.5 to the previous value and then multiply by 20".
|
||||||
|
Note that it's computed sequentially from left to right and there is no
|
||||||
|
operator precedence. Also whitespaces aren't allowed because they are used
|
||||||
|
to split arrays.
|
||||||
|
If you want to return the square of something use x*x or only *x.
|
||||||
|
|
||||||
|
ATTENTION: '-' is a special case if it is the first character of a number-
|
||||||
string. It means that the number is negative and NOT that the following
|
string. It means that the number is negative and NOT that the following
|
||||||
float will be substracted from the base value. So if x = 10 and the string
|
float will be substracted from the base value. So if x = 10 and the string
|
||||||
"-5" is processed, the result will be -5 and not the same as "x-5", which
|
"-5" is processed, the result will be -5 and not the same as "x-5", which
|
||||||
@ -49,8 +62,8 @@
|
|||||||
speed 10 the radius is 7.5 etc.
|
speed 10 the radius is 7.5 etc.
|
||||||
The actual turn radius is piece-wise linearly interpolated. This
|
The actual turn radius is piece-wise linearly interpolated. This
|
||||||
allows for tighter turning at lower speeds, and also avoids that
|
allows for tighter turning at lower speeds, and also avoids that
|
||||||
the kart becomes too hard to control at high speed (speeds of higher
|
the kart becomes too hard to control at high speed (speeds of
|
||||||
than 23 can only be reached with powerups).
|
higher than 23 can only be reached with powerups).
|
||||||
time-full-steer: This is the amount of change in steering depending
|
time-full-steer: This is the amount of change in steering depending
|
||||||
on current steering. So if the steering is between 0 and 0.5,
|
on current steering. So if the steering is between 0 and 0.5,
|
||||||
the time-for-steering-change is 0.15. If the current steering is
|
the time-for-steering-change is 0.15. If the current steering is
|
||||||
@ -71,9 +84,10 @@
|
|||||||
max-speed: The base maximum speed of the kart in m/s
|
max-speed: The base maximum speed of the kart in m/s
|
||||||
brake-factor: Value used when braking.
|
brake-factor: Value used when braking.
|
||||||
brake-time-increase: The brake force is multiplied by
|
brake-time-increase: The brake force is multiplied by
|
||||||
(1 + brake_time) * brake_time_increase - i.e. the longer the brake was
|
(1 + brake_time) * brake_time_increase - i.e. the longer the
|
||||||
pressed, the harder the kart will brake.
|
brake was pressed, the harder the kart will brake.
|
||||||
max-speed-reverse-ratio is the percentage of max speed for reverse gear.
|
max-speed-reverse-ratio is the percentage of max speed for reverse
|
||||||
|
gear.
|
||||||
-->
|
-->
|
||||||
<engine power="875" max-speed="25" brake-factor="15"
|
<engine power="875" max-speed="25" brake-factor="15"
|
||||||
brake-time-increase="6" max-speed-reverse-ratio="0.65" />
|
brake-time-increase="6" max-speed-reverse-ratio="0.65" />
|
||||||
@ -317,6 +331,8 @@
|
|||||||
<characteristic name="hard">
|
<characteristic name="hard">
|
||||||
<engine power="*0.89" max-speed="*0.92" />
|
<engine power="*0.89" max-speed="*0.92" />
|
||||||
</characteristic>
|
</characteristic>
|
||||||
|
<!-- This doesn't need to be changed because the most fast/heavy/extreme
|
||||||
|
values should also be the default ones. -->
|
||||||
<characteristic name="best" />
|
<characteristic name="best" />
|
||||||
</difficulties>
|
</difficulties>
|
||||||
|
|
||||||
|
@ -207,8 +207,9 @@ void KartPropertiesManager::loadCharacteristics(const XMLNode *root)
|
|||||||
type != nodes.cend(); type++)
|
type != nodes.cend(); type++)
|
||||||
{
|
{
|
||||||
(*type)->get("name", &name);
|
(*type)->get("name", &name);
|
||||||
m_difficulty_characteristics.emplace(name,
|
m_difficulty_characteristics.insert(std::pair<const std::string,
|
||||||
std::unique_ptr<AbstractCharacteristic>(new XmlCharacteristic(*type)));
|
std::unique_ptr<AbstractCharacteristic> >(name,
|
||||||
|
std::unique_ptr<AbstractCharacteristic>(new XmlCharacteristic(*type))));
|
||||||
}
|
}
|
||||||
// Load kart type characteristics
|
// Load kart type characteristics
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
@ -217,8 +218,9 @@ void KartPropertiesManager::loadCharacteristics(const XMLNode *root)
|
|||||||
type != nodes.cend(); type++)
|
type != nodes.cend(); type++)
|
||||||
{
|
{
|
||||||
(*type)->get("name", &name);
|
(*type)->get("name", &name);
|
||||||
m_kart_type_characteristics.emplace(name,
|
m_kart_type_characteristics.insert(std::pair<const std::string,
|
||||||
std::unique_ptr<AbstractCharacteristic>(new XmlCharacteristic(*type)));
|
std::unique_ptr<AbstractCharacteristic> >(name,
|
||||||
|
std::unique_ptr<AbstractCharacteristic>(new XmlCharacteristic(*type))));
|
||||||
}
|
}
|
||||||
// Load player difficulties
|
// Load player difficulties
|
||||||
nodes.clear();
|
nodes.clear();
|
||||||
@ -227,8 +229,9 @@ void KartPropertiesManager::loadCharacteristics(const XMLNode *root)
|
|||||||
type != nodes.cend(); type++)
|
type != nodes.cend(); type++)
|
||||||
{
|
{
|
||||||
(*type)->get("name", &name);
|
(*type)->get("name", &name);
|
||||||
m_player_characteristics.emplace(name,
|
m_player_characteristics.insert(std::pair<const std::string,
|
||||||
std::unique_ptr<AbstractCharacteristic>(new XmlCharacteristic(*type)));
|
std::unique_ptr<AbstractCharacteristic> >(name,
|
||||||
|
std::unique_ptr<AbstractCharacteristic>(new XmlCharacteristic(*type))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user