UltimateZoneBuilder/Source/Plugins/BuilderModes/VisualModes/SectorLevelComparer.cs
MaxED 133e1367d8 Sector drawing: basic properties (textures, brightness, floor and ceiling height) are now taken from the nearest sector when a new isolated sector (e.g. a sector, which doesn't not intersect with already existing map geometry and is not inside of it) is drawn.
Visual mode: when "Synch camera position" setting is enabled, and the cursor was outside of a sector when entering Visual mode, camera height is now adjusted based on nearest sector (previously the height was adjusted only when the cursor was inside of a sector).  
"Auto-align textures X", "Auto-align textures X and Y" actions, UDMF: alignment source sidedef part's horizontal scale is now applied to all aligned sidedefs.
Visual mode, UDMF: 'lightfog' flag is now automatically updated when changing sidedef brightness or using "Match Brightness" action. 
Linedefs mode: added "Update 'lightfog' flag" menu item.
Game configurations: cosmetic changes in UDMF linedef flag names.
Updated ZDoom_DECORATE.cfg.
2015-02-12 22:04:49 +00:00

29 lines
753 B
C#

#region === Copyright (c) 2010 Pascal van der Heiden ===
using System;
using System.Collections.Generic;
using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.BuilderModes
{
internal class SectorLevelComparer : IComparer<SectorLevel>
{
// Center of sector to use for plane comparison
public Vector2D center;
// Constructor
public SectorLevelComparer(Sector s)
{
this.center = new Vector2D(s.BBox.Left + s.BBox.Width / 2, s.BBox.Top + s.BBox.Height / 2);
}
// Comparer
public int Compare(SectorLevel x, SectorLevel y)
{
return (x == y ? 0 : Math.Sign(x.plane.GetZ(center) - y.plane.GetZ(center))); //mxd. Added equality check
}
}
}