mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Sector Edit Form (UDMF): fixed a problem where resetting slopes did not work correctly
This commit is contained in:
parent
8e95b074ec
commit
2ef76c39d0
2 changed files with 29 additions and 15 deletions
|
@ -104,13 +104,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
else
|
||||
{
|
||||
// Or update values
|
||||
if(!double.IsNaN(this.anglexy) && this.anglexy != anglexy) this.anglexy = float.NaN;
|
||||
if(!double.IsNaN(this.anglez) && this.anglez != anglez) this.anglez = float.NaN;
|
||||
if(!double.IsNaN(this.offset) && this.offset != offset) this.offset = float.NaN;
|
||||
if(!double.IsNaN(this.anglexy) && this.anglexy != anglexy) this.anglexy = double.NaN;
|
||||
if(!double.IsNaN(this.anglez) && this.anglez != anglez) this.anglez = double.NaN;
|
||||
if(!double.IsNaN(this.offset) && this.offset != offset) this.offset = double.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetOffset(float offset, bool first)
|
||||
public void SetOffset(double offset, bool first)
|
||||
{
|
||||
if(first)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
else if(!double.IsNaN(this.offset) && this.offset != offset)
|
||||
{
|
||||
this.offset = float.NaN;
|
||||
this.offset = double.NaN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,8 +217,12 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
|
||||
private void slopeoffset_WhenTextChanged(object sender, EventArgs e)
|
||||
{
|
||||
offset = slopeoffset.GetResultFloat(float.NaN);
|
||||
if (preventchanges) return;
|
||||
preventchanges = true;
|
||||
|
||||
offset = slopeoffset.GetResultFloat(double.NaN);
|
||||
if(OnAnglesChanged != null) OnAnglesChanged(this, EventArgs.Empty);
|
||||
preventchanges = false;
|
||||
}
|
||||
|
||||
private void reset_Click(object sender, EventArgs e)
|
||||
|
@ -230,9 +234,9 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
slopeangle.Text = "0";
|
||||
angletrackbar.Value = 0;
|
||||
slopeoffset.Text = "0";
|
||||
anglexy = 0f;
|
||||
anglez = 0f;
|
||||
offset = 0f;
|
||||
anglexy = 0.0;
|
||||
anglez = 0.0;
|
||||
offset = 0.0;
|
||||
|
||||
if(OnResetClicked != null) OnResetClicked(this, EventArgs.Empty);
|
||||
preventchanges = false;
|
||||
|
|
|
@ -1841,13 +1841,18 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private void ceilingslopecontrol_OnResetClicked(object sender, EventArgs e)
|
||||
{
|
||||
MakeUndo(); //mxd
|
||||
ceilingslopecontrol.SetOffset(General.GetByIndex(sectors, 0).CeilHeight, true);
|
||||
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)
|
||||
{
|
||||
s.UpdateBBox();
|
||||
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.CeilSlopeOffset = float.NaN;
|
||||
s.CeilHeight = ceilingheight.GetResult(sectorprops[s].CeilHeight);
|
||||
s.CeilSlopeOffset = double.NaN;
|
||||
s.UpdateNeeded = true;
|
||||
ceilingslopecontrol.SetOffset(s.CeilHeight, false);
|
||||
}
|
||||
|
@ -1861,13 +1866,18 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private void floorslopecontrol_OnResetClicked(object sender, EventArgs e)
|
||||
{
|
||||
MakeUndo(); //mxd
|
||||
floorslopecontrol.SetOffset(General.GetByIndex(sectors, 0).FloorHeight, true);
|
||||
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)
|
||||
{
|
||||
s.UpdateBBox();
|
||||
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.FloorSlopeOffset = float.NaN;
|
||||
s.FloorHeight = floorheight.GetResult(sectorprops[s].FloorHeight);
|
||||
s.FloorSlopeOffset = double.NaN;
|
||||
s.UpdateNeeded = true;
|
||||
floorslopecontrol.SetOffset(s.FloorHeight, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue