mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Added: some numeric text inputs now support expressions (e.g. (23+15)*1.5). - inspired by https://www.doomworld.com/vb/doom-editing/91089-gzdoombuilder-patch-expression-evaluation-for-sector-heights/
Fixed, Game Configurations window: fixed a crash when switching to a game engine without the file path using the "Engine" drop-down.
This commit is contained in:
parent
924c10968b
commit
50a547a570
12 changed files with 227 additions and 160 deletions
|
@ -55,6 +55,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public bool AllowNegative { get { return textbox.AllowNegative; } set { textbox.AllowNegative = value; } }
|
||||
public bool AllowRelative { get { return textbox.AllowRelative; } set { textbox.AllowRelative = value; } }
|
||||
public int MaximumValue { get { return textbox.MaximumValue; } set { textbox.MaximumValue = value; } }
|
||||
public bool AllowExpressions { get { return textbox.AllowExpressions; } set { textbox.AllowExpressions = value; } } //mxd/mgr_inz_rafal
|
||||
public int ButtonStep { get { return stepsize; } set { stepsize = value; } }
|
||||
public float ButtonStepFloat { get { return stepsizeFloat; } set { stepsizeFloat = value; } } //mxd. This is used when AllowDecimal is true
|
||||
public float ButtonStepBig { get { return stepsizeBig; } set { stepsizeBig = value; } } //mxd
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.Windows.Forms;
|
||||
|
@ -30,6 +31,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
#region ================== Constants
|
||||
|
||||
private const int ROUNDING_PRECISION = 4; //mxd
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
@ -38,9 +41,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
private bool allowrelative; // Allow ++, --, * and / prefix for relative changes
|
||||
private bool allowdecimal; // Allow decimal (float) numbers
|
||||
private int maximumvalue = System.Int32.MaxValue;
|
||||
private bool allowexpressions; // mxd/mgr_inz_rafal. Allow expressions
|
||||
private bool controlpressed;
|
||||
private int incrementstep; //mxd. Step for +++ and --- prefixes
|
||||
private ToolTip tooltip; //mxd
|
||||
|
||||
//mxd. Used to compute expressions
|
||||
private static DataTable datatable = new DataTable();
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -50,6 +57,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public bool AllowRelative { get { return allowrelative; } set { allowrelative = value; UpdateTextboxStyle(); } }
|
||||
public bool AllowDecimal { get { return allowdecimal; } set { allowdecimal = value; } }
|
||||
public int MaximumValue { get { return maximumvalue; } set { maximumvalue = value; } }
|
||||
public bool AllowExpressions { get { return allowexpressions; } set { allowexpressions = value; } } //mxd/mgr_inz_rafal
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -103,8 +111,13 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Determine allowed chars
|
||||
if(allownegative) allowedchars += CultureInfo.CurrentCulture.NumberFormat.NegativeSign;
|
||||
if(allowrelative) allowedchars += "+-*/"; //mxd
|
||||
if(allowexpressions)
|
||||
{
|
||||
allowedchars += "()"; //mxd/mgr_inz_rafal
|
||||
if(!allowrelative) allowedchars += "+-*/"; //mxd
|
||||
}
|
||||
if(controlpressed) allowedchars += "\u0018\u0003\u0016";
|
||||
if(allowdecimal || this.Text.StartsWith("*") || this.Text.StartsWith("/")) //mxd
|
||||
if(allowdecimal || allowexpressions || this.Text.StartsWith("*") || this.Text.StartsWith("/")) //mxd
|
||||
allowedchars += CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||
|
||||
// Check if key is not allowed
|
||||
|
@ -113,7 +126,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Cancel this
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
else if(!allowexpressions)
|
||||
{
|
||||
//mxd. Check if * or / is pressed
|
||||
if(e.KeyChar == '*' || e.KeyChar == '/')
|
||||
|
@ -182,6 +195,22 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
base.OnKeyPress(e);
|
||||
}
|
||||
|
||||
//mxd
|
||||
protected override void OnTextChanged(EventArgs e)
|
||||
{
|
||||
// Validate expression
|
||||
if(allowexpressions)
|
||||
{
|
||||
// Check if expression is valid. We may want "++" and "--" on their own...
|
||||
if(IsValidResult(StripPrefixes(this.Text)) || this.Text == "++" || this.Text == "--")
|
||||
this.ForeColor = (allowrelative ? SystemColors.HotTrack : SystemColors.WindowText);
|
||||
else
|
||||
this.ForeColor = Color.DarkRed;
|
||||
}
|
||||
|
||||
base.OnTextChanged(e);
|
||||
}
|
||||
|
||||
// Validate contents
|
||||
protected override void OnValidating(CancelEventArgs e)
|
||||
{
|
||||
|
@ -192,29 +221,55 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
base.OnValidating(e);
|
||||
return;
|
||||
}
|
||||
|
||||
// Strip prefixes
|
||||
string textpart = this.Text.Replace("+", "").Replace("*", "").Replace("/", ""); //mxd
|
||||
if(!allownegative) textpart = textpart.Replace("-", "");
|
||||
|
||||
// No numbers left?
|
||||
if(textpart.Length == 0)
|
||||
|
||||
if(allowexpressions) //mxd
|
||||
{
|
||||
// Make the textbox empty
|
||||
this.Text = "";
|
||||
}
|
||||
if(!IsValidResult(StripPrefixes(this.Text)))
|
||||
{
|
||||
// Make the textbox empty
|
||||
this.Text = "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Strip prefixes
|
||||
string textpart = this.Text.Replace("+", "").Replace("*", "").Replace("/", ""); //mxd
|
||||
if(!allownegative)
|
||||
textpart = textpart.Replace("-", "");
|
||||
|
||||
// No numbers left?
|
||||
if(textpart.Length == 0)
|
||||
{
|
||||
// Make the textbox empty
|
||||
this.Text = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Call base
|
||||
base.OnValidating(e);
|
||||
}
|
||||
|
||||
//mxd
|
||||
private string StripPrefixes(string input)
|
||||
{
|
||||
if(allowrelative)
|
||||
{
|
||||
// Strip prefixes
|
||||
if(input.StartsWith("+++") || input.StartsWith("---")) return input.Substring(3);
|
||||
if(input.StartsWith("++") || input.StartsWith("--")) return input.Substring(2);
|
||||
if(input.StartsWith("*") || input.StartsWith("/")) return input.Substring(1);
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
// This checks if the number is relative
|
||||
public bool CheckIsRelative()
|
||||
{
|
||||
// Prefixed with +++, ---, ++, --, * or /?
|
||||
return ( (this.Text.Length > 3 && (this.Text.StartsWith("+++") || this.Text.StartsWith("---"))) || //mxd
|
||||
(this.Text.Length > 2 && (this.Text.StartsWith("++") || this.Text.StartsWith("--") || this.Text.StartsWith("**") || this.Text.StartsWith("//"))) || //mxd
|
||||
(this.Text.Length > 1 && (this.Text.StartsWith("*") || this.Text.StartsWith("/"))) ); //mxd
|
||||
(this.Text.Length > 2 && (this.Text.StartsWith("++") || this.Text.StartsWith("--") )) || //mxd
|
||||
(this.Text.Length > 1 && (this.Text.StartsWith("*") || this.Text.StartsWith("/"))) ); //mxd
|
||||
}
|
||||
|
||||
//mxd. This determines the result value
|
||||
|
@ -226,85 +281,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
//mxd. This determines the result value
|
||||
public int GetResult(int original, int step)
|
||||
{
|
||||
string textpart = this.Text;
|
||||
|
||||
// Strip prefixes
|
||||
textpart = textpart.TrimStart('+', '-', '*', '/'); //mxd
|
||||
|
||||
// Any numbers left?
|
||||
if(textpart.Length > 0)
|
||||
{
|
||||
int result;
|
||||
|
||||
//mxd. Prefixed with +++?
|
||||
if(this.Text.StartsWith("+++"))
|
||||
{
|
||||
// Add number to original
|
||||
int.TryParse(textpart, out result);
|
||||
int newvalue = original + result * step;
|
||||
if (newvalue > maximumvalue) newvalue = maximumvalue;
|
||||
return newvalue;
|
||||
}
|
||||
//mxd. Prefixed with ---?
|
||||
if(this.Text.StartsWith("---"))
|
||||
{
|
||||
// Subtract number from original
|
||||
int.TryParse(textpart, out result);
|
||||
int newvalue = original - result * step;
|
||||
if (!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
// Prefixed with ++?
|
||||
if(this.Text.StartsWith("++"))
|
||||
{
|
||||
// Add number to original
|
||||
int.TryParse(textpart, out result);
|
||||
int newvalue = original + result;
|
||||
if (newvalue > maximumvalue) newvalue = maximumvalue;
|
||||
return newvalue;
|
||||
}
|
||||
// Prefixed with --?
|
||||
if(this.Text.StartsWith("--"))
|
||||
{
|
||||
// Subtract number from original
|
||||
int.TryParse(textpart, out result);
|
||||
int newvalue = original - result;
|
||||
if (!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
//mxd. Prefixed with *?
|
||||
if(this.Text.StartsWith("*"))
|
||||
{
|
||||
// Multiply original by number
|
||||
float resultf;
|
||||
float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out resultf);
|
||||
int newvalue = (int)Math.Round(original * resultf);
|
||||
if (newvalue > maximumvalue) newvalue = maximumvalue;
|
||||
if (!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
//mxd. Prefixed with /?
|
||||
if(this.Text.StartsWith("/"))
|
||||
{
|
||||
// Divide original by number
|
||||
float resultf;
|
||||
float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out resultf);
|
||||
if(resultf == 0) return original;
|
||||
int newvalue = (int)Math.Round(original / resultf);
|
||||
if (newvalue > maximumvalue) newvalue = maximumvalue;
|
||||
if (!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
|
||||
//mxd. Return the new value
|
||||
if(!int.TryParse(this.Text, out result)) return original;
|
||||
if (result > maximumvalue) return maximumvalue;
|
||||
if (!allownegative && (result < 0)) return 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Nothing given, keep original value
|
||||
return original;
|
||||
return (int)Math.Round(GetResultFloat(original, step));
|
||||
}
|
||||
|
||||
//mxd. This determines the result value
|
||||
|
@ -317,68 +294,97 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
public float GetResultFloat(float original, int step)
|
||||
{
|
||||
// Strip prefixes
|
||||
string textpart = this.Text.Replace("+", "").Replace("-", "").Replace("*", "").Replace("/", ""); //mxd;
|
||||
string textpart = StripPrefixes(this.Text);
|
||||
|
||||
// Any numbers left?
|
||||
if(textpart.Length > 0)
|
||||
{
|
||||
float result;
|
||||
|
||||
//mxd. Prefixed with +++?
|
||||
if(this.Text.StartsWith("+++"))
|
||||
if(allowrelative)
|
||||
{
|
||||
// Add number to original
|
||||
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
|
||||
return original + result * step;
|
||||
}
|
||||
//mxd. Prefixed with ---?
|
||||
if(this.Text.StartsWith("---"))
|
||||
{
|
||||
// Subtract number from original
|
||||
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
|
||||
float newvalue = original - result * step;
|
||||
if(!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
// Prefixed with ++?
|
||||
if(this.Text.StartsWith("++"))
|
||||
{
|
||||
// Add number to original
|
||||
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
|
||||
return original + result;
|
||||
}
|
||||
// Prefixed with --?
|
||||
if(this.Text.StartsWith("--"))
|
||||
{
|
||||
// Subtract number from original
|
||||
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
|
||||
float newvalue = original - result;
|
||||
if(!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
//mxd. Prefixed with *?
|
||||
if(this.Text.StartsWith("*"))
|
||||
{
|
||||
// Multiply original by number
|
||||
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) result = 0;
|
||||
float newvalue = original * result;
|
||||
if(!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
}
|
||||
//mxd. Prefixed with /?
|
||||
if(this.Text.StartsWith("/"))
|
||||
{
|
||||
// Divide original by number
|
||||
if(!float.TryParse(textpart, NumberStyles.Float, CultureInfo.CurrentCulture, out result) || result == 0) return original;
|
||||
float newvalue = (float)Math.Round(original / result, 3);
|
||||
if(!allownegative && (newvalue < 0)) newvalue = 0;
|
||||
return newvalue;
|
||||
//mxd. Prefixed with +++?
|
||||
if(this.Text.StartsWith("+++"))
|
||||
{
|
||||
// Add number to original
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
return original + result * step;
|
||||
|
||||
// Keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
//mxd. Prefixed with ---?
|
||||
if(this.Text.StartsWith("---"))
|
||||
{
|
||||
// Subtract number from original
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
{
|
||||
float newvalue = original - result * step;
|
||||
return (!allownegative && (newvalue < 0)) ? original : newvalue;
|
||||
}
|
||||
|
||||
// Keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
// Prefixed with ++?
|
||||
if(this.Text.StartsWith("++"))
|
||||
{
|
||||
// Add number to original
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
return original + result;
|
||||
|
||||
// Keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
// Prefixed with --?
|
||||
if(this.Text.StartsWith("--"))
|
||||
{
|
||||
// Subtract number from original
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
{
|
||||
float newvalue = original - result;
|
||||
return (!allownegative && (newvalue < 0)) ? original : newvalue;
|
||||
}
|
||||
|
||||
// Keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
//mxd. Prefixed with *?
|
||||
if(this.Text.StartsWith("*"))
|
||||
{
|
||||
// Multiply original by number
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
{
|
||||
float newvalue = (float)Math.Round(original * result, ROUNDING_PRECISION);
|
||||
return (!allownegative && (newvalue < 0f)) ? original : newvalue;
|
||||
}
|
||||
|
||||
// Keep original value
|
||||
return original;
|
||||
}
|
||||
|
||||
//mxd. Prefixed with /?
|
||||
if(this.Text.StartsWith("/"))
|
||||
{
|
||||
// Divide original by number
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
{
|
||||
if(result == 0.0f) return original;
|
||||
float newvalue = (float)Math.Round(original / result, ROUNDING_PRECISION);
|
||||
return (!allownegative && (newvalue < 0f)) ? original : newvalue;
|
||||
}
|
||||
|
||||
// Keep original value
|
||||
return original;
|
||||
}
|
||||
}
|
||||
|
||||
//mxd. Return the new value
|
||||
if(!float.TryParse(this.Text, NumberStyles.Float, CultureInfo.CurrentCulture, out result)) return original;
|
||||
if(!allownegative && (result < 0)) return 0;
|
||||
return result;
|
||||
if(TryGetResultValue(textpart, out result))
|
||||
return (!allownegative && (result < 0f)) ? original : result;
|
||||
}
|
||||
|
||||
// Nothing given, keep original value
|
||||
|
@ -386,20 +392,50 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd
|
||||
public void UpdateTextboxStyle()
|
||||
private bool IsValidResult(string expression)
|
||||
{
|
||||
UpdateTextboxStyle(string.Empty);
|
||||
float unused;
|
||||
return TryGetResultValue(expression, out unused);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public void UpdateTextboxStyle(string tip)
|
||||
private bool TryGetResultValue(string expression, out float value)
|
||||
{
|
||||
//Compute expression
|
||||
if(allowexpressions)
|
||||
{
|
||||
try { expression = datatable.Compute(expression, null).ToString(); }
|
||||
catch
|
||||
{
|
||||
value = 0f;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Parse result
|
||||
return float.TryParse(expression, NumberStyles.Float, CultureInfo.InvariantCulture, out value);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public void UpdateTextboxStyle() { UpdateTextboxStyle(string.Empty); }
|
||||
public void UpdateTextboxStyle(string tip)
|
||||
{
|
||||
this.ForeColor = (allowrelative ? SystemColors.HotTrack : SystemColors.WindowText);
|
||||
if(allowrelative)
|
||||
if(allowrelative || allowexpressions)
|
||||
{
|
||||
tooltip.SetToolTip(this, "Use ++ or -- prefixes to change by given value." + Environment.NewLine +
|
||||
"Use +++ or --- prefixes to incrementally change by given value." + Environment.NewLine +
|
||||
"Use * or / prefixes to multiply or divide by given value." + Environment.NewLine + tip);
|
||||
string s = string.Empty;
|
||||
if(allowexpressions)
|
||||
{
|
||||
s += "You can use expressions. Example: (128+64)*2.5" + Environment.NewLine;
|
||||
}
|
||||
if(allowrelative)
|
||||
{
|
||||
s += "Use ++ or -- prefixes to change by given value." + Environment.NewLine +
|
||||
"Use +++ or --- prefixes to incrementally change by given value." + Environment.NewLine +
|
||||
"Use * or / prefixes to multiply or divide by given value." + Environment.NewLine;
|
||||
}
|
||||
|
||||
tooltip.SetToolTip(this, s + tip);
|
||||
}
|
||||
else if(!string.IsNullOrEmpty(tip))
|
||||
{
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
this.slopeoffset.AllowDecimal = true;
|
||||
this.slopeoffset.AllowNegative = true;
|
||||
this.slopeoffset.AllowRelative = true;
|
||||
this.slopeoffset.AllowExpressions = true;
|
||||
this.slopeoffset.ButtonStep = 1;
|
||||
this.slopeoffset.ButtonStepBig = 16F;
|
||||
this.slopeoffset.ButtonStepFloat = 8F;
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
this.value1.AllowDecimal = false;
|
||||
this.value1.AllowNegative = true;
|
||||
this.value1.AllowRelative = true;
|
||||
this.value1.AllowExpressions = true;
|
||||
this.value1.ButtonStep = 1;
|
||||
this.value1.ButtonStepFloat = 1F;
|
||||
this.value1.ButtonStepsWrapAround = false;
|
||||
|
@ -76,6 +77,7 @@
|
|||
this.value2.AllowDecimal = false;
|
||||
this.value2.AllowNegative = true;
|
||||
this.value2.AllowRelative = true;
|
||||
this.value2.AllowExpressions = true;
|
||||
this.value2.ButtonStep = 1;
|
||||
this.value2.ButtonStepFloat = 1F;
|
||||
this.value2.ButtonStepsWrapAround = false;
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
this.value1.AllowDecimal = true;
|
||||
this.value1.AllowNegative = true;
|
||||
this.value1.AllowRelative = true;
|
||||
this.value1.AllowExpressions = true;
|
||||
this.value1.ButtonStep = 1;
|
||||
this.value1.ButtonStepFloat = 1F;
|
||||
this.value1.ButtonStepsWrapAround = false;
|
||||
|
@ -56,6 +57,7 @@
|
|||
this.value2.AllowDecimal = true;
|
||||
this.value2.AllowNegative = true;
|
||||
this.value2.AllowRelative = true;
|
||||
this.value2.AllowExpressions = true;
|
||||
this.value2.ButtonStep = 1;
|
||||
this.value2.ButtonStepFloat = 1F;
|
||||
this.value2.ButtonStepsWrapAround = false;
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
this.value1.AllowDecimal = false;
|
||||
this.value1.AllowNegative = true;
|
||||
this.value1.AllowRelative = true;
|
||||
this.value1.AllowExpressions = true;
|
||||
this.value1.ButtonStep = 1;
|
||||
this.value1.ButtonStepFloat = 1F;
|
||||
this.value1.ButtonStepsWrapAround = false;
|
||||
|
@ -65,6 +66,7 @@
|
|||
this.value2.AllowDecimal = false;
|
||||
this.value2.AllowNegative = true;
|
||||
this.value2.AllowRelative = true;
|
||||
this.value2.AllowExpressions = true;
|
||||
this.value2.ButtonStep = 1;
|
||||
this.value2.ButtonStepFloat = 1F;
|
||||
this.value2.ButtonStepsWrapAround = false;
|
||||
|
|
|
@ -325,7 +325,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
configinfo.TestProgram = testapplication.Text;
|
||||
|
||||
//mxd. User entered engine name before picking the engine?
|
||||
if(cbEngineSelector.SelectedIndex == -1)
|
||||
if(cbEngineSelector.SelectedIndex == -1 || string.IsNullOrEmpty(configinfo.TestProgram))
|
||||
{
|
||||
ApplyTestEngineNameChange();
|
||||
}
|
||||
|
@ -758,27 +758,26 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
{
|
||||
preventchanges = true;
|
||||
|
||||
// Remove EngineInfos without program path
|
||||
configinfo.TestEngines.RemoveAll(info => string.IsNullOrEmpty(info.TestProgram));
|
||||
|
||||
// Add new EngineInfo
|
||||
EngineInfo newInfo = new EngineInfo();
|
||||
newInfo.TestSkill = (int)Math.Ceiling(gameconfig.Skills.Count / 2f); // Set Medium skill level
|
||||
configinfo.TestEngines.Add(newInfo);
|
||||
configinfo.Changed = true;
|
||||
|
||||
// Store current engine name
|
||||
if(!String.IsNullOrEmpty(cbEngineSelector.Text))
|
||||
configinfo.TestProgramName = cbEngineSelector.Text;
|
||||
|
||||
// Refresh engines list
|
||||
cbEngineSelector.Items.Clear();
|
||||
foreach(EngineInfo info in configinfo.TestEngines)
|
||||
cbEngineSelector.Items.Add(info.TestProgramName);
|
||||
|
||||
cbEngineSelector.SelectedIndex = configinfo.TestEngines.Count - 1;
|
||||
btnRemoveEngine.Enabled = true;
|
||||
btnRemoveEngine.Enabled = (configinfo.TestEngines.Count > 1);
|
||||
|
||||
preventchanges = false;
|
||||
|
||||
// Set engine path
|
||||
// Set engine path (will also update current engine name)
|
||||
testapplication.Text = testprogramdialog.FileName;
|
||||
}
|
||||
}
|
||||
|
@ -814,6 +813,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private void cbEngineSelector_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(cbEngineSelector.SelectedIndex == -1) return;
|
||||
|
||||
preventchanges = true;
|
||||
|
||||
//set new values
|
||||
configinfo.CurrentEngineIndex = cbEngineSelector.SelectedIndex;
|
||||
|
@ -840,6 +841,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
gametype.Value = gametypevalue - 1;
|
||||
gametype.Value = gametypevalue;
|
||||
customparameters.Checked = configinfo.CustomParameters;
|
||||
|
||||
preventchanges = false;
|
||||
}
|
||||
|
||||
//mxd
|
||||
|
|
3
Source/Core/Windows/SectorEditForm.Designer.cs
generated
3
Source/Core/Windows/SectorEditForm.Designer.cs
generated
|
@ -214,6 +214,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.heightoffset.AllowDecimal = false;
|
||||
this.heightoffset.AllowNegative = true;
|
||||
this.heightoffset.AllowRelative = true;
|
||||
this.heightoffset.AllowExpressions = true;
|
||||
this.heightoffset.ButtonStep = 8;
|
||||
this.heightoffset.ButtonStepBig = 16F;
|
||||
this.heightoffset.ButtonStepFloat = 1F;
|
||||
|
@ -250,6 +251,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.ceilingheight.AllowDecimal = false;
|
||||
this.ceilingheight.AllowNegative = true;
|
||||
this.ceilingheight.AllowRelative = true;
|
||||
this.ceilingheight.AllowExpressions = true;
|
||||
this.ceilingheight.ButtonStep = 8;
|
||||
this.ceilingheight.ButtonStepBig = 16F;
|
||||
this.ceilingheight.ButtonStepFloat = 1F;
|
||||
|
@ -317,6 +319,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.floorheight.AllowDecimal = false;
|
||||
this.floorheight.AllowNegative = true;
|
||||
this.floorheight.AllowRelative = true;
|
||||
this.floorheight.AllowExpressions = true;
|
||||
this.floorheight.ButtonStep = 8;
|
||||
this.floorheight.ButtonStepBig = 16F;
|
||||
this.floorheight.ButtonStepFloat = 1F;
|
||||
|
|
|
@ -398,6 +398,7 @@
|
|||
this.heightoffset.AllowDecimal = false;
|
||||
this.heightoffset.AllowNegative = true;
|
||||
this.heightoffset.AllowRelative = true;
|
||||
this.heightoffset.AllowExpressions = true;
|
||||
this.heightoffset.ButtonStep = 8;
|
||||
this.heightoffset.ButtonStepBig = 16F;
|
||||
this.heightoffset.ButtonStepFloat = 1F;
|
||||
|
@ -416,6 +417,7 @@
|
|||
this.ceilingheight.AllowDecimal = false;
|
||||
this.ceilingheight.AllowNegative = true;
|
||||
this.ceilingheight.AllowRelative = true;
|
||||
this.ceilingheight.AllowExpressions = true;
|
||||
this.ceilingheight.ButtonStep = 8;
|
||||
this.ceilingheight.ButtonStepBig = 16F;
|
||||
this.ceilingheight.ButtonStepFloat = 1F;
|
||||
|
@ -452,6 +454,7 @@
|
|||
this.floorheight.AllowDecimal = false;
|
||||
this.floorheight.AllowNegative = true;
|
||||
this.floorheight.AllowRelative = true;
|
||||
this.floorheight.AllowExpressions = true;
|
||||
this.floorheight.ButtonStep = 8;
|
||||
this.floorheight.ButtonStepBig = 16F;
|
||||
this.floorheight.ButtonStepFloat = 1F;
|
||||
|
|
4
Source/Core/Windows/ThingEditForm.Designer.cs
generated
4
Source/Core/Windows/ThingEditForm.Designer.cs
generated
|
@ -137,6 +137,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.posX.AllowDecimal = false;
|
||||
this.posX.AllowNegative = true;
|
||||
this.posX.AllowRelative = true;
|
||||
this.posX.AllowExpressions = true;
|
||||
this.posX.ButtonStep = 8;
|
||||
this.posX.ButtonStepBig = 16F;
|
||||
this.posX.ButtonStepFloat = 1F;
|
||||
|
@ -155,6 +156,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.posY.AllowDecimal = false;
|
||||
this.posY.AllowNegative = true;
|
||||
this.posY.AllowRelative = true;
|
||||
this.posY.AllowExpressions = true;
|
||||
this.posY.ButtonStep = 8;
|
||||
this.posY.ButtonStepBig = 16F;
|
||||
this.posY.ButtonStepFloat = 1F;
|
||||
|
@ -173,6 +175,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.posZ.AllowDecimal = false;
|
||||
this.posZ.AllowNegative = true;
|
||||
this.posZ.AllowRelative = true;
|
||||
this.posZ.AllowExpressions = true;
|
||||
this.posZ.ButtonStep = 8;
|
||||
this.posZ.ButtonStepBig = 16F;
|
||||
this.posZ.ButtonStepFloat = 1F;
|
||||
|
@ -353,6 +356,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.angle.AllowDecimal = false;
|
||||
this.angle.AllowNegative = true;
|
||||
this.angle.AllowRelative = true;
|
||||
this.angle.AllowExpressions = true;
|
||||
this.angle.ButtonStep = 5;
|
||||
this.angle.ButtonStepBig = 15F;
|
||||
this.angle.ButtonStepFloat = 1F;
|
||||
|
|
|
@ -195,6 +195,7 @@
|
|||
this.roll.AllowDecimal = false;
|
||||
this.roll.AllowNegative = true;
|
||||
this.roll.AllowRelative = true;
|
||||
this.roll.AllowExpressions = true;
|
||||
this.roll.ButtonStep = 5;
|
||||
this.roll.ButtonStepBig = 15F;
|
||||
this.roll.ButtonStepFloat = 1F;
|
||||
|
@ -222,6 +223,7 @@
|
|||
this.pitch.AllowDecimal = false;
|
||||
this.pitch.AllowNegative = true;
|
||||
this.pitch.AllowRelative = true;
|
||||
this.pitch.AllowExpressions = true;
|
||||
this.pitch.ButtonStep = 5;
|
||||
this.pitch.ButtonStepBig = 15F;
|
||||
this.pitch.ButtonStepFloat = 1F;
|
||||
|
@ -249,6 +251,7 @@
|
|||
this.angle.AllowDecimal = false;
|
||||
this.angle.AllowNegative = true;
|
||||
this.angle.AllowRelative = true;
|
||||
this.angle.AllowExpressions = true;
|
||||
this.angle.ButtonStep = 5;
|
||||
this.angle.ButtonStepBig = 15F;
|
||||
this.angle.ButtonStepFloat = 1F;
|
||||
|
@ -478,6 +481,7 @@
|
|||
this.posX.AllowDecimal = true;
|
||||
this.posX.AllowNegative = true;
|
||||
this.posX.AllowRelative = true;
|
||||
this.posX.AllowExpressions = true;
|
||||
this.posX.ButtonStep = 8;
|
||||
this.posX.ButtonStepBig = 8F;
|
||||
this.posX.ButtonStepFloat = 1F;
|
||||
|
@ -496,6 +500,7 @@
|
|||
this.posY.AllowDecimal = true;
|
||||
this.posY.AllowNegative = true;
|
||||
this.posY.AllowRelative = true;
|
||||
this.posY.AllowExpressions = true;
|
||||
this.posY.ButtonStep = 8;
|
||||
this.posY.ButtonStepBig = 8F;
|
||||
this.posY.ButtonStepFloat = 1F;
|
||||
|
@ -514,6 +519,7 @@
|
|||
this.posZ.AllowDecimal = true;
|
||||
this.posZ.AllowNegative = true;
|
||||
this.posZ.AllowRelative = true;
|
||||
this.posZ.AllowExpressions = true;
|
||||
this.posZ.ButtonStep = 8;
|
||||
this.posZ.ButtonStepBig = 8F;
|
||||
this.posZ.ButtonStepFloat = 1F;
|
||||
|
|
4
Source/Core/Windows/VertexEditForm.Designer.cs
generated
4
Source/Core/Windows/VertexEditForm.Designer.cs
generated
|
@ -125,6 +125,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.zceiling.AllowDecimal = false;
|
||||
this.zceiling.AllowNegative = true;
|
||||
this.zceiling.AllowRelative = true;
|
||||
this.zceiling.AllowExpressions = true;
|
||||
this.zceiling.ButtonStep = 8;
|
||||
this.zceiling.ButtonStepBig = 16F;
|
||||
this.zceiling.ButtonStepFloat = 1F;
|
||||
|
@ -143,6 +144,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.zfloor.AllowDecimal = false;
|
||||
this.zfloor.AllowNegative = true;
|
||||
this.zfloor.AllowRelative = true;
|
||||
this.zfloor.AllowExpressions = true;
|
||||
this.zfloor.ButtonStep = 8;
|
||||
this.zfloor.ButtonStepBig = 16F;
|
||||
this.zfloor.ButtonStepFloat = 1F;
|
||||
|
@ -179,6 +181,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.positiony.AllowDecimal = false;
|
||||
this.positiony.AllowNegative = true;
|
||||
this.positiony.AllowRelative = true;
|
||||
this.positiony.AllowExpressions = true;
|
||||
this.positiony.ButtonStep = 1;
|
||||
this.positiony.ButtonStepBig = 8F;
|
||||
this.positiony.ButtonStepFloat = 1F;
|
||||
|
@ -197,6 +200,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
this.positionx.AllowDecimal = false;
|
||||
this.positionx.AllowNegative = true;
|
||||
this.positionx.AllowRelative = true;
|
||||
this.positionx.AllowExpressions = true;
|
||||
this.positionx.ButtonStep = 1;
|
||||
this.positionx.ButtonStepBig = 8F;
|
||||
this.positionx.ButtonStepFloat = 1F;
|
||||
|
|
Loading…
Reference in a new issue