mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-26 13:51:40 +00:00
Tag Range plugin: custom increment can now be set.
Tag Range plugin: tags can be set in relative mode (when this mode is enabled, generated values are added to existing tags instead of replacing them). Updated documentation.
This commit is contained in:
parent
2a880920d9
commit
9802b653d8
4 changed files with 195 additions and 57 deletions
|
@ -86,7 +86,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="scripting/acs.html">Enhanced scripting workflow</a>.</li>
|
<li><a href="scripting/acs.html">Enhanced scripting workflow</a>.</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> <a href="scripting/snippets.html">Code snippets.</a></li>
|
<li><span class="style1"><strong>[new]</strong></span> <a href="scripting/snippets.html">Code snippets.</a></li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> Added support for multiple ACC compilers. </li>
|
<li><span class="style1"><strong>[new]</strong></span> Added support for multiple ACC compilers.</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> BCC script compiler (<a href="https://github.com/wormt/bcc/">https://github.com/wormt/bcc/</a>) is bundled with GZDB.</li>
|
<li><span class="style1"><strong>[new]</strong></span> BCC script compiler (<a href="https://github.com/wormt/bcc/">https://github.com/wormt/bcc/</a>) is bundled with GZDB.</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> Script type can be chosen when creating or opening a map, and can be changed in Map Options form.</li>
|
<li><span class="style1"><strong>[new]</strong></span> Script type can be chosen when creating or opening a map, and can be changed in Map Options form.</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -151,6 +151,8 @@
|
||||||
</li>
|
</li>
|
||||||
<li>Line angle and front side direction are displayed when a line is drawn in Draw Geometry mode.</li>
|
<li>Line angle and front side direction are displayed when a line is drawn in Draw Geometry mode.</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> Floor/ceiling texture offsets can be pinned using this button in the toolbar: <img src="general/pin_textures.jpg"/>. When pinned, textures will be aligned to a sector while it is dragged.</li>
|
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> Floor/ceiling texture offsets can be pinned using this button in the toolbar: <img src="general/pin_textures.jpg"/>. When pinned, textures will be aligned to a sector while it is dragged.</li>
|
||||||
|
<li><span class="style1"><strong>[new]</strong></span> <strong>Tag Range plugin</strong>: custom increment can now be set.</li>
|
||||||
|
<li><span class="style1"><strong>[new]</strong></span> <strong>Tag Range plugin:</strong> tags can be set in relative mode (when this mode is enabled, generated values are added to existing tags instead of replacing them).</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> You can clear selection groups (default shortcuts are Ctrl-Shift-1 ... 0).</li>
|
<li><span class="style1"><strong>[new]</strong></span> You can clear selection groups (default shortcuts are Ctrl-Shift-1 ... 0).</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> You can add selection to groups, select and clear groups using <strong>Edit</strong> menu.
|
<li><span class="style1"><strong>[new]</strong></span> You can add selection to groups, select and clear groups using <strong>Edit</strong> menu.
|
||||||
<input class="spoilerbutton" type="button" onclick="ToggleSpoiler(this);" href="javascript:void(0);" value="Show image"/>
|
<input class="spoilerbutton" type="button" onclick="ToggleSpoiler(this);" href="javascript:void(0);" value="Show image"/>
|
||||||
|
@ -184,7 +186,7 @@
|
||||||
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> New actions: "<strong>Align Ceiling Texture to Back Side</strong>", "<strong>Align Ceiling Texture to Front Side</strong>", "<strong>Align Floor Texture to Back Side</strong>" and "<strong>Align Floor Texture to Front Side</strong>" (available in <strong>Linedefs -> Align Textures</strong> menu).</li>
|
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> New actions: "<strong>Align Ceiling Texture to Back Side</strong>", "<strong>Align Ceiling Texture to Front Side</strong>", "<strong>Align Floor Texture to Back Side</strong>" and "<strong>Align Floor Texture to Front Side</strong>" (available in <strong>Linedefs -> Align Textures</strong> menu).</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> "<strong>Make brightness gradient</strong>" command is available in Linedefs mode.</li>
|
<li><span class="style1"><strong>[new]</strong></span> <strong>[UDMF]</strong> "<strong>Make brightness gradient</strong>" command is available in Linedefs mode.</li>
|
||||||
<li><strong>[UDMF]</strong> Linedef info panel: relative UDMF light values are shown like this: <span class="style7">16</span> (<span class="style9">128</span>), which means "<span class="style7">UDMF light value</span>" ("<span class="style9">total surface brightness</span>"). Total surface brightness is UDMF light value + sector brightness.</li>
|
<li><strong>[UDMF]</strong> Linedef info panel: relative UDMF light values are shown like this: <span class="style7">16</span> (<span class="style9">128</span>), which means "<span class="style7">UDMF light value</span>" ("<span class="style9">total surface brightness</span>"). Total surface brightness is UDMF light value + sector brightness.</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> When a linedef is within Split Linedefs range, it is highlighted using Info line color.</li>
|
<li><span class="style1"><strong>[new]</strong></span> Split Linedefs preview (a rectangle, colored using Info line color) is shown in this mode.</li>
|
||||||
<li><span class="style1"><strong>[new]</strong></span> "<strong>Flip Linedefs</strong>" action will try to align linedefs, so their front (or back) point towards the same sector.</li>
|
<li><span class="style1"><strong>[new]</strong></span> "<strong>Flip Linedefs</strong>" action will try to align linedefs, so their front (or back) point towards the same sector.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
@ -208,7 +210,7 @@
|
||||||
<h3><a name="vertices" id="vertices"></a>Vertices mode:</h3>
|
<h3><a name="vertices" id="vertices"></a>Vertices mode:</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><strong>[UDMF]</strong> Vertical offsets of a vertex can be edited in Vertex Edit form and are shown in Vertex Info panel.</li>
|
<li><strong>[UDMF]</strong> Vertical offsets of a vertex can be edited in Vertex Edit form and are shown in Vertex Info panel.</li>
|
||||||
<li> When a linedef is within Split Linedefs range, it is highlighted using Info line color.</li>
|
<li><span class="style1"><strong>[new]</strong></span> Split Linedefs preview (a rectangle, colored using Info line color) is shown in this mode.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -81,7 +81,7 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
if(f.SelectionCount > 0)
|
if(f.SelectionCount > 0)
|
||||||
f.ShowDialog(Form.ActiveForm);
|
f.ShowDialog(Form.ActiveForm);
|
||||||
else
|
else
|
||||||
General.Interface.MessageBeep(MessageBeepType.Default);
|
General.Interface.DisplayStatus(StatusType.Warning, "This action requires a selection!"); //mxd
|
||||||
f.Dispose();
|
f.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
80
Source/Plugins/TagRange/TagRangeForm.Designer.cs
generated
80
Source/Plugins/TagRange/TagRangeForm.Designer.cs
generated
|
@ -37,6 +37,10 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
this.outoftagswarning = new System.Windows.Forms.Label();
|
this.outoftagswarning = new System.Windows.Forms.Label();
|
||||||
this.endtaglabel = new System.Windows.Forms.Label();
|
this.endtaglabel = new System.Windows.Forms.Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
this.label4 = new System.Windows.Forms.Label();
|
||||||
|
this.label2 = new System.Windows.Forms.Label();
|
||||||
|
this.rangestep = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||||
|
this.relativemode = new System.Windows.Forms.CheckBox();
|
||||||
|
this.bglabel = new System.Windows.Forms.Label();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// rangestart
|
// rangestart
|
||||||
|
@ -55,18 +59,19 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
//
|
//
|
||||||
this.label1.AutoSize = true;
|
|
||||||
this.label1.Location = new System.Drawing.Point(10, 17);
|
this.label1.Location = new System.Drawing.Point(10, 17);
|
||||||
this.label1.Name = "label1";
|
this.label1.Name = "label1";
|
||||||
this.label1.Size = new System.Drawing.Size(53, 14);
|
this.label1.Size = new System.Drawing.Size(62, 14);
|
||||||
this.label1.TabIndex = 1;
|
this.label1.TabIndex = 1;
|
||||||
this.label1.Text = "Start Tag:";
|
this.label1.Text = "Start Tag:";
|
||||||
|
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
//
|
//
|
||||||
// doubletagwarning
|
// doubletagwarning
|
||||||
//
|
//
|
||||||
|
this.doubletagwarning.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.doubletagwarning.BackColor = System.Drawing.SystemColors.Info;
|
this.doubletagwarning.BackColor = System.Drawing.SystemColors.Info;
|
||||||
this.doubletagwarning.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.doubletagwarning.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.doubletagwarning.Location = new System.Drawing.Point(12, 45);
|
this.doubletagwarning.Location = new System.Drawing.Point(12, 94);
|
||||||
this.doubletagwarning.Name = "doubletagwarning";
|
this.doubletagwarning.Name = "doubletagwarning";
|
||||||
this.doubletagwarning.Padding = new System.Windows.Forms.Padding(3);
|
this.doubletagwarning.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.doubletagwarning.Size = new System.Drawing.Size(273, 50);
|
this.doubletagwarning.Size = new System.Drawing.Size(273, 50);
|
||||||
|
@ -76,9 +81,10 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
//
|
//
|
||||||
// skipdoubletags
|
// skipdoubletags
|
||||||
//
|
//
|
||||||
|
this.skipdoubletags.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.skipdoubletags.AutoSize = true;
|
this.skipdoubletags.AutoSize = true;
|
||||||
this.skipdoubletags.BackColor = System.Drawing.SystemColors.Info;
|
this.skipdoubletags.BackColor = System.Drawing.SystemColors.Info;
|
||||||
this.skipdoubletags.Location = new System.Drawing.Point(63, 69);
|
this.skipdoubletags.Location = new System.Drawing.Point(63, 118);
|
||||||
this.skipdoubletags.Name = "skipdoubletags";
|
this.skipdoubletags.Name = "skipdoubletags";
|
||||||
this.skipdoubletags.Size = new System.Drawing.Size(161, 18);
|
this.skipdoubletags.Size = new System.Drawing.Size(161, 18);
|
||||||
this.skipdoubletags.TabIndex = 5;
|
this.skipdoubletags.TabIndex = 5;
|
||||||
|
@ -90,7 +96,7 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
// okbutton
|
// okbutton
|
||||||
//
|
//
|
||||||
this.okbutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.okbutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.okbutton.Location = new System.Drawing.Point(186, 102);
|
this.okbutton.Location = new System.Drawing.Point(186, 151);
|
||||||
this.okbutton.Name = "okbutton";
|
this.okbutton.Name = "okbutton";
|
||||||
this.okbutton.Size = new System.Drawing.Size(99, 26);
|
this.okbutton.Size = new System.Drawing.Size(99, 26);
|
||||||
this.okbutton.TabIndex = 6;
|
this.okbutton.TabIndex = 6;
|
||||||
|
@ -102,7 +108,7 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
//
|
//
|
||||||
this.cancelbutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
this.cancelbutton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.cancelbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.cancelbutton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.cancelbutton.Location = new System.Drawing.Point(81, 102);
|
this.cancelbutton.Location = new System.Drawing.Point(81, 151);
|
||||||
this.cancelbutton.Name = "cancelbutton";
|
this.cancelbutton.Name = "cancelbutton";
|
||||||
this.cancelbutton.Size = new System.Drawing.Size(99, 26);
|
this.cancelbutton.Size = new System.Drawing.Size(99, 26);
|
||||||
this.cancelbutton.TabIndex = 7;
|
this.cancelbutton.TabIndex = 7;
|
||||||
|
@ -112,14 +118,16 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
//
|
//
|
||||||
// outoftagswarning
|
// outoftagswarning
|
||||||
//
|
//
|
||||||
|
this.outoftagswarning.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
this.outoftagswarning.BackColor = System.Drawing.SystemColors.Info;
|
this.outoftagswarning.BackColor = System.Drawing.SystemColors.Info;
|
||||||
this.outoftagswarning.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
this.outoftagswarning.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
this.outoftagswarning.Location = new System.Drawing.Point(12, 45);
|
this.outoftagswarning.Location = new System.Drawing.Point(12, 94);
|
||||||
this.outoftagswarning.Name = "outoftagswarning";
|
this.outoftagswarning.Name = "outoftagswarning";
|
||||||
this.outoftagswarning.Padding = new System.Windows.Forms.Padding(3);
|
this.outoftagswarning.Padding = new System.Windows.Forms.Padding(3);
|
||||||
this.outoftagswarning.Size = new System.Drawing.Size(273, 50);
|
this.outoftagswarning.Size = new System.Drawing.Size(273, 50);
|
||||||
this.outoftagswarning.TabIndex = 8;
|
this.outoftagswarning.TabIndex = 8;
|
||||||
this.outoftagswarning.Text = "The range exceeds the maximum allowed tags and cannot be created.";
|
this.outoftagswarning.Text = "The range exceeds the maximum or minimum allowed tags and cannot be created.";
|
||||||
|
this.outoftagswarning.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
this.outoftagswarning.Visible = false;
|
this.outoftagswarning.Visible = false;
|
||||||
//
|
//
|
||||||
// endtaglabel
|
// endtaglabel
|
||||||
|
@ -140,13 +148,62 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
this.label4.TabIndex = 9;
|
this.label4.TabIndex = 9;
|
||||||
this.label4.Text = "End Tag:";
|
this.label4.Text = "End Tag:";
|
||||||
//
|
//
|
||||||
|
// label2
|
||||||
|
//
|
||||||
|
this.label2.Location = new System.Drawing.Point(10, 47);
|
||||||
|
this.label2.Name = "label2";
|
||||||
|
this.label2.Size = new System.Drawing.Size(62, 14);
|
||||||
|
this.label2.TabIndex = 11;
|
||||||
|
this.label2.Text = "Increment:";
|
||||||
|
this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
//
|
||||||
|
// rangestep
|
||||||
|
//
|
||||||
|
this.rangestep.AllowDecimal = false;
|
||||||
|
this.rangestep.AllowNegative = true;
|
||||||
|
this.rangestep.AllowRelative = false;
|
||||||
|
this.rangestep.ButtonStep = 1;
|
||||||
|
this.rangestep.ButtonStepFloat = 1F;
|
||||||
|
this.rangestep.Location = new System.Drawing.Point(76, 42);
|
||||||
|
this.rangestep.Name = "rangestep";
|
||||||
|
this.rangestep.Size = new System.Drawing.Size(96, 24);
|
||||||
|
this.rangestep.StepValues = null;
|
||||||
|
this.rangestep.TabIndex = 12;
|
||||||
|
this.rangestep.WhenTextChanged += new System.EventHandler(this.rangestep_WhenTextChanged);
|
||||||
|
//
|
||||||
|
// relativemode
|
||||||
|
//
|
||||||
|
this.relativemode.AutoSize = true;
|
||||||
|
this.relativemode.Location = new System.Drawing.Point(76, 72);
|
||||||
|
this.relativemode.Name = "relativemode";
|
||||||
|
this.relativemode.Size = new System.Drawing.Size(140, 18);
|
||||||
|
this.relativemode.TabIndex = 13;
|
||||||
|
this.relativemode.Text = "Relative to existing tags";
|
||||||
|
this.relativemode.UseVisualStyleBackColor = false;
|
||||||
|
this.relativemode.CheckedChanged += new System.EventHandler(this.relativemode_CheckedChanged);
|
||||||
|
//
|
||||||
|
// bglabel
|
||||||
|
//
|
||||||
|
this.bglabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||||
|
this.bglabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||||
|
this.bglabel.Enabled = false;
|
||||||
|
this.bglabel.Location = new System.Drawing.Point(12, 94);
|
||||||
|
this.bglabel.Name = "bglabel";
|
||||||
|
this.bglabel.Padding = new System.Windows.Forms.Padding(3);
|
||||||
|
this.bglabel.Size = new System.Drawing.Size(273, 50);
|
||||||
|
this.bglabel.TabIndex = 14;
|
||||||
|
this.bglabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
|
//
|
||||||
// TagRangeForm
|
// TagRangeForm
|
||||||
//
|
//
|
||||||
this.AcceptButton = this.okbutton;
|
this.AcceptButton = this.okbutton;
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||||
this.CancelButton = this.cancelbutton;
|
this.CancelButton = this.cancelbutton;
|
||||||
this.ClientSize = new System.Drawing.Size(298, 134);
|
this.ClientSize = new System.Drawing.Size(298, 183);
|
||||||
|
this.Controls.Add(this.relativemode);
|
||||||
|
this.Controls.Add(this.rangestep);
|
||||||
|
this.Controls.Add(this.label2);
|
||||||
this.Controls.Add(this.endtaglabel);
|
this.Controls.Add(this.endtaglabel);
|
||||||
this.Controls.Add(this.label4);
|
this.Controls.Add(this.label4);
|
||||||
this.Controls.Add(this.cancelbutton);
|
this.Controls.Add(this.cancelbutton);
|
||||||
|
@ -156,6 +213,7 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.rangestart);
|
this.Controls.Add(this.rangestart);
|
||||||
this.Controls.Add(this.outoftagswarning);
|
this.Controls.Add(this.outoftagswarning);
|
||||||
|
this.Controls.Add(this.bglabel);
|
||||||
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
this.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
this.MaximizeBox = false;
|
this.MaximizeBox = false;
|
||||||
|
@ -182,5 +240,9 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
private System.Windows.Forms.Label outoftagswarning;
|
private System.Windows.Forms.Label outoftagswarning;
|
||||||
private System.Windows.Forms.Label endtaglabel;
|
private System.Windows.Forms.Label endtaglabel;
|
||||||
private System.Windows.Forms.Label label4;
|
private System.Windows.Forms.Label label4;
|
||||||
|
private System.Windows.Forms.Label label2;
|
||||||
|
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox rangestep;
|
||||||
|
private System.Windows.Forms.CheckBox relativemode;
|
||||||
|
private System.Windows.Forms.Label bglabel;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,11 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
private UniversalType selectiontype;
|
private UniversalType selectiontype;
|
||||||
private int selectioncount;
|
private int selectioncount;
|
||||||
Dictionary<int, bool> usedtags;
|
Dictionary<int, bool> usedtags;
|
||||||
|
private List<int> initialtags; //mxd
|
||||||
|
|
||||||
|
//mxd. Persistent settings
|
||||||
|
private static int storedstep = 1;
|
||||||
|
private static bool storedrelative;
|
||||||
|
|
||||||
public int SelectionCount { get { return selectioncount; } }
|
public int SelectionCount { get { return selectioncount; } }
|
||||||
|
|
||||||
|
@ -31,6 +36,8 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
{
|
{
|
||||||
selectiontype = UniversalType.SectorTag;
|
selectiontype = UniversalType.SectorTag;
|
||||||
ICollection<Sector> list = General.Map.Map.GetSelectedSectors(true);
|
ICollection<Sector> list = General.Map.Map.GetSelectedSectors(true);
|
||||||
|
initialtags = new List<int>(list.Count); //mxd
|
||||||
|
foreach(Sector element in list) initialtags.Add(element.Tag); //mxd
|
||||||
selectioncount = list.Count;
|
selectioncount = list.Count;
|
||||||
this.Text = "Create tag range for " + selectioncount + (selectioncount > 1 ? " sectors" : " sector");
|
this.Text = "Create tag range for " + selectioncount + (selectioncount > 1 ? " sectors" : " sector");
|
||||||
}
|
}
|
||||||
|
@ -38,6 +45,8 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
{
|
{
|
||||||
selectiontype = UniversalType.LinedefTag;
|
selectiontype = UniversalType.LinedefTag;
|
||||||
ICollection<Linedef> list = General.Map.Map.GetSelectedLinedefs(true);
|
ICollection<Linedef> list = General.Map.Map.GetSelectedLinedefs(true);
|
||||||
|
initialtags = new List<int>(list.Count); //mxd
|
||||||
|
foreach(Linedef element in list) initialtags.Add(element.Tag); //mxd
|
||||||
selectioncount = list.Count;
|
selectioncount = list.Count;
|
||||||
this.Text = "Create tag range for " + selectioncount + (selectioncount > 1 ? " linedefs" : " linedef");
|
this.Text = "Create tag range for " + selectioncount + (selectioncount > 1 ? " linedefs" : " linedef");
|
||||||
}
|
}
|
||||||
|
@ -45,6 +54,8 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
{
|
{
|
||||||
selectiontype = UniversalType.ThingTag;
|
selectiontype = UniversalType.ThingTag;
|
||||||
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
|
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
|
||||||
|
initialtags = new List<int>(list.Count); //mxd
|
||||||
|
foreach(Thing element in list) initialtags.Add(element.Tag); //mxd
|
||||||
selectioncount = list.Count;
|
selectioncount = list.Count;
|
||||||
this.Text = "Create tag range for " + selectioncount + (selectioncount > 1 ? " things" : " thing");
|
this.Text = "Create tag range for " + selectioncount + (selectioncount > 1 ? " things" : " thing");
|
||||||
}
|
}
|
||||||
|
@ -56,6 +67,13 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
// Find the first unused tag to use as range start
|
// Find the first unused tag to use as range start
|
||||||
int starttag = General.Map.Map.GetNewTag();
|
int starttag = General.Map.Map.GetNewTag();
|
||||||
rangestart.Text = starttag.ToString();
|
rangestart.Text = starttag.ToString();
|
||||||
|
|
||||||
|
//mxd. Apply saved settings
|
||||||
|
rangestep.Text = storedstep.ToString();
|
||||||
|
relativemode.Checked = storedrelative;
|
||||||
|
|
||||||
|
//mxd. Do useless stuff
|
||||||
|
if(General.Random(0, 255) > 230) bglabel.Text = "Creating tag ranges is fun! ^_^";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handler for finding a new tag
|
// Handler for finding a new tag
|
||||||
|
@ -65,44 +83,84 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
}
|
}
|
||||||
|
|
||||||
// This creates a range
|
// This creates a range
|
||||||
private List<int> CreateRange(int starttag, bool skipusedtags, out bool tagsused, out bool outoftags)
|
private List<int> CreateRange(int starttag, int increment, bool relative, bool skipusedtags, out bool tagsused, out bool outoftags)
|
||||||
{
|
{
|
||||||
List<int> newtags = new List<int>(selectioncount);
|
List<int> newtags = new List<int>(selectioncount);
|
||||||
outoftags = false;
|
outoftags = false;
|
||||||
tagsused = false;
|
tagsused = false;
|
||||||
|
|
||||||
// Go for the number of tags we need
|
//mxd. Get relative tag range
|
||||||
for(int i = 0; i < selectioncount; i++)
|
if (relative)
|
||||||
{
|
{
|
||||||
if(starttag > General.Map.FormatInterface.MaxTag)
|
int newtag;
|
||||||
|
|
||||||
|
// Go for the number of tags we need
|
||||||
|
for(int i = 0; i < selectioncount; i++)
|
||||||
{
|
{
|
||||||
outoftags = true;
|
newtag = initialtags[i] + starttag;
|
||||||
return newtags;
|
|
||||||
}
|
if(newtag > General.Map.FormatInterface.MaxTag || newtag < General.Map.FormatInterface.MinTag)
|
||||||
|
|
||||||
if(skipusedtags)
|
|
||||||
{
|
|
||||||
// Find next unused tag
|
|
||||||
while(usedtags.ContainsKey(starttag))
|
|
||||||
{
|
{
|
||||||
if(starttag == General.Map.FormatInterface.MaxTag)
|
outoftags = true;
|
||||||
{
|
return newtags;
|
||||||
outoftags = true;
|
|
||||||
return newtags;
|
|
||||||
}
|
|
||||||
|
|
||||||
starttag++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(skipusedtags)
|
||||||
|
{
|
||||||
|
// Find next unused tag
|
||||||
|
while(usedtags.ContainsKey(newtag))
|
||||||
|
{
|
||||||
|
if(newtag >= General.Map.FormatInterface.MaxTag || newtag <= General.Map.FormatInterface.MinTag)
|
||||||
|
{
|
||||||
|
outoftags = true;
|
||||||
|
return newtags;
|
||||||
|
}
|
||||||
|
|
||||||
|
starttag += increment; //mxd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tagsused |= usedtags.ContainsKey(newtag);
|
||||||
|
}
|
||||||
|
|
||||||
|
newtags.Add(newtag);
|
||||||
|
starttag += increment;
|
||||||
}
|
}
|
||||||
else
|
}
|
||||||
|
else //mxd. Get absolute tag range
|
||||||
|
{
|
||||||
|
// Go for the number of tags we need
|
||||||
|
for (int i = 0; i < selectioncount; i++)
|
||||||
{
|
{
|
||||||
tagsused |= usedtags.ContainsKey(starttag);
|
if (starttag > General.Map.FormatInterface.MaxTag || starttag < General.Map.FormatInterface.MinTag)
|
||||||
|
{
|
||||||
|
outoftags = true;
|
||||||
|
return newtags;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (skipusedtags)
|
||||||
|
{
|
||||||
|
// Find next unused tag
|
||||||
|
while (usedtags.ContainsKey(starttag))
|
||||||
|
{
|
||||||
|
if (starttag >= General.Map.FormatInterface.MaxTag || starttag <= General.Map.FormatInterface.MinTag)
|
||||||
|
{
|
||||||
|
outoftags = true;
|
||||||
|
return newtags;
|
||||||
|
}
|
||||||
|
|
||||||
|
starttag += increment; //mxd
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tagsused |= usedtags.ContainsKey(starttag);
|
||||||
|
}
|
||||||
|
|
||||||
|
newtags.Add(starttag);
|
||||||
|
starttag += increment; //mxd
|
||||||
}
|
}
|
||||||
|
|
||||||
newtags.Add(starttag);
|
|
||||||
|
|
||||||
if(starttag < General.Map.FormatInterface.MaxTag)
|
|
||||||
starttag++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newtags;
|
return newtags;
|
||||||
|
@ -113,18 +171,17 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
{
|
{
|
||||||
bool outoftags, tagsused;
|
bool outoftags, tagsused;
|
||||||
int starttag = rangestart.GetResult(0);
|
int starttag = rangestart.GetResult(0);
|
||||||
|
int step = rangestep.GetResult(1); //mxd
|
||||||
|
|
||||||
List<int> tags = CreateRange(starttag, false, out tagsused, out outoftags);
|
List<int> tags = CreateRange(starttag, step, relativemode.Checked, skipdoubletags.Checked, out tagsused, out outoftags); //mxd
|
||||||
|
|
||||||
outoftagswarning.Visible = outoftags;
|
outoftagswarning.Visible = outoftags;
|
||||||
|
okbutton.Enabled = !outoftags;
|
||||||
doubletagwarning.Visible = tagsused && !outoftags;
|
doubletagwarning.Visible = tagsused && !outoftags;
|
||||||
skipdoubletags.Visible = tagsused && !outoftags;
|
skipdoubletags.Visible = tagsused && !outoftags;
|
||||||
skipdoubletags.BringToFront();
|
skipdoubletags.BringToFront();
|
||||||
|
|
||||||
tags = CreateRange(starttag, skipdoubletags.Checked, out tagsused, out outoftags);
|
|
||||||
|
|
||||||
if(tags.Count > 0)
|
if(tags.Count > 0) endtaglabel.Text = tags[tags.Count - 1].ToString();
|
||||||
endtaglabel.Text = tags[tags.Count - 1].ToString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Range start changes
|
// Range start changes
|
||||||
|
@ -138,9 +195,11 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
{
|
{
|
||||||
bool outoftags, tagsused;
|
bool outoftags, tagsused;
|
||||||
int starttag = rangestart.GetResult(0);
|
int starttag = rangestart.GetResult(0);
|
||||||
|
int step = rangestep.GetResult(1);
|
||||||
List<int> tags = CreateRange(starttag, skipdoubletags.Checked, out tagsused, out outoftags);
|
|
||||||
|
//mxd
|
||||||
|
List<int> tags = CreateRange(starttag, step, relativemode.Checked, skipdoubletags.Checked, out tagsused, out outoftags);
|
||||||
|
|
||||||
if(outoftags)
|
if(outoftags)
|
||||||
{
|
{
|
||||||
General.ShowWarningMessage("The range exceeds the maximum allowed tags and cannot be created.", MessageBoxButtons.OK);
|
General.ShowWarningMessage("The range exceeds the maximum allowed tags and cannot be created.", MessageBoxButtons.OK);
|
||||||
|
@ -153,28 +212,30 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
General.Map.UndoRedo.CreateUndo("Set " + selectioncount + " sector tags");
|
General.Map.UndoRedo.CreateUndo("Set " + selectioncount + " sector tags");
|
||||||
ICollection<Sector> list = General.Map.Map.GetSelectedSectors(true);
|
ICollection<Sector> list = General.Map.Map.GetSelectedSectors(true);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(Sector s in list)
|
foreach(Sector s in list) s.Tag = tags[index++];
|
||||||
s.Tag = tags[index++];
|
|
||||||
}
|
}
|
||||||
else if(selectiontype == UniversalType.LinedefTag)
|
else if(selectiontype == UniversalType.LinedefTag)
|
||||||
{
|
{
|
||||||
General.Map.UndoRedo.CreateUndo("Set " + selectioncount + " linedef tags");
|
General.Map.UndoRedo.CreateUndo("Set " + selectioncount + " linedef tags");
|
||||||
ICollection<Linedef> list = General.Map.Map.GetSelectedLinedefs(true);
|
ICollection<Linedef> list = General.Map.Map.GetSelectedLinedefs(true);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(Linedef l in list)
|
foreach(Linedef l in list) l.Tag = tags[index++];
|
||||||
l.Tag = tags[index++];
|
|
||||||
}
|
}
|
||||||
else if(selectiontype == UniversalType.ThingTag)
|
else if(selectiontype == UniversalType.ThingTag)
|
||||||
{
|
{
|
||||||
General.Map.UndoRedo.CreateUndo("Set " + selectioncount + " thing tags");
|
General.Map.UndoRedo.CreateUndo("Set " + selectioncount + " thing tags");
|
||||||
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
|
ICollection<Thing> list = General.Map.Map.GetSelectedThings(true);
|
||||||
int index = 0;
|
int index = 0;
|
||||||
foreach(Thing t in list)
|
foreach(Thing t in list) t.Tag = tags[index++];
|
||||||
t.Tag = tags[index++];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd. Store settings
|
||||||
|
storedstep = rangestep.GetResult(1);
|
||||||
|
storedrelative = relativemode.Checked;
|
||||||
|
|
||||||
|
//We are done here.
|
||||||
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cancel clicked
|
// Cancel clicked
|
||||||
|
@ -188,6 +249,19 @@ namespace CodeImp.DoomBuilder.TagRange
|
||||||
{
|
{
|
||||||
UpdateChanges();
|
UpdateChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
private void rangestep_WhenTextChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
|
|
||||||
|
//mxd
|
||||||
|
private void relativemode_CheckedChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
rangestart.AllowNegative = relativemode.Checked;
|
||||||
|
UpdateChanges();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue