namespace AcDream.Core.Physics;
///
/// Indoor walking Phase 2 (2026-05-19). Portal connection between two
/// EnvCells. Each carries a list of these,
/// mirroring retail's CCellStruct.portals array.
///
///
/// is a low-16 cell index (combined with the
/// owning landblock prefix at lookup time) or 0xFFFF to mean
/// "exit to outdoor world" (the player crosses this portal to leave
/// the building).
///
///
///
/// indexes the OWNING cell's
/// dict (the visible-polygon
/// table, NOT which holds physics
/// polys).
///
///
///
/// decodes bit 2 of :
/// (Flags & 2) == 0 → portal's polygon normal points INTO
/// the owning cell (so dist > 0 in cell-local space means "outside
/// the cell, beyond the portal"). Used in find_transit_cells's
/// load-hint path for unloaded neighbours.
///
///
public readonly struct PortalInfo
{
public PortalInfo(ushort otherCellId, ushort polygonId, ushort flags)
{
OtherCellId = otherCellId;
PolygonId = polygonId;
Flags = flags;
}
public ushort OtherCellId { get; }
public ushort PolygonId { get; }
public ushort Flags { get; }
/// Bit 2 of . See struct docstring.
public bool PortalSide => (Flags & 2) == 0;
}