Sector Edit form, UDMF: added "Slopes" tab.

Visual mode: "Lower/Raise Floor/Ceiling" actions now work on surfaces with sector slopes.
Cosmetic: numeric textboxes, which support relative values, now have differently colored text and a tooltip.
Internal: renamed Sector.CeilingSlopeOffset to Sector.CeilSlopeOffset, Sector.CeilingSlope to Sector.CeilSlope to match their names with similar sector properties.
This commit is contained in:
MaxED 2014-10-17 11:55:08 +00:00
parent 25a8365057
commit 5013720788
25 changed files with 841 additions and 520 deletions

View file

@ -18,6 +18,7 @@
using System; using System;
using System.ComponentModel; using System.ComponentModel;
using System.Drawing;
using System.Globalization; using System.Globalization;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,14 +38,15 @@ namespace CodeImp.DoomBuilder.Controls
private bool allowrelative; // Allow ++, --, * and / prefix for relative changes private bool allowrelative; // Allow ++, --, * and / prefix for relative changes
private bool allowdecimal; // Allow decimal (float) numbers private bool allowdecimal; // Allow decimal (float) numbers
private bool controlpressed; private bool controlpressed;
private readonly ToolTip tooltip; //mxd
#endregion #endregion
#region ================== Properties #region ================== Properties
public bool AllowNegative { get { return allownegative; } set { allownegative = value; } } public bool AllowNegative { get { return allownegative; } set { allownegative = value; } }
public bool AllowRelative { get { return allowrelative; } set { allowrelative = value; } } public bool AllowRelative { get { return allowrelative; } set { allowrelative = value; UpdateTextboxStyle(); } }
public bool AllowDecimal { get { return allowdecimal; } set { allowdecimal = value; } } public bool AllowDecimal { get { return allowdecimal; } set { allowdecimal = value; } }
#endregion #endregion
@ -54,6 +56,9 @@ namespace CodeImp.DoomBuilder.Controls
public NumericTextbox() public NumericTextbox()
{ {
this.ImeMode = ImeMode.Off; this.ImeMode = ImeMode.Off;
//mxd. Setup tooltip
this.tooltip = new ToolTip { AutomaticDelay = 100, AutoPopDelay = 4000, InitialDelay = 100, ReshowDelay = 100 };
} }
#endregion #endregion
@ -78,11 +83,6 @@ namespace CodeImp.DoomBuilder.Controls
protected override void OnKeyPress(KeyPressEventArgs e) protected override void OnKeyPress(KeyPressEventArgs e)
{ {
string allowedchars = "0123456789\b"; string allowedchars = "0123456789\b";
string nonselectedtext;
string textpart;
int selectionpos;
int numprefixes;
char otherprefix;
// Determine allowed chars // Determine allowed chars
if(allownegative) allowedchars += CultureInfo.CurrentUICulture.NumberFormat.NegativeSign; if(allownegative) allowedchars += CultureInfo.CurrentUICulture.NumberFormat.NegativeSign;
@ -100,12 +100,15 @@ namespace CodeImp.DoomBuilder.Controls
else else
{ {
//mxd. Check if * or / is pressed //mxd. Check if * or / is pressed
if(e.KeyChar == '*' || e.KeyChar == '/') { if(e.KeyChar == '*' || e.KeyChar == '/')
{
if (this.SelectionStart - 1 > -1) e.Handled = true; //only valid when at the start of the text if (this.SelectionStart - 1 > -1) e.Handled = true; //only valid when at the start of the text
} }
// Check if + or - is pressed // Check if + or - is pressed
else if((e.KeyChar == '+') || (e.KeyChar == '-')) else if((e.KeyChar == '+') || (e.KeyChar == '-'))
{ {
string nonselectedtext;
// Determine non-selected text // Determine non-selected text
if(this.SelectionLength > 0) if(this.SelectionLength > 0)
{ {
@ -123,12 +126,12 @@ namespace CodeImp.DoomBuilder.Controls
} }
// Not at the start? // Not at the start?
selectionpos = this.SelectionStart - 1; int selectionpos = this.SelectionStart - 1;
if(this.SelectionLength < 0) selectionpos = (this.SelectionStart + this.SelectionLength) - 1; if(this.SelectionLength < 0) selectionpos = (this.SelectionStart + this.SelectionLength) - 1;
if(selectionpos > -1) if(selectionpos > -1)
{ {
// Find any other characters before the insert position // Find any other characters before the insert position
textpart = this.Text.Substring(0, selectionpos + 1); string textpart = this.Text.Substring(0, selectionpos + 1);
textpart = textpart.Replace("+", ""); textpart = textpart.Replace("+", "");
textpart = textpart.Replace("-", ""); textpart = textpart.Replace("-", "");
if(textpart.Length > 0) if(textpart.Length > 0)
@ -139,10 +142,10 @@ namespace CodeImp.DoomBuilder.Controls
} }
// Determine other prefix // Determine other prefix
if(e.KeyChar == '+') otherprefix = '-'; else otherprefix = '+'; char otherprefix = (e.KeyChar == '+' ? '-' : '+');
// Limit the number of + and - allowed // Limit the number of + and - allowed
numprefixes = nonselectedtext.Split(e.KeyChar, otherprefix).Length; int numprefixes = nonselectedtext.Split(e.KeyChar, otherprefix).Length;
if(numprefixes > 2) if(numprefixes > 2)
{ {
// Can't have more than 2 prefixes // Can't have more than 2 prefixes
@ -166,10 +169,8 @@ namespace CodeImp.DoomBuilder.Controls
// Validate contents // Validate contents
protected override void OnValidating(CancelEventArgs e) protected override void OnValidating(CancelEventArgs e)
{ {
string textpart = this.Text;
// Strip prefixes // Strip prefixes
textpart = textpart.Replace("+", "").Replace("*", "").Replace("/", ""); //mxd string textpart = this.Text.Replace("+", "").Replace("*", "").Replace("/", ""); //mxd
if(!allownegative) textpart = textpart.Replace("-", ""); if(!allownegative) textpart = textpart.Replace("-", "");
// No numbers left? // No numbers left?
@ -177,9 +178,12 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Make the textbox empty // Make the textbox empty
this.Text = ""; this.Text = "";
} else if(allowdecimal) { //mxd }
else if(allowdecimal) //mxd
{
float value; float value;
if(float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out value)) { if(float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out value))
{
if(value == Math.Round(value)) if(value == Math.Round(value))
this.Text = this.Text.Replace(textpart, value.ToString("0.0")); this.Text = this.Text.Replace(textpart, value.ToString("0.0"));
} }
@ -227,7 +231,8 @@ namespace CodeImp.DoomBuilder.Controls
return newvalue; return newvalue;
} }
//mxd. Prefixed with *? //mxd. Prefixed with *?
if(this.Text.StartsWith("*")) { if(this.Text.StartsWith("*"))
{
// Multiply original by number // Multiply original by number
float resultf; float resultf;
float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out resultf); float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out resultf);
@ -236,7 +241,8 @@ namespace CodeImp.DoomBuilder.Controls
return newvalue; return newvalue;
} }
//mxd. Prefixed with /? //mxd. Prefixed with /?
if(this.Text.StartsWith("/")) { if(this.Text.StartsWith("/"))
{
// Divide original by number // Divide original by number
float resultf; float resultf;
float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out resultf); float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out resultf);
@ -259,15 +265,14 @@ namespace CodeImp.DoomBuilder.Controls
// This determines the result value // This determines the result value
public float GetResultFloat(float original) public float GetResultFloat(float original)
{ {
string textpart = this.Text;
float result;
// Strip prefixes // Strip prefixes
textpart = textpart.Replace("+", "").Replace("-", "").Replace("*", "").Replace("/", ""); //mxd; string textpart = this.Text.Replace("+", "").Replace("-", "").Replace("*", "").Replace("/", ""); //mxd;
// Any numbers left? // Any numbers left?
if(textpart.Length > 0) if(textpart.Length > 0)
{ {
float result;
// Prefixed with ++? // Prefixed with ++?
if(this.Text.StartsWith("++")) if(this.Text.StartsWith("++"))
{ {
@ -285,7 +290,8 @@ namespace CodeImp.DoomBuilder.Controls
return newvalue; return newvalue;
} }
//mxd. Prefixed with *? //mxd. Prefixed with *?
if(this.Text.StartsWith("*")) { if(this.Text.StartsWith("*"))
{
// Multiply original by number // Multiply original by number
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0; if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
float newvalue = original * result; float newvalue = original * result;
@ -293,7 +299,8 @@ namespace CodeImp.DoomBuilder.Controls
return newvalue; return newvalue;
} }
//mxd. Prefixed with /? //mxd. Prefixed with /?
if(this.Text.StartsWith("/")) { if(this.Text.StartsWith("/"))
{
// Divide original by number // Divide original by number
if (!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) return original; if (!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) return original;
float newvalue = (float)Math.Round(original / result, 3); float newvalue = (float)Math.Round(original / result, 3);
@ -310,6 +317,20 @@ namespace CodeImp.DoomBuilder.Controls
// Nothing given, keep original value // Nothing given, keep original value
return original; return original;
} }
//mxd
private void UpdateTextboxStyle()
{
this.ForeColor = (allowrelative ? SystemColors.HotTrack : SystemColors.WindowText);
if (allowrelative)
{
tooltip.SetToolTip(this, "Use ++ or -- prefixes to change\r\nexisting values by given value.\r\nUse * or / prefixes to multiply\r\nor divide existing values by given value.");
}
else
{
tooltip.RemoveAll();
}
}
#endregion #endregion
} }

View file

@ -115,6 +115,7 @@
// rotationcontrol // rotationcontrol
// //
this.rotationcontrol.Angle = 0; this.rotationcontrol.Angle = 0;
this.rotationcontrol.AngleOffset = 0;
this.rotationcontrol.Location = new System.Drawing.Point(173, 36); this.rotationcontrol.Location = new System.Drawing.Point(173, 36);
this.rotationcontrol.Name = "rotationcontrol"; this.rotationcontrol.Name = "rotationcontrol";
this.rotationcontrol.Size = new System.Drawing.Size(44, 44); this.rotationcontrol.Size = new System.Drawing.Size(44, 44);
@ -128,6 +129,7 @@
this.slopeangle.AllowRelative = true; this.slopeangle.AllowRelative = true;
this.slopeangle.ButtonStep = 1; this.slopeangle.ButtonStep = 1;
this.slopeangle.ButtonStepFloat = 1F; this.slopeangle.ButtonStepFloat = 1F;
this.slopeangle.ButtonStepsWrapAround = false;
this.slopeangle.Location = new System.Drawing.Point(85, 78); this.slopeangle.Location = new System.Drawing.Point(85, 78);
this.slopeangle.Name = "slopeangle"; this.slopeangle.Name = "slopeangle";
this.slopeangle.Size = new System.Drawing.Size(82, 24); this.slopeangle.Size = new System.Drawing.Size(82, 24);
@ -142,6 +144,7 @@
this.sloperotation.AllowRelative = true; this.sloperotation.AllowRelative = true;
this.sloperotation.ButtonStep = 1; this.sloperotation.ButtonStep = 1;
this.sloperotation.ButtonStepFloat = 1F; this.sloperotation.ButtonStepFloat = 1F;
this.sloperotation.ButtonStepsWrapAround = false;
this.sloperotation.Location = new System.Drawing.Point(85, 48); this.sloperotation.Location = new System.Drawing.Point(85, 48);
this.sloperotation.Name = "sloperotation"; this.sloperotation.Name = "sloperotation";
this.sloperotation.Size = new System.Drawing.Size(82, 24); this.sloperotation.Size = new System.Drawing.Size(82, 24);
@ -155,7 +158,8 @@
this.slopeoffset.AllowNegative = true; this.slopeoffset.AllowNegative = true;
this.slopeoffset.AllowRelative = true; this.slopeoffset.AllowRelative = true;
this.slopeoffset.ButtonStep = 1; this.slopeoffset.ButtonStep = 1;
this.slopeoffset.ButtonStepFloat = 16F; this.slopeoffset.ButtonStepFloat = 8F;
this.slopeoffset.ButtonStepsWrapAround = false;
this.slopeoffset.Location = new System.Drawing.Point(85, 108); this.slopeoffset.Location = new System.Drawing.Point(85, 108);
this.slopeoffset.Name = "slopeoffset"; this.slopeoffset.Name = "slopeoffset";
this.slopeoffset.Size = new System.Drawing.Size(82, 24); this.slopeoffset.Size = new System.Drawing.Size(82, 24);
@ -193,7 +197,6 @@
this.Controls.Add(this.label18); this.Controls.Add(this.label18);
this.Name = "SectorSlopeControl"; this.Name = "SectorSlopeControl";
this.Size = new System.Drawing.Size(353, 169); this.Size = new System.Drawing.Size(353, 169);
this.Load += new System.EventHandler(this.SectorSlopeControl_Load);
((System.ComponentModel.ISupportInitialize)(this.angletrackbar)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.angletrackbar)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View file

@ -1,6 +1,10 @@
using System; #region ================== Namespaces
using System;
using System.Windows.Forms; using System.Windows.Forms;
#endregion
namespace CodeImp.DoomBuilder.Controls namespace CodeImp.DoomBuilder.Controls
{ {
#region ================== Enums #region ================== Enums
@ -8,8 +12,8 @@ namespace CodeImp.DoomBuilder.Controls
internal enum SlopePivotMode internal enum SlopePivotMode
{ {
ORIGIN, // pivot around 0, 0 ORIGIN, // pivot around 0, 0
GLOBAL, // pivot around globalslopepivot GLOBAL, // pivot around selection center
LOCAL, // pivot around localslopepivots LOCAL, // pivot around sector center
} }
#endregion #endregion
@ -21,7 +25,6 @@ namespace CodeImp.DoomBuilder.Controls
public event EventHandler OnAnglesChanged; public event EventHandler OnAnglesChanged;
public event EventHandler OnUseLineAnglesChanged; public event EventHandler OnUseLineAnglesChanged;
public event EventHandler OnOffsetChanged;
public event EventHandler OnPivotModeChanged; public event EventHandler OnPivotModeChanged;
public event EventHandler OnResetClicked; public event EventHandler OnResetClicked;
@ -29,37 +32,77 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Variables #region ================== Variables
private static SlopePivotMode pivotmode = SlopePivotMode.ORIGIN; //DBG SlopePivotMode.LOCAL
internal SlopePivotMode PivotMode { get { return pivotmode; } }
private bool blockUpdate; private bool blockUpdate;
//slope values // Slope values
private float anglexy; private float anglexy;
private float anglez; private float anglez;
private float offset; private float offset;
public float AngleXY { get { return anglexy; } } //in dergrees #endregion
public float AngleZ { get { return anglez; } } //in dergrees, add 90
public float Offset { get { return offset; } } #region ================== Properties
public StepsList StepValues { set { sloperotation.StepValues = value; } } public StepsList StepValues { set { sloperotation.StepValues = value; } }
public bool UseLineAngles { get { return cbuselineangles.Checked; } set { blockUpdate = true; cbuselineangles.Checked = value; blockUpdate = false; } } public bool UseLineAngles { get { return cbuselineangles.Checked; } set { blockUpdate = true; cbuselineangles.Checked = value; blockUpdate = false; } }
internal SlopePivotMode PivotMode
{
get
{
return (SlopePivotMode)pivotmodeselector.SelectedIndex;
}
set
{
blockUpdate = true;
pivotmodeselector.SelectedIndex = (int)value;
blockUpdate = false;
}
}
#endregion #endregion
public SectorSlopeControl() { #region ================== Constructor
public SectorSlopeControl()
{
InitializeComponent(); InitializeComponent();
} }
#endregion
#region ================== Property accessors
public float GetAngleXY(float defaultvalue)
{
return sloperotation.GetResultFloat(defaultvalue);
}
public float GetAngleZ(float defaultvalue)
{
return slopeangle.GetResultFloat(defaultvalue);
}
public float GetOffset(float defaultvalue)
{
return slopeoffset.GetResultFloat(defaultvalue);
}
#endregion
#region ================== Methods #region ================== Methods
public void SetValues(float anglexy, float anglez, float offset, bool first) { public void SetValues(float anglexy, float anglez, float offset, bool first)
if (first) { {
if (first)
{
// Set values // Set values
this.anglexy = anglexy; this.anglexy = anglexy;
this.anglez = anglez; this.anglez = anglez;
this.offset = offset; this.offset = offset;
} else { }
else
{
// Or update values // Or update values
if(!float.IsNaN(this.anglexy) && this.anglexy != anglexy) this.anglexy = float.NaN; if(!float.IsNaN(this.anglexy) && this.anglexy != anglexy) this.anglexy = float.NaN;
if(!float.IsNaN(this.anglez) && this.anglez != anglez) this.anglez = float.NaN; if(!float.IsNaN(this.anglez) && this.anglez != anglez) this.anglez = float.NaN;
@ -67,34 +110,44 @@ namespace CodeImp.DoomBuilder.Controls
} }
} }
public void SetOffset(float offset, bool first) { public void SetOffset(float offset, bool first)
if(first) { {
if(first)
{
this.offset = offset; this.offset = offset;
} else { }
if(!float.IsNaN(this.offset) && this.offset != offset) this.offset = float.NaN; else if(!float.IsNaN(this.offset) && this.offset != offset)
{
this.offset = float.NaN;
} }
} }
public void UpdateControls() { public void UpdateControls()
{
blockUpdate = true; blockUpdate = true;
if(float.IsNaN(anglexy)) { if(float.IsNaN(anglexy))
{
sloperotation.Text = ""; sloperotation.Text = "";
rotationcontrol.Angle = 0; rotationcontrol.Angle = GZBuilder.Controls.AngleControl.NO_ANGLE;
} else { }
else
{
sloperotation.Text = anglexy.ToString(); sloperotation.Text = anglexy.ToString();
rotationcontrol.Angle = (int)Math.Round(anglexy + 90); //(int)Math.Round(Angle2D.RadToDeg(this.anglexy)); rotationcontrol.Angle = (int)Math.Round(anglexy + 90);
} }
if(float.IsNaN(anglez)) { if(float.IsNaN(anglez))
{
slopeangle.Text = ""; slopeangle.Text = "";
angletrackbar.Value = 0; angletrackbar.Value = 0;
} else { }
else
{
//clamp value to [-85 .. 85] //clamp value to [-85 .. 85]
anglez = General.Clamp(anglez, angletrackbar.Minimum, angletrackbar.Maximum); anglez = General.Clamp(anglez, angletrackbar.Minimum, angletrackbar.Maximum);
slopeangle.Text = anglez.ToString(); slopeangle.Text = anglez.ToString();
//angletrackbar.Value = (int)Math.Round(anglez);
angletrackbar.Value = (int)General.Clamp(anglez, angletrackbar.Minimum, angletrackbar.Maximum); angletrackbar.Value = (int)General.Clamp(anglez, angletrackbar.Minimum, angletrackbar.Maximum);
} }
@ -103,7 +156,8 @@ namespace CodeImp.DoomBuilder.Controls
blockUpdate = false; blockUpdate = false;
} }
public void UpdateOffset() { public void UpdateOffset()
{
blockUpdate = true; blockUpdate = true;
slopeoffset.Text = (float.IsNaN(offset) ? "" : offset.ToString()); slopeoffset.Text = (float.IsNaN(offset) ? "" : offset.ToString());
blockUpdate = false; blockUpdate = false;
@ -113,18 +167,20 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Events #region ================== Events
private void sloperotation_WhenTextChanged(object sender, EventArgs e) { private void sloperotation_WhenTextChanged(object sender, EventArgs e)
{
if(blockUpdate) return; if(blockUpdate) return;
blockUpdate = true; blockUpdate = true;
anglexy = General.ClampAngle(sloperotation.GetResultFloat(0f)); anglexy = General.ClampAngle(sloperotation.GetResultFloat(float.NaN));
rotationcontrol.Angle = (int)Math.Round(anglexy + 90); rotationcontrol.Angle = (float.IsNaN(anglexy) ? GZBuilder.Controls.AngleControl.NO_ANGLE : (int)Math.Round(anglexy + 90));
if(OnAnglesChanged != null) OnAnglesChanged(this, EventArgs.Empty); if(OnAnglesChanged != null) OnAnglesChanged(this, EventArgs.Empty);
blockUpdate = false; blockUpdate = false;
} }
private void rotationcontrol_AngleChanged() { private void rotationcontrol_AngleChanged()
{
if(blockUpdate) return; if(blockUpdate) return;
blockUpdate = true; blockUpdate = true;
@ -135,7 +191,8 @@ namespace CodeImp.DoomBuilder.Controls
blockUpdate = false; blockUpdate = false;
} }
private void slopeangle_WhenTextChanged(object sender, EventArgs e) { private void slopeangle_WhenTextChanged(object sender, EventArgs e)
{
if(blockUpdate) return; if(blockUpdate) return;
blockUpdate = true; blockUpdate = true;
@ -146,7 +203,8 @@ namespace CodeImp.DoomBuilder.Controls
blockUpdate = false; blockUpdate = false;
} }
private void angletrackbar_ValueChanged(object sender, EventArgs e) { private void angletrackbar_ValueChanged(object sender, EventArgs e)
{
if(blockUpdate) return; if(blockUpdate) return;
blockUpdate = true; blockUpdate = true;
@ -157,12 +215,14 @@ namespace CodeImp.DoomBuilder.Controls
blockUpdate = false; blockUpdate = false;
} }
private void slopeoffset_WhenTextChanged(object sender, EventArgs e) { private void slopeoffset_WhenTextChanged(object sender, EventArgs e)
offset = slopeoffset.GetResultFloat(0f); {
if(OnOffsetChanged != null) OnOffsetChanged(this, EventArgs.Empty); offset = slopeoffset.GetResultFloat(float.NaN);
if(OnAnglesChanged != null) OnAnglesChanged(this, EventArgs.Empty);
} }
private void reset_Click(object sender, EventArgs e) { private void reset_Click(object sender, EventArgs e)
{
blockUpdate = true; blockUpdate = true;
sloperotation.Text = "0"; sloperotation.Text = "0";
@ -178,18 +238,14 @@ namespace CodeImp.DoomBuilder.Controls
blockUpdate = false; blockUpdate = false;
} }
private void pivotmodeselector_SelectedIndexChanged(object sender, EventArgs e) { private void pivotmodeselector_SelectedIndexChanged(object sender, EventArgs e)
pivotmode = (SlopePivotMode)pivotmodeselector.SelectedIndex; {
if(blockUpdate) return; if(blockUpdate) return;
if (OnPivotModeChanged != null) OnPivotModeChanged(this, EventArgs.Empty); if(OnPivotModeChanged != null) OnPivotModeChanged(this, EventArgs.Empty);
} }
private void SectorSlopeControl_Load(object sender, EventArgs e) { private void cbuselineangles_CheckedChanged(object sender, EventArgs e)
pivotmodeselector.SelectedIndex = (int)pivotmode; {
}
private void cbuselineangles_CheckedChanged(object sender, EventArgs e) {
sloperotation.ButtonStepsWrapAround = cbuselineangles.Checked; sloperotation.ButtonStepsWrapAround = cbuselineangles.Checked;
if(blockUpdate) return; if(blockUpdate) return;
if(OnUseLineAnglesChanged != null) OnUseLineAnglesChanged(this, EventArgs.Empty); if(OnUseLineAnglesChanged != null) OnUseLineAnglesChanged(this, EventArgs.Empty);

View file

@ -43,8 +43,9 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
public delegate void AngleChangedDelegate(); public delegate void AngleChangedDelegate();
public event AngleChangedDelegate AngleChanged; public event AngleChangedDelegate AngleChanged;
public int Angle { get { return angle - angleoffset; } set { angle = value + angleoffset; this.Refresh(); } } public int Angle { get { return (angle == NO_ANGLE ? NO_ANGLE : angle - angleoffset); } set { angle = (value == NO_ANGLE ? NO_ANGLE : value + angleoffset); this.Refresh(); } }
public int AngleOffset { get { return angleoffset; } set { angleoffset = value; this.Refresh(); } } public int AngleOffset { get { return angleoffset; } set { angleoffset = value; this.Refresh(); } }
public static int NO_ANGLE = int.MinValue;
#endregion #endregion
@ -112,13 +113,16 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
SolidBrush fill; SolidBrush fill;
Brush center; Brush center;
if (this.Enabled) { if (this.Enabled)
{
outline = new Pen(outlineColor, 2.0f); outline = new Pen(outlineColor, 2.0f);
fill = new SolidBrush(fillColor); fill = new SolidBrush(fillColor);
needle = new Pen(needleColor); needle = new Pen(needleColor);
center = new SolidBrush(needleColor); center = new SolidBrush(needleColor);
marks = new Pen(marksColor); marks = new Pen(marksColor);
} else { }
else
{
outline = new Pen(outlineInactiveColor, 2.0f); outline = new Pen(outlineInactiveColor, 2.0f);
fill = new SolidBrush(fillInactiveColor); fill = new SolidBrush(fillInactiveColor);
needle = new Pen(needleInactiveColor); needle = new Pen(needleInactiveColor);
@ -135,14 +139,16 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
// Draw angle marks // Draw angle marks
int offset = this.Height / markScaler; int offset = this.Height / markScaler;
for(int i = 0; i < 360; i += 45) { for(int i = 0; i < 360; i += 45)
{
PointF p1 = DegreesToXY(i, origin.X - 6, origin); PointF p1 = DegreesToXY(i, origin.X - 6, origin);
PointF p2 = DegreesToXY(i, origin.X - offset, origin); PointF p2 = DegreesToXY(i, origin.X - offset, origin);
g.DrawLine(marks, p1, p2); g.DrawLine(marks, p1, p2);
} }
// Draw needle // Draw needle
if(angle != int.MinValue) { if(angle != NO_ANGLE)
{
PointF anglePoint = DegreesToXY(angle, origin.X - 4, origin); PointF anglePoint = DegreesToXY(angle, origin.X - 4, origin);
g.DrawLine(needle, origin, anglePoint); g.DrawLine(needle, origin, anglePoint);
} }
@ -160,12 +166,14 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
{ {
int thisAngle = XYToDegrees(new Point(e.X, e.Y), origin); int thisAngle = XYToDegrees(new Point(e.X, e.Y), origin);
if (e.Button == MouseButtons.Left) { if (e.Button == MouseButtons.Left)
{
thisAngle = (int)Math.Round(thisAngle / 45f) * 45; thisAngle = (int)Math.Round(thisAngle / 45f) * 45;
if(thisAngle == 360) thisAngle = 0; if(thisAngle == 360) thisAngle = 0;
} }
if(thisAngle != angle) { if(thisAngle != angle)
{
angle = thisAngle; angle = thisAngle;
if(!this.DesignMode && AngleChanged != null) AngleChanged(); //Raise event if(!this.DesignMode && AngleChanged != null) AngleChanged(); //Raise event
this.Refresh(); this.Refresh();
@ -174,15 +182,18 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
private void AngleSelector_MouseMove(object sender, MouseEventArgs e) private void AngleSelector_MouseMove(object sender, MouseEventArgs e)
{ {
if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) { if (e.Button == MouseButtons.Left || e.Button == MouseButtons.Right)
{
int thisAngle = XYToDegrees(new Point(e.X, e.Y), origin); int thisAngle = XYToDegrees(new Point(e.X, e.Y), origin);
if(e.Button == MouseButtons.Left) { if(e.Button == MouseButtons.Left)
{
thisAngle = (int)Math.Round(thisAngle / 45f) * 45; thisAngle = (int)Math.Round(thisAngle / 45f) * 45;
if(thisAngle == 360) thisAngle = 0; if(thisAngle == 360) thisAngle = 0;
} }
if(thisAngle != angle) { if(thisAngle != angle)
{
angle = thisAngle; angle = thisAngle;
if(!this.DesignMode && AngleChanged != null) AngleChanged(); //Raise event if(!this.DesignMode && AngleChanged != null) AngleChanged(); //Raise event
this.Refresh(); this.Refresh();

View file

@ -16,6 +16,8 @@
#region ================== Namespaces #region ================== Namespaces
using System;
#endregion #endregion
namespace CodeImp.DoomBuilder.Geometry namespace CodeImp.DoomBuilder.Geometry
@ -58,7 +60,7 @@ namespace CodeImp.DoomBuilder.Geometry
{ {
#if DEBUG #if DEBUG
if(!normal.IsNormalized()) if(!normal.IsNormalized())
General.Fail("Attempt to create a plane with a vector that is not normalized!"); throw new NotSupportedException("Attempt to create a plane with a vector that is not normalized!"); // General.Fail("Attempt to create a plane with a vector that is not normalized!");
#endif #endif
this.normal = normal; this.normal = normal;
this.offset = offset; this.offset = offset;
@ -69,7 +71,7 @@ namespace CodeImp.DoomBuilder.Geometry
{ {
#if DEBUG #if DEBUG
if(!normal.IsNormalized()) if(!normal.IsNormalized())
General.Fail("Attempt to create a plane with a vector that is not normalized!"); throw new NotSupportedException("Attempt to create a plane with a vector that is not normalized!"); //General.Fail("Attempt to create a plane with a vector that is not normalized!");
#endif #endif
this.normal = normal; this.normal = normal;
this.offset = -Vector3D.DotProduct(normal, position); this.offset = -Vector3D.DotProduct(normal, position);
@ -85,6 +87,23 @@ namespace CodeImp.DoomBuilder.Geometry
this.offset = -Vector3D.DotProduct(normal, p3); this.offset = -Vector3D.DotProduct(normal, p3);
} }
/// <summary></summary>
public Plane(Vector3D center, float anglexy, float anglez, bool up) //mxd
{
Vector2D point = new Vector2D(center.x + (float)Math.Cos(anglexy) * (float)Math.Sin(anglez), center.y + (float)Math.Sin(anglexy) * (float)Math.Sin(anglez));
Vector2D perpendicular = new Line2D(center, point).GetPerpendicular();
Vector3D p2 = new Vector3D(point.x + perpendicular.x, point.y + perpendicular.y, center.z + (float)Math.Cos(anglez));
Vector3D p3 = new Vector3D(point.x - perpendicular.x, point.y - perpendicular.y, center.z + (float)Math.Cos(anglez));
this.normal = Vector3D.CrossProduct(p2 - center, p3 - center).GetNormal();
if((up && (this.normal.z < 0.0f)) || (!up && (this.normal.z > 0.0f)))
this.normal = -this.normal;
this.offset = -Vector3D.DotProduct(normal, p3);
}
#endregion #endregion

View file

@ -56,6 +56,14 @@ namespace CodeImp.DoomBuilder.Geometry
this.y = v.y; this.y = v.y;
this.z = 0f; this.z = 0f;
} }
// Constructor (mxd)
public Vector3D(Vector2D v, float z)
{
this.x = v.x;
this.y = v.y;
this.z = z;
}
#endregion #endregion

View file

@ -193,10 +193,10 @@ namespace CodeImp.DoomBuilder.IO
writer.Write(s.FloorSlope.x); writer.Write(s.FloorSlope.x);
writer.Write(s.FloorSlope.y); writer.Write(s.FloorSlope.y);
writer.Write(s.FloorSlope.z); writer.Write(s.FloorSlope.z);
writer.Write(s.CeilingSlopeOffset); writer.Write(s.CeilSlopeOffset);
writer.Write(s.CeilingSlope.x); writer.Write(s.CeilSlope.x);
writer.Write(s.CeilingSlope.y); writer.Write(s.CeilSlope.y);
writer.Write(s.CeilingSlope.z); writer.Write(s.CeilSlope.z);
AddFlags(s.Flags, writer); AddFlags(s.Flags, writer);
AddCustomFields(s.Fields, "sector", writer); AddCustomFields(s.Fields, "sector", writer);

View file

@ -280,13 +280,13 @@ namespace CodeImp.DoomBuilder.IO
(float.IsNaN(s.FloorSlopeOffset) ? 0f : Math.Round(s.FloorSlopeOffset, 3))); (float.IsNaN(s.FloorSlopeOffset) ? 0f : Math.Round(s.FloorSlopeOffset, 3)));
} }
if (s.CeilingSlope.GetLengthSq() > 0) if (s.CeilSlope.GetLengthSq() > 0)
{ {
coll.Add("ceilingplane_a", Math.Round(s.CeilingSlope.x, 3)); coll.Add("ceilingplane_a", Math.Round(s.CeilSlope.x, 3));
coll.Add("ceilingplane_b", Math.Round(s.CeilingSlope.y, 3)); coll.Add("ceilingplane_b", Math.Round(s.CeilSlope.y, 3));
coll.Add("ceilingplane_c", Math.Round(s.CeilingSlope.z, 3)); coll.Add("ceilingplane_c", Math.Round(s.CeilSlope.z, 3));
coll.Add("ceilingplane_d", coll.Add("ceilingplane_d",
(float.IsNaN(s.CeilingSlopeOffset) ? 0f : Math.Round(s.CeilingSlopeOffset, 3))); (float.IsNaN(s.CeilSlopeOffset) ? 0f : Math.Round(s.CeilSlopeOffset, 3)));
} }
//mxd. Flags //mxd. Flags

View file

@ -122,8 +122,8 @@ namespace CodeImp.DoomBuilder.Map
//mxd. Slopes //mxd. Slopes
public Vector3D FloorSlope { get { return floorslope; } set { BeforePropsChange(); floorslope = value; updateneeded = true; } } public Vector3D FloorSlope { get { return floorslope; } set { BeforePropsChange(); floorslope = value; updateneeded = true; } }
public float FloorSlopeOffset { get { return flooroffset; } set { BeforePropsChange(); flooroffset = value; updateneeded = true; } } public float FloorSlopeOffset { get { return flooroffset; } set { BeforePropsChange(); flooroffset = value; updateneeded = true; } }
public Vector3D CeilingSlope { get { return ceilslope; } set { BeforePropsChange(); ceilslope = value; updateneeded = true; } } public Vector3D CeilSlope { get { return ceilslope; } set { BeforePropsChange(); ceilslope = value; updateneeded = true; } }
public float CeilingSlopeOffset { get { return ceiloffset; } set { BeforePropsChange(); ceiloffset = value; updateneeded = true; } } public float CeilSlopeOffset { get { return ceiloffset; } set { BeforePropsChange(); ceiloffset = value; updateneeded = true; } }
#endregion #endregion

View file

@ -380,11 +380,9 @@ namespace CodeImp.DoomBuilder.Windows
// //
// browseaction // browseaction
// //
this.browseaction.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
this.browseaction.Location = new System.Drawing.Point(496, 25); this.browseaction.Location = new System.Drawing.Point(496, 25);
this.browseaction.Name = "browseaction"; this.browseaction.Name = "browseaction";
this.browseaction.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browseaction.Size = new System.Drawing.Size(28, 25); this.browseaction.Size = new System.Drawing.Size(28, 25);
this.browseaction.TabIndex = 1; this.browseaction.TabIndex = 1;
this.browseaction.Text = " "; this.browseaction.Text = " ";

View file

@ -470,11 +470,9 @@ namespace CodeImp.DoomBuilder.Windows
// //
// browseaction // browseaction
// //
this.browseaction.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
this.browseaction.Location = new System.Drawing.Point(496, 25); this.browseaction.Location = new System.Drawing.Point(496, 25);
this.browseaction.Name = "browseaction"; this.browseaction.Name = "browseaction";
this.browseaction.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browseaction.Size = new System.Drawing.Size(28, 25); this.browseaction.Size = new System.Drawing.Size(28, 25);
this.browseaction.TabIndex = 1; this.browseaction.TabIndex = 1;
this.browseaction.Text = " "; this.browseaction.Text = " ";

View file

@ -107,11 +107,9 @@ namespace CodeImp.DoomBuilder.Windows
// //
// browseeffect // browseeffect
// //
this.browseeffect.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browseeffect.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.browseeffect.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
this.browseeffect.Location = new System.Drawing.Point(402, 26); this.browseeffect.Location = new System.Drawing.Point(402, 26);
this.browseeffect.Name = "browseeffect"; this.browseeffect.Name = "browseeffect";
this.browseeffect.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browseeffect.Size = new System.Drawing.Size(28, 25); this.browseeffect.Size = new System.Drawing.Size(28, 25);
this.browseeffect.TabIndex = 1; this.browseeffect.TabIndex = 1;
this.browseeffect.Text = " "; this.browseeffect.Text = " ";
@ -190,34 +188,25 @@ namespace CodeImp.DoomBuilder.Windows
label7.TabIndex = 25; label7.TabIndex = 25;
label7.Text = "Height offset:"; label7.Text = "Height offset:";
label7.TextAlign = System.Drawing.ContentAlignment.TopRight; label7.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.tooltip.SetToolTip(label7, "Use ++ or -- prefixes to change\r\nheight by given value.\r\nUse * or / prefixes to m" + this.tooltip.SetToolTip(label7, "Changes floor and ceiling\r\nheight by given value.");
"ultiply\r\nor divide height by given value.");
// //
// label5 // label5
// //
label5.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
label5.ForeColor = System.Drawing.SystemColors.HotTrack;
label5.Location = new System.Drawing.Point(16, 70); label5.Location = new System.Drawing.Point(16, 70);
label5.Name = "label5"; label5.Name = "label5";
label5.Size = new System.Drawing.Size(78, 14); label5.Size = new System.Drawing.Size(78, 14);
label5.TabIndex = 17; label5.TabIndex = 17;
label5.Text = "Floor height:"; label5.Text = "Floor height:";
label5.TextAlign = System.Drawing.ContentAlignment.TopRight; label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.tooltip.SetToolTip(label5, "Use ++ or -- prefixes to change\r\nheight by given value.\r\nUse * or / prefixes to m" +
"ultiply\r\nor divide height by given value.");
// //
// label6 // label6
// //
label6.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
label6.ForeColor = System.Drawing.SystemColors.HotTrack;
label6.Location = new System.Drawing.Point(16, 40); label6.Location = new System.Drawing.Point(16, 40);
label6.Name = "label6"; label6.Name = "label6";
label6.Size = new System.Drawing.Size(78, 14); label6.Size = new System.Drawing.Size(78, 14);
label6.TabIndex = 19; label6.TabIndex = 19;
label6.Text = "Ceiling height:"; label6.Text = "Ceiling height:";
label6.TextAlign = System.Drawing.ContentAlignment.TopRight; label6.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.tooltip.SetToolTip(label6, "Use ++ or -- prefixes to change\r\nheight by given value.\r\nUse * or / prefixes to m" +
"ultiply\r\nor divide height by given value.");
// //
// heightoffset // heightoffset
// //
@ -389,12 +378,9 @@ namespace CodeImp.DoomBuilder.Windows
// tooltip // tooltip
// //
this.tooltip.AutomaticDelay = 10; this.tooltip.AutomaticDelay = 10;
this.tooltip.AutoPopDelay = 4000; this.tooltip.AutoPopDelay = 10000;
this.tooltip.InitialDelay = 10; this.tooltip.InitialDelay = 10;
this.tooltip.IsBalloon = true;
this.tooltip.ReshowDelay = 100; this.tooltip.ReshowDelay = 100;
this.tooltip.UseAnimation = false;
this.tooltip.UseFading = false;
// //
// SectorEditForm // SectorEditForm
// //

View file

@ -144,6 +144,21 @@
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label4.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label7.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
@ -165,4 +180,7 @@
<metadata name="flatSelectorControl1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="flatSelectorControl1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View file

@ -275,11 +275,9 @@
// //
// browseeffect // browseeffect
// //
this.browseeffect.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browseeffect.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.browseeffect.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
this.browseeffect.Location = new System.Drawing.Point(402, 26); this.browseeffect.Location = new System.Drawing.Point(402, 26);
this.browseeffect.Name = "browseeffect"; this.browseeffect.Name = "browseeffect";
this.browseeffect.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browseeffect.Size = new System.Drawing.Size(28, 25); this.browseeffect.Size = new System.Drawing.Size(28, 25);
this.browseeffect.TabIndex = 1; this.browseeffect.TabIndex = 1;
this.browseeffect.Text = " "; this.browseeffect.Text = " ";
@ -337,7 +335,25 @@
label15.TabIndex = 27; label15.TabIndex = 27;
label15.Text = "Height offset:"; label15.Text = "Height offset:";
label15.TextAlign = System.Drawing.ContentAlignment.TopRight; label15.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.tooltip.SetToolTip(label15, "Changes floor and ceiling\r\nheight by given value"); this.tooltip.SetToolTip(label15, "Changes floor and ceiling\r\nheight by given value.");
//
// label6
//
label6.Location = new System.Drawing.Point(9, 24);
label6.Name = "label6";
label6.Size = new System.Drawing.Size(74, 14);
label6.TabIndex = 19;
label6.Text = "Ceiling height:";
label6.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label5
//
label5.Location = new System.Drawing.Point(9, 54);
label5.Name = "label5";
label5.Size = new System.Drawing.Size(74, 14);
label5.TabIndex = 17;
label5.Text = "Floor height:";
label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
// //
// heightoffset // heightoffset
// //
@ -369,30 +385,6 @@
this.ceilingheight.TabIndex = 22; this.ceilingheight.TabIndex = 22;
this.ceilingheight.WhenTextChanged += new System.EventHandler(this.ceilingheight_WhenTextChanged); this.ceilingheight.WhenTextChanged += new System.EventHandler(this.ceilingheight_WhenTextChanged);
// //
// label6
//
label6.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
label6.ForeColor = System.Drawing.SystemColors.HotTrack;
label6.Location = new System.Drawing.Point(9, 24);
label6.Name = "label6";
label6.Size = new System.Drawing.Size(74, 14);
label6.TabIndex = 19;
label6.Text = "Ceiling height:";
label6.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.tooltip.SetToolTip(label6, "Use ++ or -- prefixes to change\r\nheight by given value");
//
// label5
//
label5.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
label5.ForeColor = System.Drawing.SystemColors.HotTrack;
label5.Location = new System.Drawing.Point(9, 54);
label5.Name = "label5";
label5.Size = new System.Drawing.Size(74, 14);
label5.TabIndex = 17;
label5.Text = "Floor height:";
label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
this.tooltip.SetToolTip(label5, "Use ++ or -- prefixes to change\r\nheight by given value");
//
// sectorheightlabel // sectorheightlabel
// //
this.sectorheightlabel.Location = new System.Drawing.Point(9, 114); this.sectorheightlabel.Location = new System.Drawing.Point(9, 114);
@ -530,7 +522,7 @@
// //
// floorAngleControl // floorAngleControl
// //
this.floorAngleControl.Angle = -540; this.floorAngleControl.Angle = -1080;
this.floorAngleControl.AngleOffset = 90; this.floorAngleControl.AngleOffset = 90;
this.floorAngleControl.Location = new System.Drawing.Point(186, 132); this.floorAngleControl.Location = new System.Drawing.Point(186, 132);
this.floorAngleControl.Name = "floorAngleControl"; this.floorAngleControl.Name = "floorAngleControl";
@ -730,7 +722,7 @@
// //
// ceilAngleControl // ceilAngleControl
// //
this.ceilAngleControl.Angle = -540; this.ceilAngleControl.Angle = -1080;
this.ceilAngleControl.AngleOffset = 90; this.ceilAngleControl.AngleOffset = 90;
this.ceilAngleControl.Location = new System.Drawing.Point(186, 132); this.ceilAngleControl.Location = new System.Drawing.Point(186, 132);
this.ceilAngleControl.Name = "ceilAngleControl"; this.ceilAngleControl.Name = "ceilAngleControl";
@ -924,7 +916,6 @@
this.floorslopecontrol.OnUseLineAnglesChanged += new System.EventHandler(this.floorslopecontrol_OnUseLineAnglesChanged); this.floorslopecontrol.OnUseLineAnglesChanged += new System.EventHandler(this.floorslopecontrol_OnUseLineAnglesChanged);
this.floorslopecontrol.OnResetClicked += new System.EventHandler(this.floorslopecontrol_OnResetClicked); this.floorslopecontrol.OnResetClicked += new System.EventHandler(this.floorslopecontrol_OnResetClicked);
this.floorslopecontrol.OnAnglesChanged += new System.EventHandler(this.floorslopecontrol_OnAnglesChanged); this.floorslopecontrol.OnAnglesChanged += new System.EventHandler(this.floorslopecontrol_OnAnglesChanged);
this.floorslopecontrol.OnOffsetChanged += new System.EventHandler(this.floorslopecontrol_OnOffsetChanged);
this.floorslopecontrol.OnPivotModeChanged += new System.EventHandler(this.floorslopecontrol_OnPivotModeChanged); this.floorslopecontrol.OnPivotModeChanged += new System.EventHandler(this.floorslopecontrol_OnPivotModeChanged);
// //
// groupBox4 // groupBox4
@ -947,7 +938,6 @@
this.ceilingslopecontrol.OnUseLineAnglesChanged += new System.EventHandler(this.ceilingslopecontrol_OnUseLineAnglesChanged); this.ceilingslopecontrol.OnUseLineAnglesChanged += new System.EventHandler(this.ceilingslopecontrol_OnUseLineAnglesChanged);
this.ceilingslopecontrol.OnResetClicked += new System.EventHandler(this.ceilingslopecontrol_OnResetClicked); this.ceilingslopecontrol.OnResetClicked += new System.EventHandler(this.ceilingslopecontrol_OnResetClicked);
this.ceilingslopecontrol.OnAnglesChanged += new System.EventHandler(this.ceilingslopecontrol_OnAnglesChanged); this.ceilingslopecontrol.OnAnglesChanged += new System.EventHandler(this.ceilingslopecontrol_OnAnglesChanged);
this.ceilingslopecontrol.OnOffsetChanged += new System.EventHandler(this.ceilingslopecontrol_OnOffsetChanged);
this.ceilingslopecontrol.OnPivotModeChanged += new System.EventHandler(this.ceilingslopecontrol_OnPivotModeChanged); this.ceilingslopecontrol.OnPivotModeChanged += new System.EventHandler(this.ceilingslopecontrol_OnPivotModeChanged);
// //
// tabcustom // tabcustom
@ -1009,9 +999,8 @@
// tooltip // tooltip
// //
this.tooltip.AutomaticDelay = 10; this.tooltip.AutomaticDelay = 10;
this.tooltip.AutoPopDelay = 4000; this.tooltip.AutoPopDelay = 10000;
this.tooltip.InitialDelay = 10; this.tooltip.InitialDelay = 10;
this.tooltip.IsBalloon = true;
this.tooltip.ReshowDelay = 100; this.tooltip.ReshowDelay = 100;
this.tooltip.UseAnimation = false; this.tooltip.UseAnimation = false;
this.tooltip.UseFading = false; this.tooltip.UseFading = false;

File diff suppressed because it is too large Load diff

View file

@ -138,27 +138,21 @@
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="label14.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label13.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label8.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="groupfloorceiling.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="groupfloorceiling.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="label15.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="label15.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value> <value>False</value>
</metadata> </metadata>
<metadata name="label6.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label15.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
@ -180,4 +174,7 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="tooltip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root> </root>

View file

@ -48,6 +48,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabproperties = new System.Windows.Forms.TabPage(); this.tabproperties = new System.Windows.Forms.TabPage();
this.spritetex = new System.Windows.Forms.Panel(); this.spritetex = new System.Windows.Forms.Panel();
this.settingsgroup = new System.Windows.Forms.GroupBox(); this.settingsgroup = new System.Windows.Forms.GroupBox();
this.missingflags = new System.Windows.Forms.PictureBox();
this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl(); this.flags = new CodeImp.DoomBuilder.Controls.CheckboxArrayControl();
this.tabeffects = new System.Windows.Forms.TabPage(); this.tabeffects = new System.Windows.Forms.TabPage();
this.actiongroup = new System.Windows.Forms.GroupBox(); this.actiongroup = new System.Windows.Forms.GroupBox();
@ -72,7 +73,6 @@ namespace CodeImp.DoomBuilder.Windows
this.apply = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button();
this.hint = new System.Windows.Forms.PictureBox(); this.hint = new System.Windows.Forms.PictureBox();
this.hintlabel = new System.Windows.Forms.Label(); this.hintlabel = new System.Windows.Forms.Label();
this.missingflags = new System.Windows.Forms.PictureBox();
this.tooltip = new System.Windows.Forms.ToolTip(this.components); this.tooltip = new System.Windows.Forms.ToolTip(this.components);
groupBox1 = new System.Windows.Forms.GroupBox(); groupBox1 = new System.Windows.Forms.GroupBox();
groupBox2 = new System.Windows.Forms.GroupBox(); groupBox2 = new System.Windows.Forms.GroupBox();
@ -82,12 +82,12 @@ namespace CodeImp.DoomBuilder.Windows
this.tabs.SuspendLayout(); this.tabs.SuspendLayout();
this.tabproperties.SuspendLayout(); this.tabproperties.SuspendLayout();
this.settingsgroup.SuspendLayout(); this.settingsgroup.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.missingflags)).BeginInit();
this.tabeffects.SuspendLayout(); this.tabeffects.SuspendLayout();
this.actiongroup.SuspendLayout(); this.actiongroup.SuspendLayout();
this.hexenpanel.SuspendLayout(); this.hexenpanel.SuspendLayout();
this.groupBox3.SuspendLayout(); this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.hint)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.hint)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.missingflags)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// groupBox1 // groupBox1
@ -330,6 +330,17 @@ namespace CodeImp.DoomBuilder.Windows
this.settingsgroup.TabStop = false; this.settingsgroup.TabStop = false;
this.settingsgroup.Text = " Settings "; this.settingsgroup.Text = " Settings ";
// //
// missingflags
//
this.missingflags.BackColor = System.Drawing.SystemColors.Window;
this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
this.missingflags.Location = new System.Drawing.Point(55, -2);
this.missingflags.Name = "missingflags";
this.missingflags.Size = new System.Drawing.Size(16, 16);
this.missingflags.TabIndex = 5;
this.missingflags.TabStop = false;
this.missingflags.Visible = false;
//
// flags // flags
// //
this.flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.flags.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
@ -512,11 +523,9 @@ namespace CodeImp.DoomBuilder.Windows
// //
// browseaction // browseaction
// //
this.browseaction.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
this.browseaction.Location = new System.Drawing.Point(592, 25); this.browseaction.Location = new System.Drawing.Point(592, 25);
this.browseaction.Name = "browseaction"; this.browseaction.Name = "browseaction";
this.browseaction.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browseaction.Size = new System.Drawing.Size(28, 25); this.browseaction.Size = new System.Drawing.Size(28, 25);
this.browseaction.TabIndex = 1; this.browseaction.TabIndex = 1;
this.browseaction.Text = " "; this.browseaction.Text = " ";
@ -591,17 +600,6 @@ namespace CodeImp.DoomBuilder.Windows
this.hintlabel.TabIndex = 4; this.hintlabel.TabIndex = 4;
this.hintlabel.Text = "Select several thing types to randomly assign them to selection"; this.hintlabel.Text = "Select several thing types to randomly assign them to selection";
// //
// missingflags
//
this.missingflags.BackColor = System.Drawing.SystemColors.Window;
this.missingflags.Image = global::CodeImp.DoomBuilder.Properties.Resources.Warning;
this.missingflags.Location = new System.Drawing.Point(55, -2);
this.missingflags.Name = "missingflags";
this.missingflags.Size = new System.Drawing.Size(16, 16);
this.missingflags.TabIndex = 5;
this.missingflags.TabStop = false;
this.missingflags.Visible = false;
//
// tooltip // tooltip
// //
this.tooltip.AutomaticDelay = 10; this.tooltip.AutomaticDelay = 10;
@ -642,13 +640,13 @@ namespace CodeImp.DoomBuilder.Windows
this.tabs.ResumeLayout(false); this.tabs.ResumeLayout(false);
this.tabproperties.ResumeLayout(false); this.tabproperties.ResumeLayout(false);
this.settingsgroup.ResumeLayout(false); this.settingsgroup.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.missingflags)).EndInit();
this.tabeffects.ResumeLayout(false); this.tabeffects.ResumeLayout(false);
this.actiongroup.ResumeLayout(false); this.actiongroup.ResumeLayout(false);
this.actiongroup.PerformLayout(); this.actiongroup.PerformLayout();
this.hexenpanel.ResumeLayout(false); this.hexenpanel.ResumeLayout(false);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.hint)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.missingflags)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();

View file

@ -344,7 +344,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
if(preventchanges) return; if(preventchanges) return;
preventchanges = true; preventchanges = true;
anglecontrol.Angle = angle.GetResult(int.MinValue); anglecontrol.Angle = angle.GetResult(GZBuilder.Controls.AngleControl.NO_ANGLE);
preventchanges = false; preventchanges = false;
updateAngle(); //mxd updateAngle(); //mxd
} }

View file

@ -138,30 +138,9 @@
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View file

@ -868,11 +868,9 @@
// //
// browseaction // browseaction
// //
this.browseaction.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List; this.browseaction.Image = global::CodeImp.DoomBuilder.Properties.Resources.List;
this.browseaction.Location = new System.Drawing.Point(581, 24); this.browseaction.Location = new System.Drawing.Point(581, 24);
this.browseaction.Name = "browseaction"; this.browseaction.Name = "browseaction";
this.browseaction.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browseaction.Size = new System.Drawing.Size(28, 26); this.browseaction.Size = new System.Drawing.Size(28, 26);
this.browseaction.TabIndex = 1; this.browseaction.TabIndex = 1;
this.browseaction.Text = " "; this.browseaction.Text = " ";

View file

@ -453,7 +453,7 @@ namespace CodeImp.DoomBuilder.Windows
{ {
if (preventchanges) return; if (preventchanges) return;
preventchanges = true; preventchanges = true;
anglecontrol.Angle = angle.GetResult(int.MinValue); anglecontrol.Angle = angle.GetResult(GZBuilder.Controls.AngleControl.NO_ANGLE);
preventchanges = false; preventchanges = false;
updateAngle(); //mxd updateAngle(); //mxd
} }
@ -469,9 +469,9 @@ namespace CodeImp.DoomBuilder.Windows
private void pitch_WhenTextChanged(object sender, EventArgs e) private void pitch_WhenTextChanged(object sender, EventArgs e)
{ {
if(preventchanges) return; if(preventchanges) return;
int p = pitch.GetResult(int.MinValue); int p = pitch.GetResult(GZBuilder.Controls.AngleControl.NO_ANGLE);
preventchanges = true; preventchanges = true;
pitchControl.Angle = (p == int.MinValue ? p : p + 90); pitchControl.Angle = (p == GZBuilder.Controls.AngleControl.NO_ANGLE ? p : p + 90);
preventchanges = false; preventchanges = false;
updatePitch(); updatePitch();
} }
@ -486,9 +486,9 @@ namespace CodeImp.DoomBuilder.Windows
private void roll_WhenTextChanged(object sender, EventArgs e) private void roll_WhenTextChanged(object sender, EventArgs e)
{ {
if(preventchanges) return; if(preventchanges) return;
int r = roll.GetResult(int.MinValue); int r = roll.GetResult(GZBuilder.Controls.AngleControl.NO_ANGLE);
preventchanges = true; preventchanges = true;
rollControl.Angle = (r == int.MinValue ? r : r + 90); rollControl.Angle = (r == GZBuilder.Controls.AngleControl.NO_ANGLE ? r : r + 90);
preventchanges = false; preventchanges = false;
updateRoll(); updateRoll();
} }

View file

@ -131,9 +131,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
ceilingtexture = s.CeilTexture; ceilingtexture = s.CeilTexture;
brightness = s.Brightness; brightness = s.Brightness;
effect = s.Effect; effect = s.Effect;
ceilslopeoffset = s.CeilingSlopeOffset; ceilslopeoffset = s.CeilSlopeOffset;
floorslopeoffset = s.FloorSlopeOffset; floorslopeoffset = s.FloorSlopeOffset;
ceilslope = s.CeilingSlope; ceilslope = s.CeilSlope;
floorslope = s.FloorSlope; floorslope = s.FloorSlope;
tag = s.Tag; tag = s.Tag;
fields = new UniFields(s.Fields); fields = new UniFields(s.Fields);
@ -151,8 +151,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
if(CopySettings.Special) s.Effect = effect; if(CopySettings.Special) s.Effect = effect;
if (CopySettings.CeilingSlope) if (CopySettings.CeilingSlope)
{ {
s.CeilingSlopeOffset = ceilslopeoffset; s.CeilSlopeOffset = ceilslopeoffset;
s.CeilingSlope = ceilslope; s.CeilSlope = ceilslope;
} }
if(CopySettings.FloorSlope) if(CopySettings.FloorSlope)
{ {

View file

@ -202,7 +202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
private void BasicSetup() private void BasicSetup()
{ {
//mxd //mxd
if(sector.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(-sector.FloorSlopeOffset / sector.FloorSlope.z)) if(sector.FloorSlope.GetLengthSq() > 0 && !float.IsNaN(sector.FloorSlopeOffset / sector.FloorSlope.z))
{ {
// Sloped plane // Sloped plane
floor.plane = new Plane(sector.FloorSlope, sector.FloorSlopeOffset); floor.plane = new Plane(sector.FloorSlope, sector.FloorSlopeOffset);
@ -213,10 +213,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
floor.plane = new Plane(new Vector3D(0, 0, 1), -sector.FloorHeight); floor.plane = new Plane(new Vector3D(0, 0, 1), -sector.FloorHeight);
} }
if(sector.CeilingSlope.GetLengthSq() > 0 && !float.IsNaN(-sector.CeilingSlopeOffset / sector.CeilingSlope.z)) if(sector.CeilSlope.GetLengthSq() > 0 && !float.IsNaN(sector.CeilSlopeOffset / sector.CeilSlope.z))
{ {
// Sloped plane // Sloped plane
ceiling.plane = new Plane(sector.CeilingSlope, sector.CeilingSlopeOffset); ceiling.plane = new Plane(sector.CeilSlope, sector.CeilSlopeOffset);
} }
else else
{ {

View file

@ -281,31 +281,50 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void ChangeHeight(int amount) protected override void ChangeHeight(int amount)
{ {
mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex); mode.CreateUndo("Change ceiling height", UndoGroup.CeilingHeightChange, level.sector.FixedIndex);
//mxd. Modify vertex offsets? level.sector.CeilHeight += amount;
if(General.Map.UDMF && level.sector.Sidedefs.Count == 3 && changeVertexHeight(amount)) {
mode.SetActionResult("Changed ceiling vertex height by " + amount + "."); if(General.Map.UDMF)
return; {
//mxd. Modify vertex offsets?
if(level.sector.Sidedefs.Count == 3)
{
ChangeVertexHeight(amount);
}
//mxd. Modify slope offset?
if(level.sector.CeilSlope.GetLengthSq() > 0)
{
Vector3D center = new Vector3D(level.sector.BBox.X + level.sector.BBox.Width / 2,
level.sector.BBox.Y + level.sector.BBox.Height / 2,
level.sector.CeilHeight);
Plane p = new Plane(center,
level.sector.CeilSlope.GetAngleXY() - Angle2D.PIHALF,
level.sector.CeilSlope.GetAngleZ(),
false);
level.sector.CeilSlopeOffset = p.Offset;
}
} }
level.sector.CeilHeight += amount;
mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + "."); mode.SetActionResult("Changed ceiling height to " + level.sector.CeilHeight + ".");
} }
//mxd //mxd
private bool changeVertexHeight(int amount) { private void ChangeVertexHeight(int amount)
{
List<Vertex> verts = new List<Vertex>(3); List<Vertex> verts = new List<Vertex>(3);
//do this only if all 3 verts have offsets //do this only if all 3 verts have offsets
foreach(Sidedef side in level.sector.Sidedefs) { foreach(Sidedef side in level.sector.Sidedefs)
if(float.IsNaN(side.Line.Start.ZCeiling) || float.IsNaN(side.Line.End.ZCeiling)) return false; {
if(float.IsNaN(side.Line.Start.ZCeiling) || float.IsNaN(side.Line.End.ZCeiling)) return;
if(!verts.Contains(side.Line.Start)) verts.Add(side.Line.Start); if(!verts.Contains(side.Line.Start)) verts.Add(side.Line.Start);
if(!verts.Contains(side.Line.End)) verts.Add(side.Line.End); if(!verts.Contains(side.Line.End)) verts.Add(side.Line.End);
} }
foreach(Vertex v in verts) foreach(Vertex v in verts)
mode.GetVisualVertex(v, false).OnChangeTargetHeight(amount); mode.GetVisualVertex(v, false).OnChangeTargetHeight(amount);
return true;
} }
//mxd. Sector brightness change //mxd. Sector brightness change

View file

@ -284,31 +284,50 @@ namespace CodeImp.DoomBuilder.BuilderModes
protected override void ChangeHeight(int amount) protected override void ChangeHeight(int amount)
{ {
mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex); mode.CreateUndo("Change floor height", UndoGroup.FloorHeightChange, level.sector.FixedIndex);
//mxd. Modify vertex offsets? level.sector.FloorHeight += amount;
if(General.Map.UDMF && level.sector.Sidedefs.Count == 3 && changeVertexHeight(amount)) {
mode.SetActionResult("Changed floor vertex height by " + amount + "."); if(General.Map.UDMF)
return; {
//mxd. Modify vertex offsets?
if(level.sector.Sidedefs.Count == 3)
{
ChangeVertexHeight(amount);
}
//mxd. Modify slope offset?
if(level.sector.FloorSlope.GetLengthSq() > 0)
{
Vector3D center = new Vector3D(level.sector.BBox.X + level.sector.BBox.Width / 2,
level.sector.BBox.Y + level.sector.BBox.Height / 2,
level.sector.FloorHeight);
Plane p = new Plane(center,
level.sector.FloorSlope.GetAngleXY() + Angle2D.PIHALF,
-level.sector.FloorSlope.GetAngleZ(),
true);
level.sector.FloorSlopeOffset = p.Offset;
}
} }
level.sector.FloorHeight += amount;
mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + "."); mode.SetActionResult("Changed floor height to " + level.sector.FloorHeight + ".");
} }
//mxd //mxd
private bool changeVertexHeight(int amount) { private void ChangeVertexHeight(int amount)
{
List<Vertex> verts = new List<Vertex>(3); List<Vertex> verts = new List<Vertex>(3);
//do this only if all 3 verts have offsets //do this only if all 3 verts have offsets
foreach(Sidedef side in level.sector.Sidedefs) { foreach(Sidedef side in level.sector.Sidedefs)
if(float.IsNaN(side.Line.Start.ZFloor) || float.IsNaN(side.Line.End.ZFloor)) return false; {
if(float.IsNaN(side.Line.Start.ZFloor) || float.IsNaN(side.Line.End.ZFloor)) return;
if(!verts.Contains(side.Line.Start)) verts.Add(side.Line.Start); if(!verts.Contains(side.Line.Start)) verts.Add(side.Line.Start);
if(!verts.Contains(side.Line.End)) verts.Add(side.Line.End); if(!verts.Contains(side.Line.End)) verts.Add(side.Line.End);
} }
foreach (Vertex v in verts) foreach (Vertex v in verts)
mode.GetVisualVertex(v, true).OnChangeTargetHeight(amount); mode.GetVisualVertex(v, true).OnChangeTargetHeight(amount);
return true;
} }
//mxd. Sector brightness change //mxd. Sector brightness change