Tag Selector, changed: tag ranges are now set using ">=N" and "<=N" syntax.

Tag Selector: tags can now be set relatively using "++N" and "--N" syntax.
This commit is contained in:
MaxED 2014-08-11 08:35:39 +00:00
parent a07a5c1b37
commit 450ee02e49
12 changed files with 197 additions and 485 deletions

View file

@ -26,9 +26,11 @@
Two methods can be used to assign a new tag to a map element.<br />
Pressing &quot;<strong>New</strong>&quot; button will find a tag number, which is not used by any map element or any action argument, which expects a tag (classic Doom Builder 2 behaviour).<br />
Pressing "<strong>Unused</strong>" button will find a tag number, which is not used by any map element of current type (e.g. not used by any linedef in the map, if the button is pressed in Edit Linedefs form).</p>
<h2><strong>Setting Tags relatively:</strong></h2>
<p>You can enter &quot;<strong>++N</strong>&quot; or &quot;<strong>--N</strong>&quot; as a tag to increase or decrease tags by <strong>N</strong>.</p>
<h2><strong>Setting Tag Ranges:</strong></h2>
<p>When several map elements are selected, you can set a tag range by entering "<strong>++N</strong>" or "<strong>--N</strong>" as a tag.<br />
<strong>Example:</strong> to tag selected sectors starting from 10 and going up, enter "<strong>++10</strong>" as the tag and press <strong>OK</strong> button:<br />
<p>When several map elements are selected, you can set a tag range by entering "<strong>&gt;=N</strong>" or "<strong>&lt;=N</strong>" as a tag.<br />
<strong>Example:</strong> to tag selected sectors starting from 10 and going up, enter "<strong>&gt;=10</strong>" as the tag and press <strong>OK</strong> button:<br />
<img src="incremental_tags1.jpg" /><br />
<br />
The result:<br />

View file

@ -129,6 +129,7 @@
//
// angletrackbar
//
this.angletrackbar.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.angletrackbar.Location = new System.Drawing.Point(173, 82);
this.angletrackbar.Maximum = 85;
this.angletrackbar.Minimum = -85;

View file

