2010-09-02 20:42:38 +00:00
|
|
|
#region === Copyright (c) 2010 Pascal van der Heiden ===
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Globalization;
|
|
|
|
using System.Text;
|
|
|
|
using CodeImp.DoomBuilder.Geometry;
|
2010-09-03 15:12:07 +00:00
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
2010-09-02 20:42:38 +00:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.GZDoomEditing
|
|
|
|
{
|
2010-09-03 15:12:07 +00:00
|
|
|
internal class SectorLevel : IComparable<SectorLevel>
|
2010-09-02 20:42:38 +00:00
|
|
|
{
|
2010-09-03 15:12:07 +00:00
|
|
|
// Center of sector to use for plane comparison
|
2010-09-04 11:19:37 +00:00
|
|
|
public Vector2D center;
|
2010-09-03 15:12:07 +00:00
|
|
|
|
2010-09-02 20:42:38 +00:00
|
|
|
// Type of level
|
|
|
|
public SectorLevelType type;
|
|
|
|
|
2010-09-04 14:51:35 +00:00
|
|
|
// Original sector
|
|
|
|
public Sector sector;
|
|
|
|
|
2010-09-02 20:42:38 +00:00
|
|
|
// Plane in the sector
|
|
|
|
public Plane plane;
|
2010-09-03 15:12:07 +00:00
|
|
|
|
|
|
|
// Color of the plane (includes brightness)
|
2010-09-02 20:42:38 +00:00
|
|
|
public int color;
|
2010-09-03 15:12:07 +00:00
|
|
|
|
|
|
|
// Color and brightness below the plane
|
|
|
|
public int brightnessbelow;
|
|
|
|
public PixelColor colorbelow;
|
|
|
|
|
|
|
|
// Constructor
|
|
|
|
public SectorLevel(Sector s, SectorLevelType type)
|
|
|
|
{
|
2010-09-04 14:51:35 +00:00
|
|
|
this.sector = s;
|
2010-09-03 15:12:07 +00:00
|
|
|
this.type = type;
|
2010-09-04 11:19:37 +00:00
|
|
|
this.center = new Vector2D(s.BBox.Left + s.BBox.Width / 2, s.BBox.Top + s.BBox.Height / 2);
|
2010-09-03 15:12:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Comparer
|
|
|
|
public int CompareTo(SectorLevel other)
|
|
|
|
{
|
2010-09-04 11:19:37 +00:00
|
|
|
float delta = this.plane.GetZ(center) - other.plane.GetZ(center);
|
2010-09-03 15:12:07 +00:00
|
|
|
|
|
|
|
if(delta > 0.0f)
|
|
|
|
return 1;
|
|
|
|
else if(delta < 0.0f)
|
|
|
|
return -1;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
}
|
2010-09-02 20:42:38 +00:00
|
|
|
}
|
|
|
|
}
|