fertig-classic-games/src/games/cribbage/CribbageArt.js

863 lines
35 KiB
JavaScript

// Cribbage art — "The Keeper's Cottage": Old Murph's lighthouse-keeper's
// kitchen on a stormy night. Baked once per page load into canvas textures
// (no image files). Card faces are the shared casino deck ('casino-cards').
//
// crib-room plank wall, storm window (the light on the point, the cat
// on the sill), pot-belly stove, oilskin, barometer, ship in
// a bottle, life ring; a scrubbed oak table with a mug,
// pipe and oil lamp
// crib-board-* the walnut board (per target / match), holes and inlay
// crib-back navy card back, compass rose and rope border
// crib-peg-0/1 pegs (red = you, blue = Murph) + crib-peg-shadow
// crib-dial the brass count gauge (needle drawn live)
// crib-beam a soft band of light — the lighthouse sweeping past
import { prepareCasinoArt } from '../../ui/casino/CasinoArt.js';
import {
bakeRoom, canvas, rr, poly, mix, noisePattern, frontBands, rimBand, lampPool, rimShadow, pileSpot, CARD_TEX,
} from '../../ui/cardtable/TableArt.js';
import { W, H } from '../../ui/cardtable/TableGeometry.js';
import { T, L, boardGeometry, boardOutline, boardRect, boardPoint, skunkLinesFor } from './CribbageTable.js';
const CW = CARD_TEX.W, CH = CARD_TEX.H;
const SERIF = 'Georgia, "Times New Roman", serif';
const BRASS = '#d9b45a';
export const WINDOW = { x0: 1694, x1: 1904, y0: 16, y1: 292 };
export const STOVE = { x: 104, y: 520 };
export const LAMP = (() => { const p = T.P.project(0.9, 0.66); return { x: p.x, y: p.y, s: p.s }; })();
export const LIGHTHOUSE = { x: WINDOW.x0 + 46, y: WINDOW.y0 + 132 };
function seeded(seed) {
let s = seed;
return () => { s = (s * 16807) % 2147483647; return s / 2147483647; };
}
// ── The room ─────────────────────────────────────────────────────────────────
function planks(ctx) {
const rnd = seeded(7);
const ph = 44;
for (let y = 0, i = 0; y < 700; y += ph, i++) {
ctx.fillStyle = mix('#6d6250', '#5a4f40', rnd());
ctx.fillRect(0, y, W, ph);
ctx.fillStyle = 'rgba(255,240,210,0.05)';
ctx.fillRect(0, y + 2, W, 3);
ctx.fillStyle = 'rgba(20,12,6,0.55)';
ctx.fillRect(0, y + ph - 2, W, 2);
// butt joints and a few nail heads
for (let k = 0; k < 4; k++) {
const x = ((i * 377 + k * 523) % W);
ctx.fillStyle = 'rgba(20,12,6,0.5)';
ctx.fillRect(x, y, 2, ph);
ctx.fillStyle = 'rgba(30,22,14,0.7)';
ctx.beginPath(); ctx.arc(x + 9, y + 10, 1.6, 0, Math.PI * 2); ctx.arc(x + 9, y + ph - 10, 1.6, 0, Math.PI * 2); ctx.fill();
}
}
ctx.fillStyle = noisePattern(ctx, 160, 18);
ctx.fillRect(0, 0, W, 700);
}
function stormWindow(ctx) {
const { x0, x1, y0, y1 } = WINDOW;
// deep reveal
ctx.fillStyle = '#2a2219';
rr(ctx, x0 - 16, y0 - 12, x1 - x0 + 32, y1 - y0 + 30, 6);
ctx.fill();
// the night outside
const sky = ctx.createLinearGradient(0, y0, 0, y1);
sky.addColorStop(0, '#0b1424'); sky.addColorStop(0.55, '#16253a'); sky.addColorStop(0.62, '#0d1a28'); sky.addColorStop(1, '#060c16');
ctx.fillStyle = sky;
ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
// storm clouds
const rnd = seeded(23);
for (let i = 0; i < 14; i++) {
const cx = x0 + rnd() * (x1 - x0), cy = y0 + 20 + rnd() * 90;
const g = ctx.createRadialGradient(cx, cy, 2, cx, cy, 40 + rnd() * 40);
g.addColorStop(0, 'rgba(70,86,110,0.35)'); g.addColorStop(1, 'rgba(70,86,110,0)');
ctx.fillStyle = g;
ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
}
// the sea and the headland with the lighthouse
const horizon = y0 + (y1 - y0) * 0.6;
ctx.fillStyle = '#0a1520';
ctx.fillRect(x0, horizon, x1 - x0, y1 - horizon);
ctx.strokeStyle = 'rgba(140,170,200,0.18)';
ctx.lineWidth = 1.2;
for (let i = 0; i < 9; i++) {
const y = horizon + 8 + i * 12;
ctx.beginPath();
for (let x = x0; x <= x1; x += 8) ctx.lineTo(x, y + Math.sin(x * 0.09 + i) * 2);
ctx.stroke();
}
ctx.fillStyle = '#05090f';
ctx.beginPath();
ctx.moveTo(x0, horizon + 4);
ctx.quadraticCurveTo(x0 + 40, horizon - 22, x0 + 92, horizon + 2);
ctx.lineTo(x0, horizon + 10);
ctx.closePath();
ctx.fill();
const lx = LIGHTHOUSE.x, ly = LIGHTHOUSE.y;
ctx.fillStyle = '#d8d2c4';
ctx.beginPath(); ctx.moveTo(lx - 6, ly + 40); ctx.lineTo(lx - 4, ly + 6); ctx.lineTo(lx + 4, ly + 6); ctx.lineTo(lx + 6, ly + 40); ctx.closePath(); ctx.fill();
ctx.fillStyle = '#a8322a';
ctx.fillRect(lx - 5.2, ly + 16, 10.4, 6);
ctx.fillRect(lx - 5.8, ly + 30, 11.6, 6);
ctx.fillStyle = '#ffe9a8';
ctx.fillRect(lx - 3, ly, 6, 6);
ctx.fillStyle = '#1a1a1a';
ctx.beginPath(); ctx.moveTo(lx - 5, ly); ctx.lineTo(lx, ly - 6); ctx.lineTo(lx + 5, ly); ctx.closePath(); ctx.fill();
// rain already on the glass
for (let i = 0; i < 70; i++) {
const x = x0 + rnd() * (x1 - x0), y = y0 + rnd() * (y1 - y0);
ctx.fillStyle = `rgba(190,210,235,${0.12 + rnd() * 0.2})`;
ctx.beginPath(); ctx.ellipse(x, y, 1.2, 1.8 + rnd() * 2, 0, 0, Math.PI * 2); ctx.fill();
}
// sash and mullions
ctx.strokeStyle = '#3e3326';
ctx.lineWidth = 7;
ctx.strokeRect(x0, y0, x1 - x0, y1 - y0);
ctx.lineWidth = 5;
ctx.beginPath();
ctx.moveTo((x0 + x1) / 2, y0); ctx.lineTo((x0 + x1) / 2, y1);
ctx.moveTo(x0, (y0 + y1) / 2); ctx.lineTo(x1, (y0 + y1) / 2);
ctx.stroke();
ctx.strokeStyle = 'rgba(255,230,180,0.12)';
ctx.lineWidth = 1;
ctx.strokeRect(x0 + 4, y0 + 4, x1 - x0 - 8, y1 - y0 - 8);
// the sill and the cat asleep on it
ctx.fillStyle = '#4a3c2a';
ctx.fillRect(x0 - 22, y1 + 10, x1 - x0 + 44, 14);
ctx.fillStyle = 'rgba(255,230,180,0.12)';
ctx.fillRect(x0 - 22, y1 + 10, x1 - x0 + 44, 2);
sleepingCat(ctx, x0 + 128, y1 + 10);
}
function sleepingCat(ctx, x, y) {
ctx.save();
ctx.translate(x, y);
ctx.fillStyle = '#17120d';
// body loaf
ctx.beginPath(); ctx.ellipse(0, -16, 44, 18, 0, Math.PI, 0); ctx.lineTo(44, 0); ctx.lineTo(-44, 0); ctx.closePath(); ctx.fill();
// head tucked at the left, ears
ctx.beginPath(); ctx.ellipse(-38, -14, 15, 13, 0, 0, Math.PI * 2); ctx.fill();
ctx.beginPath(); ctx.moveTo(-50, -20); ctx.lineTo(-47, -36); ctx.lineTo(-40, -24); ctx.closePath(); ctx.fill();
ctx.beginPath(); ctx.moveTo(-36, -24); ctx.lineTo(-30, -37); ctx.lineTo(-26, -21); ctx.closePath(); ctx.fill();
// tail curled round the front and hanging over the sill
ctx.strokeStyle = '#17120d';
ctx.lineWidth = 7;
ctx.lineCap = 'round';
ctx.beginPath(); ctx.moveTo(40, -6); ctx.quadraticCurveTo(54, 6, 48, 26); ctx.quadraticCurveTo(46, 34, 52, 38); ctx.stroke();
// rim light from the lamp
ctx.strokeStyle = 'rgba(255,200,130,0.35)';
ctx.lineWidth = 1.6;
ctx.beginPath(); ctx.ellipse(0, -16, 44, 18, 0, Math.PI * 1.05, Math.PI * 1.6); ctx.stroke();
ctx.beginPath(); ctx.ellipse(-38, -14, 15, 13, 0, Math.PI * 0.9, Math.PI * 1.5); ctx.stroke();
ctx.restore();
}
function stove(ctx) {
const { x, y } = STOVE;
ctx.save();
// flue pipe up the wall
ctx.fillStyle = '#1c1a18';
ctx.fillRect(x - 14, 80, 28, y - 170);
ctx.fillStyle = 'rgba(255,255,255,0.06)';
ctx.fillRect(x - 10, 80, 5, y - 170);
// pot-belly
const g = ctx.createRadialGradient(x - 20, y - 30, 10, x, y, 110);
g.addColorStop(0, '#3a3530'); g.addColorStop(1, '#0f0d0b');
ctx.fillStyle = g;
ctx.beginPath(); ctx.ellipse(x, y, 72, 96, 0, 0, Math.PI * 2); ctx.fill();
ctx.fillStyle = '#26221e';
rr(ctx, x - 62, y - 120, 124, 26, 8); ctx.fill();
rr(ctx, x - 70, y + 78, 140, 22, 6); ctx.fill();
// glowing grate
const fg = ctx.createRadialGradient(x, y + 20, 4, x, y + 20, 46);
fg.addColorStop(0, '#ffdd8a'); fg.addColorStop(0.4, '#ff8a2a'); fg.addColorStop(1, '#5a1a04');
ctx.fillStyle = fg;
rr(ctx, x - 34, y - 4, 68, 46, 10); ctx.fill();
ctx.strokeStyle = '#140f0a';
ctx.lineWidth = 4;
for (let i = -2; i <= 2; i++) { ctx.beginPath(); ctx.moveTo(x + i * 12, y - 4); ctx.lineTo(x + i * 12, y + 42); ctx.stroke(); }
ctx.restore();
}
function oilskin(ctx) {
// a yellow oilskin and sou'wester on a peg
ctx.save();
ctx.fillStyle = '#3a2c1c';
ctx.fillRect(36, 96, 150, 10);
ctx.fillStyle = '#c7a032';
ctx.beginPath();
ctx.moveTo(84, 104); ctx.lineTo(132, 104); ctx.lineTo(164, 300); ctx.lineTo(54, 300); ctx.closePath(); ctx.fill();
ctx.fillStyle = 'rgba(0,0,0,0.25)';
ctx.beginPath(); ctx.moveTo(108, 112); ctx.lineTo(116, 112); ctx.lineTo(122, 300); ctx.lineTo(104, 300); ctx.closePath(); ctx.fill();
ctx.fillStyle = '#b08a26';
ctx.beginPath(); ctx.ellipse(108, 102, 40, 12, 0, 0, Math.PI * 2); ctx.fill();
ctx.beginPath(); ctx.ellipse(108, 92, 22, 14, 0, Math.PI, 0); ctx.fill();
ctx.restore();
}
function barometer(ctx, x, y) {
ctx.save();
ctx.fillStyle = '#3a2814';
ctx.beginPath(); ctx.arc(x, y, 50, 0, Math.PI * 2); ctx.fill();
const g = ctx.createLinearGradient(x - 44, y - 44, x + 44, y + 44);
g.addColorStop(0, '#f2d58a'); g.addColorStop(0.5, '#b8862e'); g.addColorStop(1, '#6a4a14');
ctx.fillStyle = g;
ctx.beginPath(); ctx.arc(x, y, 44, 0, Math.PI * 2); ctx.fill();
ctx.fillStyle = '#efe6cf';
ctx.beginPath(); ctx.arc(x, y, 36, 0, Math.PI * 2); ctx.fill();
ctx.strokeStyle = '#3a2a14';
ctx.lineWidth = 1;
for (let i = 0; i <= 20; i++) {
const a = Math.PI * 0.8 + (i / 20) * Math.PI * 1.4;
ctx.beginPath();
ctx.moveTo(x + Math.cos(a) * 30, y + Math.sin(a) * 30);
ctx.lineTo(x + Math.cos(a) * (i % 5 ? 33 : 35), y + Math.sin(a) * (i % 5 ? 33 : 35));
ctx.stroke();
}
ctx.fillStyle = '#3a2a14';
ctx.font = `8px ${SERIF}`;
ctx.textAlign = 'center';
ctx.fillText('STORMY', x - 16, y + 18);
ctx.fillText('FAIR', x + 18, y + 18);
ctx.strokeStyle = '#8a1a14';
ctx.lineWidth = 2;
ctx.beginPath(); ctx.moveTo(x, y); ctx.lineTo(x - 22, y + 12); ctx.stroke();
ctx.fillStyle = '#2a1a0a';
ctx.beginPath(); ctx.arc(x, y, 3, 0, Math.PI * 2); ctx.fill();
ctx.restore();
}
function shipInBottle(ctx, x, y) {
ctx.save();
// shelf
ctx.fillStyle = '#3e2e1c';
ctx.fillRect(x - 90, y + 26, 200, 10);
ctx.fillStyle = 'rgba(0,0,0,0.35)';
ctx.fillRect(x - 90, y + 36, 200, 6);
// bottle
ctx.fillStyle = 'rgba(150,190,170,0.22)';
rr(ctx, x - 70, y - 12, 120, 38, 16); ctx.fill();
ctx.fillRect(x + 46, y - 2, 30, 16);
ctx.fillStyle = '#6a4a2a';
ctx.fillRect(x + 74, y - 1, 10, 14);
// the ship
ctx.fillStyle = '#4a2a14';
ctx.beginPath(); ctx.moveTo(x - 46, y + 14); ctx.lineTo(x + 26, y + 14); ctx.lineTo(x + 18, y + 22); ctx.lineTo(x - 40, y + 22); ctx.closePath(); ctx.fill();
ctx.fillStyle = '#e8dfc8';
for (const [sx, h] of [[-30, 22], [-8, 26], [12, 20]]) {
ctx.beginPath(); ctx.moveTo(sx, y + 12); ctx.lineTo(sx, y + 12 - h); ctx.lineTo(sx + 12, y + 12 - h * 0.3); ctx.closePath(); ctx.fill();
}
ctx.strokeStyle = 'rgba(255,255,255,0.35)';
ctx.lineWidth = 1.5;
ctx.beginPath(); ctx.moveTo(x - 62, y - 6); ctx.lineTo(x + 30, y - 6); ctx.stroke();
ctx.restore();
}
function lifeRing(ctx, x, y) {
ctx.save();
ctx.lineWidth = 26;
for (let i = 0; i < 8; i++) {
ctx.strokeStyle = i % 2 ? '#e8e0d0' : '#b3322a';
ctx.beginPath(); ctx.arc(x, y, 44, (i / 8) * Math.PI * 2, ((i + 1) / 8) * Math.PI * 2); ctx.stroke();
}
ctx.lineWidth = 2;
ctx.strokeStyle = 'rgba(0,0,0,0.4)';
ctx.beginPath(); ctx.arc(x, y, 57, 0, Math.PI * 2); ctx.stroke();
ctx.beginPath(); ctx.arc(x, y, 31, 0, Math.PI * 2); ctx.stroke();
ctx.strokeStyle = '#c9b28a';
ctx.lineWidth = 3;
ctx.beginPath(); ctx.arc(x, y, 50, Math.PI * 0.15, Math.PI * 0.85); ctx.stroke();
ctx.restore();
}
function wall(ctx) {
planks(ctx);
stove(ctx);
oilskin(ctx);
barometer(ctx, 560, 78);
shipInBottle(ctx, 700, 96);
stormWindow(ctx);
lifeRing(ctx, 1842, 430);
// night: everything dim, warmer by the stove
ctx.fillStyle = 'rgba(8,6,4,0.42)';
ctx.fillRect(0, 0, W, 700);
const sg = ctx.createRadialGradient(STOVE.x, STOVE.y, 20, STOVE.x, STOVE.y, 520);
sg.addColorStop(0, 'rgba(255,140,60,0.28)'); sg.addColorStop(1, 'rgba(255,140,60,0)');
ctx.fillStyle = sg;
ctx.fillRect(0, 0, W, 900);
// the floor (dark boards below the table)
const f = ctx.createLinearGradient(0, 640, 0, H);
f.addColorStop(0, '#2a1d12'); f.addColorStop(1, '#120b06');
ctx.fillStyle = f;
ctx.fillRect(0, 640, W, H - 640);
ctx.fillStyle = '#1a120a';
ctx.fillRect(0, 628, W, 14);
}
function front(ctx, Tb) {
frontBands(ctx, Tb, ['#b08250', '#946a3e', '#7a5530', '#5e4024', '#422c18'], { grooves: [0.4] });
}
function rim(ctx, Tb) {
rimBand(ctx, Tb, { base: '#9a6c3e', dark: '#4a3018', light: '#e8c08a', grain: ['#5a3a1c', '#f0cc98'], gloss: 1.5 });
}
// Scrubbed oak: planks running the length of the table.
function oakTop(ctx, Tb) {
ctx.fillStyle = '#b88c58';
ctx.fillRect(0, 0, W, H);
const rnd = seeded(41);
const n = 9;
for (let i = 0; i < n; i++) {
const v0 = i / n, v1 = (i + 1) / n;
const a = Tb.P.project(-1.1, v0), b = Tb.P.project(1.1, v0), c = Tb.P.project(1.1, v1), d = Tb.P.project(-1.1, v1);
ctx.fillStyle = mix('#c49a64', '#a87c4a', rnd());
poly(ctx, [a, b, c, d]);
ctx.fill();
// grain streaks along the plank
ctx.lineWidth = 1;
for (let k = 0; k < 26; k++) {
const vv = v0 + (v1 - v0) * rnd();
const u0 = -1.1 + rnd() * 2.2, len = 0.15 + rnd() * 0.5;
ctx.strokeStyle = rnd() < 0.5 ? 'rgba(110,70,30,0.22)' : 'rgba(240,210,160,0.16)';
ctx.beginPath();
for (let t = 0; t <= 10; t++) {
const p = Tb.P.project(u0 + len * (t / 10), vv + Math.sin(t * 0.9 + k) * 0.002);
if (t) ctx.lineTo(p.x, p.y); else ctx.moveTo(p.x, p.y);
}
ctx.stroke();
}
// the seam
ctx.strokeStyle = 'rgba(60,36,14,0.55)';
ctx.lineWidth = 1.6;
ctx.beginPath(); ctx.moveTo(d.x, d.y); ctx.lineTo(c.x, c.y); ctx.stroke();
}
ctx.fillStyle = noisePattern(ctx, 200, 20);
ctx.fillRect(0, 0, W, H);
// knife marks and rings from a lifetime of mugs
ctx.strokeStyle = 'rgba(90,58,26,0.18)';
ctx.lineWidth = 2;
for (const [u, v, r] of [[0.45, 0.82, 34], [-0.52, 0.86, 28], [0.15, 0.93, 30]]) {
const p = Tb.P.project(u, v);
ctx.beginPath(); ctx.ellipse(p.x, p.y, r * p.s, r * p.s * 0.8, 0, 0.3, Math.PI * 1.7); ctx.stroke();
}
lampPool(ctx, Tb, { color: '255,206,140', alpha: 0.3, vignette: 0.6, at: { u: 0.35, v: 0.58 } });
const st = Tb.P.project(-1.2, 0.5);
const g = ctx.createRadialGradient(st.x, st.y, 20, st.x, st.y, 760);
g.addColorStop(0, 'rgba(255,140,60,0.16)'); g.addColorStop(1, 'rgba(255,140,60,0)');
ctx.fillStyle = g;
ctx.fillRect(0, 0, W, H);
rimShadow(ctx, Tb, 0.36);
}
function mugAndPipe(ctx) {
const p = T.P.project(-0.86, 0.75);
ctx.save();
ctx.translate(p.x, p.y);
ctx.scale(p.s, p.s);
// enamel mug
ctx.fillStyle = 'rgba(0,0,0,0.35)';
ctx.beginPath(); ctx.ellipse(10, 34, 40, 13, 0, 0, Math.PI * 2); ctx.fill();
ctx.fillStyle = '#e8e4da';
rr(ctx, -28, -26, 56, 60, 8); ctx.fill();
ctx.strokeStyle = '#e8e4da'; ctx.lineWidth = 8;
ctx.beginPath(); ctx.arc(30, 4, 14, -Math.PI / 2, Math.PI / 2); ctx.stroke();
ctx.fillStyle = '#1e3a5a';
ctx.fillRect(-28, -26, 56, 6);
ctx.beginPath(); ctx.ellipse(0, -26, 28, 8, 0, 0, Math.PI * 2);
ctx.fillStyle = '#d8d2c4'; ctx.fill();
ctx.beginPath(); ctx.ellipse(0, -25, 23, 6, 0, 0, Math.PI * 2);
ctx.fillStyle = '#3a2010'; ctx.fill();
ctx.fillStyle = 'rgba(0,0,0,0.12)';
ctx.fillRect(10, -20, 18, 54);
// pipe
ctx.translate(70, 30);
ctx.rotate(-0.25);
ctx.fillStyle = 'rgba(0,0,0,0.3)';
ctx.beginPath(); ctx.ellipse(30, 10, 46, 7, 0, 0, Math.PI * 2); ctx.fill();
ctx.strokeStyle = '#2a1a0e'; ctx.lineWidth = 5; ctx.lineCap = 'round';
ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(58, 2); ctx.stroke();
ctx.fillStyle = '#5a3418';
rr(ctx, 54, -16, 22, 22, 6); ctx.fill();
ctx.fillStyle = '#1a0e06';
ctx.beginPath(); ctx.ellipse(65, -16, 9, 3, 0, 0, Math.PI * 2); ctx.fill();
ctx.restore();
}
/** The oil lamp's base and glass chimney (the flame glow is live). */
function oilLamp(ctx) {
const { x, y, s } = LAMP;
ctx.save();
ctx.translate(x, y);
ctx.scale(s, s);
ctx.fillStyle = 'rgba(0,0,0,0.4)';
ctx.beginPath(); ctx.ellipse(14, 10, 60, 16, 0, 0, Math.PI * 2); ctx.fill();
const b = ctx.createLinearGradient(-40, 0, 40, 0);
b.addColorStop(0, '#6a4a14'); b.addColorStop(0.4, '#f0d080'); b.addColorStop(1, '#5a3a0c');
ctx.fillStyle = b;
ctx.beginPath(); ctx.ellipse(0, 0, 42, 12, 0, 0, Math.PI * 2); ctx.fill();
ctx.beginPath(); ctx.moveTo(-36, -2); ctx.quadraticCurveTo(-46, -40, -14, -54); ctx.lineTo(14, -54); ctx.quadraticCurveTo(46, -40, 36, -2); ctx.closePath(); ctx.fill();
ctx.fillStyle = '#2a1a08';
ctx.fillRect(-12, -62, 24, 10);
// chimney
const g = ctx.createLinearGradient(-20, 0, 20, 0);
g.addColorStop(0, 'rgba(255,240,210,0.35)'); g.addColorStop(0.5, 'rgba(255,250,235,0.12)'); g.addColorStop(1, 'rgba(255,240,210,0.4)');
ctx.fillStyle = g;
ctx.beginPath();
ctx.moveTo(-12, -62); ctx.quadraticCurveTo(-30, -92, -14, -118); ctx.lineTo(-10, -160); ctx.lineTo(10, -160); ctx.lineTo(14, -118); ctx.quadraticCurveTo(30, -92, 12, -62); ctx.closePath();
ctx.fill();
ctx.strokeStyle = 'rgba(255,240,210,0.5)'; ctx.lineWidth = 1.2; ctx.stroke();
// the flame
const f = ctx.createRadialGradient(0, -88, 1, 0, -88, 16);
f.addColorStop(0, '#fffbe0'); f.addColorStop(0.5, '#ffc861'); f.addColorStop(1, 'rgba(255,140,40,0)');
ctx.fillStyle = f;
ctx.beginPath(); ctx.ellipse(0, -88, 7, 16, 0, 0, Math.PI * 2); ctx.fill();
ctx.restore();
}
function marks(ctx) {
pileSpot(ctx, L.deck, 'DECK', { color: '90,60,28', alpha: 0.5 });
pileSpot(ctx, L.cribMine, '', { color: '90,60,28', alpha: 0.28 });
pileSpot(ctx, L.cribTheirs, '', { color: '90,60,28', alpha: 0.28 });
mugAndPipe(ctx);
}
// ── The board ────────────────────────────────────────────────────────────────
function boardPainter(geo, { match, doubleSkunk }) {
return (ctx) => {
const top = boardOutline();
const thick = 15;
// shadow on the table
ctx.save();
ctx.shadowColor = 'rgba(0,0,0,0.6)';
ctx.shadowBlur = 22;
ctx.shadowOffsetY = 16;
poly(ctx, top.map((p) => ({ x: p.x, y: p.y + thick * p.s })));
ctx.fillStyle = '#000';
ctx.fill();
ctx.restore();
// front edge
for (let i = thick; i >= 0; i -= 1.5) {
poly(ctx, top.map((p) => ({ x: p.x, y: p.y + i * p.s })));
ctx.fillStyle = mix('#3a2212', '#24150a', i / thick);
ctx.fill();
}
// top face: walnut
const ys = top.map((p) => p.y);
const y0 = Math.min(...ys), y1 = Math.max(...ys);
const xs = top.map((p) => p.x);
const x0 = Math.min(...xs), x1 = Math.max(...xs);
ctx.save();
poly(ctx, top);
ctx.clip();
const g = ctx.createLinearGradient(0, y0, 0, y1);
g.addColorStop(0, '#6e4426'); g.addColorStop(0.5, '#5a361c'); g.addColorStop(1, '#4a2c16');
ctx.fillStyle = g;
ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
const rnd = seeded(97);
for (let i = 0; i < 90; i++) {
const yy = y0 + rnd() * (y1 - y0);
const xa = x0 + rnd() * (x1 - x0), len = 80 + rnd() * 380;
ctx.strokeStyle = rnd() < 0.55 ? 'rgba(30,16,6,0.28)' : 'rgba(170,110,60,0.14)';
ctx.lineWidth = 0.8 + rnd() * 1.4;
ctx.beginPath();
for (let t = 0; t <= 12; t++) {
const x = xa + len * (t / 12);
const y = yy + Math.sin(t * 0.7 + i) * 1.6;
if (t) ctx.lineTo(x, y); else ctx.moveTo(x, y);
}
ctx.stroke();
}
ctx.fillStyle = noisePattern(ctx, 128, 16);
ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
// lamp sheen
const sh = ctx.createRadialGradient(LAMP.x - 200, y0, 20, LAMP.x - 200, y0, 700);
sh.addColorStop(0, 'rgba(255,214,150,0.16)'); sh.addColorStop(1, 'rgba(255,214,150,0)');
ctx.fillStyle = sh;
ctx.fillRect(x0, y0, x1 - x0, y1 - y0);
ctx.restore();
// bevel + brass inlay border
poly(ctx, top);
ctx.lineWidth = 2;
ctx.strokeStyle = 'rgba(255,210,150,0.35)';
ctx.stroke();
poly(ctx, boardOutline(-0.012));
ctx.lineWidth = 1.6;
ctx.strokeStyle = 'rgba(217,180,90,0.75)';
ctx.stroke();
// inlay between the streets
const lineAt = (by, color, w) => {
ctx.strokeStyle = color;
ctx.lineWidth = w;
ctx.beginPath();
for (let t = 0; t <= 20; t++) {
const bx = 0.03 + 0.94 * (t / 20);
const p = boardPoint(bx, by);
if (t) ctx.lineTo(p.x, p.y); else ctx.moveTo(p.x, p.y);
}
ctx.stroke();
};
for (let st = 1; st < geo.streets; st++) {
const by = geo.edgeY + st * geo.bandH;
lineAt(by, 'rgba(217,180,90,0.7)', 2.2);
lineAt(by + 0.012, 'rgba(0,0,0,0.25)', 1);
}
// each player's track tinted faintly
for (let st = 0; st < geo.streets; st++) {
for (let seat = 0; seat < 2; seat++) {
const by = geo.rowBy(st, seat);
const a = boardPoint(geo.colBx(0) - 0.006, by), b = boardPoint(geo.colBx(geo.per - 1) + 0.006, by);
ctx.strokeStyle = seat === 0 ? 'rgba(216,71,58,0.32)' : 'rgba(79,155,216,0.32)';
ctx.lineWidth = 9 * a.s;
ctx.lineCap = 'round';
ctx.beginPath(); ctx.moveTo(a.x, a.y); ctx.lineTo(b.x, b.y); ctx.stroke();
}
// mother-of-pearl dots between groups of five
for (let gi = 1; gi < geo.per / 5; gi++) {
const bx = (geo.colBx(gi * 5 - 1) + geo.colBx(gi * 5)) / 2;
const p = boardPoint(bx, geo.edgeY + (st + 0.5) * geo.bandH);
const pg = ctx.createRadialGradient(p.x - 1, p.y - 1, 0.5, p.x, p.y, 4 * p.s);
pg.addColorStop(0, '#ffffff'); pg.addColorStop(0.6, '#d8e4ec'); pg.addColorStop(1, '#9ab0c0');
ctx.fillStyle = pg;
ctx.beginPath(); ctx.ellipse(p.x, p.y, 3.6 * p.s, 3 * p.s, 0, 0, Math.PI * 2); ctx.fill();
}
}
// numbers every ten
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
for (const nmb of geo.numbers) {
ctx.font = `bold ${Math.round(10 * nmb.s + 1)}px ${SERIF}`;
ctx.fillStyle = 'rgba(0,0,0,0.5)';
ctx.fillText(String(nmb.n), nmb.x + 0.8, nmb.y + 0.8);
ctx.fillStyle = 'rgba(230,196,120,0.8)';
ctx.fillText(String(nmb.n), nmb.x, nmb.y);
}
// skunk lines
const lines = skunkLinesFor(geo.target, doubleSkunk);
for (const { line, label } of lines) {
const segs = geo.skunk(line);
for (const { a, b } of segs) {
const mx = (a.x + b.x) / 2, my = (a.y + b.y) / 2;
const dx = b.x - a.x, dy = b.y - a.y, len = Math.hypot(dx, dy) || 1;
const nx = -dy / len, ny = dx / len;
const h = 11 * a.s;
ctx.strokeStyle = 'rgba(217,180,90,0.9)';
ctx.lineWidth = 2;
ctx.beginPath(); ctx.moveTo(mx - nx * h, my - ny * h); ctx.lineTo(mx + nx * h, my + ny * h); ctx.stroke();
}
const a = segs[0].a, b = segs[0].b;
const vertical = Math.abs(b.y - a.y) > Math.abs(b.x - a.x);
const lx = vertical ? Math.max(a.x, b.x) + 18 * a.s : (a.x + b.x) / 2;
const ly = vertical ? (a.y + b.y) / 2 : Math.max(a.y, b.y) + 14 * a.s;
ctx.font = `italic bold ${Math.round(12 * a.s + 2)}px ${SERIF}`;
ctx.fillStyle = 'rgba(0,0,0,0.5)';
ctx.fillText(label, lx + 1, ly + 1);
ctx.fillStyle = 'rgba(240,206,130,0.95)';
ctx.fillText(label, lx, ly);
}
// the holes
const hole = (p, ring = null) => {
const r = geo.holeR * p.s;
ctx.fillStyle = 'rgba(255,220,170,0.16)';
ctx.beginPath(); ctx.ellipse(p.x, p.y + 1.2, r + 1.4, (r + 1.4) * 0.84, 0, 0, Math.PI * 2); ctx.fill();
const hg = ctx.createRadialGradient(p.x, p.y - r * 0.4, 0.5, p.x, p.y, r);
hg.addColorStop(0, '#050302'); hg.addColorStop(1, '#2a180a');
ctx.fillStyle = hg;
ctx.beginPath(); ctx.ellipse(p.x, p.y, r, r * 0.84, 0, 0, Math.PI * 2); ctx.fill();
if (ring) {
ctx.strokeStyle = ring;
ctx.lineWidth = 1.8;
ctx.beginPath(); ctx.ellipse(p.x, p.y, r + 3, (r + 3) * 0.84, 0, 0, Math.PI * 2); ctx.stroke();
}
};
const last = geo.holes[0].length - 1;
for (let seat = 0; seat < 2; seat++) {
geo.holes[seat].forEach((p, n) => hole(p, n === 0 || n === last ? 'rgba(240,206,130,0.95)' : null));
hole(geo.alt[seat], 'rgba(240,206,130,0.6)');
if (match) geo.gameHoles[seat].forEach((p) => hole(p, 'rgba(200,220,235,0.7)'));
}
// labels: START, the game hole, GAMES
const lab = (text, x, y, s, color = 'rgba(240,206,130,0.9)') => {
ctx.font = `bold ${Math.round(9 * s + 2)}px ${SERIF}`;
ctx.fillStyle = 'rgba(0,0,0,0.5)';
ctx.fillText(text, x + 0.8, y + 0.8);
ctx.fillStyle = color;
ctx.fillText(text, x, y);
};
const s0 = geo.holes[1][0], a0 = geo.alt[1];
lab('START', (s0.x + a0.x) / 2, s0.y - 15 * s0.s, s0.s);
const f0 = geo.holes[0][last], f1 = geo.holes[1][last];
lab(String(geo.target), f0.x, f0.y + 16 * f0.s, f0.s);
lab('GAME', f1.x, f1.y - 15 * f1.s, f1.s);
if (match) {
const gh = geo.gameHoles[1];
const cx = (gh[0].x + gh[1].x) / 2;
lab('GAMES', cx, gh[0].y - 14 * gh[0].s, gh[0].s, 'rgba(200,220,235,0.9)');
}
if (geo.target === 121) lighthouseInlay(ctx, geo);
};
}
/** A little white-and-red lighthouse inlaid at the free end of the board. */
function lighthouseInlay(ctx, geo) {
const bx = (geo.endA + geo.endB) / 2 + 0.004;
const top = boardPoint(bx, 0.1), bot = boardPoint(bx, 0.6);
const s = top.s;
const x = top.x, h = bot.y - top.y;
ctx.save();
ctx.globalAlpha = 0.85;
ctx.fillStyle = '#e8e0cc';
ctx.beginPath(); ctx.moveTo(x - 7 * s, top.y + h); ctx.lineTo(x - 4 * s, top.y + 10 * s); ctx.lineTo(x + 4 * s, top.y + 10 * s); ctx.lineTo(x + 7 * s, top.y + h); ctx.closePath(); ctx.fill();
ctx.fillStyle = '#b3322a';
for (const f of [0.35, 0.65]) ctx.fillRect(x - (4.6 + f * 2.4) * s, top.y + 10 * s + (h - 10 * s) * f, (9.2 + f * 4.8) * s, 7 * s);
ctx.fillStyle = '#f0ce82';
ctx.fillRect(x - 3.5 * s, top.y + 3 * s, 7 * s, 7 * s);
ctx.fillStyle = '#2a1a0a';
ctx.beginPath(); ctx.moveTo(x - 5 * s, top.y + 3 * s); ctx.lineTo(x, top.y - 3 * s); ctx.lineTo(x + 5 * s, top.y + 3 * s); ctx.closePath(); ctx.fill();
ctx.strokeStyle = 'rgba(240,206,130,0.6)';
ctx.lineWidth = 1;
for (const d of [-1, 1]) {
ctx.beginPath(); ctx.moveTo(x + d * 6 * s, top.y + 6 * s); ctx.lineTo(x + d * 22 * s, top.y + 1 * s); ctx.stroke();
ctx.beginPath(); ctx.moveTo(x + d * 6 * s, top.y + 7 * s); ctx.lineTo(x + d * 22 * s, top.y + 12 * s); ctx.stroke();
}
ctx.restore();
}
/** Bake (once) the board texture for a variant; returns { key, x, y }. */
export function ensureBoard(scene, target, { match = false, doubleSkunk = false } = {}) {
const key = `crib-board-${target}${match ? '-m' : ''}${doubleSkunk ? '-ds' : ''}`;
const r = boardRect();
const x = Math.floor(r.x0), y = Math.floor(r.y0);
if (!scene.textures.exists(key)) {
const c = canvas(Math.ceil(r.x1 - x), Math.ceil(r.y1 - y));
const ctx = c.getContext('2d');
ctx.translate(-x, -y);
boardPainter(boardGeometry(target), { match, doubleSkunk })(ctx);
scene.textures.addCanvas(key, c);
}
return { key, x, y };
}
// ── Card back ────────────────────────────────────────────────────────────────
function compassRose(ctx, cx, cy, r) {
ctx.save();
ctx.translate(cx, cy);
ctx.strokeStyle = BRASS;
ctx.lineWidth = 2;
ctx.beginPath(); ctx.arc(0, 0, r, 0, Math.PI * 2); ctx.stroke();
ctx.lineWidth = 1;
ctx.beginPath(); ctx.arc(0, 0, r * 0.82, 0, Math.PI * 2); ctx.stroke();
for (let i = 0; i < 32; i++) {
const a = (i / 32) * Math.PI * 2;
ctx.beginPath();
ctx.moveTo(Math.cos(a) * r * 0.82, Math.sin(a) * r * 0.82);
ctx.lineTo(Math.cos(a) * r * (i % 4 ? 0.9 : 0.98), Math.sin(a) * r * (i % 4 ? 0.9 : 0.98));
ctx.stroke();
}
const point = (a, len, w, light) => {
ctx.save();
ctx.rotate(a);
ctx.fillStyle = light ? '#f2dc9a' : '#a87a26';
ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(0, -len); ctx.lineTo(w, -w); ctx.closePath(); ctx.fill();
ctx.fillStyle = light ? '#a87a26' : '#f2dc9a';
ctx.beginPath(); ctx.moveTo(0, 0); ctx.lineTo(0, -len); ctx.lineTo(-w, -w); ctx.closePath(); ctx.fill();
ctx.restore();
};
for (let i = 0; i < 4; i++) point(Math.PI / 4 + (i * Math.PI) / 2, r * 0.6, r * 0.12, false);
for (let i = 0; i < 4; i++) point((i * Math.PI) / 2, r * 0.95, r * 0.17, true);
ctx.fillStyle = '#1d2f4a';
ctx.beginPath(); ctx.arc(0, 0, r * 0.1, 0, Math.PI * 2); ctx.fill();
ctx.fillStyle = BRASS;
ctx.font = `bold ${Math.round(r * 0.26)}px ${SERIF}`;
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.fillText('N', 0, -r * 1.16);
ctx.restore();
}
function ropeRect(ctx, x, y, w, h, r) {
ctx.save();
rr(ctx, x, y, w, h, r);
ctx.lineWidth = 7;
ctx.strokeStyle = '#b8955a';
ctx.stroke();
ctx.setLineDash([5, 5]);
ctx.lineWidth = 7;
ctx.strokeStyle = '#7a5a2a';
ctx.stroke();
ctx.setLineDash([]);
ctx.lineWidth = 1;
ctx.strokeStyle = 'rgba(0,0,0,0.45)';
rr(ctx, x - 4, y - 4, w + 8, h + 8, r + 3); ctx.stroke();
rr(ctx, x + 4, y + 4, w - 8, h - 8, Math.max(1, r - 3)); ctx.stroke();
ctx.restore();
}
function anchor(ctx, x, y, s) {
ctx.save();
ctx.translate(x, y);
ctx.scale(s, s);
ctx.strokeStyle = BRASS;
ctx.lineWidth = 2.4;
ctx.lineCap = 'round';
ctx.beginPath(); ctx.arc(0, -10, 3, 0, Math.PI * 2); ctx.stroke();
ctx.beginPath(); ctx.moveTo(0, -7); ctx.lineTo(0, 10); ctx.stroke();
ctx.beginPath(); ctx.moveTo(-6, -3); ctx.lineTo(6, -3); ctx.stroke();
ctx.beginPath(); ctx.arc(0, 2, 9, Math.PI * 0.15, Math.PI * 0.85); ctx.stroke();
ctx.restore();
}
function bakeBack(scene) {
const c = canvas(CW, CH);
const ctx = c.getContext('2d');
rr(ctx, 1, 1, CW - 2, CH - 2, 18);
const g = ctx.createLinearGradient(0, 0, CW, CH);
g.addColorStop(0, '#24395a'); g.addColorStop(1, '#101c30');
ctx.fillStyle = g;
ctx.fill();
ctx.lineWidth = 2; ctx.strokeStyle = 'rgba(0,0,0,0.6)'; ctx.stroke();
// fine wave engraving
ctx.save();
rr(ctx, 14, 14, CW - 28, CH - 28, 10);
ctx.clip();
ctx.strokeStyle = 'rgba(217,180,90,0.12)';
ctx.lineWidth = 1.2;
for (let y = 10; y < CH; y += 9) {
ctx.beginPath();
for (let x = 0; x <= CW; x += 6) ctx.lineTo(x, y + Math.sin(x * 0.09 + y * 0.05) * 2.4);
ctx.stroke();
}
ctx.restore();
ropeRect(ctx, 14, 14, CW - 28, CH - 28, 10);
compassRose(ctx, CW / 2, CH / 2 + 4, 54);
anchor(ctx, 34, 36, 0.9);
anchor(ctx, CW - 34, 36, 0.9);
anchor(ctx, 34, CH - 34, 0.9);
anchor(ctx, CW - 34, CH - 34, 0.9);
scene.textures.addCanvas('crib-back', c);
}
// ── Pegs, gauge, beam ────────────────────────────────────────────────────────
const PEG = [
{ body: ['#ff9a86', '#d8473a', '#7a1a12'], head: '#ffb8a8' },
{ body: ['#a8d8ff', '#4f9bd8', '#173a5e'], head: '#d0ecff' },
];
function bakePegs(scene) {
PEG.forEach((p, seat) => {
const key = `crib-peg-${seat}`;
if (scene.textures.exists(key)) return;
const w = 28, h = 60;
const c = canvas(w, h);
const ctx = c.getContext('2d');
const cx = w / 2;
const g = ctx.createLinearGradient(cx - 9, 0, cx + 9, 0);
g.addColorStop(0, p.body[2]); g.addColorStop(0.35, p.body[0]); g.addColorStop(0.6, p.body[1]); g.addColorStop(1, p.body[2]);
// tapered stem down into the hole
ctx.fillStyle = g;
ctx.beginPath();
ctx.moveTo(cx - 8, 18); ctx.lineTo(cx + 8, 18); ctx.lineTo(cx + 5, h - 3); ctx.quadraticCurveTo(cx, h, cx - 5, h - 3); ctx.closePath();
ctx.fill();
// brass collar
const b = ctx.createLinearGradient(cx - 10, 0, cx + 10, 0);
b.addColorStop(0, '#7a5a1a'); b.addColorStop(0.4, '#f2d58a'); b.addColorStop(1, '#6a4a14');
ctx.fillStyle = b;
rr(ctx, cx - 10, 16, 20, 6, 2); ctx.fill();
// domed head
ctx.fillStyle = g;
ctx.beginPath(); ctx.ellipse(cx, 12, 11, 11, 0, 0, Math.PI * 2); ctx.fill();
ctx.fillStyle = p.head;
ctx.globalAlpha = 0.85;
ctx.beginPath(); ctx.ellipse(cx - 4, 8, 3.6, 3, -0.4, 0, Math.PI * 2); ctx.fill();
ctx.globalAlpha = 1;
ctx.strokeStyle = 'rgba(0,0,0,0.45)';
ctx.lineWidth = 1;
ctx.beginPath(); ctx.ellipse(cx, 12, 11, 11, 0, 0, Math.PI * 2); ctx.stroke();
scene.textures.addCanvas(key, c);
});
if (!scene.textures.exists('crib-peg-shadow')) {
const c = canvas(40, 20);
const ctx = c.getContext('2d');
const g = ctx.createRadialGradient(20, 10, 1, 20, 10, 18);
g.addColorStop(0, 'rgba(0,0,0,0.7)'); g.addColorStop(1, 'rgba(0,0,0,0)');
ctx.fillStyle = g;
ctx.beginPath(); ctx.ellipse(20, 10, 19, 9, 0, 0, Math.PI * 2); ctx.fill();
scene.textures.addCanvas('crib-peg-shadow', c);
}
}
export const DIAL_A0 = Math.PI * 0.75; // 0 at the lower left…
export const DIAL_SWEEP = Math.PI * 1.5; // …31 at the lower right
export const dialAngle = (count) => DIAL_A0 + (Math.min(31, count) / 31) * DIAL_SWEEP;
function bakeDial(scene) {
const R = 64, S = (R + 12) * 2 * 2;
const c = canvas(S, S);
const ctx = c.getContext('2d');
ctx.scale(2, 2);
const cx = R + 12, cy = R + 12;
ctx.save();
ctx.shadowColor = 'rgba(0,0,0,0.6)'; ctx.shadowBlur = 12; ctx.shadowOffsetY = 6;
const bz = ctx.createLinearGradient(cx - R, cy - R, cx + R, cy + R);
bz.addColorStop(0, '#f6dc94'); bz.addColorStop(0.45, '#b8862e'); bz.addColorStop(1, '#5a3c0c');
ctx.fillStyle = bz;
ctx.beginPath(); ctx.arc(cx, cy, R, 0, Math.PI * 2); ctx.fill();
ctx.restore();
ctx.fillStyle = '#7a5418';
ctx.beginPath(); ctx.arc(cx, cy, R - 7, 0, Math.PI * 2); ctx.fill();
const face = ctx.createRadialGradient(cx - 14, cy - 18, 4, cx, cy, R);
face.addColorStop(0, '#fbf3dc'); face.addColorStop(1, '#d8c9a0');
ctx.fillStyle = face;
ctx.beginPath(); ctx.arc(cx, cy, R - 10, 0, Math.PI * 2); ctx.fill();
// red arc from 28..31, green tick at 15
const arcAt = (from, to, color, w, rad) => {
ctx.strokeStyle = color; ctx.lineWidth = w;
ctx.beginPath(); ctx.arc(cx, cy, rad, dialAngle(from), dialAngle(to)); ctx.stroke();
};
arcAt(26, 31, 'rgba(170,40,30,0.55)', 6, R - 16);
arcAt(14.6, 15.4, 'rgba(30,110,60,0.9)', 8, R - 16);
ctx.strokeStyle = '#2a1a0a';
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
for (let i = 0; i <= 31; i++) {
const a = dialAngle(i);
const major = i % 5 === 0 || i === 31;
ctx.lineWidth = major ? 1.8 : 1;
const r0 = R - (major ? 24 : 20), r1 = R - 13;
ctx.beginPath(); ctx.moveTo(cx + Math.cos(a) * r0, cy + Math.sin(a) * r0); ctx.lineTo(cx + Math.cos(a) * r1, cy + Math.sin(a) * r1); ctx.stroke();
if (major) {
ctx.font = `bold ${i === 15 || i === 31 ? 11 : 9}px ${SERIF}`;
ctx.fillStyle = i === 15 ? '#1e6a3c' : i === 31 ? '#8a1a14' : '#2a1a0a';
ctx.fillText(String(i), cx + Math.cos(a) * (R - 32), cy + Math.sin(a) * (R - 32));
}
}
ctx.font = `bold 8px ${SERIF}`;
ctx.fillStyle = '#6a4a20';
ctx.fillText('THE COUNT', cx, cy - 20);
scene.textures.addCanvas('crib-dial', c);
}
function bakeBeam(scene) {
const c = canvas(256, 8);
const ctx = c.getContext('2d');
const g = ctx.createLinearGradient(0, 0, 256, 0);
g.addColorStop(0, 'rgba(255,255,255,0)'); g.addColorStop(0.5, 'rgba(255,255,255,1)'); g.addColorStop(1, 'rgba(255,255,255,0)');
ctx.fillStyle = g;
ctx.fillRect(0, 0, 256, 8);
scene.textures.addCanvas('crib-beam', c);
}
export async function prepareCribArt(scene) {
await prepareCasinoArt(scene);
if (!scene.textures.exists('crib-back')) bakeBack(scene);
bakePegs(scene);
if (!scene.textures.exists('crib-dial')) bakeDial(scene);
if (!scene.textures.exists('crib-beam')) bakeBeam(scene);
return bakeRoom(scene, 'crib-room', T, { wall, front, rim, top: oakTop, onTop: marks, after: oilLamp });
}
export { W, H };