Sector edit form: Add friction

This commit is contained in:
MascaraSnake 2022-12-30 15:46:25 +01:00
parent 646ee17bdc
commit dc1448363b
7 changed files with 108 additions and 73 deletions

View file

@ -228,12 +228,6 @@ universalfields
type = 3; type = 3;
default = false; default = false;
} }
friction
{
type = 1;
default = 0.90625;
}
} }
linedef linedef

View file

@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
#region ================== Constants #region ================== Constants
private const int ROUNDING_PRECISION = 4; //mxd private const int ROUNDING_PRECISION = 5; //mxd
#endregion #endregion

View file

@ -101,8 +101,8 @@ namespace CodeImp.DoomBuilder.IO
public override int MaxThings { get { return int.MaxValue; } } public override int MaxThings { get { return int.MaxValue; } }
public override int MinTextureOffset { get { return int.MinValue; } } public override int MinTextureOffset { get { return int.MinValue; } }
public override int MaxTextureOffset { get { return int.MaxValue; } } public override int MaxTextureOffset { get { return int.MaxValue; } }
public override int VertexDecimals { get { return 3; } } public override int VertexDecimals { get { return 5; } }
public override string DecimalsFormat { get { return "0.000"; } } public override string DecimalsFormat { get { return "0.00000"; } }
public override bool HasLinedefTag { get { return true; } } public override bool HasLinedefTag { get { return true; } }
public override bool HasThingTag { get { return true; } } public override bool HasThingTag { get { return true; } }
public override bool HasThingAction { get { return true; } } public override bool HasThingAction { get { return true; } }

View file

@ -88,6 +88,7 @@ uifields
fadeend = 0; fadeend = 0;
triggertag = 15; triggertag = 15;
triggerer = 2; triggerer = 2;
friction = 1;
} }
thing thing

View file

