Removed lots of unnecessary casts to float of the Math methods. Also removed some other minor implicit casts

This commit is contained in:
biwa 2020-05-22 22:30:32 +02:00
parent ab81b17554
commit 9338d1221f
34 changed files with 156 additions and 156 deletions

View file

@ -92,7 +92,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Methods #region ================== Methods
public void SetValues(float anglexy, float anglez, float offset, bool first) public void SetValues(double anglexy, double anglez, double offset, bool first)
{ {
if(first) if(first)
{ {

View file

@ -883,8 +883,8 @@ namespace CodeImp.DoomBuilder.Rendering
Vector2D center = GridSetup.SnappedToGrid(0.5f * (ltview + rbview), size, sizeinv, angle, originx, originy); Vector2D center = GridSetup.SnappedToGrid(0.5f * (ltview + rbview), size, sizeinv, angle, originx, originy);
// Get the angle vectors for the gridlines // Get the angle vectors for the gridlines
Vector2D dx = new Vector2D((float)Math.Cos(angle), (float)Math.Sin(angle)); Vector2D dx = new Vector2D(Math.Cos(angle), Math.Sin(angle));
Vector2D dy = new Vector2D((float)-Math.Sin(angle), (float)Math.Cos(angle)); Vector2D dy = new Vector2D(-Math.Sin(angle), Math.Cos(angle));
double maxextent = Math.Max(mapsize.x, mapsize.y); double maxextent = Math.Max(mapsize.x, mapsize.y);
RectangleF bounds = new RectangleF((float)tlb.x, (float)tlb.y, (float)(rbb.x - tlb.x), (float)(rbb.y - tlb.y)); RectangleF bounds = new RectangleF((float)tlb.x, (float)tlb.y, (float)(rbb.x - tlb.x), (float)(rbb.y - tlb.y));
@ -1897,8 +1897,8 @@ namespace CodeImp.DoomBuilder.Rendering
if(line.RenderArrowhead) if(line.RenderArrowhead)
{ {
double angle = line.GetAngle(); double angle = line.GetAngle();
Vector2D a1 = new Vector2D(line.End.x - scaler * (float)Math.Sin(angle - 0.46f), line.End.y + scaler * (float)Math.Cos(angle - 0.46f)).GetTransformed(translatex, translatey, scale, -scale); //arrowhead end 1 Vector2D a1 = new Vector2D(line.End.x - scaler * Math.Sin(angle - 0.46f), line.End.y + scaler * Math.Cos(angle - 0.46f)).GetTransformed(translatex, translatey, scale, -scale); //arrowhead end 1
Vector2D a2 = new Vector2D(line.End.x - scaler * (float)Math.Sin(angle + 0.46f), line.End.y + scaler * (float)Math.Cos(angle + 0.46f)).GetTransformed(translatex, translatey, scale, -scale); //arrowhead end 2 Vector2D a2 = new Vector2D(line.End.x - scaler * Math.Sin(angle + 0.46f), line.End.y + scaler * Math.Cos(angle + 0.46f)).GetTransformed(translatex, translatey, scale, -scale); //arrowhead end 2
verts[pointscount] = verts[pointscount - 1]; verts[pointscount] = verts[pointscount - 1];
verts[pointscount + 1].x = (float)a1.x; verts[pointscount + 1].x = (float)a1.x;

View file

@ -483,7 +483,7 @@ namespace CodeImp.DoomBuilder.VisualModes
return; return;
} }
MoveSelectedThings(new Vector2D((float)Math.Round(hitpos.x), (float)Math.Round(hitpos.y)), true); MoveSelectedThings(new Vector2D(Math.Round(hitpos.x), Math.Round(hitpos.y)), true);
} }
//mxd. //mxd.
@ -494,7 +494,7 @@ namespace CodeImp.DoomBuilder.VisualModes
delta = delta.GetFixedLength(General.Settings.ViewDistance * 0.98f); delta = delta.GetFixedLength(General.Settings.ViewDistance * 0.98f);
VisualPickResult target = PickObject(start, start + delta); VisualPickResult target = PickObject(start, start + delta);
if(target.picked == null) return new Vector2D(float.NaN, float.NaN); if(target.picked == null) return new Vector2D(double.NaN, double.NaN);
// Now find where exactly did we hit // Now find where exactly did we hit
VisualGeometry vg = target.picked as VisualGeometry; VisualGeometry vg = target.picked as VisualGeometry;
@ -504,7 +504,7 @@ namespace CodeImp.DoomBuilder.VisualModes
VisualThing vt = target.picked as VisualThing; VisualThing vt = target.picked as VisualThing;
if(vt != null) return GetIntersection(start, start + delta, vt.CenterV3D, RenderDevice.V3D(vt.Center - vt.PositionV3)); if(vt != null) return GetIntersection(start, start + delta, vt.CenterV3D, RenderDevice.V3D(vt.Center - vt.PositionV3));
return new Vector2D(float.NaN, float.NaN); return new Vector2D(double.NaN, double.NaN);
} }
//mxd. This checks intersection between line and plane //mxd. This checks intersection between line and plane

View file

