mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-07 16:31:34 +00:00
Update thing Z whenever "Absolute Z Height" flag is (un)checked
This commit is contained in:
parent
606f323cac
commit
b5cfc3da4b
1 changed files with 32 additions and 7 deletions
|
@ -173,14 +173,15 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
|
|
||||||
// Coordination
|
// Coordination
|
||||||
angle.Text = ft.AngleDoom.ToString();
|
angle.Text = ft.AngleDoom.ToString();
|
||||||
cbAbsoluteHeight.Checked = useabsoluteheight; //mxd
|
cbAbsoluteHeight.Checked = useabsoluteheight || ft.AbsoluteZ; //mxd
|
||||||
|
cbAbsoluteHeight.Enabled = !ft.AbsoluteZ;
|
||||||
|
|
||||||
//mxd
|
//mxd
|
||||||
ft.DetermineSector();
|
ft.DetermineSector();
|
||||||
double floorheight = (ft.Sector != null ? Sector.GetFloorPlane(ft.Sector).GetZ(ft.Position) : 0);
|
double floorheight = (ft.Sector != null ? Sector.GetFloorPlane(ft.Sector).GetZ(ft.Position) : 0);
|
||||||
posX.Text = (ft.Position.x).ToString();
|
posX.Text = (ft.Position.x).ToString();
|
||||||
posY.Text = (ft.Position.y).ToString();
|
posY.Text = (ft.Position.y).ToString();
|
||||||
posZ.Text = (useabsoluteheight ? (Math.Round(ft.Position.z + floorheight, General.Map.FormatInterface.VertexDecimals)).ToString() : (ft.Position.z).ToString());
|
posZ.Text = ((useabsoluteheight && !ft.AbsoluteZ) ? (Math.Round(ft.Position.z + floorheight, General.Map.FormatInterface.VertexDecimals)).ToString() : (ft.Position.z).ToString());
|
||||||
posX.ButtonStep = General.Map.Grid.GridSize;
|
posX.ButtonStep = General.Map.Grid.GridSize;
|
||||||
posY.ButtonStep = General.Map.Grid.GridSize;
|
posY.ButtonStep = General.Map.Grid.GridSize;
|
||||||
posZ.ButtonStep = General.Map.Grid.GridSize;
|
posZ.ButtonStep = General.Map.Grid.GridSize;
|
||||||
|
@ -249,7 +250,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//mxd. Position
|
//mxd. Position
|
||||||
if((t.Position.x).ToString() != posX.Text) posX.Text = "";
|
if((t.Position.x).ToString() != posX.Text) posX.Text = "";
|
||||||
if((t.Position.y).ToString() != posY.Text) posY.Text = "";
|
if((t.Position.y).ToString() != posY.Text) posY.Text = "";
|
||||||
if(useabsoluteheight && t.Sector != null)
|
if(useabsoluteheight && !t.AbsoluteZ && t.Sector != null)
|
||||||
{
|
{
|
||||||
if((Math.Round(Sector.GetFloorPlane(t.Sector).GetZ(t.Position) + t.Position.z, General.Map.FormatInterface.VertexDecimals)).ToString() != posZ.Text)
|
if((Math.Round(Sector.GetFloorPlane(t.Sector).GetZ(t.Position) + t.Position.z, General.Map.FormatInterface.VertexDecimals)).ToString() != posZ.Text)
|
||||||
posZ.Text = "";
|
posZ.Text = "";
|
||||||
|
@ -547,13 +548,13 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
//update label text
|
//update label text
|
||||||
Thing ft = General.GetByIndex(things, 0);
|
Thing ft = General.GetByIndex(things, 0);
|
||||||
double z = ft.Position.z;
|
double z = ft.Position.z;
|
||||||
if(useabsoluteheight && ft.Sector != null) z += Sector.GetFloorPlane(ft.Sector).GetZ(ft.Position);
|
if(useabsoluteheight && !ft.AbsoluteZ && ft.Sector != null) z += Sector.GetFloorPlane(ft.Sector).GetZ(ft.Position);
|
||||||
posZ.Text = Math.Round(z, General.Map.FormatInterface.VertexDecimals).ToString();
|
posZ.Text = Math.Round(z, General.Map.FormatInterface.VertexDecimals).ToString();
|
||||||
|
|
||||||
foreach(Thing t in things)
|
foreach(Thing t in things)
|
||||||
{
|
{
|
||||||
z = t.Position.z;
|
z = t.Position.z;
|
||||||
if(useabsoluteheight && t.Sector != null) z += Sector.GetFloorPlane(t.Sector).GetZ(t.Position);
|
if(useabsoluteheight && !ft.AbsoluteZ && t.Sector != null) z += Sector.GetFloorPlane(t.Sector).GetZ(t.Position);
|
||||||
string ztext = Math.Round(z, General.Map.FormatInterface.VertexDecimals).ToString();
|
string ztext = Math.Round(z, General.Map.FormatInterface.VertexDecimals).ToString();
|
||||||
if(posZ.Text != ztext)
|
if(posZ.Text != ztext)
|
||||||
{
|
{
|
||||||
|
@ -656,7 +657,7 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
foreach(Thing t in things)
|
foreach(Thing t in things)
|
||||||
{
|
{
|
||||||
double z = posZ.GetResultFloat(thingprops[i++].Z);
|
double z = posZ.GetResultFloat(thingprops[i++].Z);
|
||||||
if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null)
|
if(useabsoluteheight && !t.AbsoluteZ && !posZ.CheckIsRelative() && t.Sector != null)
|
||||||
z -= Math.Round(Sector.GetFloorPlane(t.Sector).GetZ(t.Position.x, t.Position.y), General.Map.FormatInterface.VertexDecimals);
|
z -= Math.Round(Sector.GetFloorPlane(t.Sector).GetZ(t.Position.x, t.Position.y), General.Map.FormatInterface.VertexDecimals);
|
||||||
t.Move(new Vector3D(t.Position.x, t.Position.y, z));
|
t.Move(new Vector3D(t.Position.x, t.Position.y, z));
|
||||||
}
|
}
|
||||||
|
@ -839,6 +840,31 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preventchanges = true;
|
||||||
|
|
||||||
|
// Update Z height, in case AbsoluteZ flag changed
|
||||||
|
Thing ft = General.GetByIndex(things, 0);
|
||||||
|
double z = ft.Position.z;
|
||||||
|
if (useabsoluteheight && !ft.AbsoluteZ && ft.Sector != null) z += Sector.GetFloorPlane(ft.Sector).GetZ(ft.Position);
|
||||||
|
posZ.Text = Math.Round(z, General.Map.FormatInterface.VertexDecimals).ToString();
|
||||||
|
|
||||||
|
foreach (Thing t in things)
|
||||||
|
{
|
||||||
|
z = t.Position.z;
|
||||||
|
if (useabsoluteheight && !ft.AbsoluteZ && t.Sector != null) z += Sector.GetFloorPlane(t.Sector).GetZ(t.Position);
|
||||||
|
string ztext = Math.Round(z, General.Map.FormatInterface.VertexDecimals).ToString();
|
||||||
|
if (posZ.Text != ztext)
|
||||||
|
{
|
||||||
|
posZ.Text = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cbAbsoluteHeight.Checked = useabsoluteheight || ft.AbsoluteZ; //mxd
|
||||||
|
cbAbsoluteHeight.Enabled = !ft.AbsoluteZ;
|
||||||
|
|
||||||
|
preventchanges = false;
|
||||||
|
|
||||||
// Everything is OK
|
// Everything is OK
|
||||||
missingflags.Visible = false;
|
missingflags.Visible = false;
|
||||||
settingsgroup.ForeColor = SystemColors.ControlText;
|
settingsgroup.ForeColor = SystemColors.ControlText;
|
||||||
|
@ -873,6 +899,5 @@ namespace CodeImp.DoomBuilder.Windows
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue