Skip to content

Commit

Permalink
Make all deltas in GP online result screen dependent on server points (
Browse files Browse the repository at this point in the history
  • Loading branch information
kimden authored Dec 29, 2024
1 parent 31d3596 commit 6a9dbc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
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

1 comment on commit 6a9dbc2

@nutzboi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

finally, the math will be mathing. confusion be gone.

Please sign in to comment.