@ -18,8 +18,8 @@ namespace CodeImp.DoomBuilder.Windows
private void accept_Click(object sender, EventArgs e) private void accept_Click(object sender, EventArgs e)
{ {
coordinates.x = (float)Math.Round(General.Clamp(gotox.GetResult((int)coordinates.x), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate)); coordinates.x = Math.Round(General.Clamp(gotox.GetResult((int)coordinates.x), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate));
coordinates.y = (float)Math.Round(General.Clamp(gotoy.GetResult((int)coordinates.y), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate)); coordinates.y = Math.Round(General.Clamp(gotoy.GetResult((int)coordinates.y), General.Map.FormatInterface.MinCoordinate, General.Map.FormatInterface.MaxCoordinate));
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;
this.Close(); this.Close();

View file

@ -142,7 +142,7 @@ namespace CodeImp.DoomBuilder.Windows
//UDMF slopes //UDMF slopes
if(s.FloorSlope.GetLengthSq() > 0) if(s.FloorSlope.GetLengthSq() > 0)
{ {
FloorSlopeAngleXY = General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleXY()) - 180, 1)); FloorSlopeAngleXY = General.ClampAngle(Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleXY()) - 180, 1));
FloorSlopeAngleZ = -Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()) - 90, 1); FloorSlopeAngleZ = -Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()) - 90, 1);
FloorSlopeOffset = (double.IsNaN(s.FloorSlopeOffset) ? s.FloorHeight : s.FloorSlopeOffset); FloorSlopeOffset = (double.IsNaN(s.FloorSlopeOffset) ? s.FloorHeight : s.FloorSlopeOffset);
} }
@ -156,7 +156,7 @@ namespace CodeImp.DoomBuilder.Windows
if(s.CeilSlope.GetLengthSq() > 0) if(s.CeilSlope.GetLengthSq() > 0)
{ {
CeilSlopeAngleXY = General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleXY()) - 180, 1)); CeilSlopeAngleXY = General.ClampAngle(Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleXY()) - 180, 1));
CeilSlopeAngleZ = -Math.Round(270 - Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 1); CeilSlopeAngleZ = -Math.Round(270 - Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 1);
CeilSlopeOffset = (double.IsNaN(s.CeilSlopeOffset) ? s.CeilHeight : s.CeilSlopeOffset); CeilSlopeOffset = (double.IsNaN(s.CeilSlopeOffset) ? s.CeilHeight : s.CeilSlopeOffset);
} }
@ -906,12 +906,12 @@ namespace CodeImp.DoomBuilder.Windows
} }
// Clear horizontal slopes // Clear horizontal slopes
if((float)Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()), 3) == 90f) if(Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()), 3) == 90.0)
{ {
s.FloorSlope = new Vector3D(); s.FloorSlope = new Vector3D();
s.FloorSlopeOffset = float.NaN; s.FloorSlopeOffset = float.NaN;
} }
if((float)Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 3) == 270f) if(Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 3) == 270.0)
{ {
s.CeilSlope = new Vector3D(); s.CeilSlope = new Vector3D();
s.CeilSlopeOffset = float.NaN; s.CeilSlopeOffset = float.NaN;
@ -1237,7 +1237,7 @@ namespace CodeImp.DoomBuilder.Windows
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
UniFields.SetFloat(s.Fields, "rotationfloor", sectorprops[s].FloorRotation, 0f); UniFields.SetFloat(s.Fields, "rotationfloor", sectorprops[s].FloorRotation, 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
@ -1247,7 +1247,7 @@ namespace CodeImp.DoomBuilder.Windows
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
UniFields.SetFloat(s.Fields, "rotationfloor", floorRotation.GetResultFloat(sectorprops[s].FloorRotation), 0f); UniFields.SetFloat(s.Fields, "rotationfloor", floorRotation.GetResultFloat(sectorprops[s].FloorRotation), 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
@ -1271,7 +1271,7 @@ namespace CodeImp.DoomBuilder.Windows
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
UniFields.SetFloat(s.Fields, "rotationceiling", sectorprops[s].CeilRotation, 0f); UniFields.SetFloat(s.Fields, "rotationceiling", sectorprops[s].CeilRotation, 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
@ -1281,7 +1281,7 @@ namespace CodeImp.DoomBuilder.Windows
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
UniFields.SetFloat(s.Fields, "rotationceiling", ceilRotation.GetResultFloat(sectorprops[s].CeilRotation), 0f); UniFields.SetFloat(s.Fields, "rotationceiling", ceilRotation.GetResultFloat(sectorprops[s].CeilRotation), 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
@ -1659,9 +1659,9 @@ namespace CodeImp.DoomBuilder.Windows
{ {
if(s.FloorSlope.GetLengthSq() > 0) if(s.FloorSlope.GetLengthSq() > 0)
{ {
float anglexy = General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleXY()) - 180, 1)); double anglexy = General.ClampAngle(Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleXY()) - 180, 1));
float anglez = -(float)Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()) - 90, 1); double anglez = -Math.Round(Angle2D.RadToDeg(s.FloorSlope.GetAngleZ()) - 90, 1);
float offset = (float)Math.Round(GetVirtualSlopeOffset(s, floorslopecontrol.PivotMode, true), 1); double offset = Math.Round(GetVirtualSlopeOffset(s, floorslopecontrol.PivotMode, true), 1);
if(anglexy >= 180 && anglez < 0) if(anglexy >= 180 && anglez < 0)
{ {
@ -1673,7 +1673,7 @@ namespace CodeImp.DoomBuilder.Windows
} }
else else
{ {
floorslopecontrol.SetValues(0f, 0f, s.FloorHeight, first); floorslopecontrol.SetValues(0.0, 0.0, s.FloorHeight, first);
} }
} }
@ -1681,9 +1681,9 @@ namespace CodeImp.DoomBuilder.Windows
{ {
if(s.CeilSlope.GetLengthSq() > 0) if(s.CeilSlope.GetLengthSq() > 0)
{ {
float anglexy = General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleXY()) - 180, 1)); double anglexy = General.ClampAngle(Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleXY()) - 180, 1));
float anglez = -(float)(270 - Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 1)); double anglez = -(270 - Math.Round(Angle2D.RadToDeg(s.CeilSlope.GetAngleZ()), 1));
float offset = (float)Math.Round(GetVirtualSlopeOffset(s, ceilingslopecontrol.PivotMode, false), 1); double offset = Math.Round(GetVirtualSlopeOffset(s, ceilingslopecontrol.PivotMode, false), 1);
if(anglexy >= 180 && anglez < 0) if(anglexy >= 180 && anglez < 0)
{ {
@ -1695,7 +1695,7 @@ namespace CodeImp.DoomBuilder.Windows
} }
else else
{ {
ceilingslopecontrol.SetValues(0f, 0f, s.CeilHeight, first); ceilingslopecontrol.SetValues(0.0, 0.0, s.CeilHeight, first);
} }
} }
@ -1942,7 +1942,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
UniFields.SetFloat(s.Fields, "ceilingglowheight", sectorprops[s].CeilGlowHeight, 0f); UniFields.SetFloat(s.Fields, "ceilingglowheight", sectorprops[s].CeilGlowHeight, 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
@ -1950,14 +1950,14 @@ namespace CodeImp.DoomBuilder.Windows
{ {
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
double value = General.Clamp(ceilingglowheight.GetResultFloat(sectorprops[s].CeilGlowHeight), 0f, float.MaxValue); double value = General.Clamp(ceilingglowheight.GetResultFloat(sectorprops[s].CeilGlowHeight), 0.0, double.MaxValue);
UniFields.SetFloat(s.Fields, "ceilingglowheight", value, 0f); UniFields.SetFloat(s.Fields, "ceilingglowheight", value, 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
// Update "Reset" button // Update "Reset" button
resetceilingglowheight.Visible = (ceilingglowheight.GetResultFloat(0f) != 0f); resetceilingglowheight.Visible = (ceilingglowheight.GetResultFloat(0.0) != 0.0);
// Show height warning? // Show height warning?
UpdateCeilingGlowHeightWarning(); UpdateCeilingGlowHeightWarning();
@ -1976,7 +1976,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
UniFields.SetFloat(s.Fields, "floorglowheight", sectorprops[s].FloorGlowHeight, 0f); UniFields.SetFloat(s.Fields, "floorglowheight", sectorprops[s].FloorGlowHeight, 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
@ -1984,14 +1984,14 @@ namespace CodeImp.DoomBuilder.Windows
{ {
foreach(Sector s in sectors) foreach(Sector s in sectors)
{ {
double value = General.Clamp(floorglowheight.GetResultFloat(sectorprops[s].FloorGlowHeight), 0f, double.MaxValue); double value = General.Clamp(floorglowheight.GetResultFloat(sectorprops[s].FloorGlowHeight), 0.0, double.MaxValue);
UniFields.SetFloat(s.Fields, "floorglowheight", value, 0f); UniFields.SetFloat(s.Fields, "floorglowheight", value, 0.0);
s.UpdateNeeded = true; s.UpdateNeeded = true;
} }
} }
// Update "Reset" button // Update "Reset" button
resetfloorglowheight.Visible = (floorglowheight.GetResultFloat(0f) != 0f); resetfloorglowheight.Visible = (floorglowheight.GetResultFloat(0.0) != 0.0);
// Show height warning? // Show height warning?
UpdateFloorGlowHeightWarning(); UpdateFloorGlowHeightWarning();

View file

@ -585,7 +585,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
double z = posZ.GetResultFloat(thingprops[i++].Z); double z = posZ.GetResultFloat(thingprops[i++].Z);
if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null) if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null)
z -= (float)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));
} }
} }

View file

@ -198,7 +198,7 @@ namespace CodeImp.DoomBuilder.Windows
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 ? ((float)Math.Round(ft.Position.z + floorheight, General.Map.FormatInterface.VertexDecimals)).ToString() : (ft.Position.z).ToString()); posZ.Text = (useabsoluteheight ? (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;
@ -271,7 +271,7 @@ namespace CodeImp.DoomBuilder.Windows
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.Sector != null)
{ {
if(((float)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 = "";
} }
else if((t.Position.z).ToString() != posZ.Text) else if((t.Position.z).ToString() != posZ.Text)
@ -610,13 +610,13 @@ namespace CodeImp.DoomBuilder.Windows
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.Sector != null) z += Sector.GetFloorPlane(ft.Sector).GetZ(ft.Position);
posZ.Text = ((float)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 && t.Sector != null) z += Sector.GetFloorPlane(t.Sector).GetZ(t.Position);
string ztext = ((float)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)
{ {
posZ.Text = ""; posZ.Text = "";
@ -720,7 +720,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
double z = posZ.GetResultFloat(thingprops[i++].Z); double z = posZ.GetResultFloat(thingprops[i++].Z);
if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null) if(useabsoluteheight && !posZ.CheckIsRelative() && t.Sector != null)
z -= (float)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));
} }
} }

View file

