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 | import { drawLabel } from '../../../stage/draw-label.ts';
/** The mines of the shared playfield: one mine with the skin's cell, the Be-Music Skin, or a caution-striped bar. */
import { resolveBeMusicLaneKind } from '../../../skin/be-music/registry.ts';
import { drawCautionMine } from '../../../skins/pixi-kit/mine.ts';
import type { PlayfieldLaneRect } from '../../types.ts';
import type { PlayfieldContext } from './context.ts';
/**
* Renders one landmine sprite. Tries the skin's mine cell first (e.g. the LR2 skin's `#SRC_NOTE` `mine` slot,
* animated per its `divX/divY/cycle`), then hands it to a Be-Music Skin that draws mines itself; otherwise falls back
* to the caution-striped bar ({@link drawCautionMine}) so the hazard still reads distinctly from playable notes.
*/
export function renderMineNote(
ctx: PlayfieldContext,
laneIndex: number,
channel: string,
lane: PlayfieldLaneRect,
y: number,
alpha = 1,
): void {
const cell = ctx.playfieldSkin.noteCell('mine', channel);
if (cell?.texture) {
const sprite = ctx.noteLayerPool.acquireSprite();
sprite.texture = cell.texture;
sprite.label = drawLabel(ctx, 'mine', laneIndex, channel);
sprite.x = lane.x + (lane.w - cell.width) / 2;
sprite.y = y - cell.height;
sprite.width = cell.width;
sprite.height = cell.height;
return;
}
const binding = ctx.skinBinding;
if (binding?.drawsMines) {
binding.addMine({
...(alpha !== 1 ? { alpha } : {}),
kind: resolveBeMusicLaneKind(channel, laneIndex, ctx.play.chartPlayVariant),
x: lane.x,
w: lane.w,
y,
});
return;
}
const graphic = ctx.noteLayerPool.acquireGraphics();
graphic.label = drawLabel(ctx, 'mine-fallback', laneIndex, channel);
drawCautionMine(graphic, lane.x, lane.w, y);
}
|