mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2024-11-23 04:12:12 +00:00
Added option in user preferences for manual line split behavior.
This commit is contained in:
parent
f2d41931f4
commit
3ab5c83f3b
6 changed files with 97 additions and 14 deletions
|
@ -760,6 +760,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.UndoRedo.WithdrawUndo();
|
||||
break;
|
||||
}
|
||||
BuilderPlug.Me.AdjustSplitCoordinates(ld, sld);
|
||||
}
|
||||
|
||||
// Update cache values
|
||||
|
|
|
@ -325,6 +325,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
General.Map.UndoRedo.WithdrawUndo();
|
||||
return;
|
||||
}
|
||||
BuilderPlug.Me.AdjustSplitCoordinates(l, sld);
|
||||
|
||||
// Update
|
||||
General.Map.Map.Update();
|
||||
|
@ -642,7 +643,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
if(snaptonearest && (l != null))
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Action, "Split a linedef.");
|
||||
l.Split(v);
|
||||
Linedef sld = l.Split(v);
|
||||
if(sld == null)
|
||||
{
|
||||
General.Map.UndoRedo.WithdrawUndo();
|
||||
return;
|
||||
}
|
||||
BuilderPlug.Me.AdjustSplitCoordinates(l, sld);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -79,6 +79,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private int showvisualthings; // 0 = none, 1 = sprite only, 2 = sprite caged
|
||||
private bool usegravity;
|
||||
private int changeheightbysidedef; // 0 = nothing, 1 = change ceiling, 2 = change floor
|
||||
private int splitlinebehavior; // 0 = adjust texcoords, 1 = copy texcoords, 2 = reset texcoords
|
||||
private bool editnewthing;
|
||||
private bool editnewsector;
|
||||
private bool additiveselect;
|
||||
|
@ -122,6 +123,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
public int ShowVisualThings { get { return showvisualthings; } set { showvisualthings = value; } }
|
||||
public bool UseGravity { get { return usegravity; } set { usegravity = value; } }
|
||||
public int ChangeHeightBySidedef { get { return changeheightbysidedef; } }
|
||||
public int SplitLineBehavior { get { return splitlinebehavior; } }
|
||||
public bool EditNewThing { get { return editnewthing; } }
|
||||
public bool EditNewSector { get { return editnewsector; } }
|
||||
public bool AdditiveSelect { get { return additiveselect; } }
|
||||
|
@ -211,6 +213,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private void LoadSettings()
|
||||
{
|
||||
changeheightbysidedef = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
||||
splitlinebehavior = General.Settings.ReadPluginSetting("splitlinebehavior", 0);
|
||||
editnewthing = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
additiveselect = General.Settings.ReadPluginSetting("additiveselect", false);
|
||||
|
@ -352,6 +355,41 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
#endregion
|
||||
|
||||
#region ================== Tools
|
||||
|
||||
// This adjusts texture coordinates for splitted lines according to the user preferences
|
||||
public void AdjustSplitCoordinates(Linedef oldline, Linedef newline)
|
||||
{
|
||||
// Copy X and Y coordinates
|
||||
if(splitlinebehavior == 1)
|
||||
{
|
||||
if((oldline.Front != null) && (newline.Front != null))
|
||||
{
|
||||
newline.Front.OffsetX = oldline.Front.OffsetX;
|
||||
newline.Front.OffsetY = oldline.Front.OffsetY;
|
||||
}
|
||||
|
||||
if((oldline.Back != null) && (newline.Back != null))
|
||||
{
|
||||
newline.Back.OffsetX = oldline.Back.OffsetX;
|
||||
newline.Back.OffsetY = oldline.Back.OffsetY;
|
||||
}
|
||||
}
|
||||
// Reset X coordinate, copy Y coordinate
|
||||
else if(splitlinebehavior == 2)
|
||||
{
|
||||
if((oldline.Front != null) && (newline.Front != null))
|
||||
{
|
||||
newline.Front.OffsetX = 0;
|
||||
newline.Front.OffsetY = oldline.Front.OffsetY;
|
||||
}
|
||||
|
||||
if((oldline.Back != null) && (newline.Back != null))
|
||||
{
|
||||
newline.Back.OffsetX = 0;
|
||||
newline.Back.OffsetY = oldline.Back.OffsetY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This finds all class types that inherits from the given type
|
||||
public Type[] FindClasses(Type t)
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.tabs = new System.Windows.Forms.TabControl();
|
||||
this.taboptions = new System.Windows.Forms.TabPage();
|
||||
this.groupBox3 = new System.Windows.Forms.GroupBox();
|
||||
this.autodragonpaste = new System.Windows.Forms.CheckBox();
|
||||
this.visualmodeclearselection = new System.Windows.Forms.CheckBox();
|
||||
this.autoclearselection = new System.Windows.Forms.CheckBox();
|
||||
this.editnewthing = new System.Windows.Forms.CheckBox();
|
||||
|
@ -52,7 +53,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.heightbysidedef = new System.Windows.Forms.ComboBox();
|
||||
this.autodragonpaste = new System.Windows.Forms.CheckBox();
|
||||
this.label10 = new System.Windows.Forms.Label();
|
||||
this.splitbehavior = new System.Windows.Forms.ComboBox();
|
||||
this.tabs.SuspendLayout();
|
||||
this.taboptions.SuspendLayout();
|
||||
this.groupBox3.SuspendLayout();
|
||||
|
@ -95,13 +97,23 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.groupBox3.Controls.Add(this.editnewthing);
|
||||
this.groupBox3.Controls.Add(this.editnewsector);
|
||||
this.groupBox3.Controls.Add(this.additiveselect);
|
||||
this.groupBox3.Location = new System.Drawing.Point(308, 90);
|
||||
this.groupBox3.Location = new System.Drawing.Point(308, 129);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(332, 200);
|
||||
this.groupBox3.TabIndex = 18;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = " Options ";
|
||||
//
|
||||
// autodragonpaste
|
||||
//
|
||||
this.autodragonpaste.AutoSize = true;
|
||||
this.autodragonpaste.Location = new System.Drawing.Point(23, 163);
|
||||
this.autodragonpaste.Name = "autodragonpaste";
|
||||
this.autodragonpaste.Size = new System.Drawing.Size(205, 18);
|
||||
this.autodragonpaste.TabIndex = 6;
|
||||
this.autodragonpaste.Text = "Drag selection automatically on paste";
|
||||
this.autodragonpaste.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// visualmodeclearselection
|
||||
//
|
||||
this.visualmodeclearselection.AutoSize = true;
|
||||
|
@ -166,7 +178,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
this.groupBox2.Controls.Add(this.label6);
|
||||
this.groupBox2.Controls.Add(this.label4);
|
||||
this.groupBox2.Controls.Add(this.label7);
|
||||
this.groupBox2.Location = new System.Drawing.Point(6, 90);
|
||||
this.groupBox2.Location = new System.Drawing.Point(6, 129);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(292, 200);
|
||||
this.groupBox2.TabIndex = 17;
|
||||
|
@ -299,11 +311,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
//
|
||||
// groupBox1
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.splitbehavior);
|
||||
this.groupBox1.Controls.Add(this.label10);
|
||||
this.groupBox1.Controls.Add(this.label1);
|
||||
this.groupBox1.Controls.Add(this.heightbysidedef);
|
||||
this.groupBox1.Location = new System.Drawing.Point(6, 6);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(634, 78);
|
||||
this.groupBox1.Size = new System.Drawing.Size(634, 117);
|
||||
this.groupBox1.TabIndex = 16;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = " Behavior ";
|
||||
|
@ -329,18 +343,31 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
"Change both floor and ceiling height"});
|
||||
this.heightbysidedef.Location = new System.Drawing.Point(364, 32);
|
||||
this.heightbysidedef.Name = "heightbysidedef";
|
||||
this.heightbysidedef.Size = new System.Drawing.Size(199, 22);
|
||||
this.heightbysidedef.Size = new System.Drawing.Size(217, 22);
|
||||
this.heightbysidedef.TabIndex = 0;
|
||||
//
|
||||
// autodragonpaste
|
||||
// label10
|
||||
//
|
||||
this.autodragonpaste.AutoSize = true;
|
||||
this.autodragonpaste.Location = new System.Drawing.Point(23, 163);
|
||||
this.autodragonpaste.Name = "autodragonpaste";
|
||||
this.autodragonpaste.Size = new System.Drawing.Size(205, 18);
|
||||
this.autodragonpaste.TabIndex = 6;
|
||||
this.autodragonpaste.Text = "Drag selection automatically on paste";
|
||||
this.autodragonpaste.UseVisualStyleBackColor = true;
|
||||
this.label10.AutoSize = true;
|
||||
this.label10.Location = new System.Drawing.Point(178, 71);
|
||||
this.label10.Name = "label10";
|
||||
this.label10.Size = new System.Drawing.Size(166, 14);
|
||||
this.label10.TabIndex = 1;
|
||||
this.label10.Text = "When splitting a linedef manually:";
|
||||
this.label10.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// splitbehavior
|
||||
//
|
||||
this.splitbehavior.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.splitbehavior.FormattingEnabled = true;
|
||||
this.splitbehavior.Items.AddRange(new object[] {
|
||||
"Interpolate texture coordinates",
|
||||
"Duplicate texture coordinates",
|
||||
"Reset X coordinate, duplicate Y coordinate"});
|
||||
this.splitbehavior.Location = new System.Drawing.Point(364, 68);
|
||||
this.splitbehavior.Name = "splitbehavior";
|
||||
this.splitbehavior.Size = new System.Drawing.Size(217, 22);
|
||||
this.splitbehavior.TabIndex = 2;
|
||||
//
|
||||
// PreferencesForm
|
||||
//
|
||||
|
@ -393,5 +420,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox highlightthingsrange;
|
||||
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox highlightrange;
|
||||
private System.Windows.Forms.CheckBox autodragonpaste;
|
||||
private System.Windows.Forms.ComboBox splitbehavior;
|
||||
private System.Windows.Forms.Label label10;
|
||||
}
|
||||
}
|
|
@ -57,6 +57,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
|
||||
// Apply current settings to interface
|
||||
heightbysidedef.SelectedIndex = General.Settings.ReadPluginSetting("changeheightbysidedef", 0);
|
||||
splitbehavior.SelectedIndex = General.Settings.ReadPluginSetting("splitlinebehavior", 0);
|
||||
editnewthing.Checked = General.Settings.ReadPluginSetting("editnewthing", true);
|
||||
editnewsector.Checked = General.Settings.ReadPluginSetting("editnewsector", false);
|
||||
additiveselect.Checked = General.Settings.ReadPluginSetting("additiveselect", false);
|
||||
|
@ -78,6 +79,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
{
|
||||
// Write preferred settings
|
||||
General.Settings.WritePluginSetting("changeheightbysidedef", heightbysidedef.SelectedIndex);
|
||||
General.Settings.WritePluginSetting("splitlinebehavior", splitbehavior.SelectedIndex);
|
||||
General.Settings.WritePluginSetting("editnewthing", editnewthing.Checked);
|
||||
General.Settings.WritePluginSetting("editnewsector", editnewsector.Checked);
|
||||
General.Settings.WritePluginSetting("additiveselect", additiveselect.Checked);
|
||||
|
|
|
@ -186,6 +186,12 @@
|
|||
<metadata name="groupBox1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="splitbehavior.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label10.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
Loading…
Reference in a new issue