Fix AE001H translation target query
This commit is contained in:
@@ -448,6 +448,22 @@ public sealed class GfxState
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Op 0x228: query the translation target decomposed from the native target matrix at
|
||||
/// obj+0x17c (translation obj+0x1ac/+0x1b0/+0x1b4). This is independent of draw/base position V24.</summary>
|
||||
public bool TryQueryTranslationTarget(long handle, out (double X, double Y, double Z) target)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (_objects.TryGetValue(handle, out var o))
|
||||
{
|
||||
target = o.TranslationTarget;
|
||||
return true;
|
||||
}
|
||||
target = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Op 0x21f: delayed one-shot axis-angle rotation target, sharing obj+0x34's start timestamp.</summary>
|
||||
public void SetRotationChannel(long handle, long delayMs, long durationMs,
|
||||
(long X, long Y, long Z) axis, long angleDegrees)
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user