@ -45,6 +45,7 @@
System.Windows.Forms.Label labelFadeAlpha; System.Windows.Forms.Label labelFadeAlpha;
System.Windows.Forms.Label labelFadeStart; System.Windows.Forms.Label labelFadeStart;
System.Windows.Forms.Label labelFadeEnd; System.Windows.Forms.Label labelFadeEnd;
System.Windows.Forms.Label labelFriction;
this.tagsselector = new CodeImp.DoomBuilder.Controls.TagsSelector(); this.tagsselector = new CodeImp.DoomBuilder.Controls.TagsSelector();
this.triggerer = new System.Windows.Forms.ComboBox(); this.triggerer = new System.Windows.Forms.ComboBox();
this.triggerTag = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.triggerTag = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
@ -63,6 +64,8 @@
this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl(); this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
this.tabColors = new System.Windows.Forms.TabPage(); this.tabColors = new System.Windows.Forms.TabPage();
this.groupBox8 = new System.Windows.Forms.GroupBox(); this.groupBox8 = new System.Windows.Forms.GroupBox();
this.fadeEnd = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.fadeStart = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.fadeAlpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.fadeAlpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.lightAlpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.lightAlpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.lightColor = new CodeImp.DoomBuilder.Controls.ColorFieldsControl(); this.lightColor = new CodeImp.DoomBuilder.Controls.ColorFieldsControl();
@ -108,8 +111,7 @@
this.cancel = new System.Windows.Forms.Button(); this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button();
this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.tooltip = new System.Windows.Forms.ToolTip(this.components);
this.fadeStart = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.friction = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.fadeEnd = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
groupaction = new System.Windows.Forms.GroupBox(); groupaction = new System.Windows.Forms.GroupBox();
groupeffect = new System.Windows.Forms.GroupBox(); groupeffect = new System.Windows.Forms.GroupBox();
labelTriggerer = new System.Windows.Forms.Label(); labelTriggerer = new System.Windows.Forms.Label();
@ -125,6 +127,7 @@
labelFadeAlpha = new System.Windows.Forms.Label(); labelFadeAlpha = new System.Windows.Forms.Label();
labelFadeStart = new System.Windows.Forms.Label(); labelFadeStart = new System.Windows.Forms.Label();
labelFadeEnd = new System.Windows.Forms.Label(); labelFadeEnd = new System.Windows.Forms.Label();
labelFriction = new System.Windows.Forms.Label();
groupaction.SuspendLayout(); groupaction.SuspendLayout();
groupeffect.SuspendLayout(); groupeffect.SuspendLayout();
groupfloorceiling.SuspendLayout(); groupfloorceiling.SuspendLayout();
@ -166,6 +169,8 @@
// //
groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
groupeffect.Controls.Add(this.friction);
groupeffect.Controls.Add(labelFriction);
groupeffect.Controls.Add(labelTriggerer); groupeffect.Controls.Add(labelTriggerer);
groupeffect.Controls.Add(this.triggerer); groupeffect.Controls.Add(this.triggerer);
groupeffect.Controls.Add(labelTriggerTag); groupeffect.Controls.Add(labelTriggerTag);
@ -459,6 +464,26 @@
labelFadeAlpha.Text = "Fade alpha:"; labelFadeAlpha.Text = "Fade alpha:";
labelFadeAlpha.TextAlign = System.Drawing.ContentAlignment.TopRight; labelFadeAlpha.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// labelFadeStart
//
labelFadeStart.AutoSize = true;
labelFadeStart.Location = new System.Drawing.Point(11, 149);
labelFadeStart.Name = "labelFadeStart";
labelFadeStart.Size = new System.Drawing.Size(57, 13);
labelFadeStart.TabIndex = 22;
labelFadeStart.Text = "Fade start:";
labelFadeStart.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// labelFadeEnd
//
labelFadeEnd.AutoSize = true;
labelFadeEnd.Location = new System.Drawing.Point(12, 177);
labelFadeEnd.Name = "labelFadeEnd";
labelFadeEnd.Size = new System.Drawing.Size(55, 13);
labelFadeEnd.TabIndex = 24;
labelFadeEnd.Text = "Fade end:";
labelFadeEnd.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// tabs // tabs
// //
this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.tabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -548,6 +573,44 @@
this.groupBox8.TabStop = false; this.groupBox8.TabStop = false;
this.groupBox8.Text = "Global sector colors"; this.groupBox8.Text = "Global sector colors";
// //
// fadeEnd
//
this.fadeEnd.AllowDecimal = false;
this.fadeEnd.AllowExpressions = false;
this.fadeEnd.AllowNegative = false;
this.fadeEnd.AllowRelative = false;
this.fadeEnd.ButtonStep = 1;
this.fadeEnd.ButtonStepBig = 1F;
this.fadeEnd.ButtonStepFloat = 1F;
this.fadeEnd.ButtonStepSmall = 1F;
this.fadeEnd.ButtonStepsUseModifierKeys = true;
this.fadeEnd.ButtonStepsWrapAround = false;
this.fadeEnd.Location = new System.Drawing.Point(74, 172);
this.fadeEnd.Name = "fadeEnd";
this.fadeEnd.Size = new System.Drawing.Size(81, 24);
this.fadeEnd.StepValues = null;
this.fadeEnd.TabIndex = 25;
this.fadeEnd.WhenTextChanged += new System.EventHandler(this.fadeEnd_WhenTextChanged);
//
// fadeStart
//
this.fadeStart.AllowDecimal = false;
this.fadeStart.AllowExpressions = false;
this.fadeStart.AllowNegative = false;
this.fadeStart.AllowRelative = false;
this.fadeStart.ButtonStep = 1;
this.fadeStart.ButtonStepBig = 1F;
this.fadeStart.ButtonStepFloat = 1F;
this.fadeStart.ButtonStepSmall = 1F;
this.fadeStart.ButtonStepsUseModifierKeys = true;
this.fadeStart.ButtonStepsWrapAround = false;
this.fadeStart.Location = new System.Drawing.Point(74, 144);
this.fadeStart.Name = "fadeStart";
this.fadeStart.Size = new System.Drawing.Size(81, 24);
this.fadeStart.StepValues = null;
this.fadeStart.TabIndex = 23;
this.fadeStart.WhenTextChanged += new System.EventHandler(this.fadeStart_WhenTextChanged);
//
// fadeAlpha // fadeAlpha
// //
this.fadeAlpha.AllowDecimal = false; this.fadeAlpha.AllowDecimal = false;
@ -689,7 +752,7 @@
// //
// floorAngleControl // floorAngleControl
// //
this.floorAngleControl.Angle = -2340; this.floorAngleControl.Angle = -2430;
this.floorAngleControl.AngleOffset = 90; this.floorAngleControl.AngleOffset = 90;
this.floorAngleControl.DoomAngleClamping = false; this.floorAngleControl.DoomAngleClamping = false;
this.floorAngleControl.Location = new System.Drawing.Point(6, 156); this.floorAngleControl.Location = new System.Drawing.Point(6, 156);
@ -886,7 +949,7 @@
// //
// ceilAngleControl // ceilAngleControl
// //
this.ceilAngleControl.Angle = -2340; this.ceilAngleControl.Angle = -2430;
this.ceilAngleControl.AngleOffset = 90; this.ceilAngleControl.AngleOffset = 90;
this.ceilAngleControl.DoomAngleClamping = false; this.ceilAngleControl.DoomAngleClamping = false;
this.ceilAngleControl.Location = new System.Drawing.Point(6, 156); this.ceilAngleControl.Location = new System.Drawing.Point(6, 156);
@ -1151,64 +1214,32 @@
this.tooltip.InitialDelay = 10; this.tooltip.InitialDelay = 10;
this.tooltip.ReshowDelay = 100; this.tooltip.ReshowDelay = 100;
// //
// fadeStart // friction
// //
this.fadeStart.AllowDecimal = false; this.friction.AllowDecimal = true;
this.fadeStart.AllowExpressions = false; this.friction.AllowExpressions = false;
this.fadeStart.AllowNegative = false; this.friction.AllowNegative = true;
this.fadeStart.AllowRelative = false; this.friction.AllowRelative = true;
this.fadeStart.ButtonStep = 1; this.friction.ButtonStep = 1;
this.fadeStart.ButtonStepBig = 1F; this.friction.ButtonStepBig = 0.125F;
this.fadeStart.ButtonStepFloat = 1F; this.friction.ButtonStepFloat = 0.03125F;
this.fadeStart.ButtonStepSmall = 1F; this.friction.ButtonStepSmall = 0.03125F;
this.fadeStart.ButtonStepsUseModifierKeys = true; this.friction.ButtonStepsUseModifierKeys = true;
this.fadeStart.ButtonStepsWrapAround = false; this.friction.ButtonStepsWrapAround = false;
this.fadeStart.Location = new System.Drawing.Point(74, 144); this.friction.Location = new System.Drawing.Point(298, 74);
this.fadeStart.Name = "fadeStart"; this.friction.Name = "friction";
this.fadeStart.Size = new System.Drawing.Size(81, 24); this.friction.Size = new System.Drawing.Size(81, 24);
this.fadeStart.StepValues = null; this.friction.StepValues = null;
this.fadeStart.TabIndex = 23; this.friction.TabIndex = 23;
this.fadeStart.WhenTextChanged += new System.EventHandler(this.fadeStart_WhenTextChanged);
// //
// labelFadeStart // labelFriction
// //
labelFadeStart.AutoSize = true; labelFriction.Location = new System.Drawing.Point(218, 79);
labelFadeStart.Location = new System.Drawing.Point(11, 149); labelFriction.Name = "labelFriction";
labelFadeStart.Name = "labelFadeStart"; labelFriction.Size = new System.Drawing.Size(74, 14);
labelFadeStart.Size = new System.Drawing.Size(57, 13); labelFriction.TabIndex = 22;
labelFadeStart.TabIndex = 22; labelFriction.Text = "Friction:";
labelFadeStart.Text = "Fade start:"; labelFriction.TextAlign = System.Drawing.ContentAlignment.TopRight;
labelFadeStart.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// fadeEnd
//
this.fadeEnd.AllowDecimal = false;
this.fadeEnd.AllowExpressions = false;
this.fadeEnd.AllowNegative = false;
this.fadeEnd.AllowRelative = false;
this.fadeEnd.ButtonStep = 1;
this.fadeEnd.ButtonStepBig = 1F;
this.fadeEnd.ButtonStepFloat = 1F;
this.fadeEnd.ButtonStepSmall = 1F;
this.fadeEnd.ButtonStepsUseModifierKeys = true;
this.fadeEnd.ButtonStepsWrapAround = false;
this.fadeEnd.Location = new System.Drawing.Point(74, 172);
this.fadeEnd.Name = "fadeEnd";
this.fadeEnd.Size = new System.Drawing.Size(81, 24);
this.fadeEnd.StepValues = null;
this.fadeEnd.TabIndex = 25;
this.fadeEnd.WhenTextChanged += new System.EventHandler(this.fadeEnd_WhenTextChanged);
//
// labelFadeEnd
//
labelFadeEnd.AutoSize = true;
labelFadeEnd.Location = new System.Drawing.Point(12, 177);
labelFadeEnd.Name = "labelFadeEnd";
labelFadeEnd.Size = new System.Drawing.Size(55, 13);
labelFadeEnd.TabIndex = 24;
labelFadeEnd.Text = "Fade end:";
labelFadeEnd.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// SectorEditFormSRB2 // SectorEditFormSRB2
// //
@ -1323,5 +1354,6 @@
private Controls.ButtonsNumericTextbox triggerTag; private Controls.ButtonsNumericTextbox triggerTag;
private Controls.ButtonsNumericTextbox fadeEnd; private Controls.ButtonsNumericTextbox fadeEnd;
private Controls.ButtonsNumericTextbox fadeStart; private Controls.ButtonsNumericTextbox fadeStart;
private Controls.ButtonsNumericTextbox friction;
} }
} }

