Merge branch 'lapnumber' of https://github.com/konstin/stk-code into konstin-lapnumber

This commit is contained in:
hiker 2014-07-24 16:48:03 +10:00
commit 9267e2d304
7 changed files with 151 additions and 163 deletions

View File

@ -461,149 +461,149 @@ void KartProperties::getAllData(const XMLNode * root)
} // if sounds-node exist
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)
{
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 );
Log::fatal("[KartProperties]",
"Incorrect engine-power specifications for kart '%s'",
getIdent().c_str());
}
if(const XMLNode *bubble_node = root->getNode("bubblegum"))
engine_node->get("max-speed", &m_max_speed);
if(m_max_speed.size()!=RaceManager::DIFFICULTY_COUNT)
{
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 );
Log::fatal("[KartProperties]",
"Incorrect max-speed specifications for kart '%s'",
getIdent().c_str());
}
} // if getNode("engine")
if(const XMLNode *rescue_node = root->getNode("rescue"))
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)
{
rescue_node->get("vert-offset", &m_rescue_vert_offset);
rescue_node->get("time", &m_rescue_time );
rescue_node->get("height", &m_rescue_height );
Log::fatal("KartProperties",
"Invalid plunger in-face-time specification.");
}
}
if(const XMLNode *explosion_node = root->getNode("explosion"))
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) )
{
explosion_node->get("time", &m_explosion_time );
explosion_node->get("radius", &m_explosion_radius);
explosion_node->get("invulnerability-time",
&m_explosion_invulnerability_time);
// 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 *skid_node = root->getNode("skid"))
{
m_skidding_properties->load(skid_node);
}
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 *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);
}
if(const XMLNode *startup_node= root->getNode("startup"))
{
startup_node->get("time", &m_startup_times);
startup_node->get("boost", &m_startup_boost);
}
if(m_kart_model)
m_kart_model->loadInfo(*root);

View File

@ -211,7 +211,7 @@ private:
float m_nitro_small_container;
/** Nitro amount for big bittle. */
float m_nitro_big_container;
/* How much the speed of a kart might exceed its maximum speed (in m/s). */
/** How much the speed of a kart might exceed its maximum speed (in m/s). */
float m_nitro_max_speed_increase;
/** Additional engine force to affect the kart. */
float m_nitro_engine_force;
@ -250,7 +250,7 @@ private:
/** The speed with which the roll (when leaning in a curve) changes
* (in radians/second). */
float m_lean_speed;
/** How long a jump must be in order to trigger the jump animation. */
float m_jump_animation_time;
@ -547,7 +547,7 @@ public:
{
return m_speed_weighted_object_properties;
}
// ------------------------------------------------------------------------
/** Returns the wheel base (distance front to rear axis). */
float getWheelBase () const {return m_wheel_base; }

View File

@ -117,8 +117,8 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
continue;
m_tracks.push_back(id);
m_laps.push_back(3); // TODO: Take the default number from the track
m_reversed.push_back(false); // This will be changed later
m_laps.push_back(track_manager->getTrack(index)->getDefaultNumberOfLaps());
m_reversed.push_back(false); // This will be changed later in the code
}
}
else if (m_tracks.size() > number_of_tracks)

View File

