UltimateZoneBuilder/Source/Plugins/BuilderModes/General/BuilderModesTools.cs
MaxED 5d8e62f887 Visual mode: "Select" action with "with the same textures" / "with the same height" modifiers (Shift/Ctrl + LMB) now works when used on sides of a 3d floor.
Visual mode: "Select" action with "with the same textures" modifier (Shift + LMB) now selects adjacent sidedefs only when their height intersects with the height of the current sidedef.
Visual mode: "Select" action with "with the same textures" modifier (Shift + LMB) was not selecting connected one-sided sidedefs when used on a sidedef without a texture.
Cosmetic: fixed a couple of action descriptions in BuilderModes' Actions.cfg.
Cosmetic: MainForm.UpdateToolStripSeparators was working incorrectly in some cases.
Cosmetic: ErrorChecksForm's title was not updated when no errors were found.
2014-09-18 22:06:35 +00:00

73 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
}
}