Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | 584x 584x 9x 9x 575x 584x | import { gaugePickType, type GaugePick, type RulesetId } from '@be-music/player-engine/ruleset';
import type { PlayerGaugeSummary } from '@be-music/player-engine/signals';
import { resolveCourseStageStartGauge, type ReplayCourseStage } from '@be-music/player-engine/replay';
/**
* Placeholder gauge state for the frames before the engine reports one (the READY / LOADING phase), and the first point
* of the result graph. Values match the LR2 groove defaults so the bar does not visibly jump when the first real frame
* lands; everything real arrives via `summary.gauge`.
*
* A course stage starts on its course gauge instead: the ruleset's course gauge id and the value carried in from the
* previous stage (100 on the first), so the stage neither shows `GROOVE 20 %` nor graphs it before the engine runs.
*/
export function createPlaceholderGaugeState(
pick: GaugePick = 'GROOVE',
course?: { stage: ReplayCourseStage; ruleset: RulesetId },
): PlayerGaugeSummary {
// A qualified pick (`lr2:HARD`) starts as its gauge type does; a course stage starts on its source's course gauge.
const type = gaugePickType(pick);
if (course !== undefined) {
const start = resolveCourseStageStartGauge(course.ruleset, course.stage, pick);
return {
current: start.initial,
max: start.max,
clearThreshold: start.border,
initial: start.initial,
effectiveTotal: 0,
cleared: start.initial > start.border,
type: start.type,
survival: start.survival,
failedMidPlay: false,
};
}
const survival =
type === 'HARD' ||
type === 'DEATH' ||
type === 'DEATH-CORRECTED' ||
type === 'EX-HARD' ||
type === 'P-ATTACK' ||
type === 'G-ATTACK';
return {
current: survival ? 100 : 20,
max: 100,
clearThreshold: survival ? 0 : 80,
initial: survival ? 100 : 20,
effectiveTotal: 0,
cleared: survival,
type,
survival,
failedMidPlay: false,
};
}
|