From 2c023ebd1e9c7f1260532ee91d4427e62ac3182d Mon Sep 17 00:00:00 2001 From: MaxED Date: Tue, 23 Feb 2016 07:39:34 +0000 Subject: [PATCH] Fixed, DB2 bug, Visual mode: in some cases (sidedef's sector ceiling lower than other side's sector floor) higher/lower sidedef picking was behaving incorrectly. --- Source/Plugins/BuilderModes/VisualModes/VisualLower.cs | 3 ++- Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs index d2a2793..63f8417 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualLower.cs @@ -240,7 +240,8 @@ namespace CodeImp.DoomBuilder.BuilderModes if(polygons.Count > 0) { // Keep top and bottom planes for intersection testing - top = osd.Floor.plane; + Vector2D linecenter = Sidedef.Line.GetCenterPoint(); //mxd. Our sector's ceiling can be lower than the other sector's floor! + top = (osd.Floor.plane.GetZ(linecenter) < sd.Ceiling.plane.GetZ(linecenter) ? osd.Floor.plane : sd.Ceiling.plane); bottom = sd.Floor.plane; // Process the polygon and create vertices diff --git a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs index 5bb6463..a281d5f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs +++ b/Source/Plugins/BuilderModes/VisualModes/VisualUpper.cs @@ -235,8 +235,9 @@ namespace CodeImp.DoomBuilder.BuilderModes if(polygons.Count > 0) { // Keep top and bottom planes for intersection testing + Vector2D linecenter = Sidedef.Line.GetCenterPoint(); //mxd. Our sector's floor can be higher than the other sector's ceiling! top = sd.Ceiling.plane; - bottom = osd.Ceiling.plane; + bottom = (osd.Ceiling.plane.GetZ(linecenter) > sd.Floor.plane.GetZ(linecenter) ? osd.Ceiling.plane : sd.Floor.plane); // Process the polygon and create vertices List verts = CreatePolygonVertices(polygons, tp, sd, lightvalue, lightabsolute);