Changed, internal, UDMF: local texture offsets and scale are now copied when merging sidedefs.

Changed, internal: made TextLabel and IRenderer2D public properties compatible with DB2 implementation.
Fixed some more cases when sidedefs belonging to linedefs, which were moved on top of existing linedefs, were incorrectly reassigned when applying Edit Selection and Drag Geometry modes.
Fixed, Map Analysis mode: error checks must be updated after switching map format.
This commit is contained in:
MaxED 2016-05-19 21:44:39 +00:00 committed by spherallic
parent 154ceb0eb7
commit b6afbec977
8 changed files with 121 additions and 44 deletions

View file

@ -612,6 +612,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?
@ -623,6 +632,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?
@ -634,6 +652,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?

View file

@ -75,7 +75,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

View file

@ -1720,6 +1720,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)
{

View file

@ -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()
{

View file

@ -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();

View file

@ -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

View file

@ -1491,32 +1491,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)
//mxd. Update cached values
General.Map.Map.Update();
//mxd. Get new lines from linedef marks...
HashSet<Linedef> newlines = new HashSet<Linedef>(General.Map.Map.GetMarkedLinedefs(true));
//mxd. Marked lines were created during linedef splitting
HashSet<Linedef> changedlines = new HashSet<Linedef>(selectedlines);
changedlines.UnionWith(newlines);
//mxd. Update outer sides of the selection
if(changedlines.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));
// Get affected sectors
HashSet<Sector> affectedsectors = new HashSet<Sector>(General.Map.Map.GetSelectedSectors(true));
affectedsectors.UnionWith(General.Map.Map.GetUnselectedSectorsFromLinedefs(changedlines));
// Marked lines were created during linedef splitting
HashSet<Linedef> changedlines = new HashSet<Linedef>(selectedlines);
changedlines.UnionWith(newlines);
// Reattach/add/remove outer sidedefs
Tools.AdjustOuterSidedefs(affectedsectors, new HashSet<Linedef>(changedlines));
// 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));
// Process outer sidedefs
Tools.AdjustOuterSidedefs(affectedsectors, new HashSet<Linedef>(changedlines));
// Split outer sectors
Tools.SplitOuterSectors(changedlines);
}
// Split outer sectors
Tools.SplitOuterSectors(changedlines);
}
// Update cached values

View file

@ -616,6 +616,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()