- added option to customize testing parameters (default uses parameters from configuration)

- added new placeholders %L1 and %L2 which result in the first and second map number (usefull for -warp)
- clicking outside the selection in EditSelectionMode accepts the changes and returns to previous mode
This commit is contained in:
codeimp 2008-09-09 23:06:31 +00:00
parent fcea106b74
commit cd6ee145a2
10 changed files with 370 additions and 61 deletions

View file

@ -58,6 +58,7 @@
<Compile Include="Config\LinedefActionInfo.cs" />
<Compile Include="Config\LinedefActivateInfo.cs" />
<Compile Include="Config\ProgramConfiguration.cs" />
<Compile Include="Config\SkillInfo.cs" />
<Compile Include="Config\TagType.cs" />
<Compile Include="Config\ThingCategory.cs" />
<Compile Include="Config\ThingTypeInfo.cs" />

View file

@ -481,6 +481,12 @@ namespace CodeImp.DoomBuilder.BuilderModes
rotategripangle = delta.GetAngle() - rotation;
mode = ModifyMode.Rotating;
break;
// Outside the selection?
default:
// Accept and be done with it
General.Map.AcceptMode();
break;
}
}

View file

@ -43,6 +43,8 @@ namespace CodeImp.DoomBuilder.Config
private DataLocationList resources;
private string testprogram;
private string testparameters;
private bool customparameters;
private int testskill;
private List<ThingsFilter> thingsfilters;
#endregion
@ -57,6 +59,8 @@ namespace CodeImp.DoomBuilder.Config
public DataLocationList Resources { get { return resources; } }
public string TestProgram { get { return testprogram; } set { testprogram = value; } }
public string TestParameters { get { return testparameters; } set { testparameters = value; } }
public int TestSkill { get { return testskill; } set { testskill = value; } }
public bool CustomParameters { get { return customparameters; } set { customparameters = value; } }
internal ICollection<ThingsFilter> ThingsFilters { get { return thingsfilters; } }
#endregion
@ -79,6 +83,8 @@ namespace CodeImp.DoomBuilder.Config
this.nodebuildertest = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildertest", "");
this.testprogram = General.Settings.ReadSetting("configurations." + settingskey + ".testprogram", "");
this.testparameters = General.Settings.ReadSetting("configurations." + settingskey + ".testparameters", "");
this.customparameters = General.Settings.ReadSetting("configurations." + settingskey + ".customparameters", false);
this.testskill = General.Settings.ReadSetting("configurations." + settingskey + ".testskill", 3);
this.resources = new DataLocationList(General.Settings.Config, "configurations." + settingskey + ".resources");
// Make list of things filters
@ -114,6 +120,8 @@ namespace CodeImp.DoomBuilder.Config
General.Settings.WriteSetting("configurations." + settingskey + ".nodebuildertest", nodebuildertest);
General.Settings.WriteSetting("configurations." + settingskey + ".testprogram", testprogram);
General.Settings.WriteSetting("configurations." + settingskey + ".testparameters", testparameters);
General.Settings.WriteSetting("configurations." + settingskey + ".customparameters", customparameters);
General.Settings.WriteSetting("configurations." + settingskey + ".testskill", testskill);
resources.WriteToConfig(General.Settings.Config, "configurations." + settingskey + ".resources");
// Write filters to configuration
@ -143,6 +151,8 @@ namespace CodeImp.DoomBuilder.Config
ci.resources.AddRange(this.resources);
ci.testprogram = this.testprogram;
ci.testparameters = this.testparameters;
ci.customparameters = this.customparameters;
ci.testskill = this.testskill;
return ci;
}
@ -158,6 +168,8 @@ namespace CodeImp.DoomBuilder.Config
this.resources.AddRange(ci.resources);
this.testprogram = ci.testprogram;
this.testparameters = ci.testparameters;
this.customparameters = ci.customparameters;
this.testskill = ci.testskill;
}
#endregion

View file