@ -474,7 +474,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
{ {
foreach(HeightOffsetVertexData vd in sectorData[i].Verts) foreach(HeightOffsetVertexData vd in sectorData[i].Verts)
{ {
vd.Vertex.ZCeiling = vd.InitialCeilingHeight - (float)Math.Floor(curAmmount vd.Vertex.ZCeiling = vd.InitialCeilingHeight - Math.Floor(curAmmount
* ModifyByOffsetMode(vd.JitterCeilingHeight, ceiloffsetmode.SelectedIndex)); * ModifyByOffsetMode(vd.JitterCeilingHeight, ceiloffsetmode.SelectedIndex));
} }
} }
@ -506,7 +506,7 @@ namespace CodeImp.DoomBuilder.BuilderEffects
{ {
foreach(HeightOffsetVertexData vd in sectorData[i].Verts) foreach(HeightOffsetVertexData vd in sectorData[i].Verts)
{ {
vd.Vertex.ZFloor = vd.InitialFloorHeight + (float)Math.Floor(curAmmount vd.Vertex.ZFloor = vd.InitialFloorHeight + Math.Floor(curAmmount
* ModifyByOffsetMode(vd.JitterFloorHeight, flooroffsetmode.SelectedIndex)); * ModifyByOffsetMode(vd.JitterFloorHeight, flooroffsetmode.SelectedIndex));
} }
} }

View file

@ -163,9 +163,9 @@ namespace CodeImp.DoomBuilder.BuilderModes.ClassicModes
//angle of line, connecting handles ControlledPoints //angle of line, connecting handles ControlledPoints
double dirAngle = -Math.Atan2(handle.Pair.ControlledPoint.y - handle.ControlledPoint.y, handle.Pair.ControlledPoint.x - handle.ControlledPoint.x); double dirAngle = -Math.Atan2(handle.Pair.ControlledPoint.y - handle.ControlledPoint.y, handle.Pair.ControlledPoint.x - handle.ControlledPoint.x);
double length = Math.Sqrt(Math.Pow(Math.Abs(pos.x), 2.0) + Math.Pow(Math.Abs(pos.y), 2.0)); double length = Math.Sqrt(Math.Pow(Math.Abs(pos.x), 2.0) + Math.Pow(Math.Abs(pos.y), 2.0));
double mirroredAngle = angle + dirAngle * 2.0f; double mirroredAngle = angle + dirAngle * 2.0;
handle.Pair.RelativePosition = new Vector2D((float)Math.Sin(mirroredAngle) * length, (float)Math.Cos(mirroredAngle) * length); handle.Pair.RelativePosition = new Vector2D(Math.Sin(mirroredAngle) * length, Math.Cos(mirroredAngle) * length);
} }
else if(form.CopyMode) else if(form.CopyMode)
{ {

View file

@ -150,8 +150,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
//calculate some identities of a circle segment (refer to the graph in the url above) //calculate some identities of a circle segment (refer to the graph in the url above)
double c = line.Length; double c = line.Length;
double d = (c / (float)Math.Tan(theta / 2)) / 2; double d = (c /Math.Tan(theta / 2)) / 2;
double R = d / (float)Math.Cos(theta / 2); double R = d / Math.Cos(theta / 2);
double h = R - d; double h = R - d;
double yDeform = (fixedcurve ? 1 : distance / h); double yDeform = (fixedcurve ? 1 : distance / h);

View file

@ -115,8 +115,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector2D[] shape = new Vector2D[subdivisions + 1]; Vector2D[] shape = new Vector2D[subdivisions + 1];
bool doBevel = false; bool doBevel = false;
float hw = width / 2.0f; double hw = width / 2.0;
float hh = height / 2.0f; double hh = height / 2.0;
Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh); Vector2D center = new Vector2D(pStart.x + hw, pStart.y + hh);
double curAngle = angle; double curAngle = angle;
@ -127,13 +127,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
double px, py; double px, py;
if(doBevel) if(doBevel)
{ {
px = (center.x - (float)Math.Sin(curAngle) * (hw + currentbevelwidth)); px = (center.x - Math.Sin(curAngle) * (hw + currentbevelwidth));
py = (center.y - (float)Math.Cos(curAngle) * (hh + currentbevelwidth)); py = (center.y - Math.Cos(curAngle) * (hh + currentbevelwidth));
} }
else else
{ {
px = (center.x - (float)Math.Sin(curAngle) * hw); px = (center.x - Math.Sin(curAngle) * hw);
py = (center.y - (float)Math.Cos(curAngle) * hh); py = (center.y - Math.Cos(curAngle) * hh);
} }
doBevel = !doBevel; doBevel = !doBevel;
shape[i] = new Vector2D(px, py); shape[i] = new Vector2D(px, py);
@ -159,8 +159,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// Calculate scalers // Calculate scalers
double scalerx = 1.0f; double scalerx = 1.0;
double scalery = 1.0f; double scalery = 1.0;
if(minx != pStart.x || maxx != pEnd.x) if(minx != pStart.x || maxx != pEnd.x)
scalerx = (pEnd.x - pStart.x) / (maxx - minx); scalerx = (pEnd.x - pStart.x) / (maxx - minx);
@ -192,7 +192,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(miny != pStart.y) offset.y = pStart.y - miny; if(miny != pStart.y) offset.y = pStart.y - miny;
// Apply offset... // Apply offset...
if(offset.x != 0.0f || offset.y != 0.0f) if(offset.x != 0.0 || offset.y != 0.0)
for(int i = 0; i < shape.Length; i++) shape[i] += offset; for(int i = 0; i < shape.Length; i++) shape[i] += offset;
// Done // Done

View file

@ -475,7 +475,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
Line2D dline = new Line2D(mousemappos, points[points.Count - 1].pos); Line2D dline = new Line2D(mousemappos, points[points.Count - 1].pos);
bool foundintersection = false; bool foundintersection = false;
double u = 0.0f; double u = 0.0;
List<Line2D> blines = new List<Line2D>(); List<Line2D> blines = new List<Line2D>();
// lines for left, top, right and bottom boundaries // lines for left, top, right and bottom boundaries
@ -491,7 +491,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// only check for intersection if the last set point is not on the // only check for intersection if the last set point is not on the
// line we are checking against // line we are checking against
if(blines[i].GetSideOfLine(points[points.Count - 1].pos) != 0.0f) if(blines[i].GetSideOfLine(points[points.Count - 1].pos) != 0.0)
{ {
foundintersection = blines[i].GetIntersection(dline, out u); foundintersection = blines[i].GetIntersection(dline, out u);
} }
@ -520,8 +520,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
else else
{ {
// Normal position // Normal position
p.pos.x = (float)Math.Round(vm.x); //mxd p.pos.x = Math.Round(vm.x); //mxd
p.pos.y = (float)Math.Round(vm.y); //mxd p.pos.y = Math.Round(vm.y); //mxd
return p; return p;
} }

View file

@ -898,8 +898,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
double trotation = rotateoffsets ? (si.Rotation + texrotation) : (si.Rotation); double trotation = rotateoffsets ? (si.Rotation + texrotation) : (si.Rotation);
Vector2D offset = selectioncenter.GetRotated(trotation); Vector2D offset = selectioncenter.GetRotated(trotation);
fields["xpanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(-offset.x, General.Map.FormatInterface.VertexDecimals)); fields["xpanning" + si.Part] = new UniValue(UniversalType.Float, Math.Round(-offset.x, General.Map.FormatInterface.VertexDecimals));
fields["ypanning" + si.Part] = new UniValue(UniversalType.Float, (float)Math.Round(offset.y, General.Map.FormatInterface.VertexDecimals)); fields["ypanning" + si.Part] = new UniValue(UniversalType.Float, Math.Round(offset.y, General.Map.FormatInterface.VertexDecimals));
} }
// Restore texture offsets // Restore texture offsets
@ -911,7 +911,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update rotation // Update rotation
if(rotateoffsets) if(rotateoffsets)
fields["rotation" + si.Part] = new UniValue(UniversalType.AngleDegreesFloat, General.ClampAngle((float)Math.Round(Angle2D.RadToDeg(si.Rotation + texrotation), General.Map.FormatInterface.VertexDecimals))); fields["rotation" + si.Part] = new UniValue(UniversalType.AngleDegreesFloat, General.ClampAngle(Math.Round(Angle2D.RadToDeg(si.Rotation + texrotation), General.Map.FormatInterface.VertexDecimals)));
// Restore rotation // Restore rotation
else else
fields["rotation" + si.Part] = new UniValue(UniversalType.AngleDegreesFloat, Angle2D.RadToDeg(si.Rotation)); fields["rotation" + si.Part] = new UniValue(UniversalType.AngleDegreesFloat, Angle2D.RadToDeg(si.Rotation));
@ -919,8 +919,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Update scale // Update scale
if(scaleoffsets) if(scaleoffsets)
{ {
fields["xscale" + si.Part] = new UniValue(UniversalType.Float, (float) Math.Round(si.Scale.x * scale.x, General.Map.FormatInterface.VertexDecimals)); fields["xscale" + si.Part] = new UniValue(UniversalType.Float, Math.Round(si.Scale.x * scale.x, General.Map.FormatInterface.VertexDecimals));
fields["yscale" + si.Part] = new UniValue(UniversalType.Float, (float) Math.Round(-si.Scale.y * scale.y, General.Map.FormatInterface.VertexDecimals)); fields["yscale" + si.Part] = new UniValue(UniversalType.Float, Math.Round(-si.Scale.y * scale.y, General.Map.FormatInterface.VertexDecimals));
} }
// Restore scale // Restore scale
else else

