From 6fba87cfaab62f49316b079ac998d6f34e54cb2a Mon Sep 17 00:00:00 2001 From: MascaraSnake <jonassauer27@gmail.com> Date: Thu, 29 Dec 2022 21:38:20 +0100 Subject: [PATCH] Linedef edit form: Add field for executordelay --- Build/Configurations/Includes/SRB222_misc.cfg | 5 --- Source/Core/Resources/UDMF_UI.cfg | 1 + .../Windows/LinedefEditFormSRB2.Designer.cs | 36 ++++++++++++++++++- Source/Core/Windows/LinedefEditFormSRB2.cs | 33 +++++++++++++++++ Source/Core/Windows/LinedefEditFormSRB2.resx | 8 ++++- 5 files changed, 76 insertions(+), 7 deletions(-) diff --git a/Build/Configurations/Includes/SRB222_misc.cfg b/Build/Configurations/Includes/SRB222_misc.cfg index 3a8857c6b..45247b7ba 100644 --- a/Build/Configurations/Includes/SRB222_misc.cfg +++ b/Build/Configurations/Includes/SRB222_misc.cfg @@ -278,11 +278,6 @@ universalfields linedef { - executordelay - { - type = 0; - default = 0; - } } sidedef diff --git a/Source/Core/Resources/UDMF_UI.cfg b/Source/Core/Resources/UDMF_UI.cfg index 20c26845a..b2fa39890 100755 --- a/Source/Core/Resources/UDMF_UI.cfg +++ b/Source/Core/Resources/UDMF_UI.cfg @@ -14,6 +14,7 @@ uifields comment = 2; stringarg0 = 2; stringarg1 = 2; + executordelay = 0; } sidedef diff --git a/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs b/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs index d397284b8..336f37e32 100644 --- a/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs +++ b/Source/Core/Windows/LinedefEditFormSRB2.Designer.cs @@ -34,6 +34,7 @@ namespace CodeImp.DoomBuilder.Windows System.Windows.Forms.Label label12; System.Windows.Forms.Label label6; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LinedefEditFormSRB2)); + System.Windows.Forms.Label executordelaylabel; this.labelrenderstyle = new System.Windows.Forms.Label(); this.labelLightFront = new System.Windows.Forms.Label(); this.cancel = new System.Windows.Forms.Button(); @@ -120,10 +121,12 @@ 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.executordelay = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); label2 = new System.Windows.Forms.Label(); label11 = new System.Windows.Forms.Label(); label12 = new System.Windows.Forms.Label(); label6 = new System.Windows.Forms.Label(); + executordelaylabel = new System.Windows.Forms.Label(); this.actiongroup.SuspendLayout(); this.flagsgroup.SuspendLayout(); this.tabs.SuspendLayout(); @@ -228,7 +231,9 @@ namespace CodeImp.DoomBuilder.Windows // this.actiongroup.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.actiongroup.Controls.Add(this.executordelay); this.actiongroup.Controls.Add(this.argscontrol); + this.actiongroup.Controls.Add(executordelaylabel); this.actiongroup.Controls.Add(this.actionhelp); this.actiongroup.Controls.Add(label2); this.actiongroup.Controls.Add(this.action); @@ -244,7 +249,7 @@ namespace CodeImp.DoomBuilder.Windows // this.argscontrol.Location = new System.Drawing.Point(6, 44); this.argscontrol.Name = "argscontrol"; - this.argscontrol.Size = new System.Drawing.Size(521, 232); + this.argscontrol.Size = new System.Drawing.Size(521, 173); this.argscontrol.TabIndex = 11; this.argscontrol.Load += new System.EventHandler(this.argscontrol_Load); // @@ -1322,6 +1327,34 @@ namespace CodeImp.DoomBuilder.Windows this.imagelist.Images.SetKeyName(0, "Check.png"); this.imagelist.Images.SetKeyName(1, "SearchClear.png"); // + // executordelaylabel + // + executordelaylabel.AutoSize = true; + executordelaylabel.Location = new System.Drawing.Point(59, 229); + executordelaylabel.Name = "executordelaylabel"; + executordelaylabel.Size = new System.Drawing.Size(80, 13); + executordelaylabel.TabIndex = 71; + executordelaylabel.Text = "Executor delay:"; + // + // executordelay + // + this.executordelay.AllowDecimal = false; + this.executordelay.AllowExpressions = false; + this.executordelay.AllowNegative = false; + this.executordelay.AllowRelative = false; + this.executordelay.ButtonStep = 1; + this.executordelay.ButtonStepBig = 35F; + this.executordelay.ButtonStepFloat = 1F; + this.executordelay.ButtonStepSmall = 1F; + this.executordelay.ButtonStepsUseModifierKeys = true; + this.executordelay.ButtonStepsWrapAround = false; + this.executordelay.Location = new System.Drawing.Point(145, 224); + this.executordelay.Name = "executordelay"; + this.executordelay.Size = new System.Drawing.Size(65, 24); + this.executordelay.StepValues = null; + this.executordelay.TabIndex = 72; + this.executordelay.WhenTextChanged += new System.EventHandler(this.executordelay_WhenTextChanged); + // // LinedefEditFormSRB2 // this.AcceptButton = this.apply; @@ -1461,5 +1494,6 @@ namespace CodeImp.DoomBuilder.Windows private System.Windows.Forms.Button resetfrontlight; private System.Windows.Forms.Button resetbacklight; private System.Windows.Forms.Button resetalpha; + private Controls.ButtonsNumericTextbox executordelay; } } \ No newline at end of file diff --git a/Source/Core/Windows/LinedefEditFormSRB2.cs b/Source/Core/Windows/LinedefEditFormSRB2.cs index 8eafbc049..a952078ac 100644 --- a/Source/Core/Windows/LinedefEditFormSRB2.cs +++ b/Source/Core/Windows/LinedefEditFormSRB2.cs @@ -52,6 +52,7 @@ namespace CodeImp.DoomBuilder.Windows { public readonly Dictionary<string, bool> Flags; public readonly double Alpha; + public readonly int ExecutorDelay; public readonly SidedefProperties Front; public readonly SidedefProperties Back; @@ -61,6 +62,7 @@ namespace CodeImp.DoomBuilder.Windows Front = (line.Front != null ? new SidedefProperties(line.Front) : null); Back = (line.Back != null ? new SidedefProperties(line.Back) : null); Alpha = UniFields.GetFloat(line.Fields, "alpha", 1.0f); + ExecutorDelay = UniFields.GetInteger(line.Fields, "executordelay", 0); Flags = line.GetFlags(); } } @@ -280,6 +282,7 @@ namespace CodeImp.DoomBuilder.Windows commenteditor.SetValues(fl.Fields, true); //mxd. Comments renderStyle.SelectedIndex = Array.IndexOf(renderstyles, fl.Fields.GetValue("renderstyle", "translucent")); alpha.Text = General.Clamp(fl.Fields.GetValue("alpha", 1.0), 0.0, 1.0).ToString(); + executordelay.Text = UniFields.GetInteger(fl.Fields, "executordelay", 0).ToString(); // Action action.Value = fl.Action; @@ -375,6 +378,12 @@ namespace CodeImp.DoomBuilder.Windows if(!string.IsNullOrEmpty(alpha.Text) && General.Clamp(alpha.GetResultFloat(1.0), 0.0, 1.0) != l.Fields.GetValue("alpha", 1.0)) alpha.Text = string.Empty; + if (!string.IsNullOrEmpty(executordelay.Text)) + { + int delay = UniFields.GetInteger(l.Fields, "executordelay", 0); + if (delay != executordelay.GetResult(delay)) executordelay.Text = string.Empty; + } + // Custom fields fieldslist.SetValues(l.Fields, false); @@ -824,6 +833,30 @@ namespace CodeImp.DoomBuilder.Windows if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); } + private void executordelay_WhenTextChanged(object sender, EventArgs e) + { + if (preventchanges) return; + MakeUndo(); //mxd + int i = 0; + + //restore values + if (string.IsNullOrEmpty(executordelay.Text)) + { + foreach (Linedef l in lines) + UniFields.SetInteger(l.Fields, "executordelay", linedefprops[i++].ExecutorDelay, 0); + } + else //update values + { + foreach (Linedef l in lines) + { + UniFields.SetInteger(l.Fields, "executordelay", executordelay.GetResult(0), 0); + } + } + + General.Map.IsChanged = true; + if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); + } + #endregion #region ================== mxd. Realtime events (sides) diff --git a/Source/Core/Windows/LinedefEditFormSRB2.resx b/Source/Core/Windows/LinedefEditFormSRB2.resx index 87ca1c2ed..7ada3f690 100644 --- a/Source/Core/Windows/LinedefEditFormSRB2.resx +++ b/Source/Core/Windows/LinedefEditFormSRB2.resx @@ -129,6 +129,9 @@ <metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </metadata> + <metadata name="executordelaylabel.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>False</value> + </metadata> <metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> @@ -146,7 +149,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADM - CAAAAk1TRnQBSQFMAgEBAgEAAeABAAHgAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CAAAAk1TRnQBSQFMAgEBAgEAAegBAAHoAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA @@ -186,4 +189,7 @@ BAAB/wKAAQEEAAH/AcECgQQAAf8B4wLDBAAC/wLnBAAE/wQACw== </value> </data> + <metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> </root> \ No newline at end of file -- GitLab