using System; using DatReaderWriter; using DatReaderWriter.Options; using Xunit; using Xunit.Abstractions; using DatSetup = DatReaderWriter.DBObjs.Setup; using DatGfxObj = DatReaderWriter.DBObjs.GfxObj; namespace AcDream.App.Tests.Rendering; /// /// #131 diagnostic (throwaway): identify the Holtburg portal among the /// outside-stage setup ids captured by the [outstage] probe, by dumping each /// candidate setup's parts + bounds from the dat. The portal's setup is the /// translucent swirl; lamp posts / creatures / signs identify by part shape. /// public class Issue131SetupProbeTests { private readonly ITestOutputHelper _out; public Issue131SetupProbeTests(ITestOutputHelper output) => _out = output; [Fact] public void Diagnostic_DumpOutstageCandidateSetups() { var datDir = CornerFloodReplayTests.ResolveDatDir(); if (datDir is null) { _out.WriteLine("SKIP: dats unavailable"); return; } using var dats = new DatCollection(datDir, DatAccessType.Read); uint[] candidates = { 0x020010AC, // 0x7A9B4050 PASS r=11.9 — portal candidate A 0x02000B8E, // 0x7A9B403B PASS r=11.6 — portal candidate B 0x020019FF, // many instances (lamp posts?) 0x02000290, 0x02000001, // baseline (human?) 0x02000E08, }; foreach (uint setupId in candidates) { var setup = dats.Get(setupId); if (setup is null) { _out.WriteLine(FormattableString.Invariant($"setup 0x{setupId:X8}: NOT FOUND")); continue; } _out.WriteLine(FormattableString.Invariant( $"setup 0x{setupId:X8}: parts={setup.Parts.Count}")); int shown = 0; foreach (uint partId in setup.Parts) { if (shown++ >= 4) { _out.WriteLine(" ..."); break; } var gfx = dats.Get(partId); if (gfx is null) { _out.WriteLine(FormattableString.Invariant($" part 0x{partId:X8}: not found")); continue; } var sb = new System.Text.StringBuilder(); sb.Append(FormattableString.Invariant( $" part 0x{partId:X8}: polys={gfx.Polygons.Count} verts={gfx.VertexArray.Vertices.Count} surfaces=[")); int sShown = 0; foreach (uint surfId in gfx.Surfaces) { if (sShown++ >= 6) { sb.Append(" ..."); break; } sb.Append(FormattableString.Invariant($" 0x{surfId:X8}")); } sb.Append(" ]"); _out.WriteLine(sb.ToString()); } } } }