mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
Sector Edit Form UDMF: fixed a bug where resetting a slope when the sectors doesn't have a slope resulted in a nonsensical sector height
This commit is contained in:
parent
f1bf6a6803
commit
6b9565604d
1 changed files with 36 additions and 16 deletions
|
@ -1854,15 +1854,25 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
MakeUndo(); //mxd
|
MakeUndo(); //mxd
|
||||||
Sector fs = General.GetByIndex(sectors, 0);
|
Sector fs = General.GetByIndex(sectors, 0);
|
||||||
Plane p = new Plane(fs.CeilSlope, fs.CeilSlopeOffset);
|
|
||||||
fs.UpdateBBox();
|
|
||||||
ceilingslopecontrol.SetOffset((int)Math.Round(p.GetZ(fs.BBox.X + fs.BBox.Width / 2, fs.BBox.Y + fs.BBox.Height / 2)), true);
|
|
||||||
|
|
||||||
foreach(Sector s in sectors)
|
if (fs.CeilSlope.IsNormalized())
|
||||||
{
|
{
|
||||||
s.UpdateBBox();
|
fs.UpdateBBox();
|
||||||
p = new Plane(s.CeilSlope, s.CeilSlopeOffset);
|
Plane p = new Plane(fs.CeilSlope, fs.CeilSlopeOffset);
|
||||||
s.CeilHeight = (int)Math.Round(p.GetZ(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
|
ceilingslopecontrol.SetOffset((int)Math.Round(p.GetZ(fs.BBox.X + fs.BBox.Width / 2, fs.BBox.Y + fs.BBox.Height / 2)), true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ceilingslopecontrol.SetOffset(fs.CeilHeight, true);
|
||||||
|
|
||||||
|
foreach (Sector s in sectors)
|
||||||
|
{
|
||||||
|
if (s.CeilSlope.IsNormalized())
|
||||||
|
{
|
||||||
|
s.UpdateBBox();
|
||||||
|
Plane p = new Plane(s.CeilSlope, s.CeilSlopeOffset);
|
||||||
|
s.CeilHeight = (int)Math.Round(p.GetZ(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
|
||||||
|
}
|
||||||
|
|
||||||
s.CeilSlope = new Vector3D();
|
s.CeilSlope = new Vector3D();
|
||||||
s.CeilSlopeOffset = double.NaN;
|
s.CeilSlopeOffset = double.NaN;
|
||||||
s.UpdateNeeded = true;
|
s.UpdateNeeded = true;
|
||||||
|
@ -1879,15 +1889,25 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
MakeUndo(); //mxd
|
MakeUndo(); //mxd
|
||||||
Sector fs = General.GetByIndex(sectors, 0);
|
Sector fs = General.GetByIndex(sectors, 0);
|
||||||
Plane p = new Plane(fs.FloorSlope, fs.FloorSlopeOffset);
|
|
||||||
fs.UpdateBBox();
|
|
||||||
floorslopecontrol.SetOffset((int)Math.Round(p.GetZ(fs.BBox.X + fs.BBox.Width / 2, fs.BBox.Y + fs.BBox.Height / 2)), true);
|
|
||||||
|
|
||||||
foreach(Sector s in sectors)
|
if (fs.FloorSlope.IsNormalized())
|
||||||
{
|
{
|
||||||
s.UpdateBBox();
|
fs.UpdateBBox();
|
||||||
p = new Plane(s.FloorSlope, s.FloorSlopeOffset);
|
Plane p = new Plane(fs.FloorSlope, fs.FloorSlopeOffset);
|
||||||
s.FloorHeight = (int)Math.Round(p.GetZ(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
|
floorslopecontrol.SetOffset((int)Math.Round(p.GetZ(fs.BBox.X + fs.BBox.Width / 2, fs.BBox.Y + fs.BBox.Height / 2)), true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
floorslopecontrol.SetOffset(fs.FloorHeight, true);
|
||||||
|
|
||||||
|
foreach (Sector s in sectors)
|
||||||
|
{
|
||||||
|
if (s.FloorSlope.IsNormalized())
|
||||||
|
{
|
||||||
|
s.UpdateBBox();
|
||||||
|
Plane p = new Plane(s.FloorSlope, s.FloorSlopeOffset);
|
||||||
|
s.FloorHeight = (int)Math.Round(p.GetZ(s.BBox.X + s.BBox.Width / 2, s.BBox.Y + s.BBox.Height / 2));
|
||||||
|
}
|
||||||
|
|
||||||
s.FloorSlope = new Vector3D();
|
s.FloorSlope = new Vector3D();
|
||||||
s.FloorSlopeOffset = double.NaN;
|
s.FloorSlopeOffset = double.NaN;
|
||||||
s.UpdateNeeded = true;
|
s.UpdateNeeded = true;
|
||||||
|
|
Loading…
Reference in a new issue