Display sector flat alignment in Visual Mode and reset colormap in Visual Mode when linedef special is removed.

This commit is contained in:
MascaraSnake 2016-01-04 12:55:41 +01:00
parent c1295b7cb8
commit 760dff9df0
8 changed files with 67 additions and 3 deletions

View file

@ -105,6 +105,7 @@ namespace CodeImp.DoomBuilder.IO
public override int SlopeVertexType { get { return 9500; } }
public override int Custom3DFloorType { get { return 160; } }
public override int ColormapType { get { return -1; } }
public override int FlatAlignmentType { get { return -1; } }
#endregion

View file

@ -105,6 +105,7 @@ namespace CodeImp.DoomBuilder.IO
public override int SlopeVertexType { get { return 9500; } }
public override int Custom3DFloorType { get { return 160; } }
public override int ColormapType { get { return -1; } }
public override int FlatAlignmentType { get { return -1; } }
#endregion

View file

@ -77,5 +77,6 @@ namespace CodeImp.DoomBuilder.IO
int SlopeVertexType { get; }
int Custom3DFloorType { get; }
int ColormapType { get; }
int FlatAlignmentType { get; }
}
}

View file

@ -98,6 +98,7 @@ namespace CodeImp.DoomBuilder.IO
public abstract int SlopeVertexType { get; }
public abstract int Custom3DFloorType { get; }
public abstract int ColormapType { get; }
public abstract int FlatAlignmentType { get; }
#endregion

View file

@ -143,6 +143,7 @@ namespace CodeImp.DoomBuilder.IO
public override int MaxThingHeight { get { return 4095; } }
public override int MinThingHeight { get { return 0; } }
public override int ColormapType { get { return 606; } }
public override int FlatAlignmentType { get { return 7; } }
#endregion
#region ================== Reading

View file

@ -155,6 +155,7 @@ namespace CodeImp.DoomBuilder.IO
public override int SlopeVertexType { get { return 9500; } }
public override int Custom3DFloorType { get { return 160; } }
public override int ColormapType { get { return -1; } }
public override int FlatAlignmentType { get { return -1; } }
#endregion

View file

@ -96,6 +96,7 @@ namespace CodeImp.DoomBuilder.Map
public bool IsSlopeCopy { get { return General.Map.FormatInterface.SlopeCopyTypes.ContainsKey(Action); } }
public bool IsVertexSlope { get { return General.Map.FormatInterface.VertexSlopeTypes.ContainsKey(Action); } }
public bool IsColormap { get { return Action == General.Map.FormatInterface.ColormapType; } }
public bool IsFlatAlignment { get { return Action == General.Map.FormatInterface.FlatAlignmentType; } }
public int Tag { get { return tags[0]; } set { BeforePropsChange(); tags[0] = value; if((value < General.Map.FormatInterface.MinTag) || (value > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } //mxd
public List<int> Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd
public float LengthSq { get { return lengthsq; } }

View file

@ -833,11 +833,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
}
if (!General.Map.SRB2)
foreach (Sector s in General.Map.Map.Sectors)
{
// Find sectors with 3 vertices, because they can be sloped
foreach (Sector s in General.Map.Map.Sectors)
if (General.Map.SRB2) s.Fields.Clear(); //Reset fake UDMF properties (since the linedef special that set them might no longer be there)
else
{
// Find sectors with 3 vertices, because they can be sloped
// ========== Thing vertex slope, vertices with UDMF vertex offsets ==========
if (s.Sidedefs.Count == 3)
{
@ -950,6 +951,62 @@ namespace CodeImp.DoomBuilder.BuilderModes
if (General.Map.SRB2)
{
//MascaraSnake: Flat alignment
if (l.IsFlatAlignment)
{
int sectortag = l.Tag;
bool alignonlyceiling = l.IsFlagSet("2");
bool alignonlyfloor = l.IsFlagSet("64");
bool rotate = l.IsFlagSet("512");
bool rotateonlyceiling = l.IsFlagSet("1024");
bool rotateonlyfloor = l.IsFlagSet("16384");
if (sectortags.ContainsKey(sectortag))
{
List<Sector> sectors = sectortags[sectortag];
foreach (Sector s in sectors)
{
s.Fields.BeforeFieldsChange();
if (rotate)
{
float rotation = l.AngleDeg;
if (!rotateonlyceiling)
{
if (s.Fields.ContainsKey("rotationfloor")) s.Fields["rotationfloor"] = new UniValue(UniversalType.Float, rotation);
else s.Fields.Add("rotationfloor", new UniValue(UniversalType.Float, rotation));
}
if (!rotateonlyfloor)
{
if (s.Fields.ContainsKey("rotationceiling")) s.Fields["rotationceiling"] = new UniValue(UniversalType.Float, rotation);
else s.Fields.Add("rotationceiling", new UniValue(UniversalType.Float, rotation));
}
}
else
{
float xoffset = l.Rect.Width;
float yoffset = l.Rect.Height;
if (!alignonlyceiling)
{
if (s.Fields.ContainsKey("xpanningfloor")) s.Fields["xpanningfloor"] = new UniValue(UniversalType.Float, xoffset);
else s.Fields.Add("xpanningfloor", new UniValue(UniversalType.Float, xoffset));
if (s.Fields.ContainsKey("ypanningfloor")) s.Fields["ypanningfloor"] = new UniValue(UniversalType.Float, yoffset);
else s.Fields.Add("ypanningfloor", new UniValue(UniversalType.Float, yoffset));
}
if (!alignonlyfloor)
{
if (s.Fields.ContainsKey("xpanningceiling")) s.Fields["xpanningceiling"] = new UniValue(UniversalType.Float, xoffset);
else s.Fields.Add("xpanningceiling", new UniValue(UniversalType.Float, xoffset));
if (s.Fields.ContainsKey("ypanningceiling")) s.Fields["ypanningceiling"] = new UniValue(UniversalType.Float, yoffset);
else s.Fields.Add("ypanningceiling", new UniValue(UniversalType.Float, yoffset));
}
}
}
}
}
//MascaraSnake: Colormap
if (l.IsColormap && l.Front != null)
{