View file

@ -640,8 +640,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
fp = WorldToTex(fp); fp = WorldToTex(fp);
// Snap to the nearest left-top corner // Snap to the nearest left-top corner
fp.x = (float)Math.Floor(fp.x / texture.ScaledWidth) * texture.ScaledWidth; fp.x = Math.Floor(fp.x / texture.ScaledWidth) * texture.ScaledWidth;
fp.y = (float)Math.Ceiling(fp.y / texture.ScaledHeight) * texture.ScaledHeight; fp.y = Math.Ceiling(fp.y / texture.ScaledHeight) * texture.ScaledHeight;
// Now move the offset so that the 0,0 point is at this location // Now move the offset so that the 0,0 point is at this location
// We want to work with the 0,0 location because it makes things easier. // We want to work with the 0,0 location because it makes things easier.

View file

@ -290,11 +290,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
s.Fields.BeforeFieldsChange(); s.Fields.BeforeFieldsChange();
float sourceAngle = (float)Math.Round(General.ClampAngle(alignToFrontSide ? -Angle2D.RadToDeg(l.Angle) + 90 : -Angle2D.RadToDeg(l.Angle) - 90), 1); double sourceAngle = Math.Round(General.ClampAngle(alignToFrontSide ? -Angle2D.RadToDeg(l.Angle) + 90 : -Angle2D.RadToDeg(l.Angle) - 90), 1);
if(!alignToFrontSide) sourceAngle = General.ClampAngle(sourceAngle + 180); if(!alignToFrontSide) sourceAngle = General.ClampAngle(sourceAngle + 180);
//update angle //update angle
UniFields.SetFloat(s.Fields, (alignFloors ? "rotationfloor" : "rotationceiling"), sourceAngle, 0f); UniFields.SetFloat(s.Fields, (alignFloors ? "rotationfloor" : "rotationceiling"), sourceAngle, 0.0);
//update offset //update offset
Vector2D offset = (alignToFrontSide ? l.Start.Position : l.End.Position).GetRotated(Angle2D.DegToRad(sourceAngle)); Vector2D offset = (alignToFrontSide ? l.Start.Position : l.End.Position).GetRotated(Angle2D.DegToRad(sourceAngle));

View file

