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

The Gauge class tracks and displays the player's health/score meter during gameplay. It supports two modes: normal gameplay and dan-mode, each with different fill rules and visual styles. Used by player (owned) and game_dan (shared).

GaugeMode

Value Description
NORMAL Standard gameplay gauge with difficulty-based scaling
DAN Shared gauge for dan-mode challenges

Gauge

Construction

Gauge(GaugeMode mode, PlayerNum player_num, int total_notes, int difficulty = 0, int level = 1);
Parameter Description
mode NORMAL or DAN
player_num Which player this gauge belongs to; affects texture positioning
total_notes Total note count used to calculate per-note fill amounts
difficulty Song difficulty (0–4); indexes into the gauge lookup table
level Gauge level (1–10) used in NORMAL mode to select clear threshold

Members

Member Type Description
gauge_length float Current fill value
gauge_max float Maximum possible fill value

Private members

Member Type Description
mode GaugeMode Controls fill logic and drawing style
table vector<vector<GaugeTable>> 2D lookup table indexed by [difficulty][level] for fill multipliers
clear_start vector<int> Minimum fill required to be in "clear" state per level
is_clear bool Whether gauge_length meets the clear threshold
is_rainbow bool Whether the gauge is completely full (rainbow state)
rainbow_start_ms double Timestamp when the rainbow state began; drives the shimmer animation
rainbow_frac float Normalised animation progress for the rainbow shimmer
previous_length float Previous frame's fill value; used to trigger the hit animation
gauge_update_anim FadeAnimation* Short flash animation played when the gauge changes
tamashii_fire_change TextureChangeAnimation* Animates the "tamashii" fire sprite at the gauge head
rainbow_fade_in optional<FadeAnimation*> Fade-in animation that plays when the rainbow state is first reached
visual_length float DAN mode: smoothly animated fill value, lagging behind gauge_length

GaugeTable

Per-entry in the lookup table.

Field Type Description
clear_rate float Gauge fill fraction required to be in clear state
ok_multiplier float Fraction of a good fill added for an OK judgment
bad_multiplier float Amount subtracted from the gauge on a BAD judgment

Methods

void add_good();
void add_ok();
void add_bad();

Adjust gauge_length based on the judgment, the current table entry, and whether gogo-time is active. add_bad() always reduces the gauge. Clamps gauge_length to [0, gauge_max] and updates is_clear and is_rainbow.

void update(double current_ms);

Advances gauge_update_anim, tamashii_fire_change, and rainbow_fade_in. In DAN mode, also smoothly interpolates visual_length toward gauge_length.

void draw(float y = 0.0f);

Renders the gauge bar, the tamashii fire sprite, and the rainbow overlay when is_rainbow is true. y is an offset applied in 2P layouts.

float get_progress() const;

Returns gauge_length / gauge_max (0–1).

bool get_is_clear() const;
bool get_is_rainbow() const;

Accessors for the clear and rainbow flags used by player and result/gauge.

Clone this wiki locally