using AcDream.App.Rendering.Wb; using Xunit; namespace AcDream.App.Tests.Rendering.Wb; /// /// A7 Fix D round 2 — pins retail's useSunlight gate for per-object torch /// lighting (WbDrawDispatcher.IndoorObjectReceivesTorches). Retail enables /// the static wall-torches on an object ONLY in the indoor stage /// (DrawMeshInternal 0x0059f398: if (useSunlight == 0) minimize_object_lighting()), /// so OUTDOOR objects — building exterior shells (null ParentCellId) and outdoor /// scenery (land sub-cell 0x0001..0x00FF) — get the sun, never torches. Only /// EnvCell-parented (indoor, low word >= 0x0100) objects receive torches. /// public sealed class WbDrawDispatcherTorchGateTests { [Fact] public void BuildingShell_NullParent_IsOutdoor_NoTorches() { // Building exterior shells are top-level landblock stabs with no // ParentCellId (LandblockLoader sets BuildingShellAnchorCellId, not Parent). Assert.False(WbDrawDispatcher.IndoorObjectReceivesTorches(null)); } [Theory] [InlineData(0xA9B4_0001u)] // outdoor land sub-cell [InlineData(0xA9B4_0020u)] // outdoor land sub-cell [InlineData(0xA9B4_0040u)] // last outdoor land sub-cell (0x40) public void OutdoorLandCell_NoTorches(uint parentCellId) { Assert.False(WbDrawDispatcher.IndoorObjectReceivesTorches(parentCellId)); } [Theory] [InlineData(0xA9B4_0100u)] // first EnvCell [InlineData(0xA9B4_0164u)] // interior EnvCell [InlineData(0x0007_0143u)] // dungeon EnvCell public void IndoorEnvCell_GetsTorches(uint parentCellId) { Assert.True(WbDrawDispatcher.IndoorObjectReceivesTorches(parentCellId)); } }