Lap Trial improvements (#4664)
This commit is contained in:
parent
3623fa8f5f
commit
0d8b01b08b
@ -1274,6 +1274,7 @@ Highscores* World::getGPHighscores() const
|
||||
Highscores* highscores = highscore_manager->getGPHighscores(RaceManager::get()->getNumNonGhostKarts(),
|
||||
RaceManager::get()->getDifficulty(),
|
||||
RaceManager::get()->getGrandPrix().getId(),
|
||||
RaceManager::get()->isLapTrialMode() ? RaceManager::get()->getTimeTarget() : 0,
|
||||
RaceManager::get()->getGrandPrix().getReverseType(),
|
||||
RaceManager::get()->getMinorMode());
|
||||
return highscores;
|
||||
|
@ -205,6 +205,7 @@ Highscores* HighscoreManager::getHighscores(const Highscores::HighscoreType &hig
|
||||
Highscores* HighscoreManager::getGPHighscores(int num_karts,
|
||||
const RaceManager::Difficulty difficulty,
|
||||
const std::string &trackName,
|
||||
const int target,
|
||||
GrandPrixData::GPReverseType reverse_type,
|
||||
RaceManager::MinorRaceModeType minor_mode)
|
||||
{
|
||||
@ -213,7 +214,7 @@ Highscores* HighscoreManager::getGPHighscores(int num_karts,
|
||||
// See if we already have a record for this type
|
||||
for (auto& hs : m_all_scores)
|
||||
{
|
||||
if (hs->matches(num_karts, difficulty, trackName, reverse_type, minor_mode))
|
||||
if (hs->matches(num_karts, difficulty, trackName, target, reverse_type, minor_mode))
|
||||
{
|
||||
// we found one entry for this kind of race, return it
|
||||
return hs.get();
|
||||
@ -222,7 +223,7 @@ Highscores* HighscoreManager::getGPHighscores(int num_karts,
|
||||
|
||||
// we don't have an entry for such a race currently. Create one.
|
||||
highscores = new Highscores(num_karts, difficulty,
|
||||
trackName, reverse_type, minor_mode);
|
||||
trackName, target, reverse_type, minor_mode);
|
||||
m_all_scores.push_back(std::unique_ptr<Highscores>(highscores));
|
||||
return highscores;
|
||||
} // get
|
||||
} // getGPHighscores
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
Highscores *getGPHighscores(int num_karts,
|
||||
const RaceManager::Difficulty difficulty,
|
||||
const std::string &trackName,
|
||||
const int target,
|
||||
GrandPrixData::GPReverseType reverse_type,
|
||||
RaceManager::MinorRaceModeType minor_mode);
|
||||
// ------------------------------------------------------------------------
|
||||
|
@ -56,14 +56,14 @@ Highscores::Highscores(const HighscoreType &highscore_type,
|
||||
}
|
||||
// ----------------------------------------------------------------------------
|
||||
Highscores::Highscores(int num_karts, const RaceManager::Difficulty &difficulty,
|
||||
const std::string &track_name,
|
||||
const std::string &track_name, const int target,
|
||||
const GrandPrixData::GPReverseType reverse_type, RaceManager::MinorRaceModeType minor_mode)
|
||||
{
|
||||
m_track = track_name;
|
||||
m_highscore_type = "HST_GRANDPRIX";
|
||||
m_number_of_karts = num_karts;
|
||||
m_difficulty = difficulty;
|
||||
m_number_of_laps = 0;
|
||||
m_number_of_laps = target;
|
||||
m_reverse = false;
|
||||
m_gp_reverse_type = reverse_type;
|
||||
m_gp_minor_mode = minor_mode;
|
||||
@ -106,15 +106,14 @@ void Highscores::readEntry(const XMLNode &node)
|
||||
node.get("hscore-type", &hst );
|
||||
m_highscore_type = (HighscoreType)hst;
|
||||
node.get("difficulty", &m_difficulty );
|
||||
node.get("number-of-laps", &m_number_of_laps);
|
||||
if (hst == "HST_GRANDPRIX")
|
||||
{
|
||||
m_number_of_laps = 0;
|
||||
node.get("reverse-type", &m_gp_reverse_type);
|
||||
node.get("minor-mode", &m_gp_minor_mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
node.get("number-of-laps", &m_number_of_laps);
|
||||
node.get("reverse", &m_reverse);
|
||||
}
|
||||
for(unsigned int i=0; i<node.getNumNodes(); i++)
|
||||
@ -161,8 +160,7 @@ void Highscores::writeEntry(UTFWriter &writer)
|
||||
writer << " number-karts =\"" << m_number_of_karts << "\"\n";
|
||||
writer << " difficulty =\"" << m_difficulty << "\"\n";
|
||||
writer << " hscore-type =\"" << m_highscore_type.c_str() << "\"\n";
|
||||
if (m_highscore_type != "HST_GRANDPRIX")
|
||||
writer << " number-of-laps=\"" << m_number_of_laps << "\"\n";
|
||||
writer << " number-of-laps=\"" << m_number_of_laps << "\"\n";
|
||||
if (m_highscore_type == "HST_GRANDPRIX")
|
||||
{
|
||||
writer << " reverse-type =\"" << m_gp_reverse_type << "\"\n";
|
||||
@ -201,12 +199,13 @@ int Highscores::matches(const HighscoreType &highscore_type,
|
||||
// -----------------------------------------------------------------------------
|
||||
int Highscores::matches(int num_karts,
|
||||
const RaceManager::Difficulty &difficulty,
|
||||
const std::string &track,
|
||||
const std::string &track, const int target,
|
||||
const GrandPrixData::GPReverseType reverse_type, RaceManager::MinorRaceModeType minor_mode)
|
||||
{
|
||||
return (m_highscore_type == "HST_GRANDPRIX" &&
|
||||
m_track == track &&
|
||||
m_difficulty == difficulty &&
|
||||
m_number_of_laps == target &&
|
||||
m_number_of_karts == num_karts &&
|
||||
m_gp_reverse_type == reverse_type &&
|
||||
m_gp_minor_mode == minor_mode );
|
||||
@ -281,7 +280,7 @@ int Highscores::addGPData(const std::string& kart_name,
|
||||
if (RaceManager::get()->isLapTrialMode())
|
||||
m_number_of_laps = static_cast<int>(RaceManager::get()->getTimeTarget());
|
||||
else
|
||||
m_number_of_laps = RaceManager::get()->getNumLaps();
|
||||
m_number_of_laps = 0;
|
||||
m_gp_reverse_type = RaceManager::get()->getGrandPrix().getReverseType();
|
||||
m_gp_minor_mode = RaceManager::get()->getMinorMode();
|
||||
m_name[position] = name;
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
const bool reverse);
|
||||
/** Constructor for grandprix highscores */
|
||||
Highscores (int num_karts, const RaceManager::Difficulty &difficulty,
|
||||
const std::string &trackName,
|
||||
const std::string &trackName, const int target,
|
||||
const GrandPrixData::GPReverseType reverse_type, RaceManager::MinorRaceModeType minor_mode);
|
||||
/** Creates an entry from a file
|
||||
*/
|
||||
@ -103,7 +103,7 @@ public:
|
||||
/** matches method for grandprix highscores */
|
||||
int matches(int num_karts,
|
||||
const RaceManager::Difficulty &difficulty,
|
||||
const std::string &track,
|
||||
const std::string &track, const int target,
|
||||
const GrandPrixData::GPReverseType reverse_type, RaceManager::MinorRaceModeType minor_mode);
|
||||
// ------------------------------------------------------------------------
|
||||
int addData (const std::string& kart_name,
|
||||
|
@ -1266,6 +1266,8 @@ const core::stringw RaceManager::getNameOf(const MinorRaceModeType mode)
|
||||
//I18N: Game mode
|
||||
case MINOR_MODE_FOLLOW_LEADER: return _("Follow the Leader");
|
||||
//I18N: Game mode
|
||||
case MINOR_MODE_LAP_TRIAL: return _("Lap Trial");
|
||||
//I18N: Game mode
|
||||
case MINOR_MODE_3_STRIKES: return _("3 Strikes Battle");
|
||||
//I18N: Game mode
|
||||
case MINOR_MODE_FREE_FOR_ALL: return _("Free-For-All");
|
||||
|
@ -495,6 +495,7 @@ void GPInfoScreen::updateHighscores()
|
||||
RaceManager::get()->getNumberOfKarts(),
|
||||
RaceManager::get()->getDifficulty(),
|
||||
m_gp.getId(),
|
||||
RaceManager::get()->isLapTrialMode() ? m_time_target_spinner->getValue() * 60 : 0,
|
||||
getReverse(),
|
||||
RaceManager::get()->getMinorMode());
|
||||
m_highscore_list->clear();
|
||||
|
@ -849,6 +849,7 @@ void RaceResultGUI::unload()
|
||||
continue;
|
||||
// Save a pointer to the current row_info entry
|
||||
RowInfo *ri = &(m_all_row_infos[position - first_position]);
|
||||
ri->m_kart_id = kart->getWorldKartId();
|
||||
ri->m_is_player_kart = kart->getController()->isLocalPlayerController();
|
||||
ri->m_kart_name = kart->getController()->getName();
|
||||
if (RaceManager::get()->getKartGlobalPlayerId(kart->getWorldKartId()) > -1)
|
||||
@ -1439,16 +1440,17 @@ void RaceResultGUI::unload()
|
||||
true /* ignoreRTL */);
|
||||
current_x += m_width_kart_name + m_width_column_space;
|
||||
|
||||
|
||||
core::recti dest_rect = core::recti(current_x, y, current_x + 100, y + 10);
|
||||
m_font->draw(ri->m_finish_time_string, dest_rect, color, false, false,
|
||||
NULL, true /* ignoreRTL */);
|
||||
current_x += m_width_finish_time + m_width_column_space;
|
||||
|
||||
if (!RaceManager::get()->isLapTrialMode())
|
||||
{
|
||||
core::recti dest_rect = core::recti(current_x, y, current_x + 100, y + 10);
|
||||
m_font->draw(ri->m_finish_time_string, dest_rect, color, false, false,
|
||||
NULL, true /* ignoreRTL */);
|
||||
current_x += m_width_finish_time + m_width_column_space;
|
||||
}
|
||||
if (RaceManager::get()->isLapTrialMode())
|
||||
{
|
||||
core::recti pos_laps = core::recti(current_x, y, current_x + 100, y + 10);
|
||||
int laps = World::getWorld()->getFinishedLapsOfKart(n);
|
||||
int laps = World::getWorld()->getFinishedLapsOfKart(ri->m_kart_id);
|
||||
m_font->draw(irr::core::stringw(laps), pos_laps, color, false, false,
|
||||
NULL, true /* ignoreRTL */);
|
||||
}
|
||||
|
@ -76,6 +76,8 @@ private:
|
||||
class RowInfo
|
||||
{
|
||||
public:
|
||||
/** Kart ID in World */
|
||||
unsigned int m_kart_id;
|
||||
/** Start time for each line of the animation. */
|
||||
float m_start_at;
|
||||
/** Currenct X position. */
|
||||
|
Loading…
Reference in New Issue
Block a user