@ -33,7 +33,6 @@ using irr::gui::IGUIStaticText;
typedef GUIEngine::SpinnerWidget Spinner;
RandomGPInfoDialog::RandomGPInfoDialog()
{
// Defaults - loading selection from last time frrom a file would be better
m_number_of_tracks = 2; // We can assume that there are at least 2 standard tracks
@ -88,13 +87,9 @@ void RandomGPInfoDialog::addSpinners()
const std::vector<std::string>& groups = track_manager->getAllTrackGroups();
for (unsigned int i = 0; i < groups.size(); i++)
{
// FIXME: The NULL check is necessary until #1348 on github is fixed
if (groups[i].c_str() != NULL)
{
spinner->addLabel(stringw(groups[i].c_str()));
if(groups[i] == "standard")
index_standard = i+1;
}
spinner->addLabel(stringw(groups[i].c_str()));
if(groups[i] == "standard")
index_standard = i+1;
}
// The value can only be set here because SpinnerWidget resets the value
// every time a label is added

View File

@ -88,9 +88,7 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
screenshotWidget->add();
if (screenshot != NULL)
{
screenshotWidget->setImage(screenshot);
}
m_widgets.push_back(screenshotWidget);
@ -98,21 +96,11 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
if (has_laps)
{
m_spinner = getWidget<SpinnerWidget>("lapcountspinner");
m_spinner->m_properties[PROP_ID] = "lapcountspinner";
if (UserConfigParams::m_artist_debug_mode)
{
m_spinner->setMin(0);
}
//I18N: In the track setup screen (number of laps choice, where %i is the number)
//m_spinner->setText( _("%i laps") );
m_spinner->setValue( UserConfigParams::m_num_laps );
//m_spinner->getIrrlichtElement()->setTabStop(true);
//m_spinner->getIrrlichtElement()->setTabGroup(false);
const int num_laps = m_spinner->getValue();
race_manager->setNumLaps(num_laps);
m_spinner->setValue(track->getDefaultNumberOfLaps());
race_manager->setNumLaps(m_spinner->getValue());
}
else
{
@ -149,7 +137,6 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
m_highscore_entries[2] = getWidget<LabelWidget>("highscore3");
updateHighScores();
}
else
{

View File

@ -135,6 +135,7 @@ Track::Track(const std::string &filename)
m_ident=="overworld";
m_minimap_x_scale = 1.0f;
m_minimap_y_scale = 1.0f;
m_default_number_of_laps= UserConfigParams::m_num_laps;
m_all_nodes.clear();
m_all_physics_only_nodes.clear();
m_all_cached_meshes.clear();
@ -482,6 +483,7 @@ void Track::loadTrackInfo()
root->get("caustics-speed", &m_caustics_speed);
root->get("color-level-in", &m_color_inlevel);
root->get("color-level-out", &m_color_outlevel);
root->get("default-number-of-laps",&m_default_number_of_laps);
// Make the default for auto-rescue in battle mode and soccer mode to be false
if(m_is_arena || m_is_soccer)

View File

@ -206,7 +206,7 @@ private:
/** True if this track (textures and track data) should be cached. Used
* for the overworld. */
bool m_cache_track;
#ifdef DEBUG
/** A list of textures that were cached before the track is loaded.
@ -388,7 +388,7 @@ private:
float m_displacement_speed;
float m_caustics_speed;
/** The levels for color correction
* m_color_inlevel(black, gamma, white)
* m_color_outlevel(black, white)*/
@ -398,6 +398,9 @@ private:
/** List of all bezier curves in the track - for e.g. camera, ... */
std::vector<BezierCurve*> m_all_curves;
/** The number of laps the track will be raced if no other value is given.*/
int m_default_number_of_laps;
void loadTrackInfo();
void loadQuadGraph(unsigned int mode_id, const bool reverse);
void convertTrackToBullet(scene::ISceneNode *node);
@ -599,7 +602,7 @@ public:
bool getBloom() const { return m_bloom; }
float getBloomThreshold() const { return m_bloom_threshold; }
/** Return the color levels for color correction shader */
core::vector3df getColorLevelIn() const { return m_color_inlevel; }
core::vector2df getColorLevelOut() const { return m_color_outlevel; }
@ -607,11 +610,12 @@ public:
bool hasLensFlare() const { return m_lensflare; }
bool hasGodRays() const { return m_godrays; }
bool hasShadows() const { return m_shadows; }
void addNode(scene::ISceneNode* node) { m_all_nodes.push_back(node); }
float getDisplacementSpeed() const { return m_displacement_speed; }
float getCausticsSpeed() const { return m_caustics_speed; }
const int getDefaultNumberOfLaps() const { return m_default_number_of_laps;}
bool operator<(const Track &other) const;
}; // class Track