@ -50,8 +50,6 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Methods
public void SetValues(float anglexy, float anglez, float offset, bool first) {
blockUpdate = true;
//update values
if (first) {
this.anglexy = anglexy;
@ -62,22 +60,25 @@ namespace CodeImp.DoomBuilder.Controls
if(!float.IsNaN(this.anglez) && this.anglez != anglez) this.anglez = float.NaN;
if(!float.IsNaN(this.offset) && this.offset != offset) this.offset = float.NaN;
}
}
//update controls
if(float.IsNaN(this.anglexy)) {
public void UpdateControls() {
blockUpdate = true;
if(float.IsNaN(anglexy)) {
sloperotation.Text = "";
rotationcontrol.Angle = 0;
} else {
sloperotation.Text = this.anglexy.ToString();
rotationcontrol.Angle = (int)Math.Round(Angle2D.RadToDeg(this.anglexy));
sloperotation.Text = anglexy.ToString();
rotationcontrol.Angle = (int)Math.Round(anglexy); //(int)Math.Round(Angle2D.RadToDeg(this.anglexy));
}
if(float.IsNaN(this.anglez)) {
if(float.IsNaN(anglez)) {
slopeangle.Text = "";
angletrackbar.Value = 0;
} else {
slopeangle.Text = this.anglez.ToString();
angletrackbar.Value = General.Clamp((int)Math.Round(Angle2D.RadToDeg(this.anglez)), angletrackbar.Minimum, angletrackbar.Maximum);
slopeangle.Text = anglez.ToString();
angletrackbar.Value = General.Clamp((int)Math.Round(anglez - 90), angletrackbar.Minimum, angletrackbar.Maximum);
}
slopeoffset.Text = float.IsNaN(this.offset) ? "" : this.offset.ToString();
@ -93,7 +94,7 @@ namespace CodeImp.DoomBuilder.Controls
if(blockUpdate) return;
blockUpdate = true;
anglexy = Angle2D.DegToRad(sloperotation.GetResultFloat(0f));
anglexy = sloperotation.GetResultFloat(0f); //Angle2D.DegToRad(sloperotation.GetResultFloat(0f));
rotationcontrol.Angle = (int)Math.Round(sloperotation.GetResultFloat(0f));
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
@ -117,7 +118,7 @@ namespace CodeImp.DoomBuilder.Controls
int anglezdeg = General.Clamp((int)Math.Round(slopeangle.GetResultFloat(0f)), angletrackbar.Minimum, angletrackbar.Maximum);
angletrackbar.Value = anglezdeg;
anglez = Angle2D.DegToRad(anglezdeg);
anglez = Angle2D.DegToRad(anglezdeg - 90);
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
blockUpdate = false;

View file

@ -29,7 +29,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private bool valid;
private int tag;
private UniversalType elementType;
private int offsetmode; //0 - none, 1 - positive (++), -1 - negative (--)
private int rangemode; //0 - none, 1 - positive (>=), -1 - negative (<=)
private int offsetmode = 0; //0 - none, 1 - positive (++), -1 - negative (--)
public TagSelector() {
InitializeComponent();
@ -93,20 +94,26 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
public void ClearTag() {
cbTagPicker.SelectedIndex = -1;
cbTagPicker.Text = string.Empty;
rangemode = 0;
offsetmode = 0;
valid = false;
}
public int GetTag(int original) {
return GetTag(original, 0);
return (valid ? tag : original);
}
public int GetTag(int original, int offset) {
if(!valid) return original;
return tag + offset * offsetmode;
public int GetSmartTag(int original, int offset) {
if (!valid) return original;
if (rangemode != 0) return tag + offset * rangemode;
if (offsetmode != 0) return original + tag * offsetmode;
return tag;
}
public void ValidateTag() {
rangemode = 0;
offsetmode = 0;
if(cbTagPicker.SelectedIndex != -1) {
tag = infos[cbTagPicker.SelectedIndex].Tag;
valid = true;
@ -116,24 +123,25 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
//check text
string text = cbTagPicker.Text.Trim().ToLowerInvariant();
if(string.IsNullOrEmpty(text)) {
offsetmode = 0;
valid = false;
return;
}
//incremental?
if(text.Length > 2){
if(text.StartsWith("++")) {
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("--")) {
} else if(text.StartsWith("--")) { //relative down
offsetmode = -1;
text = text.Substring(2, text.Length - 2);
} else {
offsetmode = 0;
}
} else {
offsetmode = 0;
}
if(!int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out tag)) {

View file

@ -119,9 +119,10 @@ namespace CodeImp.DoomBuilder.Windows
label5.AutoSize = true;
label5.Location = new System.Drawing.Point(12, 272);
label5.Name = "label5";
label5.Size = new System.Drawing.Size(312, 14);
label5.Size = new System.Drawing.Size(312, 28);
label5.TabIndex = 19;
label5.Text = "Drag items to change order (lower items override higher items).";
label5.Text = "Drag && drop resources to add them.\r\nDrag items to change order (lower items over" +
"ride higher items).";
//
// label6
//

View file

@ -177,24 +177,6 @@
<metadata name="tabresources.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabnodebuilder.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabtesting.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabtextures.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabresources.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="configdata.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="configdata.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -207,12 +189,6 @@
<metadata name="nodebuildersave.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodebuildertest.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodebuildersave.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabtesting.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -240,6 +216,24 @@
<metadata name="addtextureset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="startmode.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label11.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="listmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodebuildertest.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodebuildersave.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="listtextures.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -251,7 +245,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj0yLjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAA4
CAAAAk1TRnQBSQFMAwEBAAE0AQEBNAEBARMBAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
CAAAAk1TRnQBSQFMAwEBAAE8AQEBPAEBARMBAAEQAQAE/wEJAQAI/wFCAU0BNgEEBgABNgEEAgABKAMA
AUwDAAEQAwABAQEAAQgFAAHAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
@ -307,18 +301,6 @@
<metadata name="addtextureset.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tabmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="startmode.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label11.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="listmodes.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="startmode.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -721,7 +721,7 @@ namespace CodeImp.DoomBuilder.Windows
}
// Action/tags
l.Tag = General.Clamp(tagSelector.GetTag(l.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
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;

View file

@ -230,7 +230,7 @@ namespace CodeImp.DoomBuilder.Windows
if(!effect.Empty) s.Effect = effect.Value;
// Action
s.Tag = General.Clamp(tagSelector.GetTag(s.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
s.Tag = General.Clamp(tagSelector.GetSmartTag(s.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
}
// Done

View file

@ -85,33 +85,9 @@
this.ceilingtex = new CodeImp.DoomBuilder.Controls.FlatSelectorControl();
this.tabslopes = new System.Windows.Forms.TabPage();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.floorslopeangle = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label23 = new System.Windows.Forms.Label();
this.floorsloperotation = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label24 = new System.Windows.Forms.Label();
this.resetfloorslope = new System.Windows.Forms.Button();
this.floorslopeoffset = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label18 = new System.Windows.Forms.Label();
this.floorslopez = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label17 = new System.Windows.Forms.Label();
this.floorslopey = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label16 = new System.Windows.Forms.Label();
this.floorslopex = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label15 = new System.Windows.Forms.Label();
this.floorslopecontrol = new CodeImp.DoomBuilder.Controls.SectorSlopeControl();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.ceilslopeanglelabel = new System.Windows.Forms.Label();
this.ceilsloperolllabel = new System.Windows.Forms.Label();
this.ceilslopeangle = new System.Windows.Forms.TrackBar();
this.ceilsloperoll = new System.Windows.Forms.TrackBar();
this.resetceilslope = new System.Windows.Forms.Button();
this.ceilslopeoffset = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.ceilslopex = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label19 = new System.Windows.Forms.Label();
this.label22 = new System.Windows.Forms.Label();
this.ceilslopez = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.label21 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label();
this.ceilslopey = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.ceilingslopecontrol = new CodeImp.DoomBuilder.Controls.SectorSlopeControl();
this.tabcustom = new System.Windows.Forms.TabPage();
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
this.cancel = new System.Windows.Forms.Button();
@ -138,8 +114,6 @@
this.tabslopes.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ceilslopeangle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ceilsloperoll)).BeginInit();
this.tabcustom.SuspendLayout();
this.SuspendLayout();
//
@ -878,19 +852,7 @@
//
// groupBox5
//
this.groupBox5.Controls.Add(this.floorslopeangle);
this.groupBox5.Controls.Add(this.label23);
this.groupBox5.Controls.Add(this.floorsloperotation);
this.groupBox5.Controls.Add(this.label24);
this.groupBox5.Controls.Add(this.resetfloorslope);
this.groupBox5.Controls.Add(this.floorslopeoffset);
this.groupBox5.Controls.Add(this.label18);
this.groupBox5.Controls.Add(this.floorslopez);
this.groupBox5.Controls.Add(this.label17);
this.groupBox5.Controls.Add(this.floorslopey);
this.groupBox5.Controls.Add(this.label16);
this.groupBox5.Controls.Add(this.floorslopex);
this.groupBox5.Controls.Add(this.label15);
this.groupBox5.Controls.Add(this.floorslopecontrol);
this.groupBox5.Location = new System.Drawing.Point(3, 212);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(443, 203);
@ -898,169 +860,17 @@
this.groupBox5.TabStop = false;
this.groupBox5.Text = " Floor: ";
//
// floorslopeangle
// floorslopecontrol
//
this.floorslopeangle.AllowDecimal = true;
this.floorslopeangle.AllowNegative = true;
this.floorslopeangle.AllowRelative = true;
this.floorslopeangle.ButtonStep = 1;
this.floorslopeangle.ButtonStepFloat = 1F;
this.floorslopeangle.Location = new System.Drawing.Point(282, 52);
this.floorslopeangle.Name = "floorslopeangle";
this.floorslopeangle.Size = new System.Drawing.Size(82, 24);
this.floorslopeangle.StepValues = null;
this.floorslopeangle.TabIndex = 22;
this.floorslopeangle.WhenTextChanged += new System.EventHandler(this.floorslopeangle_WhenTextChanged);
//
// label23
//
this.label23.AutoSize = true;
this.label23.Location = new System.Drawing.Point(223, 57);
this.label23.Name = "label23";
this.label23.Size = new System.Drawing.Size(38, 14);
this.label23.TabIndex = 21;
this.label23.Text = "Angle:";
//
// floorsloperotation
//
this.floorsloperotation.AllowDecimal = true;
this.floorsloperotation.AllowNegative = true;
this.floorsloperotation.AllowRelative = true;
this.floorsloperotation.ButtonStep = 1;
this.floorsloperotation.ButtonStepFloat = 1F;
this.floorsloperotation.Location = new System.Drawing.Point(282, 22);
this.floorsloperotation.Name = "floorsloperotation";
this.floorsloperotation.Size = new System.Drawing.Size(82, 24);
this.floorsloperotation.StepValues = null;
this.floorsloperotation.TabIndex = 20;
this.floorsloperotation.WhenTextChanged += new System.EventHandler(this.floorsloperotation_WhenTextChanged);
//
// label24
//
this.label24.AutoSize = true;
this.label24.Location = new System.Drawing.Point(223, 27);
this.label24.Name = "label24";
this.label24.Size = new System.Drawing.Size(49, 14);
this.label24.TabIndex = 19;
this.label24.Text = "Rotation:";
//
// resetfloorslope
//
this.resetfloorslope.Location = new System.Drawing.Point(74, 142);
this.resetfloorslope.Name = "resetfloorslope";
this.resetfloorslope.Size = new System.Drawing.Size(82, 23);
this.resetfloorslope.TabIndex = 18;
this.resetfloorslope.Text = "Reset";
this.resetfloorslope.UseVisualStyleBackColor = true;
this.resetfloorslope.Click += new System.EventHandler(this.resetfloorslope_Click);
//
// floorslopeoffset
//
this.floorslopeoffset.AllowDecimal = true;
this.floorslopeoffset.AllowNegative = true;
this.floorslopeoffset.AllowRelative = true;
this.floorslopeoffset.ButtonStep = 1;
this.floorslopeoffset.ButtonStepFloat = 16F;
this.floorslopeoffset.Location = new System.Drawing.Point(74, 112);
this.floorslopeoffset.Name = "floorslopeoffset";
this.floorslopeoffset.Size = new System.Drawing.Size(82, 24);
this.floorslopeoffset.StepValues = null;
this.floorslopeoffset.TabIndex = 8;
this.floorslopeoffset.WhenTextChanged += new System.EventHandler(this.floorslopeoffset_WhenTextChanged);
//
// label18
//
this.label18.AutoSize = true;
this.label18.Location = new System.Drawing.Point(27, 117);
this.label18.Name = "label18";
this.label18.Size = new System.Drawing.Size(41, 14);
this.label18.TabIndex = 7;
this.label18.Text = "Offset:";
//
// floorslopez
//
this.floorslopez.AllowDecimal = true;
this.floorslopez.AllowNegative = true;
this.floorslopez.AllowRelative = true;
this.floorslopez.ButtonStep = 1;
this.floorslopez.ButtonStepFloat = 0.1F;
this.floorslopez.Location = new System.Drawing.Point(74, 82);
this.floorslopez.Name = "floorslopez";
this.floorslopez.Size = new System.Drawing.Size(82, 24);
this.floorslopez.StepValues = null;
this.floorslopez.TabIndex = 6;
this.floorslopez.WhenTextChanged += new System.EventHandler(this.floorslopez_WhenTextChanged);
//
// label17
//
this.label17.AutoSize = true;
this.label17.Location = new System.Drawing.Point(15, 87);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(53, 14);
this.label17.TabIndex = 5;
this.label17.Text = "Normal Z:";
//
// floorslopey
//
this.floorslopey.AllowDecimal = true;
this.floorslopey.AllowNegative = true;
this.floorslopey.AllowRelative = true;
this.floorslopey.ButtonStep = 1;
this.floorslopey.ButtonStepFloat = 0.1F;
this.floorslopey.Location = new System.Drawing.Point(74, 52);
this.floorslopey.Name = "floorslopey";
this.floorslopey.Size = new System.Drawing.Size(82, 24);
this.floorslopey.StepValues = null;
this.floorslopey.TabIndex = 4;
this.floorslopey.WhenTextChanged += new System.EventHandler(this.floorslopey_WhenTextChanged);
//
// label16
//
this.label16.AutoSize = true;
this.label16.Location = new System.Drawing.Point(15, 57);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(53, 14);
this.label16.TabIndex = 3;
this.label16.Text = "Normal Y:";
//
// floorslopex
//
this.floorslopex.AllowDecimal = true;
this.floorslopex.AllowNegative = true;
this.floorslopex.AllowRelative = true;
this.floorslopex.ButtonStep = 1;
this.floorslopex.ButtonStepFloat = 0.1F;
this.floorslopex.Location = new System.Drawing.Point(74, 22);
this.floorslopex.Name = "floorslopex";
this.floorslopex.Size = new System.Drawing.Size(82, 24);
this.floorslopex.StepValues = null;
this.floorslopex.TabIndex = 2;
this.floorslopex.WhenTextChanged += new System.EventHandler(this.floorslopex_WhenTextChanged);
//
// label15
//
this.label15.AutoSize = true;
this.label15.Location = new System.Drawing.Point(15, 27);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(53, 14);
this.label15.TabIndex = 0;
this.label15.Text = "Normal X:";
this.floorslopecontrol.Location = new System.Drawing.Point(6, 19);
this.floorslopecontrol.Name = "floorslopecontrol";
this.floorslopecontrol.Size = new System.Drawing.Size(431, 178);
this.floorslopecontrol.TabIndex = 0;
this.floorslopecontrol.OnValuesChanged += new System.EventHandler(this.floorslopecontrol_OnValuesChanged);
//
// groupBox4
//
this.groupBox4.Controls.Add(this.ceilslopeanglelabel);
this.groupBox4.Controls.Add(this.ceilsloperolllabel);
this.groupBox4.Controls.Add(this.ceilslopeangle);
this.groupBox4.Controls.Add(this.ceilsloperoll);
this.groupBox4.Controls.Add(this.resetceilslope);
this.groupBox4.Controls.Add(this.ceilslopeoffset);
this.groupBox4.Controls.Add(this.ceilslopex);
this.groupBox4.Controls.Add(this.label19);
this.groupBox4.Controls.Add(this.label22);
this.groupBox4.Controls.Add(this.ceilslopez);
this.groupBox4.Controls.Add(this.label21);
this.groupBox4.Controls.Add(this.label20);
this.groupBox4.Controls.Add(this.ceilslopey);
this.groupBox4.Controls.Add(this.ceilingslopecontrol);
this.groupBox4.Location = new System.Drawing.Point(3, 3);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(443, 203);
@ -1068,147 +878,13 @@
this.groupBox4.TabStop = false;
this.groupBox4.Text = " Ceiling: ";
//
// ceilslopeanglelabel
// ceilingslopecontrol
//
this.ceilslopeanglelabel.AutoSize = true;
this.ceilslopeanglelabel.Location = new System.Drawing.Point(387, 73);
this.ceilslopeanglelabel.Name = "ceilslopeanglelabel";
this.ceilslopeanglelabel.Size = new System.Drawing.Size(50, 14);
this.ceilslopeanglelabel.TabIndex = 21;
this.ceilslopeanglelabel.Text = "0 \\u00B0";
//
// ceilsloperolllabel
//
this.ceilsloperolllabel.AutoSize = true;
this.ceilsloperolllabel.Location = new System.Drawing.Point(387, 23);
this.ceilsloperolllabel.Name = "ceilsloperolllabel";
this.ceilsloperolllabel.Size = new System.Drawing.Size(50, 14);
this.ceilsloperolllabel.TabIndex = 20;
this.ceilsloperolllabel.Text = "0 \\u00B0";
//
// ceilslopeangle
//
this.ceilslopeangle.Location = new System.Drawing.Point(226, 73);
this.ceilslopeangle.Maximum = 359;
this.ceilslopeangle.Name = "ceilslopeangle";
this.ceilslopeangle.Size = new System.Drawing.Size(155, 45);
this.ceilslopeangle.TabIndex = 19;
this.ceilslopeangle.TickFrequency = 15;
this.ceilslopeangle.Scroll += new System.EventHandler(this.ceilslopeangle_Scroll);
//
// ceilsloperoll
//
this.ceilsloperoll.Location = new System.Drawing.Point(226, 22);
this.ceilsloperoll.Maximum = 85;
this.ceilsloperoll.Minimum = -85;
this.ceilsloperoll.Name = "ceilsloperoll";
this.ceilsloperoll.Size = new System.Drawing.Size(155, 45);
this.ceilsloperoll.SmallChange = 5;
this.ceilsloperoll.TabIndex = 18;
this.ceilsloperoll.TickFrequency = 5;
this.ceilsloperoll.Scroll += new System.EventHandler(this.ceilsloperoll_Scroll);
//
// resetceilslope
//
this.resetceilslope.Location = new System.Drawing.Point(74, 142);
this.resetceilslope.Name = "resetceilslope";
this.resetceilslope.Size = new System.Drawing.Size(82, 23);
this.resetceilslope.TabIndex = 17;
this.resetceilslope.Text = "Reset";
this.resetceilslope.UseVisualStyleBackColor = true;
this.resetceilslope.Click += new System.EventHandler(this.resetceilslope_Click);
//
// ceilslopeoffset
//
this.ceilslopeoffset.AllowDecimal = true;
this.ceilslopeoffset.AllowNegative = true;
this.ceilslopeoffset.AllowRelative = true;
this.ceilslopeoffset.ButtonStep = 1;
this.ceilslopeoffset.ButtonStepFloat = 16F;
this.ceilslopeoffset.Location = new System.Drawing.Point(74, 112);
this.ceilslopeoffset.Name = "ceilslopeoffset";
this.ceilslopeoffset.Size = new System.Drawing.Size(82, 24);
this.ceilslopeoffset.StepValues = null;
this.ceilslopeoffset.TabIndex = 16;
this.ceilslopeoffset.WhenTextChanged += new System.EventHandler(this.ceilslopeoffset_WhenTextChanged);
//
// ceilslopex
//
this.ceilslopex.AllowDecimal = true;
this.ceilslopex.AllowNegative = true;
this.ceilslopex.AllowRelative = true;
this.ceilslopex.ButtonStep = 1;
this.ceilslopex.ButtonStepFloat = 0.1F;
this.ceilslopex.Location = new System.Drawing.Point(74, 22);
this.ceilslopex.Name = "ceilslopex";
this.ceilslopex.Size = new System.Drawing.Size(82, 24);
this.ceilslopex.StepValues = null;
this.ceilslopex.TabIndex = 10;
this.ceilslopex.WhenTextChanged += new System.EventHandler(this.ceilslopex_WhenTextChanged);
//
// label19
//
this.label19.AutoSize = true;
this.label19.Location = new System.Drawing.Point(27, 117);
this.label19.Name = "label19";
this.label19.Size = new System.Drawing.Size(41, 14);
this.label19.TabIndex = 15;
this.label19.Text = "Offset:";
//
// label22
//
this.label22.AutoSize = true;
this.label22.Location = new System.Drawing.Point(15, 27);
this.label22.Name = "label22";
this.label22.Size = new System.Drawing.Size(53, 14);
this.label22.TabIndex = 9;
this.label22.Text = "Normal X:";
//
// ceilslopez
//
this.ceilslopez.AllowDecimal = true;
this.ceilslopez.AllowNegative = true;
this.ceilslopez.AllowRelative = true;
this.ceilslopez.ButtonStep = 1;
this.ceilslopez.ButtonStepFloat = 0.1F;
this.ceilslopez.Location = new System.Drawing.Point(74, 82);
this.ceilslopez.Name = "ceilslopez";
this.ceilslopez.Size = new System.Drawing.Size(82, 24);
this.ceilslopez.StepValues = null;
this.ceilslopez.TabIndex = 14;
this.ceilslopez.WhenTextChanged += new System.EventHandler(this.ceilslopez_WhenTextChanged);
//
// label21
//
this.label21.AutoSize = true;
this.label21.Location = new System.Drawing.Point(15, 57);
this.label21.Name = "label21";
this.label21.Size = new System.Drawing.Size(53, 14);
this.label21.TabIndex = 11;
this.label21.Text = "Normal Y:";
//
// label20
//
this.label20.AutoSize = true;
this.label20.Location = new System.Drawing.Point(15, 87);
this.label20.Name = "label20";
this.label20.Size = new System.Drawing.Size(53, 14);
this.label20.TabIndex = 13;
this.label20.Text = "Normal Z:";
//
// ceilslopey
//
this.ceilslopey.AllowDecimal = true;
this.ceilslopey.AllowNegative = true;
this.ceilslopey.AllowRelative = true;
this.ceilslopey.ButtonStep = 1;
this.ceilslopey.ButtonStepFloat = 0.1F;
this.ceilslopey.Location = new System.Drawing.Point(74, 52);
this.ceilslopey.Name = "ceilslopey";
this.ceilslopey.Size = new System.Drawing.Size(82, 24);
this.ceilslopey.StepValues = null;
this.ceilslopey.TabIndex = 12;
this.ceilslopey.WhenTextChanged += new System.EventHandler(this.ceilslopey_WhenTextChanged);
this.ceilingslopecontrol.Location = new System.Drawing.Point(6, 19);
this.ceilingslopecontrol.Name = "ceilingslopecontrol";
this.ceilingslopecontrol.Size = new System.Drawing.Size(431, 178);
this.ceilingslopecontrol.TabIndex = 1;
this.ceilingslopecontrol.OnValuesChanged += new System.EventHandler(this.ceilingslopecontrol_OnValuesChanged);
//
// tabcustom
//
@ -1303,11 +979,7 @@
this.groupBox1.PerformLayout();
this.tabslopes.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.ceilslopeangle)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ceilsloperoll)).EndInit();
this.tabcustom.ResumeLayout(false);
this.ResumeLayout(false);
@ -1370,31 +1042,7 @@
private System.Windows.Forms.TabPage tabslopes;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.Label label15;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorslopeoffset;
private System.Windows.Forms.Label label18;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorslopez;
private System.Windows.Forms.Label label17;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorslopey;
private System.Windows.Forms.Label label16;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorslopex;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox ceilslopeoffset;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox ceilslopex;
private System.Windows.Forms.Label label19;
private System.Windows.Forms.Label label22;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox ceilslopez;
private System.Windows.Forms.Label label21;
private System.Windows.Forms.Label label20;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox ceilslopey;
private System.Windows.Forms.Button resetceilslope;
private System.Windows.Forms.Button resetfloorslope;
private System.Windows.Forms.TrackBar ceilslopeangle;
private System.Windows.Forms.TrackBar ceilsloperoll;
private System.Windows.Forms.Label ceilslopeanglelabel;
private System.Windows.Forms.Label ceilsloperolllabel;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorslopeangle;
private System.Windows.Forms.Label label23;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox floorsloperotation;
private System.Windows.Forms.Label label24;
private CodeImp.DoomBuilder.Controls.SectorSlopeControl floorslopecontrol;
private CodeImp.DoomBuilder.Controls.SectorSlopeControl ceilingslopecontrol;
}
}

View file

@ -45,8 +45,6 @@ namespace CodeImp.DoomBuilder.Windows
private Vector3D globalfloorslopepivot;
private List<Vector3D> ceilslopepivots;
private List<Vector3D> floorslopepivots;
//private static SlopePivotMode ceilpivotmode = SlopePivotMode.LOCAL; //dbg?
//private static SlopePivotMode floorpivotmode = SlopePivotMode.LOCAL;
private struct SectorProperties //mxd
{
@ -288,15 +286,24 @@ namespace CodeImp.DoomBuilder.Windows
lightColor.SetValueFrom(sc.Fields);
//Slopes
ceilslopex.Text = sc.Fields.GetValue("ceilingplane_a", 0f).ToString();
ceilslopey.Text = sc.Fields.GetValue("ceilingplane_b", 0f).ToString();
ceilslopez.Text = sc.Fields.GetValue("ceilingplane_c", 0f).ToString();
ceilslopeoffset.Text = sc.Fields.GetValue("ceilingplane_d", 0f).ToString();
SetSlopeValues(sc.Fields, true);
/*float ceilslopex = sc.Fields.GetValue("ceilingplane_a", 0f);
float ceilslopey = sc.Fields.GetValue("ceilingplane_b", 0f);
float ceilslopez = sc.Fields.GetValue("ceilingplane_c", 0f);
float ceilslopeoffset = sc.Fields.GetValue("ceilingplane_d", 0f);
floorslopex.Text = sc.Fields.GetValue("floorplane_a", 0f).ToString();
floorslopey.Text = sc.Fields.GetValue("floorplane_b", 0f).ToString();
floorslopez.Text = sc.Fields.GetValue("floorplane_c", 0f).ToString();
floorslopeoffset.Text = sc.Fields.GetValue("floorplane_d", 0f).ToString();
Vector3D ceilnormal = new Vector3D(ceilslopex, ceilslopey, ceilslopez);
ceilingslopecontrol.SetValues( (float)Math.Round(Angle2D.RadToDeg(ceilnormal.GetAngleXY()), 1),
(float)Math.Round(Angle2D.RadToDeg(ceilnormal.GetAngleZ()), 1), ceilslopeoffset, true);
float floorslopex = sc.Fields.GetValue("floorplane_a", 0f);
float floorslopey = sc.Fields.GetValue("floorplane_b", 0f);
float floorslopez = sc.Fields.GetValue("floorplane_c", 0f);
float floorslopeoffset = sc.Fields.GetValue("floorplane_d", 0f);
Vector3D floornormal = new Vector3D(floorslopex, floorslopey, floorslopez);
floorslopecontrol.SetValues((float)Math.Round(Angle2D.RadToDeg(floornormal.GetAngleXY()), 1),
(float)Math.Round(Angle2D.RadToDeg(floornormal.GetAngleZ()), 1), floorslopeoffset, true);*/
// Action
tagSelector.Setup(UniversalType.SectorTag); //mxd
@ -395,7 +402,8 @@ namespace CodeImp.DoomBuilder.Windows
lightColor.SetValueFrom(s.Fields);
//Slopes
if(s.Fields.GetValue("ceilingplane_a", 0f).ToString() != ceilslopex.Text) ceilslopex.Text = "";
SetSlopeValues(s.Fields, false);
/*if(s.Fields.GetValue("ceilingplane_a", 0f).ToString() != ceilslopex.Text) ceilslopex.Text = "";
if(s.Fields.GetValue("ceilingplane_b", 0f).ToString() != ceilslopey.Text) ceilslopey.Text = "";
if(s.Fields.GetValue("ceilingplane_c", 0f).ToString() != ceilslopez.Text) ceilslopez.Text = "";
if(s.Fields.GetValue("ceilingplane_d", 0f).ToString() != ceilslopeoffset.Text) ceilslopeoffset.Text = "";
@ -403,7 +411,7 @@ namespace CodeImp.DoomBuilder.Windows
if(s.Fields.GetValue("floorplane_a", 0f).ToString() != floorslopex.Text) floorslopex.Text = "";
if(s.Fields.GetValue("floorplane_b", 0f).ToString() != floorslopey.Text) floorslopey.Text = "";
if(s.Fields.GetValue("floorplane_c", 0f).ToString() != floorslopez.Text) floorslopez.Text = "";
if(s.Fields.GetValue("floorplane_d", 0f).ToString() != floorslopeoffset.Text) floorslopeoffset.Text = "";
if(s.Fields.GetValue("floorplane_d", 0f).ToString() != floorslopeoffset.Text) floorslopeoffset.Text = "";*/
// Action
if(s.Tag != sc.Tag) tagSelector.ClearTag(); //mxd
@ -441,7 +449,7 @@ namespace CodeImp.DoomBuilder.Windows
globalceilslopepivot /= sectors.Count;
//mxd. Set ceiling slope controls
if (!string.IsNullOrEmpty(ceilslopex.Text) && !string.IsNullOrEmpty(ceilslopey.Text) && !string.IsNullOrEmpty(ceilslopez.Text)) {
/*if (!string.IsNullOrEmpty(ceilslopex.Text) && !string.IsNullOrEmpty(ceilslopey.Text) && !string.IsNullOrEmpty(ceilslopez.Text)) {
Vector3D v = new Vector3D(ceilslopex.GetResultFloat(0f), ceilslopey.GetResultFloat(0f), ceilslopez.GetResultFloat(0f));
if (v.x != 0 || v.y != 0 || v.z != 0) {
ceilslopeangle.Value = (int) Math.Round(Angle2D.RadToDeg(v.GetAngleXY()));
@ -455,14 +463,20 @@ namespace CodeImp.DoomBuilder.Windows
if(!string.IsNullOrEmpty(floorslopex.Text) && !string.IsNullOrEmpty(floorslopey.Text) && !string.IsNullOrEmpty(floorslopez.Text)) {
Vector3D v = new Vector3D(floorslopex.GetResultFloat(0f), floorslopey.GetResultFloat(0f), floorslopez.GetResultFloat(0f));
if(v.x != 0 || v.y != 0 || v.z != 0) {
/*ceilslopeangle.Value = General.ClampAngle((int)Math.Round(Angle2D.RadToDeg(v.GetAngleXY())));
ceilsloperoll.Value = (int)Math.Round(Angle2D.RadToDeg(v.GetAngleZ()));
ceilslopeanglelabel.Text = ceilslopeangle.Value + "\u00B0";
ceilsloperolllabel.Text = ceilsloperoll.Value + "\u00B0";*/
//ceilslopeangle.Value = General.ClampAngle((int)Math.Round(Angle2D.RadToDeg(v.GetAngleXY())));
//ceilsloperoll.Value = (int)Math.Round(Angle2D.RadToDeg(v.GetAngleZ()));
//ceilslopeanglelabel.Text = ceilslopeangle.Value + "\u00B0";
//ceilsloperolllabel.Text = ceilsloperoll.Value + "\u00B0";
floorsloperotation.Text = ((int)Math.Round(Angle2D.RadToDeg(v.GetAngleXY()))).ToString();
floorslopeangle.Text = ((int)Math.Round(Angle2D.RadToDeg(v.GetAngleZ()))).ToString();
}
}
}*/
//mxd. Update slope controls
#if DEBUG
ceilingslopecontrol.UpdateControls();
floorslopecontrol.UpdateControls();
#endif
// Show sector height
UpdateSectorHeight();
@ -475,6 +489,32 @@ namespace CodeImp.DoomBuilder.Windows
blockUpdate = false; //mxd
}
//mxd
private void SetSlopeValues(UniFields source, bool first) {
#if !DEBUG
return;
#endif
float x = source.GetValue("ceilingplane_a", 0f);
float y = source.GetValue("ceilingplane_b", 0f);
float z = source.GetValue("ceilingplane_c", 0f);
float offset = source.GetValue("ceilingplane_d", 0f);
Vector3D ceilnormal = new Vector3D(x, y, z);
ceilingslopecontrol.SetValues((float)Math.Round(Angle2D.RadToDeg(ceilnormal.GetAngleXY()), 1),
(float)Math.Round(Angle2D.RadToDeg(ceilnormal.GetAngleZ()), 1), offset, first);
x = source.GetValue("floorplane_a", 0f);
y = source.GetValue("floorplane_b", 0f);
z = source.GetValue("floorplane_c", 0f);
offset = source.GetValue("floorplane_d", 0f);
Vector3D floornormal = new Vector3D(x, y, z);
floorslopecontrol.SetValues((float)Math.Round(Angle2D.RadToDeg(floornormal.GetAngleXY()), 1),
(float)Math.Round(Angle2D.RadToDeg(floornormal.GetAngleZ()), 1), offset, first);
}
// This updates the sector height field
private void UpdateSectorHeight() {
int delta = 0;
@ -549,7 +589,7 @@ namespace CodeImp.DoomBuilder.Windows
s.Brightness = General.Clamp(brightness.GetResult(s.Brightness), General.Map.FormatInterface.MinBrightness, General.Map.FormatInterface.MaxBrightness);
// Action
s.Tag = General.Clamp(tagSelector.GetTag(s.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
s.Tag = General.Clamp(tagSelector.GetSmartTag(s.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
//Fields
fieldslist.Apply(s.Fields);
@ -1035,9 +1075,9 @@ namespace CodeImp.DoomBuilder.Windows
#endregion
#region mxd. Floor slope realtime events
#region mxd. Slopes realtime events
private void resetfloorslope_Click(object sender, EventArgs e) {
/*private void resetfloorslope_Click(object sender, EventArgs e) {
foreach(Sector s in sectors) {
UDMFTools.ClearFields(s.Fields, floorslopekeys);
s.UpdateNeeded = true;
@ -1052,7 +1092,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
private void floorslopex_WhenTextChanged(object sender, EventArgs e) {
/*if(blockUpdate) return;
@ -1121,7 +1161,7 @@ namespace CodeImp.DoomBuilder.Windows
}
private void floorslopeoffset_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
/*if(blockUpdate) return;
int i = 0;
//restore values
@ -1139,41 +1179,70 @@ namespace CodeImp.DoomBuilder.Windows
}
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);*/
}
private void floorsloperotation_WhenTextChanged(object sender, EventArgs e) {
/*private void floorsloperotation_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
float anglexy = floorsloperotation.GetResultFloat(float.NaN);
float anglez = floorslopeangle.GetResultFloat(float.NaN);
if(float.IsNaN(anglexy) || float.IsNaN(anglez)) return;
applySlopeTransform(Angle2D.DegToRad(anglexy), Angle2D.DegToRad(anglez), floorslopekeys);
}
}*/
private void floorslopeangle_WhenTextChanged(object sender, EventArgs e) {
/*private void floorslopeangle_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
float anglexy = floorsloperotation.GetResultFloat(float.NaN);
float anglez = floorslopeangle.GetResultFloat(float.NaN);
if(float.IsNaN(anglexy) || float.IsNaN(anglez)) return;
applySlopeTransform(Angle2D.DegToRad(anglexy), Angle2D.DegToRad(anglez), floorslopekeys);
}*/
private void ceilingslopecontrol_OnValuesChanged(object sender, EventArgs e)
{
if(blockUpdate) return;
float anglexy = ceilingslopecontrol.AngleXY;
float anglez = ceilingslopecontrol.AngleZ;
if(float.IsNaN(anglexy) || float.IsNaN(anglez)) return;
applySlopeTransform(Angle2D.DegToRad(anglexy), Angle2D.DegToRad(anglez), ceilingslopecontrol.Offset, ceilslopekeys);
}
private void applySlopeTransform(float anglexy, float anglez, string[] keys) {
private void floorslopecontrol_OnValuesChanged(object sender, EventArgs e)
{
if(blockUpdate) return;
float anglexy = floorslopecontrol.AngleXY;
float anglez = floorslopecontrol.AngleZ;
if(float.IsNaN(anglexy) || float.IsNaN(anglez)) return;
applySlopeTransform(Angle2D.DegToRad(anglexy), Angle2D.DegToRad(anglez), floorslopecontrol.Offset, floorslopekeys);
}
private void applySlopeTransform(float anglexy, float anglez, float offset, string[] keys)
{
Vector3D v = Vector3D.FromAngleXYZ(anglexy + Angle2D.PI, anglez);
//restore or set values
if(v.x == 0 && v.y == 0 && v.z == 0) {
foreach(Sector s in sectors) {
if(v.x == 0 && v.y == 0 && v.z == 0)
{
foreach(Sector s in sectors)
{
UDMFTools.ClearFields(s.Fields, keys);
s.UpdateNeeded = true;
}
} else {
foreach(Sector s in sectors) {
}
else
{
foreach(Sector s in sectors)
{
UDMFTools.SetFloat(s.Fields, keys[0], v.x, float.MinValue);
UDMFTools.SetFloat(s.Fields, keys[1], v.y, float.MinValue);
UDMFTools.SetFloat(s.Fields, keys[2], v.z, float.MinValue);
UDMFTools.SetFloat(s.Fields, keys[3], offset, float.MinValue);
//TODO: set offset based on current SlopePivotMode
s.UpdateNeeded = true;
}
@ -1187,7 +1256,7 @@ namespace CodeImp.DoomBuilder.Windows
#region mxd. Ceiling slope realtime events
private void resetceilslope_Click(object sender, EventArgs e) {
/*private void resetceilslope_Click(object sender, EventArgs e) {
foreach(Sector s in sectors) {
UDMFTools.ClearFields(s.Fields, ceilslopekeys);
s.UpdateNeeded = true;
@ -1206,9 +1275,9 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
private void ceilslopex_WhenTextChanged(object sender, EventArgs e) {
/*private void ceilslopex_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
@ -1228,9 +1297,9 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
private void ceilslopey_WhenTextChanged(object sender, EventArgs e) {
/*private void ceilslopey_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
@ -1250,9 +1319,9 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
private void ceilslopez_WhenTextChanged(object sender, EventArgs e) {
/*private void ceilslopez_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
@ -1272,9 +1341,9 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
private void ceilslopeoffset_WhenTextChanged(object sender, EventArgs e) {
/*private void ceilslopeoffset_WhenTextChanged(object sender, EventArgs e) {
if(blockUpdate) return;
int i = 0;
@ -1294,11 +1363,11 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
#endregion
private void ceilslopeangle_Scroll(object sender, EventArgs e) {
/*private void ceilslopeangle_Scroll(object sender, EventArgs e) {
if(blockUpdate) return;
//ceilslopeanglelabel.Text = ceilslopeangle.Value + "\u00B0";
@ -1306,9 +1375,9 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
private void ceilsloperoll_Scroll(object sender, EventArgs e) {
/*private void ceilsloperoll_Scroll(object sender, EventArgs e) {
if(blockUpdate) return;
//ceilsloperolllabel.Text = ceilsloperoll.Value + "\u00B0";
@ -1316,7 +1385,7 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
}*/
//TODO: remove this
/*private void applySlopeValues(float anglexy, float anglez, string[] keys) {

View file

@ -405,7 +405,7 @@ namespace CodeImp.DoomBuilder.Windows
}
// Action/tags
t.Tag = General.Clamp(tagSelector.GetTag(t.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
t.Tag = General.Clamp(tagSelector.GetSmartTag(t.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
if (!action.Empty) {
t.Action = action.Value;

View file

@ -551,7 +551,7 @@ namespace CodeImp.DoomBuilder.Windows
}
// Action/tags
t.Tag = General.Clamp(tagSelector.GetTag(t.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
t.Tag = General.Clamp(tagSelector.GetSmartTag(t.Tag, tagoffset++), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag); //mxd
if(!action.Empty) {
t.Action = action.Value;