diff --git a/Source/Core/Map/Sidedef.cs b/Source/Core/Map/Sidedef.cs index c3bafcbaac88ea0602646248e7ae129e1d7fc307..e6d1a7831db5de54642b103f14c7cf47036444e8 100644 --- a/Source/Core/Map/Sidedef.cs +++ b/Source/Core/Map/Sidedef.cs @@ -599,6 +599,15 @@ namespace CodeImp.DoomBuilder.Map // Counts as a half coice for copying offsets copyoffsets += 1; + + //mxd. Also copy UDMF offsets and scale + if(General.Map.UDMF) + { + UniFields.SetFloat(s.Fields, "offsetx_top", Fields.GetValue("offsetx_top", 0f), 0f); + UniFields.SetFloat(s.Fields, "offsety_top", Fields.GetValue("offsety_top", 0f), 0f); + UniFields.SetFloat(s.Fields, "scalex_top", Fields.GetValue("scalex_top", 1.0f), 1.0f); + UniFields.SetFloat(s.Fields, "scaley_top", Fields.GetValue("scaley_top", 1.0f), 1.0f); + } } // Middle texture set? @@ -610,6 +619,15 @@ namespace CodeImp.DoomBuilder.Map // Counts for copying offsets copyoffsets += 2; + + //mxd. Also copy UDMF offsets and scale + if(General.Map.UDMF) + { + UniFields.SetFloat(s.Fields, "offsetx_mid", Fields.GetValue("offsetx_mid", 0f), 0f); + UniFields.SetFloat(s.Fields, "offsety_mid", Fields.GetValue("offsety_mid", 0f), 0f); + UniFields.SetFloat(s.Fields, "scalex_mid", Fields.GetValue("scalex_mid", 1.0f), 1.0f); + UniFields.SetFloat(s.Fields, "scaley_mid", Fields.GetValue("scaley_mid", 1.0f), 1.0f); + } } // Lower texture set? @@ -621,6 +639,15 @@ namespace CodeImp.DoomBuilder.Map // Counts as a half coice for copying offsets copyoffsets += 1; + + //mxd. Also copy UDMF offsets and scale + if(General.Map.UDMF) + { + UniFields.SetFloat(s.Fields, "offsetx_bottom", Fields.GetValue("offsetx_bottom", 0f), 0f); + UniFields.SetFloat(s.Fields, "offsety_bottom", Fields.GetValue("offsety_bottom", 0f), 0f); + UniFields.SetFloat(s.Fields, "scalex_bottom", Fields.GetValue("scalex_bottom", 1.0f), 1.0f); + UniFields.SetFloat(s.Fields, "scaley_bottom", Fields.GetValue("scaley_bottom", 1.0f), 1.0f); + } } // Copy offsets also? diff --git a/Source/Core/Rendering/IRenderer2D.cs b/Source/Core/Rendering/IRenderer2D.cs index 044be3baef23ce7cdfbe42adcfa36ed7bf9eda65..bef6a2a6da6477c00cdae24e180b5e821a5a287b 100644 --- a/Source/Core/Rendering/IRenderer2D.cs +++ b/Source/Core/Rendering/IRenderer2D.cs @@ -73,7 +73,8 @@ namespace CodeImp.DoomBuilder.Rendering void RenderLine(Vector2D start, Vector2D end, float thickness, PixelColor c, bool transformcoords); void RenderArrows(ICollection<Line3D> line); //mxd void RenderArrows(ICollection<Line3D> line, bool transformcoords); //mxd - void RenderText(ITextLabel text); + void RenderText(TextLabel text); //mxd, DB2 compatibility + void RenderText(ITextLabel text); //mxd void RenderText(IList<ITextLabel> labels); //mxd void RenderGeometry(FlatVertex[] vertices, ImageData texture, bool transformcoords); void RenderHighlight(FlatVertex[] vertices, int color); //mxd diff --git a/Source/Core/Rendering/Renderer2D.cs b/Source/Core/Rendering/Renderer2D.cs index c7695f04a750ca28482053d3f452b8faf61a72f7..b339ed3ce88cedac1d2437b87cb4e870b1d073c3 100644 --- a/Source/Core/Rendering/Renderer2D.cs +++ b/Source/Core/Rendering/Renderer2D.cs @@ -1624,6 +1624,10 @@ namespace CodeImp.DoomBuilder.Rendering graphics.Shaders.Things2D.End(); } + //mxd. This renders text (DB2 compatibility) + [Obsolete("Method is deprecated, please use RenderText(ITextLabel label) method instead.")] + public void RenderText(TextLabel label){ RenderText((ITextLabel)label); } + // This renders text public void RenderText(ITextLabel label) { diff --git a/Source/Core/Rendering/TextLabel.cs b/Source/Core/Rendering/TextLabel.cs index b151672975437cc1b3b1016992320e0c667175b7..cd6b4d77a75828d077b6116829ac5d2811a8a4e7 100644 --- a/Source/Core/Rendering/TextLabel.cs +++ b/Source/Core/Rendering/TextLabel.cs @@ -87,6 +87,9 @@ namespace CodeImp.DoomBuilder.Rendering //mxd. Rendering private bool skiprendering; + + //mxd. Compatibility + private float scale; // Disposing private bool isdisposed; @@ -109,7 +112,27 @@ namespace CodeImp.DoomBuilder.Rendering public Texture Texture { get { return texture; } } //mxd public VertexBuffer VertexBuffer { get { return textbuffer; } } public bool SkipRendering { get { return skiprendering; } } //mxd - + + //mxd. Compatibility settings + [Obsolete("Backcolor property is deprecated, please use BackColor property instead.")] + public PixelColor Backcolor { get { return BackColor; } set { BackColor = value.WithAlpha(128); } } + + [Obsolete("Scale property is deprecated, please assign the font directly using Font property instead.")] + public float Scale + { + get { return scale; } + set + { + scale = value; + font = new Font(new FontFamily(General.Settings.TextLabelFontName), (float)Math.Round(scale * 0.75f), (General.Settings.TextLabelFontBold ? FontStyle.Bold : FontStyle.Regular)); + textsize = Size.Empty; + textureupdateneeded = true; + } + } + + [Obsolete("Rectangle property is deprecated, please use Location property instead.")] + public RectangleF Rectangle { get { return new RectangleF(location.x, location.y, 0f, 0f); } set { location = new Vector2D(value.X, value.Y); updateneeded = true; } } + // Disposing public bool IsDisposed { get { return isdisposed; } } @@ -140,6 +163,30 @@ namespace CodeImp.DoomBuilder.Rendering GC.SuppressFinalize(this); } + //mxd. Compatibility constructor... + [Obsolete("TextLabel(int capacity) is deprecated, please use TextLabel() instead.")] + public TextLabel(int unused) + { + // Initialize + this.text = ""; + this.font = General.Settings.TextLabelFont; + this.location = new Vector2D(); + this.color = new PixelColor(255, 255, 255, 255); + this.backcolor = new PixelColor(128, 0, 0, 0); + this.alignx = TextAlignmentX.Center; + this.aligny = TextAlignmentY.Top; + this.textsize = SizeF.Empty; + this.texturesize = Size.Empty; + this.updateneeded = true; + this.textureupdateneeded = true; + + // Register as resource + General.Map.Graphics.RegisterResource(this); + + // We have no destructor + GC.SuppressFinalize(this); + } + // Diposer public void Dispose() { diff --git a/Source/Plugins/BuilderModes/ClassicModes/DragLinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DragLinedefsMode.cs index ebd9dce6e5ad9f96fca145f8d50ce74a3ebe38ff..3f2b1fbe17c07992c24b43ab7b9ff8a3f93fc14e 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DragLinedefsMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DragLinedefsMode.cs @@ -115,25 +115,21 @@ namespace CodeImp.DoomBuilder.BuilderModes // When not cancelled if(!cancelled) { - //mxd. Reattach/add/remove sidedefs only when there are no unstable lines in selection - if(unstablelines.Count == 0) - { - // Get new lines from linedef marks... - HashSet<Linedef> newlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(true)); + //mxd. Get new lines from linedef marks... + HashSet<Linedef> newlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(true)); - // Marked lines were created during linedef splitting - HashSet<Linedef> changedlines = new HashSet<Linedef>(selectedlines); - changedlines.UnionWith(newlines); - - // Add sectors, which have all their linedefs selected (otherwise those would be destroyed after moving the selection) - HashSet<Sector> toadjust = General.Map.Map.GetUnselectedSectorsFromLinedefs(changedlines); + //mxd. Marked lines were created during linedef splitting + HashSet<Linedef> changedlines = new HashSet<Linedef>(selectedlines); + changedlines.UnionWith(newlines); - // Process outer sidedefs - Tools.AdjustOuterSidedefs(toadjust, changedlines); + //mxd. Add sectors, which have all their linedefs selected (otherwise those would be destroyed after moving the selection) + HashSet<Sector> toadjust = General.Map.Map.GetUnselectedSectorsFromLinedefs(changedlines); - // Split outer sectors - Tools.SplitOuterSectors(changedlines); - } + //mxd. Reattach/add/remove outer sidedefs + Tools.AdjustOuterSidedefs(toadjust, changedlines); + + //mxd. Split outer sectors + Tools.SplitOuterSectors(changedlines); // If only a single linedef was selected, deselect it now if(selectedlines.Count == 1) General.Map.Map.ClearSelectedLinedefs(); diff --git a/Source/Plugins/BuilderModes/ClassicModes/DragVerticesMode.cs b/Source/Plugins/BuilderModes/ClassicModes/DragVerticesMode.cs index 70c466fb37f72908247a024904e98f7f3d738c8e..e67e465bed3a577034489c56baf9816445a976c2 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/DragVerticesMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/DragVerticesMode.cs @@ -106,8 +106,8 @@ namespace CodeImp.DoomBuilder.BuilderModes // When not cancelled if(!cancelled) { - //mxd. Reattach/add/remove sidedefs only when there are no unstable lines in selection - if(stablelines.Count > 0 && unstablelines.Count == 0) + //mxd. If linedefs were dragged, reattach/add/remove sidedefs + if(stablelines.Count > 0) { // Get new lines from linedef marks... HashSet<Linedef> newlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(true)); @@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.BuilderModes if(changedlines.Count > 0) { - // Process outer sidedefs + // Reattach/add/remove outer sidedefs Tools.AdjustOuterSidedefs(toadjust, changedlines); // Split outer sectors diff --git a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs index 924257e669fe268d04c125f223ea10f5f30508e7..235fd65fd837b034c74a522ddf52f33c6936e136 100644 --- a/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs +++ b/Source/Plugins/BuilderModes/ClassicModes/EditSelectionMode.cs @@ -1488,32 +1488,28 @@ namespace CodeImp.DoomBuilder.BuilderModes // Snap to map format accuracy General.Map.Map.SnapAllToAccuracy(General.Map.UDMF && usepreciseposition); - //mxd. Reattach/add/remove sidedefs only when there are no unstable lines in selection - if(unstablelines.Count == 0) - { - // Update cached values - General.Map.Map.Update(); - - // Get new lines from linedef marks... - HashSet<Linedef> newlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(true)); + //mxd. Update cached values + General.Map.Map.Update(); - // Marked lines were created during linedef splitting - HashSet<Linedef> changedlines = new HashSet<Linedef>(selectedlines); - changedlines.UnionWith(newlines); + //mxd. Get new lines from linedef marks... + HashSet<Linedef> newlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(true)); - // Update outer sides of the selection - if(changedlines.Count > 0) - { - // Get affected sectors - HashSet<Sector> affectedsectors = new HashSet<Sector>(General.Map.Map.GetSelectedSectors(true)); - affectedsectors.UnionWith(General.Map.Map.GetUnselectedSectorsFromLinedefs(changedlines)); + //mxd. Marked lines were created during linedef splitting + HashSet<Linedef> changedlines = new HashSet<Linedef>(selectedlines); + changedlines.UnionWith(newlines); - // Process outer sidedefs - Tools.AdjustOuterSidedefs(affectedsectors, new HashSet<Linedef>(changedlines)); + //mxd. Update outer sides of the selection + if(changedlines.Count > 0) + { + // Get affected sectors + HashSet<Sector> affectedsectors = new HashSet<Sector>(General.Map.Map.GetSelectedSectors(true)); + affectedsectors.UnionWith(General.Map.Map.GetUnselectedSectorsFromLinedefs(changedlines)); - // Split outer sectors - Tools.SplitOuterSectors(changedlines); - } + // Reattach/add/remove outer sidedefs + Tools.AdjustOuterSidedefs(affectedsectors, new HashSet<Linedef>(changedlines)); + + // Split outer sectors + Tools.SplitOuterSectors(changedlines); } // Update cached values diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs index ebcb26ac1030e3b1f85490952f667e17b477da0c..44b40306049b118477d852457efed68812ea59bf 100644 --- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs +++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs @@ -493,6 +493,12 @@ namespace CodeImp.DoomBuilder.BuilderModes //mxd. Save settings SaveUISettings(); } + + //mxd. Error checks may need to be reinitialized + public override void OnMapReconfigure() + { + errorcheckform = null; + } // Redo performed public override void OnRedoEnd()