@ -2016,8 +2016,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Sector s in orderedselection) foreach(Sector s in orderedselection)
{ {
s.Fields.BeforeFieldsChange(); s.Fields.BeforeFieldsChange();
float u = index / (float) (orderedselection.Count - 1); double u = index / (orderedselection.Count - 1);
float b = (float)Math.Round(InterpolationTools.Interpolate(startbrightness, endbrightness, u, interpolationmode)); double b = Math.Round(InterpolationTools.Interpolate(startbrightness, endbrightness, u, interpolationmode));
//absolute flag set? //absolute flag set?
if(s.Fields.GetValue(lightAbsKey, false)) if(s.Fields.GetValue(lightAbsKey, false))

View file

@ -86,11 +86,11 @@ namespace CodeImp.DoomBuilder.BuilderModes
// the lines may be touching at the ends when sharing the same vertex. // the lines may be touching at the ends when sharing the same vertex.
if(General.Map.FormatInterface.VertexDecimals > 0) //mxd if(General.Map.FormatInterface.VertexDecimals > 0) //mxd
{ {
lu = (float)Math.Round(lu, General.Map.FormatInterface.VertexDecimals); lu = Math.Round(lu, General.Map.FormatInterface.VertexDecimals);
du = (float)Math.Round(du, General.Map.FormatInterface.VertexDecimals); du = Math.Round(du, General.Map.FormatInterface.VertexDecimals);
} }
if((lu > 0.0f) && (lu < 1.0f) && (du > 0.0f) && (du < 1.0f)) if((lu > 0.0) && (lu < 1.0) && (du > 0.0) && (du < 1.0))
{ {
// Check if not the same sector on all sides // Check if not the same sector on all sides
Sector samesector = null; Sector samesector = null;

View file

@ -48,7 +48,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach(Linedef l in block.Lines) foreach(Linedef l in block.Lines)
{ {
if(v == l.Start || v == l.End) continue; if(v == l.Start || v == l.End) continue;
if((float)Math.Round(l.Line.GetDistanceToLine(v.Position, true), 3) == 0) if(Math.Round(l.Line.GetDistanceToLine(v.Position, true), 3) == 0)
SubmitResult(new ResultVertexOverlappingLine(v, l)); SubmitResult(new ResultVertexOverlappingLine(v, l));
} }

View file

@ -189,13 +189,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
continue; continue;
// Not aligned if scaley is not equal // Not aligned if scaley is not equal
float targetscaley = GetSidedefValue(target, targetparttype, "scaley", 1.0f); double targetscaley = GetSidedefValue(target, targetparttype, "scaley", 1.0);
if(targetscaley != linescaley) if(targetscaley != linescaley)
{ {
SubmitResult(new ResultTexturesMisaligned(sidedef, target, texturename)); SubmitResult(new ResultTexturesMisaligned(sidedef, target, texturename));
} }
float targetscalex = GetSidedefValue(target, targetparttype, "scalex", 1.0f); double targetscalex = GetSidedefValue(target, targetparttype, "scalex", 1.0);
alignedY %= texture.Height; alignedY %= texture.Height;
if(alignedY < 0) alignedY += texture.Height; if(alignedY < 0) alignedY += texture.Height;
@ -238,7 +238,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
continue; continue;
// Not aligned if scaley is not equal // Not aligned if scaley is not equal
float targetscaley = GetSidedefValue(target, targetparttype, "scaley", 1.0f); double targetscaley = GetSidedefValue(target, targetparttype, "scaley", 1.0);
if(targetscaley != linescaley) if(targetscaley != linescaley)
{ {
SubmitResult(new ResultTexturesMisaligned(sidedef, target, texturename)); SubmitResult(new ResultTexturesMisaligned(sidedef, target, texturename));
@ -247,7 +247,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
alignedY %= texture.Height; alignedY %= texture.Height;
if(alignedY < 0) alignedY += texture.Height; if(alignedY < 0) alignedY += texture.Height;
int alignedX = (target.OffsetX + (int)GetSidedefValue(target, targetparttype, "offsetx", 0f) - (int)Math.Round(sidedef.Line.Length / scalex * linescalex)) % texture.Width; int alignedX = (target.OffsetX + (int)GetSidedefValue(target, targetparttype, "offsetx", 0.0) - (int)Math.Round(sidedef.Line.Length / scalex * linescalex)) % texture.Width;
if(alignedX < 0) alignedX += texture.Width; if(alignedX < 0) alignedX += texture.Width;
// Submit result if target offsets don't match expected ones // Submit result if target offsets don't match expected ones
@ -261,18 +261,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
private static float GetSidedefValue(Sidedef target, VisualGeometryType targetparttype, string key, float defaultvalue) private static double GetSidedefValue(Sidedef target, VisualGeometryType targetparttype, string key, double defaultvalue)
{ {
switch(targetparttype) switch(targetparttype)
{ {
case VisualGeometryType.WALL_UPPER: case VisualGeometryType.WALL_UPPER:
return (float)Math.Round(UniFields.GetFloat(target.Fields, key + "_top", defaultvalue), 3); return Math.Round(UniFields.GetFloat(target.Fields, key + "_top", defaultvalue), 3);
case VisualGeometryType.WALL_MIDDLE: case VisualGeometryType.WALL_MIDDLE:
return (float)Math.Round(UniFields.GetFloat(target.Fields, key + "_mid", defaultvalue), 3); return Math.Round(UniFields.GetFloat(target.Fields, key + "_mid", defaultvalue), 3);
case VisualGeometryType.WALL_LOWER: case VisualGeometryType.WALL_LOWER:
return (float)Math.Round(UniFields.GetFloat(target.Fields, key + "_bottom", defaultvalue), 3); return Math.Round(UniFields.GetFloat(target.Fields, key + "_bottom", defaultvalue), 3);
} }
return 0; return 0;

View file

@ -292,16 +292,16 @@ namespace CodeImp.DoomBuilder.BuilderModes
Sector.Sector.Fields.BeforeFieldsChange(); Sector.Sector.Fields.BeforeFieldsChange();
//find an angle to rotate texture //find an angle to rotate texture
float sourceAngle = (float)Math.Round(General.ClampAngle(isFront ? -Angle2D.RadToDeg(targetLine.Angle) + 90 : -Angle2D.RadToDeg(targetLine.Angle) - 90), 1); double sourceAngle = Math.Round(General.ClampAngle(isFront ? -Angle2D.RadToDeg(targetLine.Angle) + 90 : -Angle2D.RadToDeg(targetLine.Angle) - 90), 1);
if(!isFront) sourceAngle = General.ClampAngle(sourceAngle + 180); if(!isFront) sourceAngle = General.ClampAngle(sourceAngle + 180);
//update angle //update angle
UniFields.SetFloat(Sector.Sector.Fields, (isFloor ? "rotationfloor" : "rotationceiling"), sourceAngle, 0f); UniFields.SetFloat(Sector.Sector.Fields, (isFloor ? "rotationfloor" : "rotationceiling"), sourceAngle, 0.0);
// Scale texture if it's a slope and the appropriate option is set // Scale texture if it's a slope and the appropriate option is set
if (level.plane.Normal.z != 1.0f && BuilderPlug.Me.ScaleTexturesOnSlopes != 2) if (level.plane.Normal.z != 1.0f && BuilderPlug.Me.ScaleTexturesOnSlopes != 2)
{ {
Vector2D basescale = new Vector2D(1.0f, 1.0f); Vector2D basescale = new Vector2D(1.0, 1.0);
// User wants to use the current scale as a base? // User wants to use the current scale as a base?
if(BuilderPlug.Me.ScaleTexturesOnSlopes == 1) if(BuilderPlug.Me.ScaleTexturesOnSlopes == 1)
@ -325,8 +325,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
//set scale //set scale
UniFields.SetFloat(Sector.Sector.Fields, (isFloor ? "xscalefloor" : "xscaleceiling"), scaleX, 1.0f); UniFields.SetFloat(Sector.Sector.Fields, (isFloor ? "xscalefloor" : "xscaleceiling"), scaleX, 1.0);
UniFields.SetFloat(Sector.Sector.Fields, (isFloor ? "yscalefloor" : "yscaleceiling"), scaleY, 1.0f); UniFields.SetFloat(Sector.Sector.Fields, (isFloor ? "yscalefloor" : "yscaleceiling"), scaleY, 1.0);
//update offset //update offset
double distToStart = Vector2D.Distance(hitpos, targetLine.Start.Position); double distToStart = Vector2D.Distance(hitpos, targetLine.Start.Position);
@ -925,7 +925,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Set new angle // Set new angle
Sector s = GetControlSector(); Sector s = GetControlSector();
s.Fields.BeforeFieldsChange(); s.Fields.BeforeFieldsChange();
UniFields.SetFloat(s.Fields, key, angle, 0.0f); UniFields.SetFloat(s.Fields, key, angle, 0.0);
// Mark as changed // Mark as changed
changed = true; changed = true;

View file

@ -709,7 +709,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if (options.AutoWidth) if (options.AutoWidth)
{ {
horizontalrepeat = (float)Math.Round(linelength / patternwidth); horizontalrepeat = Math.Round(linelength / patternwidth);
if (horizontalrepeat == 0) if (horizontalrepeat == 0)
horizontalrepeat = 1.0f; horizontalrepeat = 1.0f;
@ -723,14 +723,14 @@ namespace CodeImp.DoomBuilder.BuilderModes
offsetx = -Sidedef.OffsetX - options.ControlSideOffsetX; offsetx = -Sidedef.OffsetX - options.ControlSideOffsetX;
} }
UniFields.SetFloat(controlside.Fields, "scalex_" + partname, (float)Math.Round(scalex, General.Map.FormatInterface.VertexDecimals), 1.0f); UniFields.SetFloat(controlside.Fields, "scalex_" + partname, Math.Round(scalex, General.Map.FormatInterface.VertexDecimals), 1.0);
UniFields.SetFloat(Sidedef.Fields, "offsetx_" + partname, offsetx, 0.0f); UniFields.SetFloat(Sidedef.Fields, "offsetx_" + partname, offsetx, 0.0);
} }
else else
{ {
// Restore initial offsets // Restore initial offsets
UniFields.SetFloat(controlside.Fields, "scalex_" + partname, options.InitialScaleX, 1.0f); UniFields.SetFloat(controlside.Fields, "scalex_" + partname, options.InitialScaleX, 1.0);
UniFields.SetFloat(Sidedef.Fields, "offsetx_" + partname, options.InitialOffsetX, 0.0f); UniFields.SetFloat(Sidedef.Fields, "offsetx_" + partname, options.InitialOffsetX, 0.0);
} }
// Fit height // Fit height
@ -746,7 +746,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if (options.AutoHeight) if (options.AutoHeight)
{ {
verticalrepeat = (float)Math.Round((float)options.GlobalBounds.Height / patternheight); verticalrepeat = Math.Round((float)options.GlobalBounds.Height / patternheight);
if (verticalrepeat == 0) if (verticalrepeat == 0)
verticalrepeat = 1.0f; verticalrepeat = 1.0f;
@ -755,7 +755,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
verticalrepeat /= Texture.Height / patternheight; verticalrepeat /= Texture.Height / patternheight;
} }
scaley = Texture.ScaledHeight / (options.Bounds.Height * ((float)options.GlobalBounds.Height / options.Bounds.Height)) * verticalrepeat; scaley = Texture.ScaledHeight / (options.Bounds.Height * ((double)options.GlobalBounds.Height / options.Bounds.Height)) * verticalrepeat;
if(this is VisualLower) // Special cases, special cases... if(this is VisualLower) // Special cases, special cases...
{ {
@ -778,10 +778,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if (options.AutoHeight) if (options.AutoHeight)
{ {
verticalrepeat = (float)Math.Round((float)options.Bounds.Height / patternheight); verticalrepeat = Math.Round((double)options.Bounds.Height / patternheight);
if (verticalrepeat == 0) if (verticalrepeat == 0)
verticalrepeat = 1.0f; verticalrepeat = 1.0;
if (options.PatternHeight > 0) if (options.PatternHeight > 0)
verticalrepeat /= Texture.Height / patternheight; verticalrepeat /= Texture.Height / patternheight;
@ -801,15 +801,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
UniFields.SetFloat(controlside.Fields, "scaley_" + partname, (float)Math.Round(scaley, General.Map.FormatInterface.VertexDecimals), 1.0f); UniFields.SetFloat(controlside.Fields, "scaley_" + partname, (float)Math.Round(scaley, General.Map.FormatInterface.VertexDecimals), 1.0);
UniFields.SetFloat(Sidedef.Fields, "offsety_" + partname, (float)Math.Round(offsety, General.Map.FormatInterface.VertexDecimals), 0.0f); UniFields.SetFloat(Sidedef.Fields, "offsety_" + partname, (float)Math.Round(offsety, General.Map.FormatInterface.VertexDecimals), 0.0);
} }
} }
else else
{ {
// Restore initial offsets // Restore initial offsets
UniFields.SetFloat(controlside.Fields, "scaley_" + partname, options.InitialScaleY, 1.0f); UniFields.SetFloat(controlside.Fields, "scaley_" + partname, options.InitialScaleY, 1.0);
UniFields.SetFloat(Sidedef.Fields, "offsety_" + partname, options.InitialOffsetY, 0.0f); UniFields.SetFloat(Sidedef.Fields, "offsety_" + partname, options.InitialOffsetY, 0.0);
} }
} }

View file

@ -618,8 +618,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
if(coordinates.Length == 0) return null; if(coordinates.Length == 0) return null;
direction.x = (float)Math.Round(direction.x); direction.x = Math.Round(direction.x);
direction.y = (float)Math.Round(direction.y); direction.y = Math.Round(direction.y);
Vector3D[] translatedCoords = new Vector3D[coordinates.Length]; Vector3D[] translatedCoords = new Vector3D[coordinates.Length];
@ -667,7 +667,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
//move them //move them
for(int i = 0; i < coordinates.Length; i++) for(int i = 0; i < coordinates.Length; i++)
translatedCoords[i] = new Vector3D((float)Math.Round(direction.x - (selectionCenter.x - coordinates[i].x)), (float)Math.Round(direction.y - (selectionCenter.y - coordinates[i].y)), (float)Math.Round(coordinates[i].z)); translatedCoords[i] = new Vector3D(Math.Round(direction.x - (selectionCenter.x - coordinates[i].x)), Math.Round(direction.y - (selectionCenter.y - coordinates[i].y)), Math.Round(coordinates[i].z));
return translatedCoords; return translatedCoords;
} }
@ -4487,18 +4487,18 @@ namespace CodeImp.DoomBuilder.BuilderModes
//mxd. Apply Scale //mxd. Apply Scale
if(matchtop) if(matchtop)
{ {
UniFields.SetFloat(j.sidedef.Fields, "scalex_top", first.scaleX, 1.0f); UniFields.SetFloat(j.sidedef.Fields, "scalex_top", first.scaleX, 1.0);
UniFields.SetFloat(j.sidedef.Fields, "scaley_top", j.scaleY, 1.0f); UniFields.SetFloat(j.sidedef.Fields, "scaley_top", j.scaleY, 1.0);
} }
if(matchmid) if(matchmid)
{ {
UniFields.SetFloat(j.controlSide.Fields, "scalex_mid", first.scaleX, 1.0f); UniFields.SetFloat(j.controlSide.Fields, "scalex_mid", first.scaleX, 1.0);
UniFields.SetFloat(j.controlSide.Fields, "scaley_mid", j.scaleY, 1.0f); UniFields.SetFloat(j.controlSide.Fields, "scaley_mid", j.scaleY, 1.0);
} }
if(matchbottom) if(matchbottom)
{ {
UniFields.SetFloat(j.sidedef.Fields, "scalex_bottom", first.scaleX, 1.0f); UniFields.SetFloat(j.sidedef.Fields, "scalex_bottom", first.scaleX, 1.0);
UniFields.SetFloat(j.sidedef.Fields, "scaley_bottom", j.scaleY, 1.0f); UniFields.SetFloat(j.sidedef.Fields, "scaley_bottom", j.scaleY, 1.0);
} }
if(j.forward) if(j.forward)
@ -4615,7 +4615,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
j.sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float, j.sidedef.Fields["offsety_mid"] = new UniValue(UniversalType.Float,
(float)Math.Round(offset, General.Map.FormatInterface.VertexDecimals)); //mxd Math.Round(offset, General.Map.FormatInterface.VertexDecimals)); //mxd
} }
} }
} }
@ -4626,12 +4626,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// If the texture gets replaced with a "hires" texture it adds more fuckery // If the texture gets replaced with a "hires" texture it adds more fuckery
if (texture is HiResImage) if (texture is HiResImage)
forwardoffset = j.offsetx + (float)Math.Round(((float)Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals); forwardoffset = j.offsetx + Math.Round((Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals);
else else
forwardoffset = j.offsetx + (float)Math.Round(((float)Math.Round(j.sidedef.Line.Length) / scalex * Math.Abs(first.scaleX)) % vwidth, General.Map.FormatInterface.VertexDecimals); forwardoffset = j.offsetx + Math.Round((Math.Round(j.sidedef.Line.Length) / scalex * Math.Abs(first.scaleX)) % vwidth, General.Map.FormatInterface.VertexDecimals);
} }
else else
forwardoffset = (float)Math.Round((j.offsetx + (float)Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals); forwardoffset = Math.Round((j.offsetx + Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals);
// Done this sidedef // Done this sidedef
j.sidedef.Marked = true; j.sidedef.Marked = true;
@ -4656,12 +4656,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// If the texture gets replaced with a "hires" texture it adds more fuckery // If the texture gets replaced with a "hires" texture it adds more fuckery
if (texture is HiResImage) if (texture is HiResImage)
offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals); offset = Math.Round((j.offsetx - j.sidedef.OffsetX - Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals);
else else
offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length) / scalex * first.scaleX) % vwidth, General.Map.FormatInterface.VertexDecimals); offset = Math.Round((j.offsetx - j.sidedef.OffsetX - Math.Round(j.sidedef.Line.Length) / scalex * first.scaleX) % vwidth, General.Map.FormatInterface.VertexDecimals);
} }
else else
offset = (float)Math.Round((j.offsetx - j.sidedef.OffsetX - (float)Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals); offset = Math.Round((j.offsetx - j.sidedef.OffsetX - Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals);
if(matchtop) if(matchtop)
{ {
@ -4731,7 +4731,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
else else
{ {
ImageData tex = General.Map.Data.GetTextureImage(j.sidedef.LongMiddleTexture); ImageData tex = General.Map.Data.GetTextureImage(j.sidedef.LongMiddleTexture);
double scale = !worldpanning ? j.scaleY / scaley : 1.0f; double scale = !worldpanning ? j.scaleY / scaley : 1.0;
offset = Tools.GetSidedefMiddleOffsetY(j.sidedef, offset, scale, true); offset = Tools.GetSidedefMiddleOffsetY(j.sidedef, offset, scale, true);
if(tex != null && tex.IsImageLoaded) if(tex != null && tex.IsImageLoaded)
@ -4778,12 +4778,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
// If the texture gets replaced with a "hires" texture it adds more fuckery // If the texture gets replaced with a "hires" texture it adds more fuckery
if (texture is HiResImage) if (texture is HiResImage)
backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals); backwardoffset = Math.Round((j.offsetx - Math.Round(j.sidedef.Line.Length) / scalex) % vwidth, General.Map.FormatInterface.VertexDecimals);
else else
backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length) / scalex * Math.Abs(first.scaleX)) % vwidth, General.Map.FormatInterface.VertexDecimals); backwardoffset = Math.Round((j.offsetx - Math.Round(j.sidedef.Line.Length) / scalex * Math.Abs(first.scaleX)) % vwidth, General.Map.FormatInterface.VertexDecimals);
} }
else else
backwardoffset = (float)Math.Round((j.offsetx - (float)Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals); backwardoffset = Math.Round((j.offsetx - Math.Round(j.sidedef.Line.Length)) % vwidth, General.Map.FormatInterface.VertexDecimals);
// Done this sidedef // Done this sidedef
j.sidedef.Marked = true; j.sidedef.Marked = true;

View file

@ -813,15 +813,15 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementX != 0) if(incrementX != 0)
{ {
float pix = (int)Math.Round(sprite.Width * scaleX) + incrementX; double pix = (int)Math.Round(sprite.Width * scaleX) + incrementX;
float newscaleX = (float)Math.Round(pix / sprite.Width, 3); double newscaleX = Math.Round(pix / sprite.Width, 3);
scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX); scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
} }
if(incrementY != 0) if(incrementY != 0)
{ {
float pix = (int)Math.Round(sprite.Height * scaleY) + incrementY; double pix = (int)Math.Round(sprite.Height * scaleY) + incrementY;
float newscaleY = (float)Math.Round(pix / sprite.Height, 3); double newscaleY = Math.Round(pix / sprite.Height, 3);
scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY); scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
} }

