mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-02-17 01:22:18 +00:00
Decoupled plane equation slopes from sector heights. This means that changing sector heights will not change those slopes (use the offset box in the "slope" tab of the Edit Sector Dialog instead)
This commit is contained in:
parent
47cec444b5
commit
f0bfc74702
4 changed files with 38 additions and 79 deletions
|
@ -746,7 +746,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
offset = sectorprops[s].CeilHeight - sectorprops[s].FloorHeight;
|
||||
s.CeilHeight += offset * sign;
|
||||
SynchCeilSlopeOffsetToHeight(s);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -762,7 +761,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
|
||||
offset = heightoffset.GetResult(0);
|
||||
s.CeilHeight = sectorprops[s].CeilHeight + offset;
|
||||
SynchCeilSlopeOffsetToHeight(s);
|
||||
}
|
||||
}
|
||||
else //update values
|
||||
|
@ -775,7 +773,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
|
||||
offset = heightoffset.GetResult(0);
|
||||
s.CeilHeight = ceilingheight.GetResult(sectorprops[s].CeilHeight) + offset;
|
||||
SynchCeilSlopeOffsetToHeight(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -809,7 +806,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
|
||||
offset = heightoffset.GetResult(0);
|
||||
s.FloorHeight = sectorprops[s].FloorHeight + offset;
|
||||
SynchFloorSlopeOffsetToHeight(s);
|
||||
}
|
||||
}
|
||||
else //update values
|
||||
|
@ -819,28 +815,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// To get the steps for ---/+++ into effect the offset has to be retrieved again for each sector
|
||||
offset = heightoffset.GetResult(0);
|
||||
s.FloorHeight = floorheight.GetResult(sectorprops[s].FloorHeight) + offset;
|
||||
SynchFloorSlopeOffsetToHeight(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void SynchCeilSlopeOffsetToHeight(Sector s)
|
||||
{
|
||||
Vector3D center = GetSectorCenter(s, s.CeilHeight, SlopePivotMode.LOCAL);
|
||||
Plane p = new Plane(center, s.CeilSlope.GetAngleXY() - Angle2D.PIHALF, s.CeilSlope.GetAngleZ(), false);
|
||||
s.CeilSlopeOffset = p.Offset;
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void SynchFloorSlopeOffsetToHeight(Sector s)
|
||||
{
|
||||
Vector3D center = GetSectorCenter(s, s.FloorHeight, SlopePivotMode.LOCAL);
|
||||
Plane p = new Plane(center, s.FloorSlope.GetAngleXY() + Angle2D.PIHALF, -s.FloorSlope.GetAngleZ(), true);
|
||||
s.FloorSlopeOffset = p.Offset;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
@ -1795,7 +1774,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
Plane p = new Plane(center, Angle2D.DegToRad(anglexy), Angle2D.DegToRad(anglez), false);
|
||||
s.CeilSlope = p.Normal;
|
||||
s.CeilSlopeOffset = p.Offset;
|
||||
s.CeilHeight = (int)Math.Round(p.GetZ(center.x, center.y));
|
||||
|
||||
s.UpdateNeeded = true;
|
||||
}
|
||||
|
@ -1820,7 +1798,6 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
Plane p = new Plane(center, Angle2D.DegToRad(anglexy), Angle2D.DegToRad(anglez), true);
|
||||
s.FloorSlope = p.Normal;
|
||||
s.FloorSlopeOffset = p.Offset;
|
||||
s.FloorHeight = (int)Math.Round(p.GetZ(center.x, center.y));
|
||||
|
||||
s.UpdateNeeded = true;
|
||||
}
|
||||
|
|
|
@ -377,38 +377,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This changes the height
|
||||
protected override void ChangeHeight(int amount)
|
||||
{
|
||||
mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
|
||||
level.sector.CeilHeight += amount;
|
||||
|
||||
if(General.Map.UDMF)
|
||||
if (level.sector.CeilSlope.GetLengthSq() > 0)
|
||||
{
|
||||
//mxd. Modify vertex offsets?
|
||||
if(level.sector.Sidedefs.Count == 3)
|
||||
{
|
||||
ChangeVertexHeight(amount);
|
||||
}
|
||||
mode.CreateUndo("Change ceiling slope height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
|
||||
|
||||
//mxd. Modify slope offset?
|
||||
if(level.sector.CeilSlope.GetLengthSq() > 0)
|
||||
{
|
||||
/*
|
||||
Vector3D center = new Vector3D(level.sector.BBox.X + level.sector.BBox.Width / 2,
|
||||
level.sector.BBox.Y + level.sector.BBox.Height / 2,
|
||||
level.sector.CeilHeight);
|
||||
|
||||
Plane p = new Plane(center,
|
||||
level.sector.CeilSlope.GetAngleXY() - Angle2D.PIHALF,
|
||||
level.sector.CeilSlope.GetAngleZ(),
|
||||
false);
|
||||
level.sector.CeilSlopeOffset -= level.sector.CeilSlope.z * amount;
|
||||
|
||||
level.sector.CeilSlopeOffset = p.Offset;
|
||||
*/
|
||||
|
||||
level.sector.CeilSlopeOffset -= level.sector.CeilSlope.z * amount;
|
||||
}
|
||||
mode.SetActionResult("Changed ceiling slope height by " + amount + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
|
||||
level.sector.CeilHeight += amount;
|
||||
|
||||
mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + ".");
|
||||
if (General.Map.UDMF)
|
||||
{
|
||||
//mxd. Modify vertex offsets?
|
||||
if (level.sector.Sidedefs.Count == 3)
|
||||
{
|
||||
ChangeVertexHeight(amount);
|
||||
}
|
||||
}
|
||||
|
||||
mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + ".");
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
|
|
@ -337,38 +337,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// This changes the height
|
||||
protected override void ChangeHeight(int amount)
|
||||
{
|
||||
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
|
||||
level.sector.FloorHeight += amount;
|
||||
|
||||
if(General.Map.UDMF)
|
||||
if (level.sector.FloorSlope.GetLengthSq() > 0)
|
||||
{
|
||||
//mxd. Modify vertex offsets?
|
||||
if(level.sector.Sidedefs.Count == 3)
|
||||
{
|
||||
ChangeVertexHeight(amount);
|
||||
}
|
||||
mode.CreateUndo("Change floor slope height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
|
||||
|
||||
//mxd. Modify slope offset?
|
||||
if(level.sector.FloorSlope.GetLengthSq() > 0)
|
||||
{
|
||||
/*
|
||||
Vector3D center = new Vector3D(level.sector.BBox.X + level.sector.BBox.Width / 2,
|
||||
level.sector.BBox.Y + level.sector.BBox.Height / 2,
|
||||
level.sector.FloorHeight);
|
||||
|
||||
Plane p = new Plane(center,
|
||||
level.sector.FloorSlope.GetAngleXY() + Angle2D.PIHALF,
|
||||
-level.sector.FloorSlope.GetAngleZ(),
|
||||
true);
|
||||
level.sector.FloorSlopeOffset -= level.sector.FloorSlope.z * amount;
|
||||
|
||||
level.sector.FloorSlopeOffset = p.Offset;
|
||||
*/
|
||||
|
||||
level.sector.FloorSlopeOffset -= level.sector.FloorSlope.z * amount;
|
||||
}
|
||||
mode.SetActionResult("Changed floor slope height by " + amount + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
|
||||
level.sector.FloorHeight += amount;
|
||||
|
||||
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
|
||||
if (General.Map.UDMF)
|
||||
{
|
||||
//mxd. Modify vertex offsets?
|
||||
if (level.sector.Sidedefs.Count == 3)
|
||||
{
|
||||
ChangeVertexHeight(amount);
|
||||
}
|
||||
}
|
||||
|
||||
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
|
|
@ -241,13 +241,11 @@ namespace CodeImp.DoomBuilder.VisualModes
|
|||
Plane downplane = plane.GetInverted();
|
||||
level.sector.CeilSlope = downplane.Normal;
|
||||
level.sector.CeilSlopeOffset = downplane.Offset;
|
||||
level.sector.CeilHeight = (int)new Plane(level.sector.CeilSlope, level.sector.CeilSlopeOffset).GetZ(center);
|
||||
}
|
||||
else
|
||||
{
|
||||
level.sector.FloorSlope = plane.Normal;
|
||||
level.sector.FloorSlopeOffset = plane.Offset;
|
||||
level.sector.FloorHeight = (int)new Plane(level.sector.FloorSlope, level.sector.FloorSlopeOffset).GetZ(center);
|
||||
}
|
||||
|
||||
// Rebuild sector
|
||||
|
|
Loading…
Reference in a new issue