@ -56,7 +56,11 @@ namespace CodeImp.DoomBuilder.Config
private bool generalizedeffects;
private int start3dmodethingtype;
private int linedefactivationsfilter;
private string testparameters;
// Skills
private List<SkillInfo> skills;
// Map lumps
private IDictionary maplumpnames;
@ -111,6 +115,10 @@ namespace CodeImp.DoomBuilder.Config
public bool GeneralizedEffects { get { return generalizedeffects; } }
public int Start3DModeThingType { get { return start3dmodethingtype; } }
public int LinedefActivationsFilter { get { return linedefactivationsfilter; } }
public string TestParameters { get { return testparameters; } }
// Skills
public List<SkillInfo> Skills { get { return skills; } }
// Map lumps
public IDictionary MapLumpNames { get { return maplumpnames; } }
@ -173,7 +181,8 @@ namespace CodeImp.DoomBuilder.Config
this.sortedsectoreffects = new List<SectorEffectInfo>();
this.geneffectoptions = new List<GeneralizedOption>();
this.enums = new Dictionary<string, EnumList>();
this.skills = new List<SkillInfo>();
// Read general settings
enginename = cfg.ReadSetting("engine", "");
defaulttexturescale = cfg.ReadSetting("defaulttexturescale", 1f);
@ -184,6 +193,7 @@ namespace CodeImp.DoomBuilder.Config
generalizedeffects = cfg.ReadSetting("generalizedsectors", false);
start3dmodethingtype = cfg.ReadSetting("start3dmode", 0);
linedefactivationsfilter = cfg.ReadSetting("linedefactivationsfilter", 0);
testparameters = cfg.ReadSetting("testparameters", "");
// Flags have special (invariant culture) conversion
// because they are allowed to be written as integers in the configs
@ -202,6 +212,9 @@ namespace CodeImp.DoomBuilder.Config
// Get texture and flat sources
textureranges = cfg.ReadSetting("textures", new Hashtable());
flatranges = cfg.ReadSetting("flats", new Hashtable());
// Skills
LoadSkills();
// Enums
LoadEnums();
@ -296,7 +309,17 @@ namespace CodeImp.DoomBuilder.Config
thingcat = new ThingCategory(cfg, de.Key.ToString());
// Add all things in category to the big list
foreach(ThingTypeInfo t in thingcat.Things) things.Add(t.Index, t);
foreach(ThingTypeInfo t in thingcat.Things)
{
if(!things.ContainsKey(t.Index))
{
things.Add(t.Index, t);
}
else
{
General.WriteLogLine("WARNING: Thing number " + t.Index + " is defined more than once! (as '" + things[t.Index].Title + "' and '" + t.Title + "')");
}
}
// Add category to list
thingcategories.Add(thingcat);
@ -530,6 +553,27 @@ namespace CodeImp.DoomBuilder.Config
}
}
}
// Skills
private void LoadSkills()
{
IDictionary dic;
// Get skills
dic = cfg.ReadSetting("skills", new Hashtable());
foreach(DictionaryEntry de in dic)
{
int num = 0;
if(int.TryParse(de.Key.ToString(), out num))
{
skills.Add(new SkillInfo(num, de.Value.ToString()));
}
else
{
General.WriteLogLine("WARNING: Structure 'skills' contains invalid skill numbers!");
}
}
}
#endregion

View file

