mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 20:32:34 +00:00
74 lines
1.8 KiB
C#
74 lines
1.8 KiB
C#
|
#region ================== Namespaces
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Drawing;
|
|||
|
using CodeImp.DoomBuilder.Map;
|
|||
|
using CodeImp.DoomBuilder.VisualModes;
|
|||
|
|
|||
|
#endregion
|
|||
|
|
|||
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
{
|
|||
|
public static class BuilderModesTools
|
|||
|
{
|
|||
|
#region ================== Sidedef
|
|||
|
|
|||
|
internal static Rectangle GetSidedefPartSize(BaseVisualGeometrySidedef side, VisualGeometryType type)
|
|||
|
{
|
|||
|
if(type == VisualGeometryType.WALL_MIDDLE_3D)
|
|||
|
{
|
|||
|
Rectangle rect = new Rectangle(0, 0, 1, 0);
|
|||
|
Linedef cl = side.GetControlLinedef();
|
|||
|
if(cl.Front != null && cl.Front.Sector != null) {
|
|||
|
rect.Y = cl.Front.Sector.FloorHeight;
|
|||
|
rect.Height = cl.Front.GetMiddleHeight();
|
|||
|
} else {
|
|||
|
rect.Y = side.Sidedef.Sector.FloorHeight;
|
|||
|
rect.Height = side.Sidedef.GetMiddleHeight();
|
|||
|
}
|
|||
|
|
|||
|
return rect;
|
|||
|
}
|
|||
|
|
|||
|
return GetSidedefPartSize(side.Sidedef, type);
|
|||
|
}
|
|||
|
|
|||
|
public static Rectangle GetSidedefPartSize(Sidedef side, VisualGeometryType type)
|
|||
|
{
|
|||
|
Rectangle rect = new Rectangle(0, 0, 1, 0);
|
|||
|
|
|||
|
switch(type)
|
|||
|
{
|
|||
|
case VisualGeometryType.WALL_LOWER:
|
|||
|
rect.Y = side.Sector.FloorHeight;
|
|||
|
rect.Height = side.GetLowHeight();
|
|||
|
break;
|
|||
|
|
|||
|
case VisualGeometryType.WALL_UPPER:
|
|||
|
if(side.Other != null && side.Other.Sector != null)
|
|||
|
{
|
|||
|
rect.Y = side.Other.Sector.CeilHeight;
|
|||
|
rect.Height = side.GetHighHeight();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
rect.Height = 0;
|
|||
|
}
|
|||
|
break;
|
|||
|
|
|||
|
case VisualGeometryType.WALL_MIDDLE:
|
|||
|
rect.Y = side.Sector.FloorHeight;
|
|||
|
rect.Height = side.GetMiddleHeight();
|
|||
|
break;
|
|||
|
|
|||
|
default:
|
|||
|
throw new NotImplementedException("GetSidedefPartSize: got unsupported geometry type: '" + type + "'");
|
|||
|
}
|
|||
|
|
|||
|
return rect;
|
|||
|
}
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|