View file

@ -93,7 +93,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
double angle = Angle2D.DoomToReal((int)Angle2D.RadToDeg(t.Angle)); double angle = Angle2D.DoomToReal((int)Angle2D.RadToDeg(t.Angle));
double vangle = Angle2D.DegToRad(General.Clamp(t.Args[0], 0, 180)); //mxd. Don't underestimate user stupidity (or curiosity)! double vangle = Angle2D.DegToRad(General.Clamp(t.Args[0], 0, 180)); //mxd. Don't underestimate user stupidity (or curiosity)!
Vector2D point = new Vector2D(t.Position.x + (float)Math.Cos(angle) * (float)Math.Sin(vangle), t.Position.y + (float)Math.Sin(angle) * (float)Math.Sin(vangle)); Vector2D point = new Vector2D(t.Position.x + Math.Cos(angle) * Math.Sin(vangle), t.Position.y + Math.Sin(angle) * Math.Sin(vangle));
Vector2D perpendicular = new Line2D(t.Position, point).GetPerpendicular(); Vector2D perpendicular = new Line2D(t.Position, point).GetPerpendicular();
Vector3D v1 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + t.Sector.CeilHeight); Vector3D v1 = new Vector3D(t.Position.x, t.Position.y, t.Position.z + t.Sector.CeilHeight);
@ -101,13 +101,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
Vector3D v2 = new Vector3D( Vector3D v2 = new Vector3D(
point.x + perpendicular.x, point.x + perpendicular.x,
point.y + perpendicular.y, point.y + perpendicular.y,
t.Position.z + t.Sector.CeilHeight + (float)Math.Cos(vangle) t.Position.z + t.Sector.CeilHeight + Math.Cos(vangle)
); );
Vector3D v3 = new Vector3D( Vector3D v3 = new Vector3D(
point.x - perpendicular.x, point.x - perpendicular.x,
point.y - perpendicular.y, point.y - perpendicular.y,
t.Position.z + t.Sector.CeilHeight + (float)Math.Cos(vangle) t.Position.z + t.Sector.CeilHeight + Math.Cos(vangle)
); );
SectorData sd = data.Mode.GetSectorData(t.Sector); SectorData sd = data.Mode.GetSectorData(t.Sector);