@ -0,0 +1,86 @@
#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Data;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
#endregion
namespace CodeImp.DoomBuilder.Config
{
public class SkillInfo : INumberedTitle, IComparable<SkillInfo>
{
#region ================== Constants
#endregion
#region ================== Variables
// Properties
private int index;
private string title;
#endregion
#region ================== Properties
public int Index { get { return index; } }
public string Title { get { return title; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
internal SkillInfo(int index, string title)
{
// Initialize
this.index = index;
this.title = title;
}
#endregion
#region ================== Methods
// This presents the item as string
public override string ToString()
{
return index + " - " + title;
}
// This compares against another skill
public int CompareTo(SkillInfo other)
{
if(this.index < other.index) return -1;
else if(this.index > other.index) return 1;
else return 0;
}
#endregion
}
}

View file

@ -53,6 +53,12 @@ namespace CodeImp.DoomBuilder.Controls
InitializeComponent();
}
// This clears all information
public void ClearInfo()
{
list.Items.Clear();
}
// This adds information to display
public void AddInfo(INumberedTitle[] infolist)
{

View file

@ -35,6 +35,8 @@ namespace CodeImp.DoomBuilder
{
#region ================== Constants
private const string NUMBERS = "0123456789";
#endregion
#region ================== Variables
@ -84,12 +86,13 @@ namespace CodeImp.DoomBuilder
// This takes the unconverted parameters (with placeholders) and converts it
// to parameters with full paths, names and numbers where placeholders were put.
// The tempfile must be the full path and filename to the PWAD file to test.
public string ConvertParameters(string parameters)
public string ConvertParameters(string parameters, int skill)
{
string outp = parameters;
DataLocation iwadloc;
string p_wp = "", p_wf = "";
string p_ap = "", p_apq = "";
string p_l1 = "", p_l2 = "";
// Find the first IWAD file
if(General.Map.Data.FindFirstIWAD(out iwadloc))
@ -120,6 +123,38 @@ namespace CodeImp.DoomBuilder
// Trim last space from resource file locations
p_ap = p_ap.TrimEnd(' ');
p_apq = p_apq.TrimEnd(' ');
// Try finding the L1 and L2 numbers from the map name
string numstr = "";
bool first = true;
foreach(char c in General.Map.Options.CurrentName)
{
// Character is a number?
if(NUMBERS.IndexOf(c) > -1)
{
// Include it
numstr += c;
}
else
{
// Store the number if we found one
if(numstr.Length > 0)
{
int num = 0;
int.TryParse(numstr, out num);
if(first) p_l1 = num.ToString(); else p_l2 = num.ToString();
first = false;
}
}
}
// Store the number if we found one
if(numstr.Length > 0)
{
int num = 0;
int.TryParse(numstr, out num);
if(first) p_l1 = num.ToString(); else p_l2 = num.ToString();
}
// Make sure all our placeholders are in uppercase
outp = outp.Replace("%f", "%F");
@ -129,18 +164,24 @@ namespace CodeImp.DoomBuilder
outp = outp.Replace("%wF", "%WF");
outp = outp.Replace("%Wp", "%WP");
outp = outp.Replace("%Wf", "%WF");
outp = outp.Replace("%l1", "%L1");
outp = outp.Replace("%l2", "%L2");
outp = outp.Replace("%l", "%L");
outp = outp.Replace("%ap", "%AP");
outp = outp.Replace("%aP", "%AP");
outp = outp.Replace("%Ap", "%AP");
outp = outp.Replace("%s", "%S");
// Replace placeholders with actual values
outp = outp.Replace("%F", General.Map.Launcher.TempWAD);
outp = outp.Replace("%WP", p_wp);
outp = outp.Replace("%WF", p_wf);
outp = outp.Replace("%L1", p_l1);
outp = outp.Replace("%L2", p_l2);
outp = outp.Replace("%L", General.Map.Options.CurrentName);
outp = outp.Replace("\"%AP\"", p_apq);
outp = outp.Replace("%AP", p_ap);
outp = outp.Replace("%S", skill.ToString());
// Return result
return outp;
@ -175,13 +216,20 @@ namespace CodeImp.DoomBuilder
return;
}
// No custom parameters?
if(!General.Map.ConfigSettings.CustomParameters)
{
// Set parameters to the default ones
General.Map.ConfigSettings.TestParameters = General.Map.Config.TestParameters;
}
// Save map to temporary file
Cursor.Current = Cursors.WaitCursor;
tempwad = General.MakeTempFilename(General.Map.TempPath, "wad");
if(General.Map.SaveMap(tempwad, MapManager.SAVE_TEST))
{
// Make arguments
args = ConvertParameters(General.Map.ConfigSettings.TestParameters);
args = ConvertParameters(General.Map.ConfigSettings.TestParameters, General.Map.ConfigSettings.TestSkill);
// Setup process info
processinfo = new ProcessStartInfo();

View file

@ -35,8 +35,9 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label7;
System.Windows.Forms.Label label9;
System.Windows.Forms.Label label4;
System.Windows.Forms.Label label1;
System.Windows.Forms.Label label8;
this.labelparameters = new System.Windows.Forms.Label();
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.tabs = new System.Windows.Forms.TabControl();
@ -46,6 +47,8 @@ namespace CodeImp.DoomBuilder.Windows
this.nodebuildertest = new System.Windows.Forms.ComboBox();
this.nodebuildersave = new System.Windows.Forms.ComboBox();
this.tabtesting = new System.Windows.Forms.TabPage();
this.customparameters = new System.Windows.Forms.CheckBox();
this.skill = new CodeImp.DoomBuilder.Controls.ActionSelectorControl();
this.browsetestprogram = new System.Windows.Forms.Button();
this.noresultlabel = new System.Windows.Forms.Label();
this.testresult = new System.Windows.Forms.TextBox();
@ -61,8 +64,8 @@ namespace CodeImp.DoomBuilder.Windows
label2 = new System.Windows.Forms.Label();
label7 = new System.Windows.Forms.Label();
label9 = new System.Windows.Forms.Label();
label4 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
label8 = new System.Windows.Forms.Label();
this.tabs.SuspendLayout();
this.tabresources.SuspendLayout();
this.tabnodebuilder.SuspendLayout();
@ -98,14 +101,14 @@ namespace CodeImp.DoomBuilder.Windows
label3.AutoEllipsis = true;
label3.Location = new System.Drawing.Point(12, 15);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(384, 54);
label3.Size = new System.Drawing.Size(385, 54);
label3.TabIndex = 22;
label3.Text = resources.GetString("label3.Text");
//
// label2
//
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(12, 80);
label2.Location = new System.Drawing.Point(12, 86);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(149, 14);
label2.TabIndex = 24;
@ -127,28 +130,39 @@ namespace CodeImp.DoomBuilder.Windows
label9.AutoEllipsis = true;
label9.Location = new System.Drawing.Point(12, 15);
label9.Name = "label9";
label9.Size = new System.Drawing.Size(393, 54);
label9.Size = new System.Drawing.Size(394, 54);
label9.TabIndex = 23;
label9.Text = resources.GetString("label9.Text");
//
// label4
//
label4.AutoSize = true;
label4.Location = new System.Drawing.Point(15, 121);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(65, 14);
label4.TabIndex = 27;
label4.Text = "Parameters:";
label9.Text = "Here you can specify the program settings to use for launching a game engine when" +
" testing the map. Press F1 for help with custom parameters.";
//
// label1
//
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(15, 80);
label1.Location = new System.Drawing.Point(15, 62);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(63, 14);
label1.TabIndex = 24;
label1.Text = "Application:";
//
// label8
//
label8.AutoSize = true;
label8.Location = new System.Drawing.Point(21, 97);
label8.Name = "label8";
label8.Size = new System.Drawing.Size(57, 14);
label8.TabIndex = 34;
label8.Text = "Skill Level:";
//
// labelparameters
//
this.labelparameters.AutoSize = true;
this.labelparameters.Location = new System.Drawing.Point(15, 159);
this.labelparameters.Name = "labelparameters";
this.labelparameters.Size = new System.Drawing.Size(65, 14);
this.labelparameters.TabIndex = 27;
this.labelparameters.Text = "Parameters:";
this.labelparameters.Visible = false;
//
// cancel
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -227,7 +241,7 @@ namespace CodeImp.DoomBuilder.Windows
this.tabnodebuilder.Location = new System.Drawing.Point(4, 23);
this.tabnodebuilder.Name = "tabnodebuilder";
this.tabnodebuilder.Padding = new System.Windows.Forms.Padding(6);
this.tabnodebuilder.Size = new System.Drawing.Size(414, 318);
this.tabnodebuilder.Size = new System.Drawing.Size(415, 318);
this.tabnodebuilder.TabIndex = 1;
this.tabnodebuilder.Text = "Nodebuilder";
this.tabnodebuilder.UseVisualStyleBackColor = true;
@ -240,7 +254,7 @@ namespace CodeImp.DoomBuilder.Windows
this.nodebuildertest.FormattingEnabled = true;
this.nodebuildertest.Location = new System.Drawing.Point(167, 122);
this.nodebuildertest.Name = "nodebuildertest";
this.nodebuildertest.Size = new System.Drawing.Size(229, 22);
this.nodebuildertest.Size = new System.Drawing.Size(230, 22);
this.nodebuildertest.Sorted = true;
this.nodebuildertest.TabIndex = 25;
this.nodebuildertest.SelectedIndexChanged += new System.EventHandler(this.nodebuildertest_SelectedIndexChanged);
@ -251,21 +265,24 @@ namespace CodeImp.DoomBuilder.Windows
| System.Windows.Forms.AnchorStyles.Right)));
this.nodebuildersave.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nodebuildersave.FormattingEnabled = true;
this.nodebuildersave.Location = new System.Drawing.Point(167, 77);
this.nodebuildersave.Location = new System.Drawing.Point(167, 83);
this.nodebuildersave.Name = "nodebuildersave";
this.nodebuildersave.Size = new System.Drawing.Size(229, 22);
this.nodebuildersave.Size = new System.Drawing.Size(230, 22);
this.nodebuildersave.Sorted = true;
this.nodebuildersave.TabIndex = 23;
this.nodebuildersave.SelectedIndexChanged += new System.EventHandler(this.nodebuildersave_SelectedIndexChanged);
//
// tabtesting
//
this.tabtesting.Controls.Add(this.customparameters);
this.tabtesting.Controls.Add(this.skill);
this.tabtesting.Controls.Add(label8);
this.tabtesting.Controls.Add(this.browsetestprogram);
this.tabtesting.Controls.Add(this.noresultlabel);
this.tabtesting.Controls.Add(this.testresult);
this.tabtesting.Controls.Add(this.labelresult);
this.tabtesting.Controls.Add(this.testparameters);
this.tabtesting.Controls.Add(label4);
this.tabtesting.Controls.Add(this.labelparameters);
this.tabtesting.Controls.Add(this.testapplication);
this.tabtesting.Controls.Add(label1);
this.tabtesting.Controls.Add(label9);
@ -273,16 +290,40 @@ namespace CodeImp.DoomBuilder.Windows
this.tabtesting.Location = new System.Drawing.Point(4, 23);
this.tabtesting.Name = "tabtesting";
this.tabtesting.Padding = new System.Windows.Forms.Padding(6);
this.tabtesting.Size = new System.Drawing.Size(414, 318);
this.tabtesting.Size = new System.Drawing.Size(415, 318);
this.tabtesting.TabIndex = 2;
this.tabtesting.Text = "Testing";
this.tabtesting.UseVisualStyleBackColor = true;
//
// customparameters
//
this.customparameters.AutoSize = true;
this.customparameters.Location = new System.Drawing.Point(86, 132);
this.customparameters.Name = "customparameters";
this.customparameters.Size = new System.Drawing.Size(134, 18);
this.customparameters.TabIndex = 36;
this.customparameters.Text = "Customize parameters";
this.customparameters.UseVisualStyleBackColor = true;
this.customparameters.CheckedChanged += new System.EventHandler(this.customparameters_CheckedChanged);
//
// skill
//
this.skill.BackColor = System.Drawing.SystemColors.Control;
this.skill.Cursor = System.Windows.Forms.Cursors.Default;
this.skill.Empty = false;
this.skill.GeneralizedCategories = null;
this.skill.Location = new System.Drawing.Point(87, 94);
this.skill.Name = "skill";
this.skill.Size = new System.Drawing.Size(271, 21);
this.skill.TabIndex = 35;
this.skill.Value = 402;
this.skill.ValueChanges += new System.EventHandler(this.skill_ValueChanges);
//
// browsetestprogram
//
this.browsetestprogram.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.browsetestprogram.Image = global::CodeImp.DoomBuilder.Properties.Resources.Folder;
this.browsetestprogram.Location = new System.Drawing.Point(363, 76);
this.browsetestprogram.Location = new System.Drawing.Point(363, 58);
this.browsetestprogram.Name = "browsetestprogram";
this.browsetestprogram.Padding = new System.Windows.Forms.Padding(0, 0, 1, 3);
this.browsetestprogram.Size = new System.Drawing.Size(30, 23);
@ -293,11 +334,12 @@ namespace CodeImp.DoomBuilder.Windows
//
// noresultlabel
//
this.noresultlabel.Location = new System.Drawing.Point(84, 217);
this.noresultlabel.Location = new System.Drawing.Point(84, 220);
this.noresultlabel.Name = "noresultlabel";
this.noresultlabel.Size = new System.Drawing.Size(272, 43);
this.noresultlabel.TabIndex = 32;
this.noresultlabel.Text = "An example result cannot be displayed, because it requires a map to be loaded.";
this.noresultlabel.Visible = false;
//
// testresult
//
@ -308,8 +350,9 @@ namespace CodeImp.DoomBuilder.Windows
this.testresult.Multiline = true;
this.testresult.Name = "testresult";
this.testresult.ReadOnly = true;
this.testresult.Size = new System.Drawing.Size(307, 79);
this.testresult.Size = new System.Drawing.Size(308, 79);
this.testresult.TabIndex = 31;
this.testresult.Visible = false;
//
// labelresult
//
@ -319,26 +362,28 @@ namespace CodeImp.DoomBuilder.Windows
this.labelresult.Size = new System.Drawing.Size(40, 14);
this.labelresult.TabIndex = 30;
this.labelresult.Text = "Result:";
this.labelresult.Visible = false;
//
// testparameters
//
this.testparameters.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.testparameters.Location = new System.Drawing.Point(86, 118);
this.testparameters.Location = new System.Drawing.Point(86, 156);
this.testparameters.Multiline = true;
this.testparameters.Name = "testparameters";
this.testparameters.Size = new System.Drawing.Size(307, 79);
this.testparameters.Size = new System.Drawing.Size(308, 41);
this.testparameters.TabIndex = 28;
this.testparameters.Visible = false;
this.testparameters.TextChanged += new System.EventHandler(this.testparameters_TextChanged);
//
// testapplication
//
this.testapplication.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.testapplication.Location = new System.Drawing.Point(86, 77);
this.testapplication.Location = new System.Drawing.Point(86, 59);
this.testapplication.Name = "testapplication";
this.testapplication.ReadOnly = true;
this.testapplication.Size = new System.Drawing.Size(271, 20);
this.testapplication.Size = new System.Drawing.Size(272, 20);
this.testapplication.TabIndex = 25;
this.testapplication.TextChanged += new System.EventHandler(this.testapplication_TextChanged);
//
@ -423,5 +468,8 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label noresultlabel;
private System.Windows.Forms.Button browsetestprogram;
private System.Windows.Forms.OpenFileDialog testprogramdialog;
private System.Windows.Forms.CheckBox customparameters;
private CodeImp.DoomBuilder.Controls.ActionSelectorControl skill;
private System.Windows.Forms.Label labelparameters;
}
}

