Fix AE001H translation target query

This commit is contained in:
gamer147
2026-07-11 21:40:16 -04:00
parent 5614fc7631
commit aa14ad6b3d
7 changed files with 124 additions and 20 deletions

View File

@@ -399,12 +399,15 @@ public sealed class VirtualMachine
Gfx.SetSrcRect(Read(a[0]), Read(a[2]), Read(a[3]), 0, Read(a[1])); return pc + 1;
case "u00421EF0": // 0x232 anim color/glow: (handle)(period)(alpha)(color) — ping-pong the color
Gfx.SetColorAnim(Read(a[0]), Read(a[1]), GfxState.PackColor(Read(a[2]), Read(a[3]))); return pc + 1;
case "u00421940": // 0x228 query-position: (succ)(handle)(outX)(outY)(outZ) <- current V24
case "u00421940": // 0x228: (succ)(handle)(outX)(outY)(outZ) <- target translation matrix
{
var obj = Gfx.TryGet(Read(a[1]));
var v = obj?.V24 ?? default;
Write(a[2], v.X); Write(a[3], v.Y); Write(a[4], v.Z);
Write(a[0], obj != null ? 0 : 1); return pc + 1;
if (Gfx.TryQueryTranslationTarget(Read(a[1]), out var v))
{
Write(a[2], (long)v.X); Write(a[3], (long)v.Y); Write(a[4], (long)v.Z);
Write(a[0], 0);
}
else Write(a[0], 1); // native missing-object path leaves output operands untouched
return pc + 1;
}
case "u00422930": // 0x23f query-object: (out)(handle) <- 0 if the object exists, else -1
Write(a[0], Gfx.TryGet(Read(a[1])) != null ? 0 : -1); return pc + 1;