Files
m3te/tests/fx_combo.sx
swipelab 0b293a2c48 P11.2: escalating combo emphasis tied to cascade depth (sx / iOS)
Scale the combo FX with cascade depth (mv.rounds.len) — the same depth the
cascade SFX (play_cascade) steps up on — so deeper cascades read as more
exciting and land in lockstep with the audio escalation. Purely visual and
self-pruning: no board / score / move state changes, and input stays gated by
BoardAnim.active alone.

- board_fx.sx: add fx_combo_level (mirrors audio's cascade_cue_index clamp:
  depth<=1 -> floor, depth>=5 -> ceiling). The +points popup now carries the
  cascade depth and grows one font step + lerps gold -> hot-gold per level
  (fx_popup_font / fx_popup_color). Every burst of a deep cascade gets a
  whole-move depth boost (FX_BURST_DEPTH) on top of the existing per-round bump.
- board_view.sx: render_fx_popups derives styling from depth and tops a combo
  with a "COMBO xN" label naming the true cascade depth.
- tests/fx_combo.sx: headless snapshot locking the depth->level/font table and
  asserting fx_combo_level matches the cascade-cue index column entry-for-entry.
- goldens/p11_combo_deep.png + README: deterministic depth-5 capture (M3TE_FX=11)
  vs the depth-1 single clear (M3TE_FX=3); FX gone after settle at a later phase.
2026-06-05 20:51:56 +03:00

58 lines
3.0 KiB
Plaintext

// P11.2 — Combo-emphasis selection snapshot: prove the cascade-depth → combo-
// emphasis mapping is a PURE, headless clamp that steps up in LOCKSTEP with the
// cascade SFX cue. The on-screen combo emphasis (`board_fx.sx`'s `fx_combo_level`,
// which drives the popup size/colour step + the burst depth boost) must use the
// SAME depth→level clamp the audio path uses (`audio.sx`'s `cascade_cue_index`):
// depth <= 1 pins to the floor, depth >= 5 to the ceiling, stepping up
// monotonically between — so a deeper cascade always looks AND sounds more
// escalated. `expect_level` below is exactly the index column locked by
// `tests/expected/cascade_cue.stdout`, so any drift on EITHER side breaks a
// snapshot. (audio.sx isn't imported here: its AudioToolbox `#foreign` symbols
// can't link into the same headless binary as board_fx.sx's GL imports.) The
// derived popup-font table is locked by this test's own committed snapshot.
#import "modules/std.sx";
#import "board_fx.sx";
main :: () -> s32 {
print("== combo emphasis selection (depth -> fx level / popup font) ==\n");
// The cascade-cue index per depth 0..9, copied from cascade_cue.stdout. The
// FX level must equal this entry for entry — the audio/visual lockstep.
expect_level : [10]s64 = .{ 0, 0, 1, 2, 3, 4, 4, 4, 4, 4 };
prev : s64 = -1;
for 0..10: (depth) {
lvl := fx_combo_level(depth);
font := fx_popup_font(depth);
combo := depth > 1;
print("depth {} -> level {} font {} combo {}\n", depth, lvl, font, combo);
if lvl < prev { print("FAIL: fx level decreased at depth {}\n", depth); return 1; }
if lvl != expect_level[depth] {
print("FAIL: fx level {} != cascade cue index {} at depth {}\n",
lvl, expect_level[depth], depth);
return 1;
}
prev = lvl;
}
// Explicit clamp boundaries, independent of the loop above.
if fx_combo_level(0) != 0 { print("FAIL: depth 0 not clamped to floor\n"); return 1; }
if fx_combo_level(1) != 0 { print("FAIL: depth 1 not clamped to floor\n"); return 1; }
if fx_combo_level(5) != FX_COMBO_MAX_LEVEL { print("FAIL: depth 5 not at ceiling\n"); return 1; }
if fx_combo_level(9) != FX_COMBO_MAX_LEVEL { print("FAIL: deep cascade not clamped to ceiling\n"); return 1; }
// A single clear (depth 1) keeps the plain popup font; a combo is strictly
// larger and the font never shrinks as the cascade deepens.
if fx_popup_font(1) != FX_POPUP_FONT { print("FAIL: single-clear popup not plain font\n"); return 1; }
pf : f32 = 0.0;
for 2..10: (depth) {
f := fx_popup_font(depth);
if f <= FX_POPUP_FONT { print("FAIL: combo popup not larger than plain at depth {}\n", depth); return 1; }
if depth > 2 and f < pf { print("FAIL: popup font shrank at depth {}\n", depth); return 1; }
pf = f;
}
print("ok: combo emphasis clamps into level 0..{} in lockstep with the cascade cue\n", FX_COMBO_MAX_LEVEL);
return 0;
}