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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | 202x 202x 202x 202x 2562x 2552x 2552x 45x 45x 43x 43x 45x 202x 76x 50x 38x 38x 376x 376x 376x 376x 7x 48x 33x 31x 31x 31x 545x 545x 202x 18x 17x 170x 8x 8x 7x 7x | /**
* Hi-speed (note scroll multiplier) range shared by the select screens' play-option panels, the gameplay screens'
* hi-speed keys and hosts that remember the player's pick (e.g. the player's Options dialog). Visual only: hi-speed changes how
* far apart notes are drawn, never when they are judged.
*/
/**
* Hi-speed a play starts at when nothing else is picked — 2.0× rather than upstream beatoraja's `PlayConfig.java:16`
* default of `1.0f`: at 1.0 most charts (BPM 130-180) take about 1.8 seconds to cross the lane, which reads as "the chart
* isn't moving" to anyone coming from LR2 / That-Which-Must-Not-Be-Named defaults, and 2.0 is the lowest setting most players use.
*/
export const DEFAULT_HISPEED = 2.0;
/** Slowest selectable hi-speed. */
export const HISPEED_MIN = 0.1;
/** Fastest selectable hi-speed. */
export const HISPEED_MAX = 6.0;
/** One press of the in-game hotkey (and one click of the select panel's HS button). */
export const HISPEED_STEP = 0.1;
/**
* Snaps `value` to the 1/1000 grid and clamps it to [{@link HISPEED_MIN}, {@link HISPEED_MAX}]. The snap absorbs the
* float drift of repeated ±{@link HISPEED_STEP} steps (`0.1` has no exact IEEE-754 representation, so 13 presses would
* otherwise land on `1.3000000000000003`). `NaN` / non-finite input returns `undefined` so callers keep their value.
*/
export function snapHiSpeed(value: number): number | undefined {
if (!Number.isFinite(value)) return undefined;
const snapped = Math.round(value * 1000) / 1000;
return Math.max(HISPEED_MIN, Math.min(HISPEED_MAX, snapped));
}
/**
* A hi-speed change under HS-FIX. The player's hi-speed (`player`, on their own scale: the one the select panel, the
* readouts and the host show) moves to `player + delta`, and the drawn one is that times the chart's HS-FIX
* `multiplier` (1 without HS-FIX). Stepping the player's value keeps it on the {@link HISPEED_STEP} grid, where
* stepping the drawn one would move the player's by `delta / multiplier`. `undefined` for non-finite input.
*/
export function stepPlayerHiSpeed(
player: number,
delta: number,
multiplier: number,
classic = false,
): { player: number; drawn: number } | undefined {
const next = classic ? stepClassicHiSpeed(player, delta) : snapHiSpeed(player + delta);
if (next === undefined) return undefined;
const rawDrawn = next * multiplier;
const drawn = classic ? (Number.isFinite(rawDrawn) && rawDrawn > 0 ? rawDrawn : undefined) : snapHiSpeed(rawDrawn);
return drawn === undefined ? undefined : { player: next, drawn };
}
/**
* How long the note scroll takes to glide to a new hi-speed. Long enough that the notes visibly ease instead of
* jumping, short enough that the new speed is readable right away.
*/
export const HISPEED_TRANSITION_MS = 200;
/**
* The scroll hi-speed `nowMs` into a transition from `from` to `to` that started at `startMs` and lasts `durationMs`,
* eased out (cubic) so the change responds at once and settles softly. `from` before the start, `to` from the end on
* (and at once for a non-positive duration). Time is an input: the caller owns the clock.
*/
export function easeHiSpeed(from: number, to: number, startMs: number, nowMs: number, durationMs: number): number {
if (!(durationMs > 0) || nowMs >= startMs + durationMs) return to;
if (nowMs <= startMs) return from;
const remaining = 1 - (nowMs - startMs) / durationMs;
return from + (to - from) * (1 - remaining * remaining * remaining);
}
/**
* A hi-speed whose note-scroll value glides to each new target ({@link easeHiSpeed}). The target is what the HUD shows
* and what is reported to the host; {@link valueAt} is what notes, bar lines and long notes are positioned with.
* Visual only — judging never reads it.
*/
export class HiSpeedTransition {
private from: number;
private to: number;
private startMs = 0;
private readonly durationMs: number;
public constructor(initial: number, durationMs: number = HISPEED_TRANSITION_MS) {
this.from = initial;
this.to = initial;
this.durationMs = durationMs;
}
/** The hi-speed being moved to. */
public get target(): number {
return this.to;
}
/** The scroll hi-speed at `nowMs`. */
public valueAt(nowMs: number): number {
return easeHiSpeed(this.from, this.to, this.startMs, nowMs, this.durationMs);
}
/** Glides to `value` from wherever the scroll is at `nowMs` (mid-transition included), so a retarget never jumps. */
public retarget(value: number, nowMs: number): void {
if (value === this.to) return;
this.from = this.valueAt(nowMs);
this.to = value;
this.startMs = nowMs;
}
/** Moves to `value` at once — for setup before the notes are on screen. */
public jump(value: number): void {
this.from = value;
this.to = value;
}
}
/** AC 34's official CLASSIC HI-SPEED window, bottom to top (05_classic.jpg). */
export const CLASSIC_HI_SPEED_STEPS: readonly number[] = [1, 1.5, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4];
/** Nearest classic multiplier, preferring the lower step on a tie; invalid input leaves the setting alone. */
export function snapClassicHiSpeed(value: number): number | undefined {
if (!Number.isFinite(value)) return undefined;
return CLASSIC_HI_SPEED_STEPS.reduce((best, candidate) =>
Math.abs(candidate - value) < Math.abs(best - value) ? candidate : best,
);
}
/** Steps through the source's table without wrapping past either end. Zero delta only snaps the setting. */
export function stepClassicHiSpeed(value: number, delta: number): number | undefined {
const current = snapClassicHiSpeed(value);
if (current === undefined || !Number.isFinite(delta)) return undefined;
const index = CLASSIC_HI_SPEED_STEPS.indexOf(current);
return CLASSIC_HI_SPEED_STEPS[Math.max(0, Math.min(CLASSIC_HI_SPEED_STEPS.length - 1, index + Math.sign(delta)))]!;
}
|