diff --git a/Core/World/Geometry/Sectors/Sector3D.cs b/Core/World/Geometry/Sectors/Sector3D.cs index 8172e8fe0..c29563da0 100644 --- a/Core/World/Geometry/Sectors/Sector3D.cs +++ b/Core/World/Geometry/Sectors/Sector3D.cs @@ -26,7 +26,7 @@ public enum SectorFlags3D DisableLighting = 128, RestrictLighting = 256, Fog = 512, - Model = 1024, + CeilingModel = 1024, UseParentUpperTexture = 2048, UseParentLowerTexture = 4096, AdditiveTransparency = 8192, @@ -129,7 +129,7 @@ public Sector3D(IWorld world, int parentSectorId, Sector parentSector, Sector co ParentSector = parentSector; ControlSector = controlSector; ControlTop = controlSector.Ceiling; - ControlBottom = controlSector.Floor; + ControlBottom = (flags & SectorFlags3D.CeilingModel) == 0 ? controlSector.Floor : controlSector.Ceiling; LightTop = ParentSector; LightBottom = ParentSector; Flags = flags; diff --git a/Tests/Resources/sector3d-map.zip b/Tests/Resources/sector3d-map.zip index 1805a20ea..9b09cc63b 100644 Binary files a/Tests/Resources/sector3d-map.zip and b/Tests/Resources/sector3d-map.zip differ diff --git a/Tests/Unit/GameAction/3DSector/Sector3D_Map.cs b/Tests/Unit/GameAction/3DSector/Sector3D_Map.cs index 92747afc9..8cb56dff8 100644 --- a/Tests/Unit/GameAction/3DSector/Sector3D_Map.cs +++ b/Tests/Unit/GameAction/3DSector/Sector3D_Map.cs @@ -1,9 +1,6 @@ using FluentAssertions; -using Helion.Geometry.Vectors; using Helion.Render.OpenGL.Renderers.Legacy.World.Data; using Helion.Resources.IWad; -using Helion.Tests.Unit.GameAction.Mbf21; -using Helion.World.Cheats; using Helion.World.Entities.Players; using Helion.World.Geometry.Sectors; using Helion.World.Geometry.Sides; @@ -271,6 +268,26 @@ public void OverlappingNonSolidWallsWithNormalGeometry() higher3D.CalculateWallHeights(GameActions.GetLine(World, 134).Front, out _).Should().BeFalse(); } + [Fact(DisplayName = "Sector3D CeilingModel flag")] + public void CeilingModel() + { + var sector = GameActions.GetSectorByTag(World, 73); + sector.Sectors3D.Length.Should().Be(2); + + var controlSector1 = GameActions.GetSector(World, 243); + var controlSector2 = GameActions.GetSector(World, 242); + + sector.Sectors3D[0].Flags.Should().Be(SectorFlags3D.Swim | SectorFlags3D.RenderInside | SectorFlags3D.CeilingModel); + sector.Sectors3D[1].Flags.Should().Be(SectorFlags3D.Swim | SectorFlags3D.RenderInside | SectorFlags3D.CeilingModel); + + // Renders both top and bottom as the control sector's ceiling. This simply means both control top and bottom are set to the control sector's ceiling. + sector.Sectors3D[0].ControlTop.Should().Be(controlSector1.Ceiling); + sector.Sectors3D[0].ControlBottom.Should().Be(controlSector1.Ceiling); + + sector.Sectors3D[1].ControlTop.Should().Be(controlSector2.Ceiling); + sector.Sectors3D[1].ControlBottom.Should().Be(controlSector2.Ceiling); + } + private static void AssertWallHeights(WallHeights wallHeights, double bottomZ, double topZ) { wallHeights.TopZ.Should().Be(topZ);