mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
Some refactoring
Made sloping work more reliably with irregularly shaped sectors
This commit is contained in:
parent
f93a13c1f2
commit
d6d579ab76
3 changed files with 38 additions and 7 deletions
|
@ -167,11 +167,11 @@
|
|||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(61, 72);
|
||||
this.label3.Location = new System.Drawing.Point(50, 72);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(37, 13);
|
||||
this.label3.Size = new System.Drawing.Size(48, 13);
|
||||
this.label3.TabIndex = 27;
|
||||
this.label3.Text = "Scale:";
|
||||
this.label3.Text = "Scale %:";
|
||||
//
|
||||
// quartercircleleft
|
||||
//
|
||||
|
|
|
@ -121,8 +121,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
double t = theta.GetResultFloat(originaltheta);
|
||||
|
||||
if (t <= 0.0)
|
||||
{
|
||||
t = 1.0;
|
||||
theta.Text = "1";
|
||||
}
|
||||
|
||||
if (t > 180.0)
|
||||
{
|
||||
t = 180.0;
|
||||
theta.Text = "180";
|
||||
}
|
||||
|
||||
double o = (180 - t) / 2.0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
public double Theta { get { return theta; } set { theta = value; CalculateBaseHeightOffset(); } }
|
||||
public double OffsetAngle { get { return offsetangle; } set { offsetangle = value; CalculateBaseHeightOffset(); } }
|
||||
public double Scale { get { return scale; } set { scale = value; } }
|
||||
public double Scale { get { return scale; } set { scale = value; CalculateBaseHeightOffset(); } }
|
||||
public int Baseheight { get { return baseheight; } }
|
||||
public double HeightOffset { get { return heightoffset; } set { heightoffset = value; } }
|
||||
|
||||
|
@ -50,13 +50,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
else
|
||||
baseheight = handle1.Level.extrafloor ? handle1.Level.sector.CeilHeight : handle1.Level.sector.FloorHeight;
|
||||
|
||||
//baseheight = handle1.Level.type == SectorLevelType.Ceiling ? handle1.Level.sector.CeilHeight : handle1.Level.sector.FloorHeight;
|
||||
baseheightoffset = 0.0;
|
||||
}
|
||||
|
||||
private void CalculateBaseHeightOffset()
|
||||
{
|
||||
double right = Math.Cos(0.0);
|
||||
/*
|
||||
double left = Math.Cos(theta + offsetangle);
|
||||
double middle = Math.Cos(offsetangle);
|
||||
|
||||
|
@ -67,11 +66,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
double sectionstart = Math.Cos(offsetangle + theta) * radius;
|
||||
|
||||
baseheightoffset = Math.Sqrt(radius * radius - sectionstart * sectionstart) * scale;
|
||||
*/
|
||||
}
|
||||
|
||||
public void ApplySlope()
|
||||
{
|
||||
double right = Math.Cos(0.0);
|
||||
double left = Math.Cos(theta + offsetangle);
|
||||
double middle = Math.Cos(offsetangle);
|
||||
|
||||
|
@ -81,11 +80,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
double sectionstart = Math.Cos(offsetangle + theta) * radius;
|
||||
|
||||
baseheightoffset = Math.Sqrt(radius * radius - sectionstart * sectionstart) * scale;
|
||||
|
||||
foreach (BaseVisualGeometrySector bvgs in sectors)
|
||||
{
|
||||
HashSet<Vertex> vertices = new HashSet<Vertex>(bvgs.Sector.Sides.Count * 2);
|
||||
double u1 = 1.0;
|
||||
double u2 = 0.0;
|
||||
|
||||
foreach (Sidedef sd in bvgs.Sector.Sides.Keys)
|
||||
{
|
||||
vertices.Add(sd.Line.Start);
|
||||
vertices.Add(sd.Line.End);
|
||||
}
|
||||
|
||||
foreach(Vertex v in vertices)
|
||||
{
|
||||
double intersection = handleline.GetNearestOnLine(v.Position);
|
||||
|
||||
if (intersection < u1)
|
||||
u1 = intersection;
|
||||
if (intersection > u2)
|
||||
u2 = intersection;
|
||||
}
|
||||
|
||||
/*
|
||||
foreach (Sidedef sd in bvgs.Sector.Sides.Keys)
|
||||
{
|
||||
double intersection;
|
||||
|
@ -99,7 +118,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if (intersection > u2)
|
||||
u2 = intersection;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (u1 == u2)
|
||||
{
|
||||
if (u1 >= 0.5)
|
||||
|
@ -112,6 +133,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
double xpos1 = sectionstart + (u1 * length);
|
||||
double xpos2 = sectionstart + (u2 * length);
|
||||
|
|
Loading…
Reference in a new issue