Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Core/World/Geometry/Sectors/Sector3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public enum SectorFlags3D
DisableLighting = 128,
RestrictLighting = 256,
Fog = 512,
Model = 1024,
CeilingModel = 1024,
UseParentUpperTexture = 2048,
UseParentLowerTexture = 4096,
AdditiveTransparency = 8192,
Expand Down Expand Up @@ -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;
Expand Down
Binary file modified Tests/Resources/sector3d-map.zip
Binary file not shown.
23 changes: 20 additions & 3 deletions Tests/Unit/GameAction/3DSector/Sector3D_Map.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
Expand Down
Loading