diff --git a/Source/Core/IO/DoomMapSetIO.cs b/Source/Core/IO/DoomMapSetIO.cs index 52b4a2f..3e738ce 100644 --- a/Source/Core/IO/DoomMapSetIO.cs +++ b/Source/Core/IO/DoomMapSetIO.cs @@ -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 diff --git a/Source/Core/IO/HexenMapSetIO.cs b/Source/Core/IO/HexenMapSetIO.cs index 5ee63a3..c76b9cf 100644 --- a/Source/Core/IO/HexenMapSetIO.cs +++ b/Source/Core/IO/HexenMapSetIO.cs @@ -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 diff --git a/Source/Core/IO/IMapSetIO.cs b/Source/Core/IO/IMapSetIO.cs index 82d72ba..e1387bf 100644 --- a/Source/Core/IO/IMapSetIO.cs +++ b/Source/Core/IO/IMapSetIO.cs @@ -77,5 +77,6 @@ namespace CodeImp.DoomBuilder.IO int SlopeVertexType { get; } int Custom3DFloorType { get; } int ColormapType { get; } + int FlatAlignmentType { get; } } } diff --git a/Source/Core/IO/MapSetIO.cs b/Source/Core/IO/MapSetIO.cs index 2425cb3..cf5935d 100644 --- a/Source/Core/IO/MapSetIO.cs +++ b/Source/Core/IO/MapSetIO.cs @@ -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 diff --git a/Source/Core/IO/SRB2MapSetIO.cs b/Source/Core/IO/SRB2MapSetIO.cs index 377143a..288fb00 100644 --- a/Source/Core/IO/SRB2MapSetIO.cs +++ b/Source/Core/IO/SRB2MapSetIO.cs @@ -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 diff --git a/Source/Core/IO/UniversalMapSetIO.cs b/Source/Core/IO/UniversalMapSetIO.cs index 4d75c57..a1045e5 100644 --- a/Source/Core/IO/UniversalMapSetIO.cs +++ b/Source/Core/IO/UniversalMapSetIO.cs @@ -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 diff --git a/Source/Core/Map/Linedef.cs b/Source/Core/Map/Linedef.cs index 06edde7..2489dd1 100644 --- a/Source/Core/Map/Linedef.cs +++ b/Source/Core/Map/Linedef.cs @@ -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 Tags { get { return tags; } set { BeforePropsChange(); tags = value; } } //mxd public float LengthSq { get { return lengthsq; } } diff --git a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs index eff65a8..dd75d0f 100644 --- a/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs +++ b/Source/Plugins/BuilderModes/VisualModes/BaseVisualMode.cs @@ -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 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) {