Linedef edit form: Add field for executordelay

This commit is contained in:
MascaraSnake 2022-12-29 21:38:20 +01:00
parent c5d91d15fc
commit 6fba87cfaa
5 changed files with 76 additions and 7 deletions

View file

@ -278,11 +278,6 @@ universalfields
linedef
{
executordelay
{
type = 0;
default = 0;
}
}
sidedef

View file

@ -14,6 +14,7 @@ uifields
comment = 2;
stringarg0 = 2;
stringarg1 = 2;
executordelay = 0;
}
sidedef

View file

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

View file

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

View file

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