mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 12:22:35 +00:00
- Fixed vertical grid lines being 1 pixel off in their horizontal position
- Fixed a bug where lines with 3D floor indicators were 1 pixel off in their horizontal position
This commit is contained in:
parent
12fd006c61
commit
c46e548a73
2 changed files with 11 additions and 11 deletions
|
@ -380,26 +380,26 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
}
|
||||
|
||||
//mxd
|
||||
public void DrawLine3DFloor(Vector2D start, Vector2D end, ref PixelColor c, PixelColor c2)
|
||||
public void DrawLine3DFloor(int x1, int y1, int x2, int y2, ref PixelColor c, PixelColor c2)
|
||||
{
|
||||
Vector2D delta = end - start;
|
||||
float length = delta.GetLength();
|
||||
float length = (float)Math.Sqrt(((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1)));
|
||||
|
||||
if (length < DASH_INTERVAL * 2)
|
||||
{
|
||||
DrawLineSolid((int)start.x, (int)start.y, (int)end.x, (int)end.y, ref c2);
|
||||
DrawLineSolid(x1, y1, x2, y2, ref c2);
|
||||
}
|
||||
else
|
||||
{
|
||||
float d1 = DASH_INTERVAL / length;
|
||||
float d2 = 1.0f - d1;
|
||||
|
||||
Vector2D p1 = CurveTools.GetPointOnLine(start, end, d1);
|
||||
Vector2D p2 = CurveTools.GetPointOnLine(start, end, d2);
|
||||
Line2D l = new Line2D(x1, y1, x2, y2);
|
||||
Vector2D p1 = l.GetCoordinatesAt(d1);
|
||||
Vector2D p2 = l.GetCoordinatesAt(d2);
|
||||
|
||||
DrawLineSolid((int)start.x, (int)start.y, (int)p1.x, (int)p1.y, ref c2);
|
||||
DrawLineSolid(x1, y1, (int)p1.x, (int)p1.y, ref c2);
|
||||
DrawLineSolid((int)p1.x, (int)p1.y, (int)p2.x, (int)p2.y, ref c);
|
||||
DrawLineSolid((int)p2.x, (int)p2.y, (int)end.x, (int)end.y, ref c2);
|
||||
DrawLineSolid((int)p2.x, (int)p2.y, x2, y2, ref c2);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -977,7 +977,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
pos.y = y;
|
||||
pos = pos.GetTransformed(translatex, translatey, scale, -scale);
|
||||
|
||||
gridplotter.DrawGridLineH((int)pos.y, (int)Math.Round(from + 0.49999f), (int)Math.Round(to + 0.49999f), ref c);
|
||||
gridplotter.DrawGridLineH((int)Math.Round(pos.y + 0.49999f), (int)from, (int)to, ref c);
|
||||
}
|
||||
|
||||
// Draw all vertical grid lines
|
||||
|
@ -2074,7 +2074,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Draw line. mxd: added 3d-floor indication
|
||||
if(l.ExtraFloorFlag && General.Settings.GZMarkExtraFloors)
|
||||
plotter.DrawLine3DFloor(TransformY(v1), TransformY(v2), ref c, General.Colors.ThreeDFloor);
|
||||
plotter.DrawLine3DFloor((int)v1.x, TransformY((int)v1.y), (int)v2.x, TransformY((int)v2.y), ref c, General.Colors.ThreeDFloor);
|
||||
else
|
||||
plotter.DrawLineSolid((int)v1.x, TransformY((int)v1.y), (int)v2.x, TransformY((int)v2.y), ref c);
|
||||
|
||||
|
@ -2110,7 +2110,7 @@ namespace CodeImp.DoomBuilder.Rendering
|
|||
|
||||
// Draw line. mxd: added 3d-floor indication
|
||||
if(l.ExtraFloorFlag && General.Settings.GZMarkExtraFloors)
|
||||
plotter.DrawLine3DFloor(TransformY(v1), TransformY(v2), ref c, General.Colors.ThreeDFloor);
|
||||
plotter.DrawLine3DFloor((int)v1.x, TransformY((int)v1.y), (int)v2.x, TransformY((int)v2.y), ref c, General.Colors.ThreeDFloor);
|
||||
else
|
||||
plotter.DrawLineSolid((int)v1.x, TransformY((int)v1.y), (int)v2.x, TransformY((int)v2.y), ref c);
|
||||
|
||||
|
|
Loading…
Reference in a new issue