mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-24 04:41:10 +00:00
ee8e31db37
Fixed: Visual mode: "Select" action with "with the same textures" / "with the same height" modifiers (Shift/Ctrl + LMB) was not working properly when used on vavoom-type 3d floor sidedefs. Fixed: Visual mode, UDMF, "Auto-align textures" actions: vertical texture offset was calculated incorrectly for vavoom-type 3d floors.
83 lines
2.1 KiB
C#
83 lines
2.1 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) {
|
|
// Use ceiling height for vavoom-type 3d floors. Also, FloorHeight is > CeilHeight for these...
|
|
if (cl.Args[1] == 0)
|
|
{
|
|
rect.Y = cl.Front.Sector.CeilHeight;
|
|
rect.Height = cl.Front.Sector.FloorHeight - cl.Front.Sector.CeilHeight;
|
|
}
|
|
else
|
|
{
|
|
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
|
|
}
|
|
}
|