using System.Collections.Generic;
using System.Numerics;
namespace AcDream.Core.Physics;
///
/// Indoor walking Phase 2 (2026-05-19). Cached building portal data
/// for outdoor→indoor cell entry. One per outdoor landcell that contains
/// a building stab. Mirrors retail's BuildingObj.Portals array
/// (per the pseudocode doc §"LandCell.find_transit_cells").
///
public sealed class BuildingPhysics
{
public required Matrix4x4 WorldTransform { get; init; }
public required Matrix4x4 InverseWorldTransform { get; init; }
public required IReadOnlyList Portals { get; init; }
}
///
/// One building portal: the connection from a SortCell's BuildingObj to
/// an interior EnvCell. ExactMatch is decoded from
/// bit 0 (PortalFlags.ExactMatch = 0x0001).
///
public readonly struct BldPortalInfo
{
public BldPortalInfo(uint otherCellId, ushort otherPortalId, ushort flags)
{
OtherCellId = otherCellId;
OtherPortalId = otherPortalId;
Flags = flags;
}
/// Full id of the interior EnvCell this portal connects to.
public uint OtherCellId { get; }
/// The portal id within the destination EnvCell.
public ushort OtherPortalId { get; }
public ushort Flags { get; }
/// Bit 0 of Flags (PortalFlags.ExactMatch = 0x0001).
public bool ExactMatch => (Flags & 0x0001) != 0;
}