View file

@ -300,6 +300,7 @@ namespace CodeImp.DoomBuilder.Windows
// Misc // Misc
gravity.Text = sc.Fields.GetValue("gravity", 1.0).ToString(); gravity.Text = sc.Fields.GetValue("gravity", 1.0).ToString();
friction.Text = sc.Fields.GetValue("friction", 0.90625).ToString();
triggerTag.Text = sc.Fields.GetValue("triggertag", 0).ToString(); triggerTag.Text = sc.Fields.GetValue("triggertag", 0).ToString();
triggerer.Text = sc.Fields.GetValue("triggerer", TRIGGERER_DEFAULT); triggerer.Text = sc.Fields.GetValue("triggerer", TRIGGERER_DEFAULT);
@ -391,7 +392,8 @@ namespace CodeImp.DoomBuilder.Windows
damagetype.SelectedIndex = -1; damagetype.SelectedIndex = -1;
// Misc // Misc
if(s.Fields.GetValue("gravity", 1.0).ToString() != gravity.Text) gravity.Text = ""; if (s.Fields.GetValue("gravity", 1.0).ToString() != gravity.Text) gravity.Text = "";
if (s.Fields.GetValue("friction", 0.90625).ToString() != friction.Text) friction.Text = "";
if (s.Fields.GetValue("triggertag", 0).ToString() != triggerTag.Text) triggerTag.Text = ""; if (s.Fields.GetValue("triggertag", 0).ToString() != triggerTag.Text) triggerTag.Text = "";
if (triggerer.SelectedIndex > -1 && s.Fields.GetValue("triggerer", TRIGGERER_DEFAULT) != triggerer.Text) if (triggerer.SelectedIndex > -1 && s.Fields.GetValue("triggerer", TRIGGERER_DEFAULT) != triggerer.Text)
triggerer.SelectedIndex = -1; triggerer.SelectedIndex = -1;
@ -680,6 +682,9 @@ namespace CodeImp.DoomBuilder.Windows
if(!string.IsNullOrEmpty(gravity.Text)) if(!string.IsNullOrEmpty(gravity.Text))
UniFields.SetFloat(s.Fields, "gravity", gravity.GetResultFloat(s.Fields.GetValue("gravity", 1.0)), 1.0); UniFields.SetFloat(s.Fields, "gravity", gravity.GetResultFloat(s.Fields.GetValue("gravity", 1.0)), 1.0);
if (!string.IsNullOrEmpty(friction.Text))
UniFields.SetFloat(s.Fields, "friction", friction.GetResultFloat(s.Fields.GetValue("friction", 0.90625)), 0.90625);
if (!string.IsNullOrEmpty(triggerTag.Text)) if (!string.IsNullOrEmpty(triggerTag.Text))
UniFields.SetInteger(s.Fields, "triggertag", triggerTag.GetResult(s.Fields.GetValue("triggertag", 0)), 0); UniFields.SetInteger(s.Fields, "triggertag", triggerTag.GetResult(s.Fields.GetValue("triggertag", 0)), 0);

View file

@ -123,6 +123,9 @@
<metadata name="groupeffect.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="groupeffect.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="labelFriction.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="labelTriggerer.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="labelTriggerer.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
@ -174,14 +177,14 @@
<metadata name="labelFadeAlpha.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="labelFadeAlpha.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="labelFadeStart.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>False</value>
</metadata> </metadata>
<metadata name="labelFadeEnd.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="labelFadeEnd.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="labelFadeStart.GenerateMember" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="tabproperties.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>True</value>
</metadata> </metadata>
<data name="resetfloorlight.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="resetfloorlight.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>