From dc1448363b30b6881a84c09dbf942d97bb482a31 Mon Sep 17 00:00:00 2001 From: MascaraSnake Date: Fri, 30 Dec 2022 15:46:25 +0100 Subject: [PATCH] Sector edit form: Add friction --- Build/Configurations/Includes/SRB222_misc.cfg | 6 - Source/Core/Controls/NumericTextbox.cs | 2 +- Source/Core/IO/UniversalMapSetIO.cs | 4 +- Source/Core/Resources/UDMF_UI.cfg | 1 + .../Windows/SectorEditFormSRB2.Designer.cs | 150 +++++++++++------- Source/Core/Windows/SectorEditFormSRB2.cs | 7 +- Source/Core/Windows/SectorEditFormSRB2.resx | 11 +- 7 files changed, 108 insertions(+), 73 deletions(-) diff --git a/Build/Configurations/Includes/SRB222_misc.cfg b/Build/Configurations/Includes/SRB222_misc.cfg index 780de714..e31bc2c7 100644 --- a/Build/Configurations/Includes/SRB222_misc.cfg +++ b/Build/Configurations/Includes/SRB222_misc.cfg @@ -228,12 +228,6 @@ universalfields type = 3; default = false; } - - friction - { - type = 1; - default = 0.90625; - } } linedef diff --git a/Source/Core/Controls/NumericTextbox.cs b/Source/Core/Controls/NumericTextbox.cs index 27332d47..560c646f 100755 --- a/Source/Core/Controls/NumericTextbox.cs +++ b/Source/Core/Controls/NumericTextbox.cs @@ -31,7 +31,7 @@ namespace CodeImp.DoomBuilder.Controls { #region ================== Constants - private const int ROUNDING_PRECISION = 4; //mxd + private const int ROUNDING_PRECISION = 5; //mxd #endregion diff --git a/Source/Core/IO/UniversalMapSetIO.cs b/Source/Core/IO/UniversalMapSetIO.cs index cfe2fe91..87e5e354 100755 --- a/Source/Core/IO/UniversalMapSetIO.cs +++ b/Source/Core/IO/UniversalMapSetIO.cs @@ -101,8 +101,8 @@ namespace CodeImp.DoomBuilder.IO public override int MaxThings { get { return int.MaxValue; } } public override int MinTextureOffset { get { return int.MinValue; } } public override int MaxTextureOffset { get { return int.MaxValue; } } - public override int VertexDecimals { get { return 3; } } - public override string DecimalsFormat { get { return "0.000"; } } + public override int VertexDecimals { get { return 5; } } + public override string DecimalsFormat { get { return "0.00000"; } } public override bool HasLinedefTag { get { return true; } } public override bool HasThingTag { get { return true; } } public override bool HasThingAction { get { return true; } } diff --git a/Source/Core/Resources/UDMF_UI.cfg b/Source/Core/Resources/UDMF_UI.cfg index a382a652..8409793b 100755 --- a/Source/Core/Resources/UDMF_UI.cfg +++ b/Source/Core/Resources/UDMF_UI.cfg @@ -88,6 +88,7 @@ uifields fadeend = 0; triggertag = 15; triggerer = 2; + friction = 1; } thing diff --git a/Source/Core/Windows/SectorEditFormSRB2.Designer.cs b/Source/Core/Windows/SectorEditFormSRB2.Designer.cs index 1a3c6756..8a043f9a 100644 --- a/Source/Core/Windows/SectorEditFormSRB2.Designer.cs +++ b/Source/Core/Windows/SectorEditFormSRB2.Designer.cs @@ -45,6 +45,7 @@ System.Windows.Forms.Label labelFadeAlpha; System.Windows.Forms.Label labelFadeStart; System.Windows.Forms.Label labelFadeEnd; + System.Windows.Forms.Label labelFriction; this.tagsselector = new CodeImp.DoomBuilder.Controls.TagsSelector(); this.triggerer = new System.Windows.Forms.ComboBox(); this.triggerTag = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); @@ -63,6 +64,8 @@ this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl(); this.tabColors = new System.Windows.Forms.TabPage(); 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.lightAlpha = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.lightColor = new CodeImp.DoomBuilder.Controls.ColorFieldsControl(); @@ -108,8 +111,7 @@ this.cancel = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button(); this.tooltip = new System.Windows.Forms.ToolTip(this.components); - this.fadeStart = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); - this.fadeEnd = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); + this.friction = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); groupaction = new System.Windows.Forms.GroupBox(); groupeffect = new System.Windows.Forms.GroupBox(); labelTriggerer = new System.Windows.Forms.Label(); @@ -125,6 +127,7 @@ labelFadeAlpha = new System.Windows.Forms.Label(); labelFadeStart = new System.Windows.Forms.Label(); labelFadeEnd = new System.Windows.Forms.Label(); + labelFriction = new System.Windows.Forms.Label(); groupaction.SuspendLayout(); groupeffect.SuspendLayout(); groupfloorceiling.SuspendLayout(); @@ -166,6 +169,8 @@ // groupeffect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + groupeffect.Controls.Add(this.friction); + groupeffect.Controls.Add(labelFriction); groupeffect.Controls.Add(labelTriggerer); groupeffect.Controls.Add(this.triggerer); groupeffect.Controls.Add(labelTriggerTag); @@ -459,6 +464,26 @@ labelFadeAlpha.Text = "Fade alpha:"; 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 // 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.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 // this.fadeAlpha.AllowDecimal = false; @@ -689,7 +752,7 @@ // // floorAngleControl // - this.floorAngleControl.Angle = -2340; + this.floorAngleControl.Angle = -2430; this.floorAngleControl.AngleOffset = 90; this.floorAngleControl.DoomAngleClamping = false; this.floorAngleControl.Location = new System.Drawing.Point(6, 156); @@ -886,7 +949,7 @@ // // ceilAngleControl // - this.ceilAngleControl.Angle = -2340; + this.ceilAngleControl.Angle = -2430; this.ceilAngleControl.AngleOffset = 90; this.ceilAngleControl.DoomAngleClamping = false; this.ceilAngleControl.Location = new System.Drawing.Point(6, 156); @@ -1151,64 +1214,32 @@ this.tooltip.InitialDelay = 10; this.tooltip.ReshowDelay = 100; // - // fadeStart + // friction // - 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); - + this.friction.AllowDecimal = true; + this.friction.AllowExpressions = false; + this.friction.AllowNegative = true; + this.friction.AllowRelative = true; + this.friction.ButtonStep = 1; + this.friction.ButtonStepBig = 0.125F; + this.friction.ButtonStepFloat = 0.03125F; + this.friction.ButtonStepSmall = 0.03125F; + this.friction.ButtonStepsUseModifierKeys = true; + this.friction.ButtonStepsWrapAround = false; + this.friction.Location = new System.Drawing.Point(298, 74); + this.friction.Name = "friction"; + this.friction.Size = new System.Drawing.Size(81, 24); + this.friction.StepValues = null; + this.friction.TabIndex = 23; // - // labelFadeStart + // labelFriction // - 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; - // - // 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; + labelFriction.Location = new System.Drawing.Point(218, 79); + labelFriction.Name = "labelFriction"; + labelFriction.Size = new System.Drawing.Size(74, 14); + labelFriction.TabIndex = 22; + labelFriction.Text = "Friction:"; + labelFriction.TextAlign = System.Drawing.ContentAlignment.TopRight; // // SectorEditFormSRB2 // @@ -1323,5 +1354,6 @@ private Controls.ButtonsNumericTextbox triggerTag; private Controls.ButtonsNumericTextbox fadeEnd; private Controls.ButtonsNumericTextbox fadeStart; + private Controls.ButtonsNumericTextbox friction; } } \ No newline at end of file diff --git a/Source/Core/Windows/SectorEditFormSRB2.cs b/Source/Core/Windows/SectorEditFormSRB2.cs index dc5ded8a..4a09ea01 100644 --- a/Source/Core/Windows/SectorEditFormSRB2.cs +++ b/Source/Core/Windows/SectorEditFormSRB2.cs @@ -300,6 +300,7 @@ namespace CodeImp.DoomBuilder.Windows // Misc 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(); triggerer.Text = sc.Fields.GetValue("triggerer", TRIGGERER_DEFAULT); @@ -391,7 +392,8 @@ namespace CodeImp.DoomBuilder.Windows damagetype.SelectedIndex = -1; // 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 (triggerer.SelectedIndex > -1 && s.Fields.GetValue("triggerer", TRIGGERER_DEFAULT) != triggerer.Text) triggerer.SelectedIndex = -1; @@ -680,6 +682,9 @@ namespace CodeImp.DoomBuilder.Windows if(!string.IsNullOrEmpty(gravity.Text)) 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)) UniFields.SetInteger(s.Fields, "triggertag", triggerTag.GetResult(s.Fields.GetValue("triggertag", 0)), 0); diff --git a/Source/Core/Windows/SectorEditFormSRB2.resx b/Source/Core/Windows/SectorEditFormSRB2.resx index ad7b2221..fac61567 100644 --- a/Source/Core/Windows/SectorEditFormSRB2.resx +++ b/Source/Core/Windows/SectorEditFormSRB2.resx @@ -123,6 +123,9 @@ False + + False + False @@ -174,14 +177,14 @@ False - - True + + False False - - False + + True