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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | 585x 561x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 172x 13x 134x 6x 2x 11x 1x 3x 2x 178x 59x 59x 178x 59x 141x 141x 141x 141x 141x 56x 661x 610x 56x 606x 606x 606x 605x 605x 605x 606x 102x 92x 92x 6x 3x | import { resolveLaneCover, type LaneCoverState } from '@be-music/player-scene-model';
import { BEATORAJA_OP, type BeatorajaSide } from '../runtime-ids.ts';
import { beatorajaGaugeModeFromString } from '../elements/gauge.ts';
/**
* What a chart has, for the ops that show or hide chrome by it. A trait left out lights neither of its ops (the select
* screen reads no `#TEXT`, the play screen no `#RANDOM`).
*/
export interface BeatorajaChartTraits {
readonly longNote?: boolean;
readonly bpmChange?: boolean;
/** STOPs: `HAS_BPMSTOP` (1177) has no "none" op. */
readonly stop?: boolean;
readonly text?: boolean;
readonly bga?: boolean;
readonly random?: boolean;
readonly stageFile?: boolean;
readonly banner?: boolean;
readonly backBMP?: boolean;
}
function pick(ops: number[], value: boolean | undefined, has: number, none: number | undefined): void {
if (value === true) ops.push(has);
else if (value === false && none !== undefined) ops.push(none);
}
/**
* The chart-trait ops (`HAS_LN` / `NO_LN`, `HAS_BPMCHANGE` / `NO_BPMCHANGE`, `HAS_BPMSTOP`, `HAS_TEXT` / `NO_TEXT`,
* `HAS_BGA` / `NO_BGA`, `HAS_RANDOMSEQUENCE` / `NO_RANDOMSEQUENCE`, and the STAGEFILE / BANNER / BACKBMP pairs) for the
* traits given.
*/
export function resolveBeatorajaChartTraitOps(traits: BeatorajaChartTraits): number[] {
const ops: number[] = [];
pick(ops, traits.longNote, BEATORAJA_OP.HAS_LN, BEATORAJA_OP.NO_LN);
pick(ops, traits.bpmChange, BEATORAJA_OP.HAS_BPMCHANGE, BEATORAJA_OP.NO_BPMCHANGE);
pick(ops, traits.stop, BEATORAJA_OP.HAS_BPMSTOP, undefined);
pick(ops, traits.text, BEATORAJA_OP.HAS_TEXT, BEATORAJA_OP.NO_TEXT);
pick(ops, traits.bga, BEATORAJA_OP.HAS_BGA, BEATORAJA_OP.NO_BGA);
pick(ops, traits.random, BEATORAJA_OP.HAS_RANDOMSEQUENCE, BEATORAJA_OP.NO_RANDOMSEQUENCE);
pick(ops, traits.stageFile, BEATORAJA_OP.HAS_STAGEFILE, BEATORAJA_OP.NO_STAGEFILE);
pick(ops, traits.banner, BEATORAJA_OP.HAS_BANNER, BEATORAJA_OP.NO_BANNER);
pick(ops, traits.backBMP, BEATORAJA_OP.HAS_BACKBMP, BEATORAJA_OP.NO_BACKBMP);
return ops;
}
/** The key-mode op (`KEYSONG_*`: 160-164, 1160 / 1161) of a play variant (`'7'`, `'14'`, `'24'`, `'48'`, …). */
export function beatorajaKeysongOp(playVariant: string | undefined): number | undefined {
switch (playVariant) {
case '5':
return BEATORAJA_OP.KEYSONG_5K;
case '7':
return BEATORAJA_OP.KEYSONG_7K;
case '9':
return BEATORAJA_OP.KEYSONG_9K;
case '10':
return BEATORAJA_OP.KEYSONG_10K;
case '14':
return BEATORAJA_OP.KEYSONG_14K;
case '24':
return BEATORAJA_OP.KEYSONG_24K;
case '48':
return BEATORAJA_OP.KEYSONG_24K_DP;
default:
return undefined;
}
}
/**
* Gauge frame conditions from beatoraja's runtime class: groove (42) for classes 0–2, hard (43) for 3–8,
* and EX (1046) for ASSIST-EASY, EASY, EX-HARD, HAZARD, EXCLASS and EXHARDCLASS. No class lights no frame.
* Shares the gauge element's type mapping, including LR2 and That-Which-Must-Not-Be-Named aliases; independent of gauge value and mode.
*/
export function resolveBeatorajaGaugeTypeOps(type: string | undefined): number[] {
if (type === undefined) return [];
const mode = beatorajaGaugeModeFromString(type);
const ops: number[] = [mode <= 2 ? BEATORAJA_OP.GAUGE_GROOVE : BEATORAJA_OP.GAUGE_HARD];
if (mode === 0 || mode === 1 || mode === 4 || mode === 5 || mode === 7 || mode === 8) ops.push(BEATORAJA_OP.GAUGE_EX);
return ops;
}
/** How a play starts on a play skin. */
export interface BeatorajaPlayStartInput {
readonly playVariant: string;
readonly autoPlay: boolean;
/** The chart's traits; none lit without a chart. */
readonly traits?: BeatorajaChartTraits;
}
/**
* The ops a play skin starts a play with, before the engine's first frame: the autoplay op (`AUTOPLAY_ON` or
* `AUTOPLAY_OFF`), `NOW_LOADING`, the key-mode op and the chart-trait ops. `NOW_LOADING` gives way to
* `LOADED` when playback starts ({@link BEATORAJA_PLAY_STARTED_OPS}).
*/
export function resolveBeatorajaPlayStartOps(input: BeatorajaPlayStartInput): number[] {
const ops: number[] = [
input.autoPlay ? BEATORAJA_OP.AUTOPLAY_ON : BEATORAJA_OP.AUTOPLAY_OFF,
BEATORAJA_OP.NOW_LOADING,
];
const keysong = beatorajaKeysongOp(input.playVariant);
Eif (keysong !== undefined) ops.push(keysong);
if (input.traits !== undefined) ops.push(...resolveBeatorajaChartTraitOps(input.traits));
return ops;
}
/** The op playback starting lights (`LOADED`), in place of `NOW_LOADING`. */
export const BEATORAJA_PLAY_STARTED_OPS: { readonly on: number; readonly off: number } = {
on: BEATORAJA_OP.LOADED,
off: BEATORAJA_OP.NOW_LOADING,
};
/**
* The CONSTANT op (`OPTION_CONSTANT`, 400) while the player's CONSTANT setting is on. beatoraja's
* `BooleanPropertyFactory` reads the player's play config, not the lane renderer's copy, so a course's `NO_SPEED`
* constraint, which stops CONSTANT drawing, leaves the op lit.
*/
export function resolveBeatorajaConstantOps(constant: boolean | undefined): number[] {
return constant === true ? [BEATORAJA_OP.CONSTANT] : [];
}
/**
* The judgment display ops: `JUDGE_DISPLAY_HIDDEN` (synthetic) while the play runs LR2's SILENT automatic judge timing,
* which draws no judgment or combo (OpenLR2 `LR2f.cpp` 2513), so the skin's `judge[]` display goes as the built-in and
* LR2 play screens' does. `judgeTimingAutoAdjust` is the play's mode (`PlayOptions.judgeTimingAutoAdjust`, a replay's
* as it recorded it). `chartHidesJudge` is a chart's `774:CRAZY_HIDJUDGE` in force (#931), which hides it the same way.
*/
export function resolveBeatorajaJudgeDisplayOps(
judgeTimingAutoAdjust: string | undefined,
chartHidesJudge = false,
): number[] {
return judgeTimingAutoAdjust === 'LR2-SILENT' || chartHidesJudge ? [BEATORAJA_OP.JUDGE_DISPLAY_HIDDEN] : [];
}
/** The lane cover ops a play skin keeps up to date (`LANECOVER1_CHANGING`, `LANECOVER1_ON`, `LIFT1_ON`). */
export const BEATORAJA_COVER_OPS: readonly number[] = [
BEATORAJA_OP.LANECOVER1_CHANGING,
BEATORAJA_OP.LANECOVER1_ON,
BEATORAJA_OP.LIFT1_ON,
];
/**
* The lane cover ops lit for the 1P covers: `LANECOVER1_ON` (271) while the lane cover is drawn, `LIFT1_ON` (272) while
* the LIFT is raised, and `LANECOVER1_CHANGING` (270) while `changing` (the player moved a cover a moment ago; skins
* gate the cover's percentage popup on it).
*/
export function resolveBeatorajaCoverOps(cover: LaneCoverState | undefined, changing: boolean): number[] {
const ops: number[] = [];
if (changing) ops.push(BEATORAJA_OP.LANECOVER1_CHANGING);
if (cover !== undefined) {
const drawn = resolveLaneCover(cover);
if (drawn.sudden > 0) ops.push(BEATORAJA_OP.LANECOVER1_ON);
if (drawn.lift > 0) ops.push(BEATORAJA_OP.LIFT1_ON);
}
return ops;
}
/**
* The FAST / SLOW op of a judge plate for a timed judgment (`_1p_early` 1242 / `_1p_late` 1243, 1262 / 1263 for 2P,
* 1362 / 1363 for POPN 9 KEY's third plate): early below 0 ms, late above. `undefined` on time (0 ms).
*/
export function beatorajaFastSlowOp(plate: BeatorajaSide, deltaMs: number): number | undefined {
if (deltaMs === 0) return undefined;
const isEarly = deltaMs < 0;
if (plate === 1) return isEarly ? BEATORAJA_OP.P1_JUDGE_EARLY : BEATORAJA_OP.P1_JUDGE_LATE;
if (plate === 2) return isEarly ? BEATORAJA_OP.P2_JUDGE_EARLY : BEATORAJA_OP.P2_JUDGE_LATE;
return isEarly ? BEATORAJA_OP.P3_JUDGE_EARLY : BEATORAJA_OP.P3_JUDGE_LATE;
}
|