Skip to content

score_history

Anthony Samms edited this page Jun 2, 2026 · 1 revision

The ScoreHistory class displays the player's saved score for the currently selected song in the song-select screen. When scores exist for multiple difficulties it cycles through them automatically, showing each one for one second. Owned by box_song.

Construction

ScoreHistory(const array<optional<Score>, 5>& scores, double current_ms);
Parameter Description
scores Array of five optional Score values, one per difficulty slot (Easy through Ura)
current_ms Current song-select timestamp, used as the starting reference for the one-second timer

Filters out empty slots and populates available with only the difficulties that have a recorded score. curr_index starts at 1 % available.size() so the first score shown on the next cycle is not the same as the initial one.

Members

Member Type Description
available vector<DiffScore> Scores that actually exist, each paired with their difficulty index
curr_index int Index into available for the currently displayed entry
last_ms double Timestamp of the last cycle step

DiffScore

Private helper struct.

Field Type Description
diff int Difficulty index (0 = Easy, 4 = Ura)
score Score The saved score data for that difficulty

Methods

void update(double current_ms);

Does nothing if available is empty. Otherwise advances curr_index by one (wrapping) whenever at least 1000 ms has elapsed since last_ms, then updates last_ms.

void draw();

Does nothing if available is empty. Calls draw_long() to render the full score panel for the current entry.

Private methods

void draw_long();

Renders the full score panel using LEADERBOARD textures. Shows:

  • Background and title strip.
  • Score mode indicator (SHINUCHI or NORMAL) and PTS label with colour adjusted for the mode.
  • Difficulty badge for curr_diff.
  • Four row backgrounds for the judge lines.
  • JUDGE_GOOD, JUDGE_OK, JUDGE_BAD, and JUDGE_DRUMROLL label textures.
  • Score, good, ok, bad, and drumroll values as right-aligned digit strings using LEADERBOARD::COUNTER and LEADERBOARD::JUDGE_NUM textures.
void draw_short();

Renders a compact single-score panel (score only, no per-judge breakdown). Used when the panel area is too narrow for the full view. Currently not called by draw() but available for callers that need the short form.

Clone this wiki locally