41 lines
1.5 KiB
C#
41 lines
1.5 KiB
C#
using System.Numerics;
|
|
|
|
namespace GamePort.Game;
|
|
|
|
/// <summary>
|
|
/// Player43B5A0 stages a level transition. Ordinary departure captures the current
|
|
/// root at complete+9A8; RETURN preserves it using complete+9A5. PostLoad restores
|
|
/// that root and STRT suppresses its initial trigger using the separate+954 flag.
|
|
/// This is distinct from Jimmy42AF00's currently unconsumed+1E38 checkpoint.
|
|
/// </summary>
|
|
public sealed class RuntimeCheckpoint
|
|
{
|
|
public Vector3 Root { get; }
|
|
public bool Returning { get; }
|
|
public bool ActivateStartTrigger => !Returning;
|
|
|
|
private RuntimeCheckpoint(Vector3 root, bool returning)
|
|
{
|
|
Root = root;
|
|
Returning = returning;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Only RETURN restores a root on scene entry. No rotation is captured here;
|
|
/// the destination STRT remains the source of authored spawn rotation.
|
|
/// Root is the same vector serialized in OriginalSave.StoredVector.
|
|
/// </summary>
|
|
public static RuntimeCheckpoint Stage(Vector3 storedRoot, Vector3 currentRoot, bool returning)
|
|
{
|
|
Validate(storedRoot, nameof(storedRoot));
|
|
Validate(currentRoot, nameof(currentRoot));
|
|
return new(returning ? storedRoot : currentRoot, returning);
|
|
}
|
|
|
|
private static void Validate(Vector3 root, string name)
|
|
{
|
|
if (!float.IsFinite(root.X) || !float.IsFinite(root.Y) || !float.IsFinite(root.Z))
|
|
throw new ArgumentOutOfRangeException(name, "Transition roots must be finite");
|
|
}
|
|
}
|