View file

@ -26,7 +26,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(x == y) return 0; //mxd if(x == y) return 0; //mxd
//mxd. Handle surfaces with the same height //mxd. Handle surfaces with the same height
float diff = (float)Math.Round(x.plane.GetZ(center) - y.plane.GetZ(center), 3); double diff = Math.Round(x.plane.GetZ(center) - y.plane.GetZ(center), 3);
if(diff == 0) if(diff == 0)
{ {
bool xislight = (x.type == SectorLevelType.Light || x.type == SectorLevelType.Glow); bool xislight = (x.type == SectorLevelType.Light || x.type == SectorLevelType.Glow);

View file

@ -315,7 +315,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
double pix = (int)Math.Round(Texture.Width * scaleX) - incrementX; double pix = (int)Math.Round(Texture.Width * scaleX) - incrementX;
double newscaleX = Math.Round(pix / Texture.Width, 3); double newscaleX = Math.Round(pix / Texture.Width, 3);
scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX); scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
UniFields.SetFloat(s.Fields, "xscaleceiling", scaleX, 1.0f); UniFields.SetFloat(s.Fields, "xscaleceiling", scaleX, 1.0);
} }
if(incrementY != 0) if(incrementY != 0)
@ -323,7 +323,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
double pix = (int)Math.Round(Texture.Height * scaleY) - incrementY; double pix = (int)Math.Round(Texture.Height * scaleY) - incrementY;
double newscaleY = Math.Round(pix / Texture.Height, 3); double newscaleY = Math.Round(pix / Texture.Height, 3);
scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY); scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
UniFields.SetFloat(s.Fields, "yscaleceiling", scaleY, 1.0f); UniFields.SetFloat(s.Fields, "yscaleceiling", scaleY, 1.0);
} }
mode.SetActionResult("Ceiling scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ")."); mode.SetActionResult("Ceiling scale changed to " + scaleX.ToString("F03", CultureInfo.InvariantCulture) + ", " + scaleY.ToString("F03", CultureInfo.InvariantCulture) + " (" + (int)Math.Round(Texture.Width / scaleX) + " x " + (int)Math.Round(Texture.Height / scaleY) + ").");

View file

@ -273,7 +273,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementX != 0) if(incrementX != 0)
{ {
double pix = (int)Math.Round(Texture.Width * scaleX) - incrementX; double pix = (int)Math.Round(Texture.Width * scaleX) - incrementX;
double newscaleX = (float)Math.Round(pix / Texture.Width, 3); double newscaleX = Math.Round(pix / Texture.Width, 3);
scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX); scaleX = (newscaleX == 0 ? scaleX * -1 : newscaleX);
UniFields.SetFloat(s.Fields, "xscalefloor", scaleX, 1.0); UniFields.SetFloat(s.Fields, "xscalefloor", scaleX, 1.0);
} }
@ -281,7 +281,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(incrementY != 0) if(incrementY != 0)
{ {
double pix = (int)Math.Round(Texture.Height * scaleY) - incrementY; double pix = (int)Math.Round(Texture.Height * scaleY) - incrementY;
double newscaleY = (float)Math.Round(pix / Texture.Height, 3); double newscaleY = Math.Round(pix / Texture.Height, 3);
scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY); scaleY = (newscaleY == 0 ? scaleY * -1 : newscaleY);
UniFields.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0); UniFields.SetFloat(s.Fields, "yscalefloor", scaleY, 1.0);
} }

View file

@ -152,21 +152,21 @@ namespace CodeImp.DoomBuilder.BuilderModes
// NOTE: I use a small bias for the floor height, because if the difference in // NOTE: I use a small bias for the floor height, because if the difference in
// height is 0 then the TexturePlane doesn't work! // height is 0 then the TexturePlane doesn't work!
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
float floorbias = (Sidedef.Other.Sector.FloorHeight == Sidedef.Sector.FloorHeight) ? 1.0f : 0.0f; double floorbias = (Sidedef.Other.Sector.FloorHeight == Sidedef.Sector.FloorHeight) ? 1.0 : 0.0;
if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag)) if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag))
{ {
if(Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName && Sidedef.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName) if(Sidedef.Sector.CeilTexture == General.Map.Config.SkyFlatName && Sidedef.Other.Sector.CeilTexture == General.Map.Config.SkyFlatName)
{ {
// mxd. Replicate Doom texture offset glitch when front and back sector's ceilings are sky // mxd. Replicate Doom texture offset glitch when front and back sector's ceilings are sky
tp.tlt.y = (float)Sidedef.Other.Sector.CeilHeight - Sidedef.Other.Sector.FloorHeight; tp.tlt.y = (double)Sidedef.Other.Sector.CeilHeight - Sidedef.Other.Sector.FloorHeight;
} }
else else
{ {
// When lower unpegged is set, the lower texture is bound to the bottom // When lower unpegged is set, the lower texture is bound to the bottom
tp.tlt.y = (float) Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.FloorHeight; tp.tlt.y = (double) Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.FloorHeight;
} }
} }
tp.trb.x = tp.tlt.x + (float)Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length tp.trb.x = tp.tlt.x + Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length
tp.trb.y = tp.tlt.y + (Sidedef.Other.Sector.FloorHeight - (Sidedef.Sector.FloorHeight + floorbias)); tp.trb.y = tp.tlt.y + (Sidedef.Other.Sector.FloorHeight - (Sidedef.Sector.FloorHeight + floorbias));
// Apply texture offset // Apply texture offset

View file

@ -165,8 +165,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// For Vavoom type 3D floors the ceiling is lower than floor and they are reversed. // For Vavoom type 3D floors the ceiling is lower than floor and they are reversed.
// We choose here. // We choose here.
float sourcetopheight = extrafloor.VavoomType ? sourceside.Sector.FloorHeight : sourceside.Sector.CeilHeight; double sourcetopheight = extrafloor.VavoomType ? sourceside.Sector.FloorHeight : sourceside.Sector.CeilHeight;
float sourcebottomheight = extrafloor.VavoomType ? sourceside.Sector.CeilHeight : sourceside.Sector.FloorHeight; double sourcebottomheight = extrafloor.VavoomType ? sourceside.Sector.CeilHeight : sourceside.Sector.FloorHeight;
// Determine texture coordinates plane as they would be in normal circumstances. // Determine texture coordinates plane as they would be in normal circumstances.
// We can then use this plane to find any texture coordinate we need. // We can then use this plane to find any texture coordinate we need.
@ -175,9 +175,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// NOTE: I use a small bias for the floor height, because if the difference in // NOTE: I use a small bias for the floor height, because if the difference in
// height is 0 then the TexturePlane doesn't work! // height is 0 then the TexturePlane doesn't work!
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
float floorbias = (sourcetopheight == sourcebottomheight) ? 1.0f : 0.0f; double floorbias = (sourcetopheight == sourcebottomheight) ? 1.0f : 0.0f;
tp.trb.x = tp.tlt.x + (float)Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length tp.trb.x = tp.tlt.x + Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length
tp.trb.y = tp.tlt.y + (sourcetopheight - sourcebottomheight) + floorbias; tp.trb.y = tp.tlt.y + (sourcetopheight - sourcebottomheight) + floorbias;
// Apply texture offset // Apply texture offset