View file

@ -36,6 +36,9 @@ namespace CodeImp.DoomBuilder.Windows
{
internal partial class ConfigForm : DelayedForm
{
// Variables
private GameConfiguration gameconfig;
// Constructor
public ConfigForm()
{
@ -59,27 +62,14 @@ namespace CodeImp.DoomBuilder.Windows
lvi.Selected = true;
}
// TODO: Save and test nodebuilders are allowed to be empty
// No skill
skill.Value = 0;
// TODO: Nodebuilders are allowed to be empty
// Fill comboboxes with nodebuilders
nodebuildersave.Items.AddRange(General.Nodebuilders.ToArray());
nodebuildertest.Items.AddRange(General.Nodebuilders.ToArray());
// Check if a map is loaded
if(General.Map != null)
{
// Show parameters example result
labelresult.Visible = true;
testresult.Visible = true;
noresultlabel.Visible = false;
}
else
{
// Cannot show parameters example result
labelresult.Visible = false;
testresult.Visible = false;
noresultlabel.Visible = true;
}
}
// This shows a specific page
@ -103,6 +93,9 @@ namespace CodeImp.DoomBuilder.Windows
// Get config info of selected item
ci = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
// Load the game configuration
gameconfig = new GameConfiguration(General.LoadGameConfiguration(ci.Filename));
// Fill resources list
configdata.EditResourceLocationList(ci.Resources);
@ -138,9 +131,18 @@ namespace CodeImp.DoomBuilder.Windows
}
}
// Fill skills list
skill.ClearInfo();
skill.AddInfo(gameconfig.Skills.ToArray());
// Set test application and parameters
if(!ci.CustomParameters) ci.TestParameters = gameconfig.TestParameters;
testapplication.Text = ci.TestProgram;
testparameters.Text = ci.TestParameters;
int skilllevel = ci.TestSkill;
skill.Value = skilllevel - 1;
skill.Value = skilllevel;
customparameters.Checked = ci.CustomParameters;
}
}
@ -157,7 +159,11 @@ namespace CodeImp.DoomBuilder.Windows
nodebuildertest.SelectedIndex = -1;
testapplication.Text = "";
testparameters.Text = "";
skill.Value = 0;
skill.ClearInfo();
customparameters.Checked = false;
tabs.Enabled = false;
gameconfig = null;
}
}
@ -245,7 +251,7 @@ namespace CodeImp.DoomBuilder.Windows
if(General.Map != null)
{
// Make converted parameters
testresult.Text = General.Map.Launcher.ConvertParameters(testparameters.Text);
testresult.Text = General.Map.Launcher.ConvertParameters(testparameters.Text, skill.Value);
}
}
@ -298,5 +304,51 @@ namespace CodeImp.DoomBuilder.Windows
testapplication.Text = testprogramdialog.FileName;
}
}
// Customize parameters (un)checked
private void customparameters_CheckedChanged(object sender, EventArgs e)
{
ConfigurationInfo ci;
// Leave when no configuration selected
if(listconfigs.SelectedItems.Count == 0) return;
// Apply to selected configuration
ci = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
ci.CustomParameters = customparameters.Checked;
// Update interface
labelparameters.Visible = customparameters.Checked;
testparameters.Visible = customparameters.Checked;
// Check if a map is loaded
if(General.Map != null)
{
// Show parameters example result
labelresult.Visible = customparameters.Checked;
testresult.Visible = customparameters.Checked;
noresultlabel.Visible = false;
}
else
{
// Cannot show parameters example result
labelresult.Visible = false;
testresult.Visible = false;
noresultlabel.Visible = customparameters.Checked;
}
}
// Skill changes
private void skill_ValueChanges(object sender, EventArgs e)
{
ConfigurationInfo ci;
// Leave when no configuration selected
if(listconfigs.SelectedItems.Count == 0) return;
// Apply to selected configuration
ci = listconfigs.SelectedItems[0].Tag as ConfigurationInfo;
ci.TestSkill = skill.Value;
}
}
}
}

View file

@ -156,21 +156,21 @@
<metadata name="label9.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<data name="label9.Text" xml:space="preserve">
<value>Here you can specify the program settings to use for launching a game engine when testing the map. Press F1 for a list of placeholders that can be used for automatic filenames, paths, names and numbers.</value>
</data>
<metadata name="label4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</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="label1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label8.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</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="labelparameters.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -198,6 +198,12 @@
<metadata name="tabtesting.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="customparameters.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="skill.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="browsetestprogram.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>