P10.10: play one ascending combo cue per cascade round

For combos, play a sound for each match ascending (Candy-Crush cascade run):
as a chain resolves, EACH successive round plays the next higher cue
(combo1, combo2, … clamped at combo5) instead of a single combo cue keyed
to the final cascade depth at commit.

- board_anim.sx: add `BoardAnim.cascade_fired` (edge-trigger high-water mark,
  reset on init/begin) and the pure `cascade_rounds_started(elapsed, n)` helper
  — how many rounds have begun clearing on the swap→(clear,fall)* timeline.
- main.sx: in the frame loop, diff `cascade_rounds_started` against
  `cascade_fired` and play one ascending cue per newly-cleared round, once each,
  gated on a real multi-round chain (rounds >= 2). Additive; never touches
  board/score/move state.
- board_view.sx: drop the single `sfx_cascade(final depth)` at commit; keep
  `sfx_swap` / `sfx_match` (and win/lose) exactly as before.
- tests/cascade_rounds.sx: headless snapshot of the per-round timing + the
  ascending combo1..combo5 run with the combo5 clamp.

Sim (M3TE_FX=11, depth-5): log show shows combo1→combo2→combo3→combo4→combo5
at successive timestamps ~0.36s apart (= CLEAR+FALL per-round spacing).
This commit is contained in:
swipelab
2026-06-06 08:37:46 +03:00
parent 704ae08011
commit 51b3397ade
6 changed files with 139 additions and 8 deletions

14
main.sx
View File

@@ -197,6 +197,20 @@ frame :: () {
if g_fx != null { g_fx.tick(g_delta_time); }
}
// Per-round cascade SFX (P10.10): as each cascade round's clear begins on the
// move timeline, play the NEXT ascending combo cue (round 1 → combo1, round 2
// → combo2, … clamped at combo5). Edge-triggered off `cascade_fired` so each
// round's cue fires exactly once; only a real multi-round chain (rounds >= 2)
// gets the run, so a single match stays the lone match pop. Additive — reads
// only the recorded timeline, never board/score/move state.
if g_anim != null and g_anim.move.rounds.len >= 2 {
started := cascade_rounds_started(g_anim.elapsed, g_anim.move.rounds.len);
while g_anim.cascade_fired < started {
g_anim.cascade_fired += 1;
sfx_cascade(g_anim.cascade_fired);
}
}
// Advance the always-on per-gem animation clock (idle/select/land). Capture
// mode pins the clock, so it only moves when not pinned. On the exact frame a
// move timeline settles, stamp the landing bounce on every cell the move