Added the penalty time (when starting too early) to stk_config.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5670 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-07-08 01:34:46 +00:00
parent e9837ca8fc
commit 534404d154
4 changed files with 16 additions and 7 deletions

View File

@ -23,8 +23,10 @@
<follow-the-leader intervals="30 20 10"/>
<!-- Startup information. Boost: startup speed boost for
the first karts to press acceleration at start -->
<startup boost="10 5" />
the first karts to press acceleration at start.
Penalty: Penalty time if a kart accelerates before GO. -->
<startup boost ="10 5"
penalty="1" />
<!-- The title music. -->
<music title="main_theme.music"/>

View File

@ -121,6 +121,7 @@ void STKConfig::load(const std::string &filename)
CHECK_NEG(m_near_ground, "near-ground" );
CHECK_NEG(m_delay_finish_time, "delay-finish-time" );
CHECK_NEG(m_music_credit_time, "music-credit-time" );
CHECK_NEG(m_penalty_time, "penalty-time" );
m_kart_properties.checkAllSet(filename);
item_manager->setSwitchItems(m_switch_items);
@ -142,7 +143,8 @@ void STKConfig::init_defaults()
m_zipper_max_speed_fraction = m_music_credit_time =
m_explosion_impulse = m_explosion_impulse_objects =
m_delay_finish_time = m_skid_fadeout_time =
m_near_ground = m_item_switch_time = UNDEFINED;
m_near_ground = m_item_switch_time =
m_penalty_time = UNDEFINED;
m_bubble_gum_counter = -100;
m_max_karts = -100;
m_gp_order = -100;
@ -194,8 +196,11 @@ void STKConfig::getAllData(const XMLNode * root)
if(const XMLNode *leader_node= root->getNode("follow-the-leader"))
leader_node->get("intervals", &m_leader_intervals);
if(const XMLNode *startup_boost_node= root->getNode("startup"))
startup_boost_node->get("boost", &m_startup_boost);
if(const XMLNode *startup_node= root->getNode("startup"))
{
startup_node->get("boost", &m_startup_boost);
startup_node->get("penalty", &m_penalty_time );
}
if(const XMLNode *music_node = root->getNode("music"))
{

View File

@ -67,7 +67,9 @@ public:
before they disappear. */
float m_explosion_impulse; /**<Impulse affecting each non-hit kart.*/
float m_explosion_impulse_objects;/**<Impulse of explosion on moving
objects, e.g. road cones, ... */
objects, e.g. road cones, ... */
float m_penalty_time; /**< Penalty time when starting too
early. */
float m_delay_finish_time; /**<Delay after a race finished before
the results are displayed. */
float m_music_credit_time; /**<Time the music credits are

View File

@ -282,7 +282,7 @@ void PlayerController::update(float dt)
m_bzzt_sound->play();
} // if penalty_time = 0
m_penalty_time = 1.0;
m_penalty_time = stk_config->m_penalty_time;
m_controls->m_accel = 0.0f;
} // if key pressed