mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 22:01:45 +00:00
20bb7fd119
Updated to Doom Builder 2 SVN rev. 1549.
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Globalization;
|
|
using System.Text;
|
|
using CodeImp.DoomBuilder.Geometry;
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
#endregion
|
|
|
|
namespace CodeImp.DoomBuilder.Plugins.VisplaneExplorer
|
|
{
|
|
internal sealed class NearestLineBlockmap : BlockMap<BlockEntry>
|
|
{
|
|
// Constructor
|
|
public NearestLineBlockmap(RectangleF range) : base(range)
|
|
{
|
|
List<Linedef> singlesided = new List<Linedef>(General.Map.Map.Linedefs.Count);
|
|
foreach(Linedef ld in General.Map.Map.Linedefs)
|
|
if(ld.Back == null) singlesided.Add(ld);
|
|
AddLinedefsSet(singlesided);
|
|
|
|
// Blocks that do not have any linedefs in them must get the nearest line in them!
|
|
for(int x = 0; x < size.Width; x++)
|
|
{
|
|
for(int y = 0; y < size.Height; y++)
|
|
{
|
|
BlockEntry be = blockmap[x, y];
|
|
if(be.Lines.Count == 0)
|
|
{
|
|
Vector2D bc = GetBlockCenter(new Point(x, y));
|
|
Linedef ld = MapSet.NearestLinedef(singlesided, bc);
|
|
be.Lines.Add(ld);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|