View file

@ -112,8 +112,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// For Vavoom type 3D floors the ceiling is lower than floor and they are reversed. // For Vavoom type 3D floors the ceiling is lower than floor and they are reversed.
// We choose here. // We choose here.
float sourcetopheight = extrafloor.VavoomType ? sourceside.Sector.FloorHeight : sourceside.Sector.CeilHeight; double sourcetopheight = extrafloor.VavoomType ? sourceside.Sector.FloorHeight : sourceside.Sector.CeilHeight;
float sourcebottomheight = extrafloor.VavoomType ? sourceside.Sector.CeilHeight : sourceside.Sector.FloorHeight; double sourcebottomheight = extrafloor.VavoomType ? sourceside.Sector.CeilHeight : sourceside.Sector.FloorHeight;
// Determine texture coordinates plane as they would be in normal circumstances. // Determine texture coordinates plane as they would be in normal circumstances.
// We can then use this plane to find any texture coordinate we need. // We can then use this plane to find any texture coordinate we need.
@ -122,9 +122,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
// NOTE: I use a small bias for the floor height, because if the difference in // NOTE: I use a small bias for the floor height, because if the difference in
// height is 0 then the TexturePlane doesn't work! // height is 0 then the TexturePlane doesn't work!
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
float floorbias = (sourcetopheight == sourcebottomheight) ? 1.0f : 0.0f; double floorbias = (sourcetopheight == sourcebottomheight) ? 1.0 : 0.0;
tp.trb.x = tp.tlt.x + (float)Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length tp.trb.x = tp.tlt.x + Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length
tp.trb.y = tp.tlt.y + (sourcetopheight - sourcebottomheight) + floorbias; tp.trb.y = tp.tlt.y + (sourcetopheight - sourcebottomheight) + floorbias;
// Apply texture offset // Apply texture offset

View file

@ -152,17 +152,17 @@ namespace CodeImp.DoomBuilder.BuilderModes
// NOTE: I use a small bias for the floor height, because if the difference in // NOTE: I use a small bias for the floor height, because if the difference in
// height is 0 then the TexturePlane doesn't work! // height is 0 then the TexturePlane doesn't work!
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
float floorbias = (Sidedef.Sector.CeilHeight == Sidedef.Sector.FloorHeight) ? 1.0f : 0.0f; double floorbias = (Sidedef.Sector.CeilHeight == Sidedef.Sector.FloorHeight) ? 1.0 : 0.0;
float geotop = Math.Min(Sidedef.Sector.CeilHeight, Sidedef.Other.Sector.CeilHeight); double geotop = Math.Min(Sidedef.Sector.CeilHeight, Sidedef.Other.Sector.CeilHeight);
float geobottom = Math.Max(Sidedef.Sector.FloorHeight, Sidedef.Other.Sector.FloorHeight); double geobottom = Math.Max(Sidedef.Sector.FloorHeight, Sidedef.Other.Sector.FloorHeight);
float zoffset = Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.CeilHeight; //mxd double zoffset = Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.CeilHeight; //mxd
// When lower unpegged is set, the middle texture is bound to the bottom // When lower unpegged is set, the middle texture is bound to the bottom
if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag)) if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag))
tp.tlt.y = tsz.y - (geotop - geobottom); tp.tlt.y = tsz.y - (geotop - geobottom);
if(zoffset > 0) tp.tlt.y -= zoffset; //mxd if(zoffset > 0) tp.tlt.y -= zoffset; //mxd
tp.trb.x = tp.tlt.x + (float)Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length tp.trb.x = tp.tlt.x + Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length
tp.trb.y = tp.tlt.y + (Sidedef.Sector.CeilHeight - (Sidedef.Sector.FloorHeight + floorbias)); tp.trb.y = tp.tlt.y + (Sidedef.Sector.CeilHeight - (Sidedef.Sector.FloorHeight + floorbias));
// Apply texture offset // Apply texture offset

View file

@ -138,13 +138,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// NOTE: I use a small bias for the floor height, because if the difference in // NOTE: I use a small bias for the floor height, because if the difference in
// height is 0 then the TexturePlane doesn't work! // height is 0 then the TexturePlane doesn't work!
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
float floorbias = (Sidedef.Sector.CeilHeight == Sidedef.Sector.FloorHeight) ? 1.0f : 0.0f; double floorbias = (Sidedef.Sector.CeilHeight == Sidedef.Sector.FloorHeight) ? 1.0 : 0.0;
if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag)) if(Sidedef.Line.IsFlagSet(General.Map.Config.LowerUnpeggedFlag))
{ {
// When lower unpegged is set, the middle texture is bound to the bottom // When lower unpegged is set, the middle texture is bound to the bottom
tp.tlt.y = tsz.y - (Sidedef.Sector.CeilHeight - Sidedef.Sector.FloorHeight); tp.tlt.y = tsz.y - (Sidedef.Sector.CeilHeight - Sidedef.Sector.FloorHeight);
} }
tp.trb.x = tp.tlt.x + (float)Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length tp.trb.x = tp.tlt.x + Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length
tp.trb.y = tp.tlt.y + (Sidedef.Sector.CeilHeight - (Sidedef.Sector.FloorHeight + floorbias)); tp.trb.y = tp.tlt.y + (Sidedef.Sector.CeilHeight - (Sidedef.Sector.FloorHeight + floorbias));
// Apply texture offset // Apply texture offset

View file

@ -153,13 +153,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
// NOTE: I use a small bias for the floor height, because if the difference in // NOTE: I use a small bias for the floor height, because if the difference in
// height is 0 then the TexturePlane doesn't work! // height is 0 then the TexturePlane doesn't work!
TexturePlane tp = new TexturePlane(); TexturePlane tp = new TexturePlane();
float ceilbias = (Sidedef.Other.Sector.CeilHeight == Sidedef.Sector.CeilHeight) ? 1.0f : 0.0f; double ceilbias = (Sidedef.Other.Sector.CeilHeight == Sidedef.Sector.CeilHeight) ? 1.0 : 0.0;
if(!Sidedef.Line.IsFlagSet(General.Map.Config.UpperUnpeggedFlag)) if(!Sidedef.Line.IsFlagSet(General.Map.Config.UpperUnpeggedFlag))
{ {
// When lower unpegged is set, the lower texture is bound to the bottom // When lower unpegged is set, the lower texture is bound to the bottom
tp.tlt.y = tsz.y - ((float)Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.CeilHeight); tp.tlt.y = tsz.y - (Sidedef.Sector.CeilHeight - Sidedef.Other.Sector.CeilHeight);
} }
tp.trb.x = tp.tlt.x + (float)Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length tp.trb.x = tp.tlt.x + Math.Round(Sidedef.Line.Length); //mxd. (G)ZDoom snaps texture coordinates to integral linedef length
tp.trb.y = tp.tlt.y + (Sidedef.Sector.CeilHeight - (Sidedef.Other.Sector.CeilHeight + ceilbias)); tp.trb.y = tp.tlt.y + (Sidedef.Sector.CeilHeight - (Sidedef.Other.Sector.CeilHeight + ceilbias));
// Apply texture offset // Apply texture offset

View file

@ -1070,7 +1070,7 @@ namespace CodeImp.DoomBuilder.StairSectorBuilderMode
v.stitch = true; v.stitch = true;
v.stitchline = true; v.stitchline = true;
v.pos = new Vector2D((float)Math.Round(x, General.Map.FormatInterface.VertexDecimals), (float)Math.Round(y, General.Map.FormatInterface.VertexDecimals)); v.pos = new Vector2D(Math.Round(x, General.Map.FormatInterface.VertexDecimals), Math.Round(y, General.Map.FormatInterface.VertexDecimals));
return v; return v;
} }