Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5234 #5235

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 5 additions & 18 deletions src/states_screens/race_result_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1286,20 +1286,15 @@ void RaceResultGUI::renderGlobal(float dt)
{
WorldWithRank *wwr = dynamic_cast<WorldWithRank*>(World::getWorld());
assert(wwr);
int most_points;
if (RaceManager::get()->isFollowMode())
most_points = wwr->getScoreForPosition(2);
else
most_points = wwr->getScoreForPosition(1);
ri->m_current_displayed_points +=
dt*most_points / m_time_for_points;
dt * m_most_points / m_time_for_points;
if (ri->m_current_displayed_points > ri->m_new_overall_points)
{
ri->m_current_displayed_points =
(float)ri->m_new_overall_points;
}
ri->m_new_points -=
dt*most_points / m_time_for_points;
dt * m_most_points / m_time_for_points;
if (ri->m_new_points < 0)
ri->m_new_points = 0;
break;
Expand Down Expand Up @@ -1345,6 +1340,7 @@ void RaceResultGUI::determineGPLayout()
max_time = std::max(RaceManager::get()->getOverallTime(kart_id), max_time);
}

m_most_points = 0.;
for (unsigned int kart_id = 0; kart_id < num_karts; kart_id++)
{
int rank = RaceManager::get()->getKartGPRank(kart_id);
Expand Down Expand Up @@ -1385,17 +1381,6 @@ void RaceResultGUI::determineGPLayout()
ri->m_y_pos = (float)(m_top + rank*m_distance_between_rows);
int p = RaceManager::get()->getKartPrevScore(kart_id);
ri->m_current_displayed_points = (float)p;
if (kart->isEliminated() && !(RaceManager::get()->isFollowMode()))
{
ri->m_new_points = 0;
}
else
{
WorldWithRank *wwr = dynamic_cast<WorldWithRank*>(World::getWorld());
assert(wwr);
ri->m_new_points =
(float)wwr->getScoreForPosition(kart->getPosition());
}
}

// Now update the GP ranks, and determine the new position
Expand All @@ -1412,6 +1397,8 @@ void RaceResultGUI::determineGPLayout()
ri->m_centre_point = m_top + (gp_position + j)*m_distance_between_rows*0.5f;
int p = RaceManager::get()->getKartScore(i);
ri->m_new_overall_points = p;
ri->m_new_points = ri->m_new_overall_points - ri->m_current_displayed_points;
m_most_points = std::max(m_most_points, ri->m_new_points);
ri->m_new_gp_rank = gp_position;
ri->m_laps = World::getWorld()->getFinishedLapsOfKart(i);
} // i < num_karts
Expand Down
3 changes: 3 additions & 0 deletions src/states_screens/race_result_gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ class RaceResultGUI : public RaceGUIBase,
/** For highscores */
int m_highscore_rank;

/** Maximum number of points earned by a player in this game (used in animation). */
float m_most_points;

unsigned int m_width_all_points;

int m_max_tracks;
Expand Down
Loading