Tidy up improved associations

This commit is contained in:
spherallic 2023-04-27 03:50:41 +02:00
parent e4b8a6ba2b
commit d71b84bcdb
3 changed files with 57 additions and 12 deletions

View file

@ -226,12 +226,12 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
if (!result.PatrolPoints.ContainsKey(t.Tag)) continue; if (!result.PatrolPoints.ContainsKey(t.Tag)) continue;
start = t.Position; start = t.Position;
start.z += GetCorrectHeight(t, blockmap, true); start.z += GetCorrectHeight(t, blockmap, bsp, true);
foreach (Thing tt in result.PatrolPoints[t.Tag]) foreach (Thing tt in result.PatrolPoints[t.Tag])
{ {
end = tt.Position; end = tt.Position;
end.z += GetCorrectHeight(tt, blockmap, true); end.z += GetCorrectHeight(tt, blockmap, bsp, true);
lines.Add(new Line3D(start, end, General.Colors.Selection)); lines.Add(new Line3D(start, end, General.Colors.Selection));
} }
@ -357,7 +357,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
if (targettag == 0 || !result.InterpolationPoints.ContainsKey(targettag)) continue; //no target / target doesn't exist if (targettag == 0 || !result.InterpolationPoints.ContainsKey(targettag)) continue; //no target / target doesn't exist
start = t.Position; start = t.Position;
start.z += GetCorrectHeight(t, blockmap, true); start.z += GetCorrectHeight(t, blockmap, bsp, true);
foreach (PathNode node in result.InterpolationPoints[targettag]) foreach (PathNode node in result.InterpolationPoints[targettag])
{ {

View file

@ -26,6 +26,7 @@ using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Rendering; using CodeImp.DoomBuilder.Rendering;
using CodeImp.DoomBuilder.Types; using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.Windows; using CodeImp.DoomBuilder.Windows;
using CodeImp.DoomBuilder.GZBuilder.Geometry;
#endregion #endregion
@ -37,7 +38,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
private Vector2D center; private Vector2D center;
private UniversalType type; private UniversalType type;
private int directlinktype; private int directlinktype;
private int directlinktype;
private Dictionary<string, List<Line3D>> eventlines; private Dictionary<string, List<Line3D>> eventlines;
private IRenderer2D renderer; private IRenderer2D renderer;
private SelectableElement element; private SelectableElement element;
@ -551,7 +551,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
} }
description += " (" + string.Join(", ", argdescription) + ")"; //description += " (" + string.Join(", ", argdescription) + ")";
return description; return description;
} }
@ -606,8 +606,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private Vector2D GetLabelPosition(Vector2D start, Vector2D end) private Vector2D GetLabelPosition(Vector2D start, Vector2D end)
{ {
// Check if start/end point is on screen... // Check if start/end point is on screen...
Vector2D lt = General.Map.Renderer2D.DisplayToMap(new Vector2D(0.0, General.Interface.Display.Size.Height)); Vector2D lt = General.Map.Renderer2D.DisplayToMap(new Vector2D(0.0f, General.Interface.Display.Size.Height));
Vector2D rb = General.Map.Renderer2D.DisplayToMap(new Vector2D(General.Interface.Display.Size.Width, 0.0)); Vector2D rb = General.Map.Renderer2D.DisplayToMap(new Vector2D(General.Interface.Display.Size.Width, 0.0f));
RectangleF viewport = new RectangleF((float)lt.x, (float)lt.y, (float)(rb.x - lt.x), (float)(rb.y - lt.y)); RectangleF viewport = new RectangleF((float)lt.x, (float)lt.y, (float)(rb.x - lt.x), (float)(rb.y - lt.y));
bool startvisible = viewport.Contains((float)start.x, (float)start.y); bool startvisible = viewport.Contains((float)start.x, (float)start.y);
bool endvisible = viewport.Contains((float)end.x, (float)end.y); bool endvisible = viewport.Contains((float)end.x, (float)end.y);
@ -626,7 +626,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
foreach (Line2D side in viewportsides) foreach (Line2D side in viewportsides)
{ {
// Modify the start point so it stays on screen // Modify the start point so it stays on screen
double u; float u;
if (!startvisible && side.GetIntersection(drawnline, out u)) if (!startvisible && side.GetIntersection(drawnline, out u))
{ {
start = drawnline.GetCoordinatesAt(u); start = drawnline.GetCoordinatesAt(u);
@ -644,7 +644,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Create position // Create position
Vector2D delta = end - start; Vector2D delta = end - start;
return new Vector2D(start.x + delta.x * 0.5, start.y + delta.y * 0.5); return new Vector2D(start.x + delta.x * 0.5f, start.y + delta.y * 0.5f);
} }
/// <summary> /// <summary>
@ -657,7 +657,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
{ {
List<Vector2D> allpositions = positions.OrderBy(o => o.x).ToList(); List<Vector2D> allpositions = positions.OrderBy(o => o.x).ToList();
List<Vector2D> newpositions = new List<Vector2D>(positions.Count); List<Vector2D> newpositions = new List<Vector2D>(positions.Count);
Vector2D mergedistance = distance / renderer.Scale * 1.5; Vector2D mergedistance = distance / renderer.Scale * 1.5f;
// Keep going while we have positions me might want to merge // Keep going while we have positions me might want to merge
while (allpositions.Count > 0) while (allpositions.Count > 0)
@ -691,8 +691,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
} }
// ... and set the current position to the center of that // ... and set the current position to the center of that
curposition.x = tl.x + (br.x - tl.x) / 2.0; curposition.x = tl.x + (br.x - tl.x) / 2.0f;
curposition.y = tl.y + (br.y - tl.y) / 2.0; curposition.y = tl.y + (br.y - tl.y) / 2.0f;
} }
else else
{ {

View file

@ -75,6 +75,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.mouseselectionthreshold = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.mouseselectionthreshold = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label16 = new System.Windows.Forms.Label(); this.label16 = new System.Windows.Forms.Label();
this.label17 = new System.Windows.Forms.Label(); this.label17 = new System.Windows.Forms.Label();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.eventlinelabelvisibility = new System.Windows.Forms.ComboBox();
this.eventlinelabelstyle = new System.Windows.Forms.ComboBox();
this.tabs.SuspendLayout(); this.tabs.SuspendLayout();
this.taboptions.SuspendLayout(); this.taboptions.SuspendLayout();
this.groupBox4.SuspendLayout(); this.groupBox4.SuspendLayout();
@ -99,6 +102,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// //
// taboptions // taboptions
// //
this.taboptions.Controls.Add(this.groupBox5);
this.taboptions.Controls.Add(this.groupBox4); this.taboptions.Controls.Add(this.groupBox4);
this.taboptions.Controls.Add(this.groupBox3); this.taboptions.Controls.Add(this.groupBox3);
this.taboptions.Controls.Add(this.groupBox2); this.taboptions.Controls.Add(this.groupBox2);
@ -662,6 +666,44 @@ namespace CodeImp.DoomBuilder.BuilderModes
this.label17.Size = new System.Drawing.Size(100, 23); this.label17.Size = new System.Drawing.Size(100, 23);
this.label17.TabIndex = 0; this.label17.TabIndex = 0;
// //
// groupBox5
//
this.groupBox5.Controls.Add(this.eventlinelabelstyle);
this.groupBox5.Controls.Add(this.eventlinelabelvisibility);
this.groupBox5.Location = new System.Drawing.Point(6, 445);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(272, 54);
this.groupBox5.TabIndex = 4;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "Event line labels";
//
// eventlinelabelvisibility
//
this.eventlinelabelvisibility.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.eventlinelabelvisibility.FormattingEnabled = true;
this.eventlinelabelvisibility.Items.AddRange(new object[] {
"Never show",
"Forward only",
"Reverse only",
"Forward + Reverse"});
this.eventlinelabelvisibility.Location = new System.Drawing.Point(6, 19);
this.eventlinelabelvisibility.Name = "eventlinelabelvisibility";
this.eventlinelabelvisibility.Size = new System.Drawing.Size(121, 21);
this.eventlinelabelvisibility.TabIndex = 0;
//
// eventlinelabelstyle
//
this.eventlinelabelstyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.eventlinelabelstyle.FormattingEnabled = true;
this.eventlinelabelstyle.Items.AddRange(new object[] {
"Action only",
"Action + short arguments",
"Action + full arguments"});
this.eventlinelabelstyle.Location = new System.Drawing.Point(133, 19);
this.eventlinelabelstyle.Name = "eventlinelabelstyle";
this.eventlinelabelstyle.Size = new System.Drawing.Size(133, 21);
this.eventlinelabelstyle.TabIndex = 1;
//
// PreferencesForm // PreferencesForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -737,5 +779,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
private System.Windows.Forms.Label label17; private System.Windows.Forms.Label label17;
private System.Windows.Forms.CheckBox additivepaintselect; private System.Windows.Forms.CheckBox additivepaintselect;
private System.Windows.Forms.CheckBox selectafterundoredo; private System.Windows.Forms.CheckBox selectafterundoredo;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.ComboBox eventlinelabelvisibility;
private System.Windows.Forms.ComboBox eventlinelabelstyle;
} }
} }