diff --git a/Source/Core/Builder.csproj b/Source/Core/Builder.csproj index 41cc55a4..fe35b728 100644 --- a/Source/Core/Builder.csproj +++ b/Source/Core/Builder.csproj @@ -795,6 +795,12 @@ ColorFieldsControl.cs + + UserControl + + + TagsSelector.cs + UserControl @@ -1022,6 +1028,9 @@ ColorFieldsControl.cs + + TagsSelector.cs + CustomLinedefColorProperties.cs diff --git a/Source/Core/Controls/LinedefInfoPanel.cs b/Source/Core/Controls/LinedefInfoPanel.cs index 18ded945..39fdc8ed 100644 --- a/Source/Core/Controls/LinedefInfoPanel.cs +++ b/Source/Core/Controls/LinedefInfoPanel.cs @@ -121,10 +121,23 @@ namespace CodeImp.DoomBuilder.Controls taglabel.Visible = true; tag.Visible = true; - //set tag - tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " - " + General.Map.Options.TagLabels[l.Tag] : string.Empty); - tag.Enabled = (l.Tag != 0); - taglabel.Enabled = (l.Tag != 0); + //mxd. Set tag(s) + if(l.Tags.Count > 1) + { + string[] tags = new string[l.Tags.Count]; + for (int i = 0; i < l.Tags.Count; i++) tags[i] = l.Tags[i].ToString(); + tag.Text = string.Join(", ", tags); + tag.Enabled = true; + taglabel.Enabled = true; + taglabel.Text = "Tags:"; + } + else + { + tag.Text = l.Tag + (General.Map.Options.TagLabels.ContainsKey(l.Tag) ? " - " + General.Map.Options.TagLabels[l.Tag] : string.Empty); + tag.Enabled = (l.Tag != 0); + taglabel.Enabled = (l.Tag != 0); + taglabel.Text = "Tag:"; + } } // Get line action information diff --git a/Source/Core/Controls/SectorInfoPanel.Designer.cs b/Source/Core/Controls/SectorInfoPanel.Designer.cs index dd5f7421..a368fb1a 100644 --- a/Source/Core/Controls/SectorInfoPanel.Designer.cs +++ b/Source/Core/Controls/SectorInfoPanel.Designer.cs @@ -32,8 +32,8 @@ namespace CodeImp.DoomBuilder.Controls System.Windows.Forms.Label label5; this.labelfloor = new System.Windows.Forms.Label(); this.labelceiling = new System.Windows.Forms.Label(); - this.labelTag = new System.Windows.Forms.Label(); - this.labelEffect = new System.Windows.Forms.Label(); + this.taglabel = new System.Windows.Forms.Label(); + this.effectlabel = new System.Windows.Forms.Label(); this.ceilingLightLabel = new System.Windows.Forms.Label(); this.ceilingScaleLabel = new System.Windows.Forms.Label(); this.ceilingAngleLabel = new System.Windows.Forms.Label(); @@ -119,23 +119,23 @@ namespace CodeImp.DoomBuilder.Controls this.labelceiling.Text = "Ceiling:"; this.labelceiling.TextAlign = System.Drawing.ContentAlignment.TopRight; // - // labelTag + // taglabel // - this.labelTag.Location = new System.Drawing.Point(8, 79); - this.labelTag.Name = "labelTag"; - this.labelTag.Size = new System.Drawing.Size(44, 14); - this.labelTag.TabIndex = 4; - this.labelTag.Text = "Tag:"; - this.labelTag.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.taglabel.Location = new System.Drawing.Point(8, 79); + this.taglabel.Name = "taglabel"; + this.taglabel.Size = new System.Drawing.Size(44, 14); + this.taglabel.TabIndex = 4; + this.taglabel.Text = "Tag:"; + this.taglabel.TextAlign = System.Drawing.ContentAlignment.TopRight; // // labelEffect // - this.labelEffect.Location = new System.Drawing.Point(8, 19); - this.labelEffect.Name = "labelEffect"; - this.labelEffect.Size = new System.Drawing.Size(44, 14); - this.labelEffect.TabIndex = 0; - this.labelEffect.Text = "Effect:"; - this.labelEffect.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.effectlabel.Location = new System.Drawing.Point(8, 19); + this.effectlabel.Name = "effectlabel"; + this.effectlabel.Size = new System.Drawing.Size(44, 14); + this.effectlabel.TabIndex = 0; + this.effectlabel.Text = "Effect:"; + this.effectlabel.TextAlign = System.Drawing.ContentAlignment.TopRight; // // ceilingLightLabel // @@ -222,11 +222,11 @@ namespace CodeImp.DoomBuilder.Controls this.sectorinfo.Controls.Add(this.tag); this.sectorinfo.Controls.Add(this.floor); this.sectorinfo.Controls.Add(this.ceiling); - this.sectorinfo.Controls.Add(this.labelTag); + this.sectorinfo.Controls.Add(this.taglabel); this.sectorinfo.Controls.Add(this.labelfloor); this.sectorinfo.Controls.Add(this.labelceiling); this.sectorinfo.Controls.Add(this.effect); - this.sectorinfo.Controls.Add(this.labelEffect); + this.sectorinfo.Controls.Add(this.effectlabel); this.sectorinfo.Location = new System.Drawing.Point(0, 0); this.sectorinfo.Margin = new System.Windows.Forms.Padding(0, 0, 3, 0); this.sectorinfo.Name = "sectorinfo"; @@ -601,8 +601,8 @@ namespace CodeImp.DoomBuilder.Controls private System.Windows.Forms.Label labelLight; private System.Windows.Forms.GroupBox flagsPanel; private System.Windows.Forms.ListView flags; - private System.Windows.Forms.Label labelTag; - private System.Windows.Forms.Label labelEffect; + private System.Windows.Forms.Label taglabel; + private System.Windows.Forms.Label effectlabel; private System.Windows.Forms.Label labelfloor; private System.Windows.Forms.Label labelceiling; } diff --git a/Source/Core/Controls/SectorInfoPanel.cs b/Source/Core/Controls/SectorInfoPanel.cs index 78023e2d..495388c4 100644 --- a/Source/Core/Controls/SectorInfoPanel.cs +++ b/Source/Core/Controls/SectorInfoPanel.cs @@ -65,17 +65,32 @@ namespace CodeImp.DoomBuilder.Controls effect.Text = effectinfo; ceiling.Text = s.CeilHeight.ToString(); floor.Text = s.FloorHeight.ToString(); - tag.Text = s.Tag + (General.Map.Options.TagLabels.ContainsKey(s.Tag) ? " - " + General.Map.Options.TagLabels[s.Tag] : string.Empty); height.Text = sheight.ToString(); brightness.Text = s.Brightness.ToString(); floorname.Text = s.FloorTexture; ceilingname.Text = s.CeilTexture; + //mxd. Set tags + if(s.Tags.Count > 1) + { + string[] tags = new string[s.Tags.Count]; + for(int i = 0; i < s.Tags.Count; i++) tags[i] = s.Tags[i].ToString(); + tag.Text = string.Join(", ", tags); + tag.Enabled = true; + taglabel.Enabled = true; + taglabel.Text = "Tags:"; + } + else + { + tag.Text = s.Tag + (General.Map.Options.TagLabels.ContainsKey(s.Tag) ? " - " + General.Map.Options.TagLabels[s.Tag] : string.Empty); + tag.Enabled = (s.Tag != 0); + taglabel.Enabled = (s.Tag != 0); + taglabel.Text = "Tag:"; + } + //mxd effect.Enabled = (s.Effect != 0); - labelEffect.Enabled = (s.Effect != 0); - tag.Enabled = (s.Tag != 0); - labelTag.Enabled = (s.Tag != 0); + effectlabel.Enabled = (s.Effect != 0); //mxd. Texture size if (s.LongFloorTexture == MapSet.EmptyLongName) diff --git a/Source/Core/GZBuilder/Controls/TagSelector.Designer.cs b/Source/Core/GZBuilder/Controls/TagSelector.Designer.cs index 63b93e81..7297d472 100644 --- a/Source/Core/GZBuilder/Controls/TagSelector.Designer.cs +++ b/Source/Core/GZBuilder/Controls/TagSelector.Designer.cs @@ -33,18 +33,23 @@ this.cbTagPicker = new System.Windows.Forms.ComboBox(); this.newTag = new System.Windows.Forms.Button(); this.unusedTag = new System.Windows.Forms.Button(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.clear = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.label1.ForeColor = System.Drawing.SystemColors.HotTrack; this.label1.Location = new System.Drawing.Point(7, 10); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(29, 13); this.label1.TabIndex = 0; this.label1.Text = "Tag:"; + this.tooltip.SetToolTip(this.label1, "Use \">=\" or \"<=\" prefixes to create\r\nacsending or descending tags range.\r\nUse \"++" + + "\" or \"--\" prefixes to increment\r\nor decrement already existing tags \r\nby given v" + + "alue."); // // cbTagPicker // @@ -66,7 +71,7 @@ this.newTag.Size = new System.Drawing.Size(54, 24); this.newTag.TabIndex = 2; this.newTag.Text = "New"; - this.toolTip1.SetToolTip(this.newTag, "Finds a tag, which is not used as a tag or tag action argument \r\nby any map eleme" + + this.tooltip.SetToolTip(this.newTag, "Finds a tag, which is not used as a tag or tag action argument \r\nby any map eleme" + "nt"); this.newTag.UseVisualStyleBackColor = true; this.newTag.Click += new System.EventHandler(this.newTag_Click); @@ -79,10 +84,17 @@ this.unusedTag.Size = new System.Drawing.Size(54, 24); this.unusedTag.TabIndex = 3; this.unusedTag.Text = "Unused"; - this.toolTip1.SetToolTip(this.unusedTag, "Finds a tag, which is not used as a tag \r\nby any map element of this type"); + this.tooltip.SetToolTip(this.unusedTag, "Finds a tag, which is not used as a tag \r\nby any map element of this type"); this.unusedTag.UseVisualStyleBackColor = true; this.unusedTag.Click += new System.EventHandler(this.unusedTag_Click); // + // tooltip + // + this.tooltip.AutomaticDelay = 10; + this.tooltip.AutoPopDelay = 10000; + this.tooltip.InitialDelay = 10; + this.tooltip.ReshowDelay = 100; + // // clear // this.clear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -91,7 +103,7 @@ this.clear.Name = "clear"; this.clear.Size = new System.Drawing.Size(26, 24); this.clear.TabIndex = 4; - this.toolTip1.SetToolTip(this.clear, "Sets tag to 0"); + this.tooltip.SetToolTip(this.clear, "Sets tag to 0"); this.clear.UseVisualStyleBackColor = true; this.clear.Click += new System.EventHandler(this.clear_Click); // @@ -117,7 +129,7 @@ private System.Windows.Forms.ComboBox cbTagPicker; private System.Windows.Forms.Button newTag; private System.Windows.Forms.Button unusedTag; - private System.Windows.Forms.ToolTip toolTip1; + private System.Windows.Forms.ToolTip tooltip; private System.Windows.Forms.Button clear; } } diff --git a/Source/Core/GZBuilder/Controls/TagSelector.cs b/Source/Core/GZBuilder/Controls/TagSelector.cs index c9b1843d..7c558f73 100644 --- a/Source/Core/GZBuilder/Controls/TagSelector.cs +++ b/Source/Core/GZBuilder/Controls/TagSelector.cs @@ -36,7 +36,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls private List infos; private bool valid; private int tag; - private UniversalType elementType; + private UniversalType elementtype; private int rangemode; //0 - none, 1 - positive (>=), -1 - negative (<=) private int offsetmode; //0 - none, 1 - positive (++), -1 - negative (--) @@ -53,37 +53,50 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls #region ================== Methods - public void Setup(UniversalType elementType) + public void Setup(UniversalType mapelementtype) { tags = new List(); infos = new List(); - this.elementType = elementType; + this.elementtype = mapelementtype; - //collect used tags from sectors... - foreach(Sector s in General.Map.Map.Sectors) + //collect used tags from appropriate element type... + switch(elementtype) { - if(s.Tag == 0 || tags.Contains(s.Tag)) continue; - tags.Add(s.Tag); - } + case UniversalType.SectorTag: + foreach(Sector s in General.Map.Map.Sectors) + { + foreach(int t in s.Tags) + { + if(t == 0 || tags.Contains(t)) continue; + tags.Add(t); + } + } + break; - //...and linedefs... - if(General.Map.FormatInterface.HasLinedefTag) - { - foreach(Linedef l in General.Map.Map.Linedefs) - { - if(l.Tag == 0 || tags.Contains(l.Tag)) continue; - tags.Add(l.Tag); - } - } + case UniversalType.LinedefTag: + if(General.Map.FormatInterface.HasLinedefTag) + { + foreach(Linedef l in General.Map.Map.Linedefs) + { + foreach(int t in l.Tags) + { + if(t == 0 || tags.Contains(t)) continue; + tags.Add(t); + } + } + } + break; - //...and things... - if(General.Map.FormatInterface.HasThingTag) - { - foreach(Thing t in General.Map.Map.Things) - { - if(t.Tag == 0 || tags.Contains(t.Tag)) continue; - tags.Add(t.Tag); - } + case UniversalType.ThingTag: + if(General.Map.FormatInterface.HasThingTag) + { + foreach(Thing t in General.Map.Map.Things) + { + if(t.Tag == 0 || tags.Contains(t.Tag)) continue; + tags.Add(t.Tag); + } + } + break; } //now sort them in descending order @@ -224,7 +237,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls private void unusedTag_Click(object sender, EventArgs e) { - tag = General.Map.Map.GetNewTag(elementType); + tag = General.Map.Map.GetNewTag(elementtype); cbTagPicker.SelectedIndex = -1; cbTagPicker.Text = tag.ToString(); valid = true; diff --git a/Source/Core/GZBuilder/Controls/TagSelector.resx b/Source/Core/GZBuilder/Controls/TagSelector.resx index 7ce03af8..f991e2b7 100644 --- a/Source/Core/GZBuilder/Controls/TagSelector.resx +++ b/Source/Core/GZBuilder/Controls/TagSelector.resx @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + 17, 17 \ No newline at end of file diff --git a/Source/Core/GZBuilder/Controls/TagsSelector.Designer.cs b/Source/Core/GZBuilder/Controls/TagsSelector.Designer.cs new file mode 100644 index 00000000..6166cc49 --- /dev/null +++ b/Source/Core/GZBuilder/Controls/TagsSelector.Designer.cs @@ -0,0 +1,196 @@ +namespace CodeImp.DoomBuilder.GZBuilder.Controls +{ + partial class TagsSelector + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if(disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.components = new System.ComponentModel.Container(); + this.curtaglabel = new System.Windows.Forms.Label(); + this.tagpicker = new System.Windows.Forms.ComboBox(); + this.newtag = new System.Windows.Forms.Button(); + this.unusedtag = new System.Windows.Forms.Button(); + this.tooltip = new System.Windows.Forms.ToolTip(this.components); + this.removetag = new System.Windows.Forms.Button(); + this.addtag = new System.Windows.Forms.Button(); + this.clear = new System.Windows.Forms.Button(); + this.tagslist = new System.Windows.Forms.LinkLabel(); + this.label1 = new System.Windows.Forms.Label(); + this.clearalltags = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // curtaglabel + // + this.curtaglabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(204))); + this.curtaglabel.ForeColor = System.Drawing.SystemColors.HotTrack; + this.curtaglabel.Location = new System.Drawing.Point(8, 10); + this.curtaglabel.Name = "curtaglabel"; + this.curtaglabel.Size = new System.Drawing.Size(52, 13); + this.curtaglabel.TabIndex = 0; + this.curtaglabel.Text = "Tag 1:"; + this.curtaglabel.TextAlign = System.Drawing.ContentAlignment.TopRight; + this.tooltip.SetToolTip(this.curtaglabel, "Use \">=\" or \"<=\" prefixes to create\r\nacsending or descending tags range.\r\nUse \"++" + + "\" or \"--\" prefixes to increment\r\nor decrement already existing tags \r\nby given v" + + "alue."); + // + // tagpicker + // + this.tagpicker.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tagpicker.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; + this.tagpicker.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.tagpicker.FormattingEnabled = true; + this.tagpicker.Location = new System.Drawing.Point(65, 7); + this.tagpicker.Name = "tagpicker"; + this.tagpicker.Size = new System.Drawing.Size(230, 21); + this.tagpicker.TabIndex = 1; + this.tagpicker.TextChanged += new System.EventHandler(this.tagpicker_TextChanged); + // + // newtag + // + this.newtag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.newtag.Location = new System.Drawing.Point(299, 5); + this.newtag.Name = "newtag"; + this.newtag.Size = new System.Drawing.Size(54, 24); + this.newtag.TabIndex = 2; + this.newtag.Text = "New"; + this.tooltip.SetToolTip(this.newtag, "Find number, which is not used as a tag\r\nor tag action argument by any map elemen" + + "t"); + this.newtag.UseVisualStyleBackColor = true; + this.newtag.Click += new System.EventHandler(this.newtag_Click); + // + // unusedtag + // + this.unusedtag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.unusedtag.Location = new System.Drawing.Point(356, 5); + this.unusedtag.Name = "unusedtag"; + this.unusedtag.Size = new System.Drawing.Size(54, 24); + this.unusedtag.TabIndex = 3; + this.unusedtag.Text = "Unused"; + this.tooltip.SetToolTip(this.unusedtag, "Find number, which is not used as a tag \r\nby any map element of this type"); + this.unusedtag.UseVisualStyleBackColor = true; + this.unusedtag.Click += new System.EventHandler(this.unusedtag_Click); + // + // removetag + // + this.removetag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.removetag.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear; + this.removetag.Location = new System.Drawing.Point(413, 33); + this.removetag.Name = "removetag"; + this.removetag.Size = new System.Drawing.Size(26, 24); + this.removetag.TabIndex = 7; + this.tooltip.SetToolTip(this.removetag, "Remove selected tag"); + this.removetag.UseVisualStyleBackColor = true; + this.removetag.Click += new System.EventHandler(this.removetag_Click); + // + // addtag + // + this.addtag.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.addtag.Image = global::CodeImp.DoomBuilder.Properties.Resources.Add; + this.addtag.Location = new System.Drawing.Point(384, 33); + this.addtag.Name = "addtag"; + this.addtag.Size = new System.Drawing.Size(26, 24); + this.addtag.TabIndex = 8; + this.tooltip.SetToolTip(this.addtag, "Add new tag"); + this.addtag.UseVisualStyleBackColor = true; + this.addtag.Click += new System.EventHandler(this.addtag_Click); + // + // clear + // + this.clear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.clear.Image = global::CodeImp.DoomBuilder.Properties.Resources.Reset; + this.clear.Location = new System.Drawing.Point(413, 5); + this.clear.Name = "clear"; + this.clear.Size = new System.Drawing.Size(26, 24); + this.clear.TabIndex = 9; + this.tooltip.SetToolTip(this.clear, "Set current tag to 0"); + this.clear.UseVisualStyleBackColor = true; + this.clear.Click += new System.EventHandler(this.clear_Click); + // + // tagslist + // + this.tagslist.AutoSize = true; + this.tagslist.Location = new System.Drawing.Point(63, 39); + this.tagslist.Name = "tagslist"; + this.tagslist.Size = new System.Drawing.Size(82, 13); + this.tagslist.TabIndex = 5; + this.tagslist.TabStop = true; + this.tagslist.Text = "12 , ??? , [667]"; + this.tagslist.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.tagslist_LinkClicked); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(28, 39); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(34, 13); + this.label1.TabIndex = 6; + this.label1.Text = "Tags:"; + // + // clearalltags + // + this.clearalltags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Clear; + this.clearalltags.Location = new System.Drawing.Point(0, 33); + this.clearalltags.Name = "clearalltags"; + this.clearalltags.Size = new System.Drawing.Size(24, 24); + this.clearalltags.TabIndex = 10; + this.tooltip.SetToolTip(this.clearalltags, "Remove all tags"); + this.clearalltags.UseVisualStyleBackColor = true; + this.clearalltags.Click += new System.EventHandler(this.clearalltags_Click); + // + // TagsSelector + // + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.Controls.Add(this.clearalltags); + this.Controls.Add(this.clear); + this.Controls.Add(this.addtag); + this.Controls.Add(this.removetag); + this.Controls.Add(this.label1); + this.Controls.Add(this.tagslist); + this.Controls.Add(this.unusedtag); + this.Controls.Add(this.newtag); + this.Controls.Add(this.tagpicker); + this.Controls.Add(this.curtaglabel); + this.Name = "TagsSelector"; + this.Size = new System.Drawing.Size(442, 60); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label curtaglabel; + private System.Windows.Forms.ComboBox tagpicker; + private System.Windows.Forms.Button newtag; + private System.Windows.Forms.Button unusedtag; + private System.Windows.Forms.ToolTip tooltip; + private System.Windows.Forms.LinkLabel tagslist; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button removetag; + private System.Windows.Forms.Button addtag; + private System.Windows.Forms.Button clear; + private System.Windows.Forms.Button clearalltags; + } +} diff --git a/Source/Core/GZBuilder/Controls/TagsSelector.cs b/Source/Core/GZBuilder/Controls/TagsSelector.cs new file mode 100644 index 00000000..2be758d3 --- /dev/null +++ b/Source/Core/GZBuilder/Controls/TagsSelector.cs @@ -0,0 +1,407 @@ +#region ================== Namespaces + +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using CodeImp.DoomBuilder.Map; +using CodeImp.DoomBuilder.Types; + +#endregion + +namespace CodeImp.DoomBuilder.GZBuilder.Controls +{ + public partial class TagsSelector : UserControl + { + #region ================== Structs + + private struct TagLinkData + { + public int Index; + public int Tag; + } + + #endregion + + #region ================== Variables + + private List usedtags; //tags already used in the map + private List infos; + private List tags; //tags being edited + private List rangemodes; //0 - none, 1 - positive (>=), -1 - negative (<=) + private List offsetmodes; //0 - none, 1 - positive (++), -1 - negative (--) + private UniversalType elementtype; + private const string TAGS_SEPARATOR = ", "; + private int curtagindex; + private bool blockupdate; + + #endregion + + #region ================== Constructor + + public TagsSelector() + { + InitializeComponent(); + } + + #endregion + + #region ================== Setup + + public void Setup(UniversalType mapelementtype) + { + tags = new List(); + usedtags = new List(); + rangemodes = new List(); + offsetmodes = new List(); + infos = new List(); + elementtype = mapelementtype; + + //collect used tags from appropriate element type... + switch(elementtype) + { + case UniversalType.SectorTag: + foreach(Sector s in General.Map.Map.Sectors) + { + foreach(int tag in s.Tags) + { + if(tag == 0 || usedtags.Contains(tag)) continue; + usedtags.Add(tag); + } + } + break; + + case UniversalType.LinedefTag: + if(General.Map.FormatInterface.HasLinedefTag) + { + foreach(Linedef l in General.Map.Map.Linedefs) + { + foreach(int tag in l.Tags) + { + if(tag == 0 || usedtags.Contains(tag)) continue; + usedtags.Add(tag); + } + } + } + break; + + default: + throw new NotSupportedException(elementtype + " doesn't support 'moreids' property!"); + } + + //now sort them in descending order + usedtags.Sort((a, b) => -1 * a.CompareTo(b)); + + //create tag infos + foreach(int tag in usedtags) + { + if(General.Map.Options.TagLabels.ContainsKey(tag)) //tag labels + infos.Add(new TagInfo(tag, General.Map.Options.TagLabels[tag])); + else + infos.Add(new TagInfo(tag, string.Empty)); + } + + foreach(TagInfo info in infos) tagpicker.Items.Add(info); + tagpicker.DropDownWidth = DoomBuilder.Geometry.Tools.GetDropDownWidth(tagpicker); + } + + // Update collections and controls + public void FinishSetup() + { + if(tags.Count == 0) tags.Add(0); + + // Initialize modifier modes + for(int i = 0; i < tags.Count; i++) + { + rangemodes.Add(0); + offsetmodes.Add(0); + } + + // Update controls + UpdateTagPicker(tags[0]); + UpdateTagsList(); + removetag.Enabled = (tags.Count > 1); + } + + public void SetValue(List newtags, bool first) + { + if(first) + { + foreach(int tag in newtags) tags.Add(tag); + return; + } + + for(int i = 0; i < newtags.Count; i++) + { + if(i < tags.Count && newtags[i] != tags[i]) + tags[i] = int.MinValue; + else if(i >= tags.Count) + tags.Add(int.MinValue); + } + } + + #endregion + + #region ================== Apply + + public void ApplyTo(Linedef mo, int offset) + { + int[] oldtags = new int[mo.Tags.Count]; + mo.Tags.CopyTo(oldtags); + mo.Tags.Clear(); + mo.Tags.AddRange(GetResultTags(oldtags, offset)); + } + + public void ApplyTo(Sector mo, int offset) + { + int[] oldtags = new int[mo.Tags.Count]; + mo.Tags.CopyTo(oldtags); + mo.Tags.Clear(); + mo.Tags.AddRange(GetResultTags(oldtags, offset)); + } + + private IEnumerable GetResultTags(int[] oldtags, int offset) + { + Dictionary newtags = new Dictionary(); + + for(int i = 0; i < tags.Count; i++) + { + if(tags[i] == int.MinValue && oldtags.Length > i) + { + if(!newtags.ContainsKey(oldtags[i])) newtags.Add(oldtags[i], false); + } + else if(tags[i] != 0 && tags[i] != int.MinValue) + { + int tag; + if(rangemodes[i] != 0) + tag = tags[i] + offset * rangemodes[i]; + else if(offsetmodes[i] != 0 && oldtags.Length > i) + tag = oldtags[i] + tags[i] * offsetmodes[i]; + else + tag = tags[i]; + + if(!newtags.ContainsKey(tag)) newtags.Add(tag, false); + } + } + + if(newtags.Count == 0) newtags.Add(0, false); + return newtags.Keys; + } + + #endregion + + #region ================== Methods + + private void UpdateTagsList() + { + string[] displaytags = new string[tags.Count]; + int displaytagslen = 0; + tagslist.Links.Clear(); + + // Gather tags into a single string collection + for(int i = 0; i < tags.Count; i++) + { + displaytags[i] = (tags[i] == int.MinValue ? "???" : tags[i].ToString()); + + // Add modify mode markers + if(offsetmodes[i] == -1) displaytags[i] = "--" + displaytags[i]; + else if(offsetmodes[i] == 1) displaytags[i] = "++" + displaytags[i]; + else if(rangemodes[i] == -1) displaytags[i] = "<=" + displaytags[i]; + else if(rangemodes[i] == 1) displaytags[i] = ">=" + displaytags[i]; + + // Add selection indictor + if(curtagindex == i) displaytags[i] = "[" + displaytags[i] + "]"; + else displaytags[i] = " " + displaytags[i] + " "; + + int start = displaytagslen + i * TAGS_SEPARATOR.Length; + tagslist.Links.Add(new LinkLabel.Link(start, displaytags[i].Length, new TagLinkData { Index = i, Tag = tags[i] })); + displaytagslen += displaytags[i].Length; + } + + // Create label text + tagslist.Text = string.Join(TAGS_SEPARATOR, displaytags); + + // Update current tag label + curtaglabel.Text = "Tag " + (curtagindex + 1) + ":"; + } + + private void UpdateTagPicker(int tag) + { + blockupdate = true; + + tagpicker.SelectedIndex = -1; + + if(tag == int.MinValue) + { + tagpicker.Text = string.Empty; + } + else if(rangemodes[curtagindex] != 0 && tag != 0) + { + tagpicker.Text = (rangemodes[curtagindex] == 1 ? ">=" : "<=") + tag; + } + else if(offsetmodes[curtagindex] != 0 && tag != 0) + { + tagpicker.Text = (offsetmodes[curtagindex] == 1 ? "++" : "--") + tag; + } + else + { + foreach(var item in tagpicker.Items) + if(((TagInfo)item).Tag == tag) tagpicker.SelectedItem = item; + + if(tagpicker.SelectedIndex == -1) tagpicker.Text = tag.ToString(); + } + + blockupdate = false; + } + + #endregion + + #region ================== Events + + private void newtag_Click(object sender, EventArgs e) + { + tagpicker.SelectedIndex = -1; + tagpicker.Text = General.Map.Map.GetNewTag().ToString(); + } + + private void unusedtag_Click(object sender, EventArgs e) + { + tagpicker.SelectedIndex = -1; + tagpicker.Text = General.Map.Map.GetNewTag(elementtype).ToString(); + } + + private void clear_Click(object sender, EventArgs e) + { + tagpicker.SelectedIndex = -1; + tagpicker.Text = "0"; + } + + private void addtag_Click(object sender, EventArgs e) + { + int nt = General.Map.Map.GetNewTag(tags); + tags.Add(nt); + rangemodes.Add(0); + offsetmodes.Add(0); + curtagindex = tags.Count - 1; + + // Update controls + blockupdate = true; + tagpicker.Text = nt.ToString(); + blockupdate = false; + + removetag.Enabled = true; + UpdateTagsList(); + } + + private void removetag_Click(object sender, EventArgs e) + { + tags.RemoveAt(curtagindex); + rangemodes.RemoveAt(curtagindex); + offsetmodes.RemoveAt(curtagindex); + if(curtagindex >= tags.Count) curtagindex = tags.Count - 1; + + // Update controls + UpdateTagPicker(tags[curtagindex]); + + removetag.Enabled = (tags.Count > 1); + UpdateTagsList(); + } + + private void clearalltags_Click(object sender, EventArgs e) + { + curtagindex = 0; + + // Clear collections + tags.Clear(); + tags.Add(0); + rangemodes.Clear(); + rangemodes.Add(0); + offsetmodes.Clear(); + offsetmodes.Add(0); + + // Update controls + blockupdate = true; + tagpicker.Text = "0"; + blockupdate = false; + + removetag.Enabled = false; + UpdateTagsList(); + } + + private void tagslist_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + TagLinkData data = (TagLinkData)e.Link.LinkData; + curtagindex = data.Index; + curtaglabel.Text = "Tag " + (curtagindex + 1) + ":"; + + // Update interface + UpdateTagPicker(data.Tag); + UpdateTagsList(); + } + + private void tagpicker_TextChanged(object sender, EventArgs e) + { + if(blockupdate) return; + + if(tagpicker.SelectedItem != null) + { + TagInfo info = (TagInfo)tagpicker.SelectedItem; + tags[curtagindex] = info.Tag; + UpdateTagsList(); + return; + } + + string text = tagpicker.Text.Trim(); + if(string.IsNullOrEmpty(text)) + { + tags[curtagindex] = int.MinValue; + UpdateTagsList(); + return; + } + + //incremental? + int rangemode = 0; + int offsetmode = 0; + if(text.Length > 2) + { + if(text.StartsWith(">=")) //range up + { + rangemode = 1; + text = text.Substring(2, text.Length - 2); + } + else if(text.StartsWith("<=")) //range down + { + rangemode = -1; + text = text.Substring(2, text.Length - 2); + } + else if(text.StartsWith("++")) //relative up + { + offsetmode = 1; + text = text.Substring(2, text.Length - 2); + } + else if(text.StartsWith("--")) //relative down + { + offsetmode = -1; + text = text.Substring(2, text.Length - 2); + } + } + + int tag; + if(int.TryParse(text, out tag)) + { + // Validate entered tag + if((tag < General.Map.FormatInterface.MinTag) || (tag > General.Map.FormatInterface.MaxTag)) + { + General.ShowWarningMessage("Sector tag must be between " + General.Map.FormatInterface.MinTag + " and " + General.Map.FormatInterface.MaxTag + ".", MessageBoxButtons.OK); + return; + } + + tags[curtagindex] = tag; + rangemodes[curtagindex] = rangemode; + offsetmodes[curtagindex] = offsetmode; + UpdateTagsList(); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Source/Core/GZBuilder/Controls/TagsSelector.resx b/Source/Core/GZBuilder/Controls/TagsSelector.resx new file mode 100644 index 00000000..cc4d82ad --- /dev/null +++ b/Source/Core/GZBuilder/Controls/TagsSelector.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 17, 17 + + + 17, 17 + + \ No newline at end of file diff --git a/Source/Core/IO/ClipboardStreamReader.cs b/Source/Core/IO/ClipboardStreamReader.cs index 4330e23b..4d81ce41 100644 --- a/Source/Core/IO/ClipboardStreamReader.cs +++ b/Source/Core/IO/ClipboardStreamReader.cs @@ -110,11 +110,16 @@ namespace CodeImp.DoomBuilder.IO for (int i = 0; i < count; i++) { - int tag = reader.ReadInt32(); int effect = reader.ReadInt32(); int hfloor = reader.ReadInt32(); int hceil = reader.ReadInt32(); int bright = reader.ReadInt32(); + + //mxd. Tags + int numtags = reader.ReadInt32(); //mxd + List tags = new List(numtags); //mxd + for(int a = 0; a < numtags; a++) tags.Add(reader.ReadInt32()); //mxd + string tfloor = ReadString(reader); string tceil = ReadString(reader); @@ -141,7 +146,7 @@ namespace CodeImp.DoomBuilder.IO Sector s = map.CreateSector(); if(s != null) { - s.Update(hfloor, hceil, tfloor, tceil, effect, stringflags, tag, bright, foffset, fslope, coffset, cslope); + s.Update(hfloor, hceil, tfloor, tceil, effect, stringflags, tags, bright, foffset, fslope, coffset, cslope); // Add custom fields s.Fields.BeforeFieldsChange(); @@ -169,13 +174,15 @@ namespace CodeImp.DoomBuilder.IO for(int i = 0; i < count; i++) { int[] args = new int[Linedef.NUM_ARGS]; - int tag = reader.ReadInt32(); int v1 = reader.ReadInt32(); int v2 = reader.ReadInt32(); int s1 = reader.ReadInt32(); int s2 = reader.ReadInt32(); int special = reader.ReadInt32(); for(int a = 0; a < Linedef.NUM_ARGS; a++) args[a] = reader.ReadInt32(); + int numtags = reader.ReadInt32(); //mxd + List tags = new List(numtags); //mxd + for(int a = 0; a < numtags; a++) tags.Add(reader.ReadInt32()); //mxd //flags Dictionary stringflags = new Dictionary(StringComparer.Ordinal); @@ -206,7 +213,7 @@ namespace CodeImp.DoomBuilder.IO Linedef l = map.CreateLinedef(vertexlink[v1], vertexlink[v2]); if (l != null) { - l.Update(stringflags, 0, tag, special, args); + l.Update(stringflags, 0, tags, special, args); l.UpdateCache(); // Add custom fields diff --git a/Source/Core/IO/ClipboardStreamWriter.cs b/Source/Core/IO/ClipboardStreamWriter.cs index 71ee848f..d050639b 100644 --- a/Source/Core/IO/ClipboardStreamWriter.cs +++ b/Source/Core/IO/ClipboardStreamWriter.cs @@ -139,7 +139,6 @@ namespace CodeImp.DoomBuilder.IO foreach(Linedef l in linedefs) { //write "static" properties - writer.Write(l.Tag); writer.Write(vertexids[l.Start]); writer.Write(vertexids[l.End]); @@ -151,6 +150,10 @@ namespace CodeImp.DoomBuilder.IO writer.Write(l.Action); for(int i = 0; i < l.Args.Length; i++) writer.Write(l.Args[i]); + //mxd. Tags + writer.Write(l.Tags.Count); + for(int i = 0; i < l.Tags.Count; i++) writer.Write(l.Tags[i]); + AddFlags(l.Flags, writer); AddCustomFields(l.Fields, "linedef", writer); } @@ -191,12 +194,15 @@ namespace CodeImp.DoomBuilder.IO foreach(Sector s in sectors) { //write "static" properties - writer.Write(s.Tag); writer.Write(s.Effect); writer.Write(s.FloorHeight); writer.Write(s.CeilHeight); writer.Write(s.Brightness); + //mxd. Tags + writer.Write(s.Tags.Count); + for(int i = 0; i < s.Tags.Count; i++) writer.Write(s.Tags[i]); + //textures writer.Write(s.FloorTexture.Length); writer.Write(s.FloorTexture.ToCharArray()); diff --git a/Source/Core/IO/DoomMapSetIO.cs b/Source/Core/IO/DoomMapSetIO.cs index 9026c3dd..b2d15ad6 100644 --- a/Source/Core/IO/DoomMapSetIO.cs +++ b/Source/Core/IO/DoomMapSetIO.cs @@ -283,7 +283,7 @@ namespace CodeImp.DoomBuilder.IO if(Vector2D.ManhattanDistance(vertexlink[v1].Position, vertexlink[v2].Position) > 0.0001f) { Linedef l = map.CreateLinedef(vertexlink[v1], vertexlink[v2]); - l.Update(stringflags, 0, tag, action, new int[Linedef.NUM_ARGS]); + l.Update(stringflags, 0, new List { tag }, action, new int[Linedef.NUM_ARGS]); l.UpdateCache(); string thigh, tmid, tlow; diff --git a/Source/Core/IO/HexenMapSetIO.cs b/Source/Core/IO/HexenMapSetIO.cs index c62350c4..e51b084b 100644 --- a/Source/Core/IO/HexenMapSetIO.cs +++ b/Source/Core/IO/HexenMapSetIO.cs @@ -299,7 +299,7 @@ namespace CodeImp.DoomBuilder.IO if(Vector2D.ManhattanDistance(vertexlink[v1].Position, vertexlink[v2].Position) > 0.0001f) { Linedef l = map.CreateLinedef(vertexlink[v1], vertexlink[v2]); - l.Update(stringflags, (flags & manager.Config.LinedefActivationsFilter), 0, action, args); + l.Update(stringflags, (flags & manager.Config.LinedefActivationsFilter), new List { 0 }, action, args); l.UpdateCache(); Sidedef s; diff --git a/Source/Core/IO/UniversalStreamReader.cs b/Source/Core/IO/UniversalStreamReader.cs index bfb362ea..d052cbc5 100644 --- a/Source/Core/IO/UniversalStreamReader.cs +++ b/Source/Core/IO/UniversalStreamReader.cs @@ -246,6 +246,7 @@ namespace CodeImp.DoomBuilder.IO // Go for all lines map.SetCapacity(0, map.Linedefs.Count + linescolls.Count, map.Sidedefs.Count + sidescolls.Count, 0, 0); + char[] splitter = new[] { ',' }; //mxd for(int i = 0; i < linescolls.Count; i++) { // Read fields @@ -270,6 +271,22 @@ namespace CodeImp.DoomBuilder.IO int s1 = GetCollectionEntry(lc, "sidefront", true, -1, where); int s2 = GetCollectionEntry(lc, "sideback", false, -1, where); + //mxd. MoreIDs + List tags = new List { tag }; + string moreids = GetCollectionEntry(lc, "moreids", false, string.Empty, where); + if(!string.IsNullOrEmpty(moreids)) + { + string[] moreidscol = moreids.Split(splitter, StringSplitOptions.RemoveEmptyEntries); + int id; + foreach (string sid in moreidscol) + { + if(int.TryParse(sid.Trim(), out id) && id != 0 && !tags.Contains(id)) + { + tags.Add(id); + } + } + } + // Flags Dictionary stringflags = new Dictionary(StringComparer.Ordinal); foreach(KeyValuePair flag in General.Map.Config.LinedefFlags) @@ -291,7 +308,7 @@ namespace CodeImp.DoomBuilder.IO Linedef l = map.CreateLinedef(vertexlink[v1], vertexlink[v2]); if(l != null) { - l.Update(stringflags, 0, tag, special, args); + l.Update(stringflags, 0, tags, special, args); l.UpdateCache(); // Custom fields @@ -369,6 +386,7 @@ namespace CodeImp.DoomBuilder.IO // Go for all collections map.SetCapacity(0, 0, 0, map.Sectors.Count + collections.Count, 0); + char[] splitter = new[] { ',' }; //mxd for(int i = 0; i < collections.Count; i++) { // Read fields @@ -382,6 +400,22 @@ namespace CodeImp.DoomBuilder.IO int special = GetCollectionEntry(c, "special", false, 0, where); int tag = GetCollectionEntry(c, "id", false, 0, where); + //mxd. MoreIDs + List tags = new List { tag }; + string moreids = GetCollectionEntry(c, "moreids", false, string.Empty, where); + if(!string.IsNullOrEmpty(moreids)) + { + string[] moreidscol = moreids.Split(splitter, StringSplitOptions.RemoveEmptyEntries); + int id; + foreach(string sid in moreidscol) + { + if(int.TryParse(sid.Trim(), out id) && id != 0 && !tags.Contains(id)) + { + tags.Add(id); + } + } + } + //mxd. Read slopes float fslopex = GetCollectionEntry(c, "floorplane_a", false, 0.0f, where); float fslopey = GetCollectionEntry(c, "floorplane_b", false, 0.0f, where); @@ -402,7 +436,7 @@ namespace CodeImp.DoomBuilder.IO Sector s = map.CreateSector(); if(s != null) { - s.Update(hfloor, hceil, tfloor, tceil, special, stringflags, tag, bright, foffset, new Vector3D(fslopex, fslopey, fslopez).GetNormal(), coffset, new Vector3D(cslopex, cslopey, cslopez).GetNormal()); + s.Update(hfloor, hceil, tfloor, tceil, special, stringflags, tags, bright, foffset, new Vector3D(fslopex, fslopey, fslopez).GetNormal(), coffset, new Vector3D(cslopex, cslopey, cslopez).GetNormal()); // Custom fields ReadCustomFields(c, s, "sector"); diff --git a/Source/Core/IO/UniversalStreamWriter.cs b/Source/Core/IO/UniversalStreamWriter.cs index bd70b1e9..c24670ea 100644 --- a/Source/Core/IO/UniversalStreamWriter.cs +++ b/Source/Core/IO/UniversalStreamWriter.cs @@ -193,6 +193,17 @@ namespace CodeImp.DoomBuilder.IO coll.Add("v1", vertexids[l.Start]); coll.Add("v2", vertexids[l.End]); coll.Comment = l.Index.ToString(); + + //mxd. MoreIDs + if(l.Tags.Count > 1) //first entry is saved as "id" + { + string[] moreidscol = new string[l.Tags.Count - 1]; + for(int i = 1; i < l.Tags.Count; i++) + { + moreidscol[i - 1] = l.Tags[i].ToString(); + } + coll.Add("moreids", string.Join(",", moreidscol)); + } // Sidedef references if((l.Front != null) && sidedefids.ContainsKey(l.Front)) @@ -270,6 +281,17 @@ namespace CodeImp.DoomBuilder.IO if(s.Tag != 0) coll.Add("id", s.Tag); coll.Comment = s.Index.ToString(); + //mxd. MoreIDs + if(s.Tags.Count > 1) //first entry is saved as "id" + { + string[] moreidscol = new string[s.Tags.Count - 1]; + for(int i = 1; i < s.Tags.Count; i++) + { + moreidscol[i - 1] = s.Tags[i].ToString(); + } + coll.Add("moreids", string.Join(",", moreidscol)); + } + //mxd. Slopes if (s.FloorSlope.GetLengthSq() > 0) { diff --git a/Source/Core/Map/Linedef.cs b/Source/Core/Map/Linedef.cs index 794d6ef5..26393912 100644 --- a/Source/Core/Map/Linedef.cs +++ b/Source/Core/Map/Linedef.cs @@ -70,7 +70,7 @@ namespace CodeImp.DoomBuilder.Map private Dictionary flags; private int action; private int activate; - private int tag; + private List tags; //mxd private int[] args; private bool frontinterior; // for drawing only private int colorPresetIndex;//mxd @@ -92,7 +92,8 @@ namespace CodeImp.DoomBuilder.Map public int Action { get { return action; } set { BeforePropsChange(); action = value; UpdateColorPreset(); } } public int Activate { get { return activate; } set { BeforePropsChange(); activate = value; UpdateColorPreset(); } } - public int Tag { get { return tag; } set { BeforePropsChange(); tag = value; if((tag < General.Map.FormatInterface.MinTag) || (tag > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } + 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; } } //mxd public float LengthSq { get { return lengthsq; } } public float Length { get { return length; } } public float LengthInv { get { return lengthinv; } } @@ -118,6 +119,7 @@ namespace CodeImp.DoomBuilder.Map this.listindex = listindex; this.updateneeded = true; this.args = new int[NUM_ARGS]; + this.tags = new List { 0 }; //mxd this.flags = new Dictionary(StringComparer.Ordinal); this.colorPresetIndex = -1;//mxd @@ -220,7 +222,24 @@ namespace CodeImp.DoomBuilder.Map s.rwInt(ref action); s.rwInt(ref activate); - s.rwInt(ref tag); + + //mxd + if(s.IsWriting) + { + s.wInt(tags.Count); + foreach (int tag in tags) s.wInt(tag); + } + else + { + int c; s.rInt(out c); + tags = new List(c); + for(int i = 0; i < c; i++) + { + int t; s.rInt(out t); + tags.Add(t); + } + } + for(int i = 0; i < NUM_ARGS; i++) s.rwInt(ref args[i]); //mxd @@ -283,7 +302,7 @@ namespace CodeImp.DoomBuilder.Map l.action = action; l.args = (int[])args.Clone(); l.flags = new Dictionary(flags); - l.tag = tag; + l.tags = new List(tags); //mxd l.updateneeded = true; l.activate = activate; l.impassableflag = impassableflag; @@ -438,7 +457,7 @@ namespace CodeImp.DoomBuilder.Map { case 121: //Line_SetIdentification //Convert arg0 to tag - tag = args[0] + args[4] * 256; + tags[0] = args[0] + args[4] * 256; //Convert arg1 to flags ConvertArgToFlags(1); @@ -450,7 +469,7 @@ namespace CodeImp.DoomBuilder.Map case 208: //TranslucentLine //Convert arg0 to tag - tag = args[0]; + tags[0] = args[0]; //Convert arg3 to flags ConvertArgToFlags(3); @@ -466,7 +485,7 @@ namespace CodeImp.DoomBuilder.Map // Convert to UDMF if ((args[1] & 8) == 8) // arg4 is LineID? { - tag = args[4]; + tags[0] = args[4]; args[1] &= ~8; // Unset flag } else // It's sector's HiTag then @@ -569,13 +588,13 @@ namespace CodeImp.DoomBuilder.Map { case 208: //TranslucentLine //Convert tag to arg0 - if(tag < General.Map.FormatInterface.MinArgument || tag > General.Map.FormatInterface.MaxArgument) + if(tags[0] < General.Map.FormatInterface.MinArgument || tags[0] > General.Map.FormatInterface.MaxArgument) { - General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tag + ") to LineID because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); + General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); } else { - args[0] = tag; + args[0] = tags[0]; } //Convert flags to arg3 @@ -597,40 +616,40 @@ namespace CodeImp.DoomBuilder.Map args[0] = lotag; args[4] = hitag; - if (tag != 0) + if(tags[0] != 0) { - General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tag + ") to LineID, because target sector tag (arg0) is greater than " + General.Map.FormatInterface.MaxArgument + "."); + General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because target sector tag (arg0) is greater than " + General.Map.FormatInterface.MaxArgument + "."); } } else if(args[0] < General.Map.FormatInterface.MinArgument) { General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert arg0 (" + args[0] + "), because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); } - else if(tag > General.Map.FormatInterface.MinArgument) // Convert to LineID? + else if(tags[0] > General.Map.FormatInterface.MinArgument) // Convert to LineID? { - if(tag > General.Map.FormatInterface.MaxArgument) + if(tags[0] > General.Map.FormatInterface.MaxArgument) { - General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tag + ") to LineID, because linedef tag is greater than " + General.Map.FormatInterface.MaxArgument + "."); + General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because linedef tag is greater than " + General.Map.FormatInterface.MaxArgument + "."); } else { - args[4] = tag; + args[4] = tags[0]; args[1] |= 8; // Add "Use arg4 as LineID" flag } } break; default: // Convert tag to Line_SetIdentification? - if(tag > General.Map.FormatInterface.MinArgument) + if(tags[0] > General.Map.FormatInterface.MinArgument) { if (action != 0) { - General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tag + ") to LineID, because linedef already has an action."); + General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because linedef already has an action."); } else // Convert to Line_SetIdentification { - int hiid = tag / 256; - int loid = tag - hiid; + int hiid = tags[0] / 256; + int loid = tags[0] - hiid; action = 121; args[0] = loid; @@ -638,15 +657,15 @@ namespace CodeImp.DoomBuilder.Map ConvertFlagsToArg(oldfields, 1); } } - else if(tag < General.Map.FormatInterface.MinArgument) + else if(tags[0] < General.Map.FormatInterface.MinArgument) { - General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tag + ") to LineID, because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); + General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID, because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); } break; } // Clear tag - tag = 0; + tags[0] = 0; } //mxd. Update cached flags @@ -660,7 +679,7 @@ namespace CodeImp.DoomBuilder.Map private void ConvertArgToTag(int argnum, bool cleararg) { // Convert arg to tag - tag = args[argnum]; + tags[0] = args[argnum]; // Clear obsolete arg if(cleararg) args[argnum] = 0; @@ -669,13 +688,13 @@ namespace CodeImp.DoomBuilder.Map //mxd private void ConvertTagToArg(int argnum) { - if(tag < General.Map.FormatInterface.MinArgument || tag > General.Map.FormatInterface.MaxArgument) + if(tags[0] < General.Map.FormatInterface.MinArgument || tags[0] > General.Map.FormatInterface.MaxArgument) { - General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tag + ") to LineID because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); + General.ErrorLogger.Add(ErrorType.Warning, "Linedef " + Index + ": unable to convert Tag (" + tags[0] + ") to LineID because it's outside of supported argument range [" + General.Map.FormatInterface.MinArgument + ".." + General.Map.FormatInterface.MaxArgument + "]."); } else { - args[argnum] = tag; + args[argnum] = tags[0]; } } @@ -1275,13 +1294,13 @@ namespace CodeImp.DoomBuilder.Map #region ================== Changes // This updates all properties - public void Update(Dictionary flags, int activate, int tag, int action, int[] args) + public void Update(Dictionary flags, int activate, List tags, int action, int[] args) { BeforePropsChange(); // Apply changes this.flags = new Dictionary(flags); - this.tag = tag; + this.tags = new List(tags); //mxd this.activate = activate; this.action = action; this.args = new int[NUM_ARGS]; diff --git a/Source/Core/Map/MapSet.cs b/Source/Core/Map/MapSet.cs index c3c5a8ae..7005753d 100644 --- a/Source/Core/Map/MapSet.cs +++ b/Source/Core/Map/MapSet.cs @@ -2801,6 +2801,23 @@ namespace CodeImp.DoomBuilder.Map return 0; } + //mxd + /// This returns the next unused tag number. + public int GetNewTag(List moreusedtags) + { + Dictionary usedtags = new Dictionary(); + foreach(int t in moreusedtags) if(!usedtags.ContainsKey(t)) usedtags.Add(t, true); + ForAllTags(NewTagHandler, false, usedtags); + ForAllTags(NewTagHandler, true, usedtags); + + // Now find the first unused index + for(int i = 1; i <= General.Map.FormatInterface.MaxTag; i++) + if(!usedtags.ContainsKey(i)) return i; + + // All tags used! + return 0; + } + //mxd /// This returns the tag number, which is not used by any map element of given type. This method doesn't check action arguments! public int GetNewTag(UniversalType elementType) diff --git a/Source/Core/Map/Sector.cs b/Source/Core/Map/Sector.cs index 4510ee40..5c3715d8 100644 --- a/Source/Core/Map/Sector.cs +++ b/Source/Core/Map/Sector.cs @@ -57,7 +57,7 @@ namespace CodeImp.DoomBuilder.Map private long longfloortexname; private long longceiltexname; private int effect; - private int tag; + private List tags; //mxd private int brightness; //mxd. UDMF properties @@ -106,7 +106,8 @@ namespace CodeImp.DoomBuilder.Map public long LongCeilTexture { get { return longceiltexname; } } internal Dictionary Flags { get { return flags; } } //mxd public int Effect { get { return effect; } set { BeforePropsChange(); effect = value; } } - public int Tag { get { return tag; } set { BeforePropsChange(); tag = value; if((tag < General.Map.FormatInterface.MinTag) || (tag > General.Map.FormatInterface.MaxTag)) throw new ArgumentOutOfRangeException("Tag", "Invalid tag number"); } } + 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; } } //mxd public int Brightness { get { return brightness; } set { BeforePropsChange(); brightness = value; updateneeded = true; } } public bool UpdateNeeded { get { return updateneeded; } set { updateneeded |= value; triangulationneeded |= value; } } public RectangleF BBox { get { return bbox; } } @@ -144,6 +145,7 @@ namespace CodeImp.DoomBuilder.Map this.longfloortexname = MapSet.EmptyLongName; this.longceiltexname = MapSet.EmptyLongName; this.flags = new Dictionary(StringComparer.Ordinal); //mxd + this.tags = new List { 0 }; //mxd this.updateneeded = true; this.triangulationneeded = true; this.surfaceentries = new SurfaceEntryCollection(); @@ -246,9 +248,27 @@ namespace CodeImp.DoomBuilder.Map s.rwLong(ref longfloortexname); s.rwLong(ref longceiltexname); s.rwInt(ref effect); - s.rwInt(ref tag); s.rwInt(ref brightness); + //mxd. (Re)store tags + if(s.IsWriting) + { + s.wInt(tags.Count); + foreach(int tag in tags) s.wInt(tag); + } + else + { + int c; + s.rInt(out c); + tags = new List(c); + for(int i = 0; i < c; i++) + { + int t; + s.rInt(out t); + tags.Add(t); + } + } + //mxd. Slopes s.rwFloat(ref flooroffset); s.rwVector3D(ref floorslope); @@ -277,7 +297,7 @@ namespace CodeImp.DoomBuilder.Map s.floortexname = floortexname; s.longfloortexname = longfloortexname; s.effect = effect; - s.tag = tag; + s.tags = new List(tags); //mxd s.flags = new Dictionary(flags); //mxd s.brightness = brightness; s.flooroffset = flooroffset; //mxd @@ -769,11 +789,11 @@ namespace CodeImp.DoomBuilder.Map //mxd. This updates all properties (Doom/Hexen version) public void Update(int hfloor, int hceil, string tfloor, string tceil, int effect, int tag, int brightness) { - Update(hfloor, hceil, tfloor, tceil, effect, new Dictionary(StringComparer.Ordinal), tag, brightness, 0, new Vector3D(), 0, new Vector3D()); + Update(hfloor, hceil, tfloor, tceil, effect, new Dictionary(StringComparer.Ordinal), new List { tag }, brightness, 0, new Vector3D(), 0, new Vector3D()); } //mxd. This updates all properties (UDMF version) - public void Update(int hfloor, int hceil, string tfloor, string tceil, int effect, Dictionary flags, int tag, int brightness, float flooroffset, Vector3D floorslope, float ceiloffset, Vector3D ceilslope) + public void Update(int hfloor, int hceil, string tfloor, string tceil, int effect, Dictionary flags, List tags, int brightness, float flooroffset, Vector3D floorslope, float ceiloffset, Vector3D ceilslope) { BeforePropsChange(); @@ -783,7 +803,7 @@ namespace CodeImp.DoomBuilder.Map //SetFloorTexture(tfloor); //SetCeilTexture(tceil); this.effect = effect; - this.tag = tag; + this.tags = new List(tags); //mxd this.flags = new Dictionary(flags); //mxd this.brightness = brightness; this.flooroffset = flooroffset; //mxd diff --git a/Source/Core/Resources/UDMF.cfg b/Source/Core/Resources/UDMF.cfg index adf670c9..e49dd47f 100644 --- a/Source/Core/Resources/UDMF.cfg +++ b/Source/Core/Resources/UDMF.cfg @@ -17,6 +17,7 @@ managedfields linedef { id; + moreids; v1; v2; special; @@ -48,6 +49,7 @@ managedfields lightlevel; special; id; + moreids; floorplane_a; floorplane_b; floorplane_c; diff --git a/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs b/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs index 62157fe1..0456d3e7 100644 --- a/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs +++ b/Source/Core/Windows/LinedefEditFormUDMF.Designer.cs @@ -40,6 +40,7 @@ namespace CodeImp.DoomBuilder.Windows this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.actiongroup = new System.Windows.Forms.GroupBox(); + this.argscontrol = new CodeImp.DoomBuilder.Controls.ArgumentsControl(); this.actionhelp = new CodeImp.DoomBuilder.Controls.ActionSpecialHelpButton(); this.action = new CodeImp.DoomBuilder.Controls.ActionSelectorControl(); this.browseaction = new System.Windows.Forms.Button(); @@ -55,7 +56,6 @@ namespace CodeImp.DoomBuilder.Windows this.activationGroup = new System.Windows.Forms.GroupBox(); this.missingactivation = new System.Windows.Forms.PictureBox(); this.idgroup = new System.Windows.Forms.GroupBox(); - this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector(); this.tabfront = new System.Windows.Forms.TabPage(); this.frontside = new System.Windows.Forms.CheckBox(); this.frontgroup = new System.Windows.Forms.GroupBox(); @@ -121,7 +121,7 @@ namespace CodeImp.DoomBuilder.Windows this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl(); this.imagelist = new System.Windows.Forms.ImageList(this.components); this.tooltip = new System.Windows.Forms.ToolTip(this.components); - this.argscontrol = new CodeImp.DoomBuilder.Controls.ArgumentsControl(); + this.tagsselector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector(); label2 = new System.Windows.Forms.Label(); label11 = new System.Windows.Forms.Label(); label12 = new System.Windows.Forms.Label(); @@ -153,7 +153,7 @@ namespace CodeImp.DoomBuilder.Windows // label2 // label2.AutoSize = true; - label2.Location = new System.Drawing.Point(15, 30); + label2.Location = new System.Drawing.Point(15, 22); label2.Name = "label2"; label2.Size = new System.Drawing.Size(40, 13); label2.TabIndex = 9; @@ -180,7 +180,7 @@ namespace CodeImp.DoomBuilder.Windows // label6 // label6.AutoSize = true; - label6.Location = new System.Drawing.Point(199, 24); + label6.Location = new System.Drawing.Point(199, 21); label6.Name = "label6"; label6.Size = new System.Drawing.Size(37, 13); label6.TabIndex = 17; @@ -189,7 +189,7 @@ namespace CodeImp.DoomBuilder.Windows // labelrenderstyle // this.labelrenderstyle.AutoSize = true; - this.labelrenderstyle.Location = new System.Drawing.Point(15, 24); + this.labelrenderstyle.Location = new System.Drawing.Point(15, 21); this.labelrenderstyle.Name = "labelrenderstyle"; this.labelrenderstyle.Size = new System.Drawing.Size(69, 13); this.labelrenderstyle.TabIndex = 11; @@ -198,7 +198,7 @@ namespace CodeImp.DoomBuilder.Windows // labellockpick // this.labellockpick.AutoSize = true; - this.labellockpick.Location = new System.Drawing.Point(330, 24); + this.labellockpick.Location = new System.Drawing.Point(330, 21); this.labellockpick.Name = "labellockpick"; this.labellockpick.Size = new System.Drawing.Size(72, 13); this.labellockpick.TabIndex = 15; @@ -246,16 +246,23 @@ namespace CodeImp.DoomBuilder.Windows this.actiongroup.Controls.Add(label2); this.actiongroup.Controls.Add(this.action); this.actiongroup.Controls.Add(this.browseaction); - this.actiongroup.Location = new System.Drawing.Point(8, 253); + this.actiongroup.Location = new System.Drawing.Point(8, 245); this.actiongroup.Name = "actiongroup"; - this.actiongroup.Size = new System.Drawing.Size(533, 142); + this.actiongroup.Size = new System.Drawing.Size(533, 126); this.actiongroup.TabIndex = 1; this.actiongroup.TabStop = false; this.actiongroup.Text = " Action "; // + // argscontrol + // + this.argscontrol.Location = new System.Drawing.Point(6, 44); + this.argscontrol.Name = "argscontrol"; + this.argscontrol.Size = new System.Drawing.Size(521, 80); + this.argscontrol.TabIndex = 11; + // // actionhelp // - this.actionhelp.Location = new System.Drawing.Point(497, 25); + this.actionhelp.Location = new System.Drawing.Point(497, 17); this.actionhelp.Name = "actionhelp"; this.actionhelp.Size = new System.Drawing.Size(28, 25); this.actionhelp.TabIndex = 10; @@ -267,7 +274,7 @@ namespace CodeImp.DoomBuilder.Windows this.action.Empty = false; this.action.GeneralizedCategories = null; this.action.GeneralizedOptions = null; - this.action.Location = new System.Drawing.Point(62, 27); + this.action.Location = new System.Drawing.Point(62, 19); this.action.Name = "action"; this.action.Size = new System.Drawing.Size(402, 21); this.action.TabIndex = 0; @@ -277,7 +284,7 @@ namespace CodeImp.DoomBuilder.Windows // browseaction // this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; - this.browseaction.Location = new System.Drawing.Point(467, 25); + this.browseaction.Location = new System.Drawing.Point(467, 17); this.browseaction.Name = "browseaction"; this.browseaction.Size = new System.Drawing.Size(28, 25); this.browseaction.TabIndex = 1; @@ -306,7 +313,7 @@ namespace CodeImp.DoomBuilder.Windows this.flagsgroup.Controls.Add(this.flags); this.flagsgroup.Location = new System.Drawing.Point(8, 3); this.flagsgroup.Name = "flagsgroup"; - this.flagsgroup.Size = new System.Drawing.Size(533, 186); + this.flagsgroup.Size = new System.Drawing.Size(533, 184); this.flagsgroup.TabIndex = 0; this.flagsgroup.TabStop = false; this.flagsgroup.Text = " Flags"; @@ -318,9 +325,9 @@ namespace CodeImp.DoomBuilder.Windows | System.Windows.Forms.AnchorStyles.Right))); this.flags.AutoScroll = true; this.flags.Columns = 3; - this.flags.Location = new System.Drawing.Point(18, 17); + this.flags.Location = new System.Drawing.Point(18, 15); this.flags.Name = "flags"; - this.flags.Size = new System.Drawing.Size(509, 164); + this.flags.Size = new System.Drawing.Size(509, 162); this.flags.TabIndex = 0; this.flags.VerticalSpacing = 0; this.flags.OnValueChanged += new System.EventHandler(this.flags_OnValueChanged); @@ -371,9 +378,9 @@ namespace CodeImp.DoomBuilder.Windows this.groupsettings.Controls.Add(this.labellockpick); this.groupsettings.Controls.Add(this.renderStyle); this.groupsettings.Controls.Add(this.labelrenderstyle); - this.groupsettings.Location = new System.Drawing.Point(8, 195); + this.groupsettings.Location = new System.Drawing.Point(8, 193); this.groupsettings.Name = "groupsettings"; - this.groupsettings.Size = new System.Drawing.Size(533, 52); + this.groupsettings.Size = new System.Drawing.Size(533, 46); this.groupsettings.TabIndex = 3; this.groupsettings.TabStop = false; this.groupsettings.Text = " Settings"; @@ -381,7 +388,7 @@ namespace CodeImp.DoomBuilder.Windows // lockpick // this.lockpick.FormattingEnabled = true; - this.lockpick.Location = new System.Drawing.Point(408, 20); + this.lockpick.Location = new System.Drawing.Point(408, 17); this.lockpick.Name = "lockpick"; this.lockpick.Size = new System.Drawing.Size(115, 21); this.lockpick.TabIndex = 19; @@ -397,7 +404,7 @@ namespace CodeImp.DoomBuilder.Windows this.alpha.ButtonStepSmall = 0.01F; this.alpha.ButtonStepsUseModifierKeys = true; this.alpha.ButtonStepsWrapAround = false; - this.alpha.Location = new System.Drawing.Point(243, 19); + this.alpha.Location = new System.Drawing.Point(243, 16); this.alpha.Name = "alpha"; this.alpha.Size = new System.Drawing.Size(65, 24); this.alpha.StepValues = null; @@ -408,7 +415,7 @@ namespace CodeImp.DoomBuilder.Windows // this.renderStyle.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.renderStyle.FormattingEnabled = true; - this.renderStyle.Location = new System.Drawing.Point(92, 20); + this.renderStyle.Location = new System.Drawing.Point(92, 17); this.renderStyle.Name = "renderStyle"; this.renderStyle.Size = new System.Drawing.Size(86, 21); this.renderStyle.TabIndex = 12; @@ -418,7 +425,7 @@ namespace CodeImp.DoomBuilder.Windows // this.activationGroup.Controls.Add(this.missingactivation); this.activationGroup.Controls.Add(this.udmfactivates); - this.activationGroup.Location = new System.Drawing.Point(8, 401); + this.activationGroup.Location = new System.Drawing.Point(8, 375); this.activationGroup.Name = "activationGroup"; this.activationGroup.Size = new System.Drawing.Size(533, 152); this.activationGroup.TabIndex = 1; @@ -429,7 +436,7 @@ namespace CodeImp.DoomBuilder.Windows // this.missingactivation.BackColor = System.Drawing.SystemColors.Window; this.missingactivation.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning; - this.missingactivation.Location = new System.Drawing.Point(64, -2); + this.missingactivation.Location = new System.Drawing.Point(64, -1); this.missingactivation.Name = "missingactivation"; this.missingactivation.Size = new System.Drawing.Size(16, 16); this.missingactivation.TabIndex = 4; @@ -441,21 +448,14 @@ namespace CodeImp.DoomBuilder.Windows // this.idgroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.idgroup.Controls.Add(this.tagSelector); - this.idgroup.Location = new System.Drawing.Point(8, 559); + this.idgroup.Controls.Add(this.tagsselector); + this.idgroup.Location = new System.Drawing.Point(8, 533); this.idgroup.Name = "idgroup"; - this.idgroup.Size = new System.Drawing.Size(533, 58); + this.idgroup.Size = new System.Drawing.Size(533, 85); this.idgroup.TabIndex = 2; this.idgroup.TabStop = false; this.idgroup.Text = " Identification "; // - // tagSelector - // - this.tagSelector.Location = new System.Drawing.Point(6, 19); - this.tagSelector.Name = "tagSelector"; - this.tagSelector.Size = new System.Drawing.Size(444, 35); - this.tagSelector.TabIndex = 0; - // // tabfront // this.tabfront.Controls.Add(this.frontside); @@ -1339,12 +1339,12 @@ namespace CodeImp.DoomBuilder.Windows this.imagelist.Images.SetKeyName(0, "Check.png"); this.imagelist.Images.SetKeyName(1, "SearchClear.png"); // - // argscontrol + // tagsselector // - this.argscontrol.Location = new System.Drawing.Point(6, 56); - this.argscontrol.Name = "argscontrol"; - this.argscontrol.Size = new System.Drawing.Size(521, 80); - this.argscontrol.TabIndex = 11; + this.tagsselector.Location = new System.Drawing.Point(6, 21); + this.tagsselector.Name = "tagsselector"; + this.tagsselector.Size = new System.Drawing.Size(524, 60); + this.tagsselector.TabIndex = 0; // // LinedefEditFormUDMF // @@ -1429,7 +1429,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Button custombackbutton; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox frontsector; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backsector; - private CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector tagSelector; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox lightFront; private System.Windows.Forms.CheckBox cbLightAbsoluteFront; private CodeImp.DoomBuilder.GZBuilder.Controls.PairedFieldsControl pfcFrontOffsetTop; @@ -1489,5 +1488,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.TabPage tabcomment; private CodeImp.DoomBuilder.Controls.CommentEditor commenteditor; private CodeImp.DoomBuilder.Controls.ArgumentsControl argscontrol; + private CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector tagsselector; } } \ No newline at end of file diff --git a/Source/Core/Windows/LinedefEditFormUDMF.cs b/Source/Core/Windows/LinedefEditFormUDMF.cs index bc81221e..0a5adc40 100644 --- a/Source/Core/Windows/LinedefEditFormUDMF.cs +++ b/Source/Core/Windows/LinedefEditFormUDMF.cs @@ -277,14 +277,12 @@ namespace CodeImp.DoomBuilder.Windows lockpick.SelectedIndex = keynumbers.IndexOf(locknumber); if(lockpick.SelectedIndex == -1) lockpick.Text = locknumber.ToString(); - // Action/tags + // Action action.Value = fl.Action; - if(General.Map.FormatInterface.HasLinedefTag) //mxd - { - tagSelector.Setup(UniversalType.LinedefTag); - tagSelector.SetTag(fl.Tag); - } + //mxd. Tags + tagsselector.Setup(UniversalType.LinedefTag); + tagsselector.SetValue(fl.Tags, true); //mxd. Args argscontrol.SetValue(fl, true); @@ -410,7 +408,7 @@ namespace CodeImp.DoomBuilder.Windows // Action/tags if(l.Action != action.Value) action.Empty = true; - if(General.Map.FormatInterface.HasLinedefTag && l.Tag != fl.Tag) tagSelector.ClearTag(); //mxd + tagsselector.SetValue(l.Tags, false); //mxd. Arguments argscontrol.SetValue(l, false); @@ -557,6 +555,7 @@ namespace CodeImp.DoomBuilder.Windows CheckActivationFlagsRequired(); //mxd argscontrol.UpdateScriptControls(); //mxd actionhelp.UpdateAction(action.GetValue()); //mxd + tagsselector.FinishSetup(); //mxd commenteditor.FinishSetup(); //mxd //mxd. Update some labels @@ -646,17 +645,6 @@ namespace CodeImp.DoomBuilder.Windows Sector s; int index; - // Verify the tag - if(General.Map.FormatInterface.HasLinedefTag) - { - tagSelector.ValidateTag(); //mxd - if(((tagSelector.GetTag(0) < General.Map.FormatInterface.MinTag) || (tagSelector.GetTag(0) > General.Map.FormatInterface.MaxTag))) - { - General.ShowWarningMessage("Linedef tag must be between " + General.Map.FormatInterface.MinTag + " and " + General.Map.FormatInterface.MaxTag + ".", MessageBoxButtons.OK); - return; - } - } - // Verify the action if((action.Value < General.Map.FormatInterface.MinAction) || (action.Value > General.Map.FormatInterface.MaxAction)) { @@ -698,8 +686,8 @@ namespace CodeImp.DoomBuilder.Windows } // Action/tags - l.Tag = General.Clamp(tagSelector.GetSmartTag(l.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd if(!action.Empty) l.Action = action.Value; + tagsselector.ApplyTo(l, tagoffset++); //mxd //mxd. Apply args argscontrol.Apply(l); diff --git a/Source/Core/Windows/LinedefEditFormUDMF.resx b/Source/Core/Windows/LinedefEditFormUDMF.resx index 5912cdba..061d4285 100644 --- a/Source/Core/Windows/LinedefEditFormUDMF.resx +++ b/Source/Core/Windows/LinedefEditFormUDMF.resx @@ -117,9 +117,6 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - True - False @@ -149,7 +146,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADM - CAAAAk1TRnQBSQFMAgEBAgEAAbgBAAG4AQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAcABAAHAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -189,4 +186,7 @@ BAAB/wKAAQEEAAH/AcECgQQAAf8B4wLDBAAC/wLnBAAE/wQACw== + + 17, 17 + \ No newline at end of file diff --git a/Source/Core/Windows/SectorEditFormUDMF.Designer.cs b/Source/Core/Windows/SectorEditFormUDMF.Designer.cs index bbec191b..83a1d63b 100644 --- a/Source/Core/Windows/SectorEditFormUDMF.Designer.cs +++ b/Source/Core/Windows/SectorEditFormUDMF.Designer.cs @@ -40,7 +40,6 @@ System.Windows.Forms.Label label15; System.Windows.Forms.Label label6; System.Windows.Forms.Label label5; - this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector(); this.soundsequence = new System.Windows.Forms.ComboBox(); this.resetsoundsequence = new System.Windows.Forms.Button(); this.fadeColor = new CodeImp.DoomBuilder.GZBuilder.Controls.ColorFieldsControl(); @@ -100,12 +99,13 @@ this.groupBox4 = new System.Windows.Forms.GroupBox(); this.ceilingslopecontrol = new CodeImp.DoomBuilder.Controls.SectorSlopeControl(); this.tabcomment = new System.Windows.Forms.TabPage(); + this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor(); this.tabcustom = new System.Windows.Forms.TabPage(); this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl(); this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.tooltip = new System.Windows.Forms.ToolTip(this.components); - this.commenteditor = new CodeImp.DoomBuilder.Controls.CommentEditor(); + this.tagsselector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector(); groupaction = new System.Windows.Forms.GroupBox(); groupeffect = new System.Windows.Forms.GroupBox(); label14 = new System.Windows.Forms.Label(); @@ -137,21 +137,14 @@ // groupaction.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - groupaction.Controls.Add(this.tagSelector); - groupaction.Location = new System.Drawing.Point(7, 341); + groupaction.Controls.Add(this.tagsselector); + groupaction.Location = new System.Drawing.Point(7, 327); groupaction.Name = "groupaction"; - groupaction.Size = new System.Drawing.Size(490, 71); + groupaction.Size = new System.Drawing.Size(490, 85); groupaction.TabIndex = 2; groupaction.TabStop = false; groupaction.Text = " Identification "; // - // tagSelector - // - this.tagSelector.Location = new System.Drawing.Point(6, 21); - this.tagSelector.Name = "tagSelector"; - this.tagSelector.Size = new System.Drawing.Size(478, 35); - this.tagSelector.TabIndex = 0; - // // groupeffect // groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -172,7 +165,7 @@ groupeffect.Controls.Add(label8); groupeffect.Location = new System.Drawing.Point(7, 160); groupeffect.Name = "groupeffect"; - groupeffect.Size = new System.Drawing.Size(490, 175); + groupeffect.Size = new System.Drawing.Size(490, 161); groupeffect.TabIndex = 1; groupeffect.TabStop = false; groupeffect.Text = " Effects "; @@ -203,7 +196,7 @@ this.fadeColor.DefaultValue = 0; this.fadeColor.Field = "fadecolor"; this.fadeColor.Label = "Fade:"; - this.fadeColor.Location = new System.Drawing.Point(241, 111); + this.fadeColor.Location = new System.Drawing.Point(241, 104); this.fadeColor.Name = "fadeColor"; this.fadeColor.Size = new System.Drawing.Size(207, 31); this.fadeColor.TabIndex = 30; @@ -214,7 +207,7 @@ this.lightColor.DefaultValue = 16777215; this.lightColor.Field = "lightcolor"; this.lightColor.Label = "Light:"; - this.lightColor.Location = new System.Drawing.Point(241, 82); + this.lightColor.Location = new System.Drawing.Point(241, 77); this.lightColor.Name = "lightColor"; this.lightColor.Size = new System.Drawing.Size(207, 29); this.lightColor.TabIndex = 29; @@ -231,7 +224,7 @@ this.brightness.ButtonStepSmall = 1F; this.brightness.ButtonStepsUseModifierKeys = true; this.brightness.ButtonStepsWrapAround = false; - this.brightness.Location = new System.Drawing.Point(125, 84); + this.brightness.Location = new System.Drawing.Point(125, 79); this.brightness.Name = "brightness"; this.brightness.Size = new System.Drawing.Size(81, 24); this.brightness.StepValues = null; @@ -249,7 +242,7 @@ this.desaturation.ButtonStepSmall = 0.01F; this.desaturation.ButtonStepsUseModifierKeys = true; this.desaturation.ButtonStepsWrapAround = false; - this.desaturation.Location = new System.Drawing.Point(125, 142); + this.desaturation.Location = new System.Drawing.Point(125, 131); this.desaturation.Name = "desaturation"; this.desaturation.Size = new System.Drawing.Size(81, 24); this.desaturation.StepValues = null; @@ -267,7 +260,7 @@ // label9 // label9.AutoSize = true; - label9.Location = new System.Drawing.Point(57, 89); + label9.Location = new System.Drawing.Point(57, 84); label9.Name = "label9"; label9.Size = new System.Drawing.Size(59, 13); label9.TabIndex = 2; @@ -275,7 +268,7 @@ // // label13 // - label13.Location = new System.Drawing.Point(45, 147); + label13.Location = new System.Drawing.Point(45, 136); label13.Name = "label13"; label13.Size = new System.Drawing.Size(74, 14); label13.TabIndex = 27; @@ -293,7 +286,7 @@ this.gravity.ButtonStepSmall = 0.01F; this.gravity.ButtonStepsUseModifierKeys = true; this.gravity.ButtonStepsWrapAround = false; - this.gravity.Location = new System.Drawing.Point(125, 112); + this.gravity.Location = new System.Drawing.Point(125, 105); this.gravity.Name = "gravity"; this.gravity.Size = new System.Drawing.Size(81, 24); this.gravity.StepValues = null; @@ -301,7 +294,7 @@ // // label2 // - label2.Location = new System.Drawing.Point(45, 117); + label2.Location = new System.Drawing.Point(45, 110); label2.Name = "label2"; label2.Size = new System.Drawing.Size(74, 14); label2.TabIndex = 23; @@ -590,7 +583,7 @@ // // floorAngleControl // - this.floorAngleControl.Angle = -180; + this.floorAngleControl.Angle = -270; this.floorAngleControl.AngleOffset = 90; this.floorAngleControl.Location = new System.Drawing.Point(6, 132); this.floorAngleControl.Name = "floorAngleControl"; @@ -824,7 +817,7 @@ // // ceilAngleControl // - this.ceilAngleControl.Angle = -180; + this.ceilAngleControl.Angle = -270; this.ceilAngleControl.AngleOffset = 90; this.ceilAngleControl.Location = new System.Drawing.Point(6, 132); this.ceilAngleControl.Name = "ceilAngleControl"; @@ -1065,6 +1058,13 @@ this.tabcomment.Text = "Comment"; this.tabcomment.UseVisualStyleBackColor = true; // + // commenteditor + // + this.commenteditor.Location = new System.Drawing.Point(3, 3); + this.commenteditor.Name = "commenteditor"; + this.commenteditor.Size = new System.Drawing.Size(497, 413); + this.commenteditor.TabIndex = 0; + // // tabcustom // this.tabcustom.Controls.Add(this.fieldslist); @@ -1127,12 +1127,12 @@ this.tooltip.InitialDelay = 10; this.tooltip.ReshowDelay = 100; // - // commenteditor + // tagsselector // - this.commenteditor.Location = new System.Drawing.Point(3, 3); - this.commenteditor.Name = "commenteditor"; - this.commenteditor.Size = new System.Drawing.Size(497, 413); - this.commenteditor.TabIndex = 0; + this.tagsselector.Location = new System.Drawing.Point(6, 21); + this.tagsselector.Name = "tagsselector"; + this.tagsselector.Size = new System.Drawing.Size(478, 60); + this.tagsselector.TabIndex = 0; // // SectorEditFormUDMF // @@ -1181,7 +1181,6 @@ private System.Windows.Forms.TabControl tabs; private System.Windows.Forms.TabPage tabproperties; - private CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector tagSelector; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox brightness; private System.Windows.Forms.Button browseeffect; private CodeImp.DoomBuilder.Controls.ActionSelectorControl effect; @@ -1245,5 +1244,6 @@ private System.Windows.Forms.ComboBox soundsequence; private System.Windows.Forms.TabPage tabcomment; private CodeImp.DoomBuilder.Controls.CommentEditor commenteditor; + private CodeImp.DoomBuilder.GZBuilder.Controls.TagsSelector tagsselector; } } \ No newline at end of file diff --git a/Source/Core/Windows/SectorEditFormUDMF.cs b/Source/Core/Windows/SectorEditFormUDMF.cs index 6d17ede0..8223acc2 100644 --- a/Source/Core/Windows/SectorEditFormUDMF.cs +++ b/Source/Core/Windows/SectorEditFormUDMF.cs @@ -323,8 +323,8 @@ namespace CodeImp.DoomBuilder.Windows SetupCeilingSlope(sc, true); // Action - tagSelector.Setup(UniversalType.SectorTag); //mxd - tagSelector.SetTag(sc.Tag);//mxd + tagsselector.Setup(UniversalType.SectorTag); //mxd + tagsselector.SetValue(sc.Tags, true);//mxd // Custom fields fieldslist.SetValues(sc.Fields, true); @@ -430,7 +430,7 @@ namespace CodeImp.DoomBuilder.Windows SetupCeilingSlope(s, false); // Action - if(s.Tag != sc.Tag) tagSelector.ClearTag(); //mxd + tagsselector.SetValue(s.Tags, false); //mxd // Custom fields fieldslist.SetValues(s.Fields, false); @@ -471,8 +471,9 @@ namespace CodeImp.DoomBuilder.Windows if(useCeilSlopeLineAngles) ceilingslopecontrol.StepValues = anglesteps; if(useFloorSlopeLineAngles) floorslopecontrol.StepValues = anglesteps; - //mxd. Comments + //mxd. Comments and Tags commenteditor.FinishSetup(); + tagsselector.FinishSetup(); preventchanges = false; //mxd } @@ -641,14 +642,6 @@ namespace CodeImp.DoomBuilder.Windows private void apply_Click(object sender, EventArgs e) { - // Verify the tag - tagSelector.ValidateTag(); //mxd - if((tagSelector.GetTag(0) < General.Map.FormatInterface.MinTag) || (tagSelector.GetTag(0) > General.Map.FormatInterface.MaxTag)) - { - General.ShowWarningMessage("Sector tag must be between " + General.Map.FormatInterface.MinTag + " and " + General.Map.FormatInterface.MaxTag + ".", MessageBoxButtons.OK); - return; - } - // Verify the effect if((effect.Value < General.Map.FormatInterface.MinEffect) || (effect.Value > General.Map.FormatInterface.MaxEffect)) { @@ -684,8 +677,8 @@ namespace CodeImp.DoomBuilder.Windows if(!effect.Empty) s.Effect = effect.Value; s.Brightness = General.Clamp(brightness.GetResult(s.Brightness), General.Map.FormatInterface.MinBrightness, General.Map.FormatInterface.MaxBrightness); - // Action - s.Tag = General.Clamp(tagSelector.GetSmartTag(s.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd + //mxd. Tag + tagsselector.ApplyTo(s, tagoffset++); // Fields fieldslist.Apply(s.Fields); diff --git a/Source/Core/Windows/SectorEditFormUDMF.resx b/Source/Core/Windows/SectorEditFormUDMF.resx index b149e7f6..2f82d0ae 100644 --- a/Source/Core/Windows/SectorEditFormUDMF.resx +++ b/Source/Core/Windows/SectorEditFormUDMF.resx @@ -138,36 +138,12 @@ False - - False - - - False - - - False - - - False - - - False - False False - - False - - - False - - - False - 17, 17 @@ -186,7 +162,4 @@ True - - 17, 17 - \ No newline at end of file diff --git a/Source/Core/Windows/ThingEditFormUDMF.Designer.cs b/Source/Core/Windows/ThingEditFormUDMF.Designer.cs index b3d72193..922f6f03 100644 --- a/Source/Core/Windows/ThingEditFormUDMF.Designer.cs +++ b/Source/Core/Windows/ThingEditFormUDMF.Designer.cs @@ -280,12 +280,16 @@ // // labelGravity // + this.labelGravity.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.labelGravity.ForeColor = System.Drawing.SystemColors.HotTrack; this.labelGravity.Location = new System.Drawing.Point(52, 27); this.labelGravity.Name = "labelGravity"; this.labelGravity.Size = new System.Drawing.Size(50, 14); this.labelGravity.TabIndex = 18; this.labelGravity.Text = "Gravity:"; this.labelGravity.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.tooltip.SetToolTip(this.labelGravity, "Positive values are multiplied with the class\'s property.\r\nNegative values are us" + + "ed as their absolute.\r\nDefault is 1.0."); // // label7 // @@ -350,7 +354,7 @@ // this.missingflags.BackColor = System.Drawing.SystemColors.Window; this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning; - this.missingflags.Location = new System.Drawing.Point(42, -1); + this.missingflags.Location = new System.Drawing.Point(42, -2); this.missingflags.Name = "missingflags"; this.missingflags.Size = new System.Drawing.Size(16, 16); this.missingflags.TabIndex = 5; @@ -606,12 +610,16 @@ // // label10 // + this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label10.ForeColor = System.Drawing.SystemColors.HotTrack; this.label10.Location = new System.Drawing.Point(52, 91); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(50, 14); this.label10.TabIndex = 22; this.label10.Text = "Health:"; this.label10.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.tooltip.SetToolTip(this.label10, "Positive values are multiplied with the class\'s property.\r\nNegative values are us" + + "ed as their absolute.\r\nDefault is 1."); // // score // @@ -919,6 +927,13 @@ this.hintlabel.TabIndex = 4; this.hintlabel.Text = "Select categories or several thing types to randomly assign them to selection"; // + // tooltip + // + this.tooltip.AutomaticDelay = 10; + this.tooltip.AutoPopDelay = 10000; + this.tooltip.InitialDelay = 10; + this.tooltip.ReshowDelay = 100; + // // ThingEditFormUDMF // this.AcceptButton = this.apply; diff --git a/Source/Core/Windows/ThingEditFormUDMF.resx b/Source/Core/Windows/ThingEditFormUDMF.resx index 853abdf8..90f1f8dc 100644 --- a/Source/Core/Windows/ThingEditFormUDMF.resx +++ b/Source/Core/Windows/ThingEditFormUDMF.resx @@ -120,7 +120,4 @@ 17, 17 - - 17, 17 - \ No newline at end of file