feat(gfx): label + dispatch set-anim-transform 0x21e/0x220 into GfxState
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -42,4 +42,31 @@ public class GfxAnimationTests
|
||||
Assert.Equal(400, g.AnimClockDurationTicks);
|
||||
Assert.Equal(cg0 + 1, g.AnimClockGeneration);
|
||||
}
|
||||
|
||||
// ---- Tasks 3-5: VM dispatch + snapshot (synthesized scenes) ----
|
||||
|
||||
private static OpcodeTable T() => OpcodeTableJson.Load(Paths.OpcodesJson);
|
||||
private static Operand G(int a) => new(3, a);
|
||||
private static Operand I(long v) => new(0, v);
|
||||
private static (int, Operand[]) MovGI(int d, long v) => (0x55, new[] { G(d), I(v) });
|
||||
private static (int, Operand[]) Exit() => (0x2, System.Array.Empty<Operand>());
|
||||
|
||||
[Fact]
|
||||
public void SetAnimTransformAbs_DispatchRecordsChannel()
|
||||
{
|
||||
var t = T();
|
||||
// handle g[1]=0x1000; p1 g[2]=7; p2 g[3]=9; target g[4,5,6]=(800,500,0)
|
||||
var scene = ScriptAssembler.Assemble(t, "ANIM", new List<(int, Operand[])>
|
||||
{
|
||||
MovGI(1, 0x1000), MovGI(2, 7), MovGI(3, 9), MovGI(4, 800), MovGI(5, 500), MovGI(6, 0),
|
||||
(0x220, new[] { G(1), G(2), G(3), G(4), G(5), G(6) }),
|
||||
Exit(),
|
||||
}, System.Array.Empty<string>());
|
||||
var vm = new VirtualMachine(scene, t, new RecordingHost());
|
||||
vm.Run();
|
||||
var o = vm.Gfx.TryGet(0x1000)!;
|
||||
Assert.Equal((800L, 500L, 0L), o.AnimTarget);
|
||||
Assert.False(o.AnimNormalized);
|
||||
Assert.True(o.AnimEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +270,13 @@ public sealed class VirtualMachine
|
||||
case "gfx-draw-color": // 0x203 (handle)(v)(alpha)(color) — blend deferred
|
||||
Gfx.GetOrCreate(Read(a[0])).Color = GfxState.PackColor(Read(a[2]), Read(a[3]));
|
||||
WarnAlphaDeferredOnce(); return pc + 1;
|
||||
// ---- sprite transform / animation cluster (docs/engine-re.md "0x21c-0x243 ... ANIMATION") ----
|
||||
case "set-anim-transform-abs": // 0x220 (handle)(p1)(p2)(x)(y)(z) — set transform directly
|
||||
Gfx.SetAnimTransform(Read(a[0]), Read(a[1]), Read(a[2]),
|
||||
(Read(a[3]), Read(a[4]), Read(a[5])), normalized: false); return pc + 1;
|
||||
case "set-anim-transform-norm": // 0x21e — same, operands are ~percent (/_DAT_00571c28)
|
||||
Gfx.SetAnimTransform(Read(a[0]), Read(a[1]), Read(a[2]),
|
||||
(Read(a[3]), Read(a[4]), Read(a[5])), normalized: true); return pc + 1;
|
||||
default:
|
||||
// Stub is per-instruction frequency (the VM handles ~30 ops; the rest hit here, e.g.
|
||||
// 0x258/0x259 stmt markers appear en masse), so gate it with Step — else --trace floods.
|
||||
|
||||
Reference in New Issue
Block a user