- "save into" implemented (really just a modified copy of "save as", needs testing)

- added function to find the first IWAD (needed for testing parameters)
- removed the nodebuilder option for 3D mode, we don't need a nodebuilder for 3D mode anymore
- removed test parameters information and increased parameter input field (the info will go in help files)
This commit is contained in:
codeimp 2008-05-22 12:03:33 +00:00
parent eaf6e83dab
commit 1b1a243983
8 changed files with 102 additions and 116 deletions

View file

@ -0,0 +1,8 @@
%F indicates the edited PWAD file to be tested.
%WP indicates the IWAD resource files to be used (paths included).
%WF indicates the IWAD resource files to be used (without paths).
%L indicates the map lump name as is set in the map options.
%AP indicates the additional resources (if any, paths included).
%AF indicates the additional resources (if any, without paths).
%E indicates the Episode number from E#M# map name.
%M indicates the Map number from E#M# or MAP## map name.

View file

@ -39,7 +39,6 @@ namespace CodeImp.DoomBuilder.Config
private string defaultlumpname;
private string nodebuildersave;
private string nodebuildertest;
private string nodebuilder3d;
private DataLocationList resources;
private string testprogram;
private string testparameters;
@ -53,7 +52,6 @@ namespace CodeImp.DoomBuilder.Config
public string DefaultLumpName { get { return defaultlumpname; } }
public string NodebuilderSave { get { return nodebuildersave; } set { nodebuildersave = value; } }
public string NodebuilderTest { get { return nodebuildertest; } set { nodebuildertest = value; } }
public string Nodebuilder3D { get { return nodebuilder3d; } set { nodebuilder3d = value; } }
public DataLocationList Resources { get { return resources; } }
public string TestProgram { get { return testprogram; } set { testprogram = value; } }
public string TestParameters { get { return testparameters; } set { testparameters = value; } }
@ -76,7 +74,6 @@ namespace CodeImp.DoomBuilder.Config
// Load settings from program configuration
this.nodebuildersave = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildersave", "");
this.nodebuildertest = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildertest", "");
this.nodebuilder3d = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuilder3d", "");
this.testprogram = General.Settings.ReadSetting("configurations." + settingskey + ".testprogram", "");
this.testparameters = General.Settings.ReadSetting("configurations." + settingskey + ".testparameters", "");
this.resources = new DataLocationList(General.Settings.Config, "configurations." + settingskey + ".resources");
@ -104,7 +101,6 @@ namespace CodeImp.DoomBuilder.Config
// Write to configuration
General.Settings.WriteSetting("configurations." + settingskey + ".nodebuildersave", nodebuildersave);
General.Settings.WriteSetting("configurations." + settingskey + ".nodebuildertest", nodebuildertest);
General.Settings.WriteSetting("configurations." + settingskey + ".nodebuilder3d", nodebuilder3d);
General.Settings.WriteSetting("configurations." + settingskey + ".testprogram", testprogram);
General.Settings.WriteSetting("configurations." + settingskey + ".testparameters", testparameters);
resources.WriteToConfig(General.Settings.Config, "configurations." + settingskey + ".resources");
@ -125,7 +121,6 @@ namespace CodeImp.DoomBuilder.Config
ci.settingskey = this.settingskey;
ci.nodebuildersave = this.nodebuildersave;
ci.nodebuildertest = this.nodebuildertest;
ci.nodebuilder3d = this.nodebuilder3d;
ci.resources = new DataLocationList();
ci.resources.AddRange(this.resources);
ci.testprogram = this.testprogram;
@ -141,7 +136,6 @@ namespace CodeImp.DoomBuilder.Config
this.settingskey = ci.settingskey;
this.nodebuildersave = ci.nodebuildersave;
this.nodebuildertest = ci.nodebuildertest;
this.nodebuilder3d = ci.nodebuilder3d;
this.resources = new DataLocationList();
this.resources.AddRange(ci.resources);
this.testprogram = ci.testprogram;

View file

@ -805,5 +805,35 @@ namespace CodeImp.DoomBuilder.Data
}
#endregion
#region ================== Tools
// This finds the first IWAD resource
// Returns false when not found
internal bool FindFirstIWAD(out DataLocation result)
{
// Go for all data containers
foreach(DataReader dr in containers)
{
// Container is a WAD file?
if(dr is WADReader)
{
// Check if it is an IWAD
WADReader wr = dr as WADReader;
if(wr.IsIWAD)
{
// Return location!
result = wr.Location;
return true;
}
}
}
// No IWAD found
result = new DataLocation();
return false;
}
#endregion
}
}

View file

@ -40,11 +40,14 @@ namespace CodeImp.DoomBuilder.Data
// Source
private WAD file;
private bool is_iwad;
#endregion
#region ================== Properties
public bool IsIWAD { get { return is_iwad; } }
#endregion
#region ================== Constructor / Disposer
@ -52,10 +55,11 @@ namespace CodeImp.DoomBuilder.Data
// Constructor
public WADReader(DataLocation dl) : base(dl)
{
General.WriteLogLine("Opening WAD resource '" + location.location + "'");
// Initialize
file = new WAD(location.location, true);
General.WriteLogLine("Opening WAD resource '" + location.location + "'");
is_iwad = (file.Type == WAD.TYPE_IWAD);
// We have no destructor
GC.SuppressFinalize(this);
@ -92,6 +96,7 @@ namespace CodeImp.DoomBuilder.Data
public override void Resume()
{
file = new WAD(location.location, true);
is_iwad = (file.Type == WAD.TYPE_IWAD);
base.Resume();
}

View file

@ -837,6 +837,50 @@ namespace CodeImp.DoomBuilder
return result;
}
// This saves the current map as a different file
// Returns tre when saved, false when cancelled or failed
[BeginAction("savemapinto")]
internal static void ActionSaveMapInto() { SaveMapInto(); }
internal static bool SaveMapInto()
{
SaveFileDialog savefile;
bool result = false;
// Cancel volatile mode, if any
General.CancelVolatileMode();
// Show save as dialog
savefile = new SaveFileDialog();
savefile.Filter = "Doom WAD Files (*.wad)|*.wad";
savefile.Title = "Save Map Into";
savefile.AddExtension = true;
savefile.CheckPathExists = true;
savefile.OverwritePrompt = false;
savefile.ValidateNames = true;
if(savefile.ShowDialog(mainwindow) == DialogResult.OK)
{
// Display status
mainwindow.DisplayStatus("Saving map file...");
Cursor.Current = Cursors.WaitCursor;
// Save the map
if(map.SaveMap(savefile.FileName, MapManager.SAVE_INTO))
{
// Add recent file
mainwindow.AddRecentFile(map.FilePathName);
result = true;
}
// All done
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
Cursor.Current = Cursors.Default;
}
return result;
}
// This asks to save the map if needed
// Returns false when action was cancelled
internal static bool AskSaveMap()

View file

@ -34,18 +34,15 @@ namespace CodeImp.DoomBuilder.Interface
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ConfigForm));
System.Windows.Forms.Label label2;
System.Windows.Forms.Label label7;
System.Windows.Forms.Label label8;
System.Windows.Forms.Label label9;
System.Windows.Forms.Label label4;
System.Windows.Forms.Label label1;
System.Windows.Forms.Label label10;
this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button();
this.tabs = new System.Windows.Forms.TabControl();
this.tabresources = new System.Windows.Forms.TabPage();
this.configdata = new CodeImp.DoomBuilder.Interface.ResourceListEditor();
this.tabnodebuilder = new System.Windows.Forms.TabPage();
this.nodebuilder3d = new System.Windows.Forms.ComboBox();
this.nodebuildertest = new System.Windows.Forms.ComboBox();
this.nodebuildersave = new System.Windows.Forms.ComboBox();
this.tabtesting = new System.Windows.Forms.TabPage();
@ -61,11 +58,9 @@ namespace CodeImp.DoomBuilder.Interface
label3 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
label7 = new System.Windows.Forms.Label();
label8 = new System.Windows.Forms.Label();
label9 = new System.Windows.Forms.Label();
label4 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
label10 = new System.Windows.Forms.Label();
this.tabs.SuspendLayout();
this.tabresources.SuspendLayout();
this.tabnodebuilder.SuspendLayout();
@ -123,15 +118,6 @@ namespace CodeImp.DoomBuilder.Interface
label7.TabIndex = 26;
label7.Text = "Configuration for testing:";
//
// label8
//
label8.AutoSize = true;
label8.Location = new System.Drawing.Point(25, 170);
label8.Name = "label8";
label8.Size = new System.Drawing.Size(136, 14);
label8.TabIndex = 28;
label8.Text = "Configuration for 3D mode:";
//
// label9
//
label9.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -141,9 +127,7 @@ namespace CodeImp.DoomBuilder.Interface
label9.Name = "label9";
label9.Size = new System.Drawing.Size(393, 54);
label9.TabIndex = 23;
label9.Text = "Here you can specify the program settings to use for launching a game engine when" +
" testing the map. Use the placeholders as listed below where you want automatic " +
"names and numbers inserted.";
label9.Text = resources.GetString("label9.Text");
//
// label4
//
@ -163,17 +147,6 @@ namespace CodeImp.DoomBuilder.Interface
label1.TabIndex = 24;
label1.Text = "Application:";
//
// label10
//
label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
label10.AutoEllipsis = true;
label10.Location = new System.Drawing.Point(41, 151);
label10.Name = "label10";
label10.Size = new System.Drawing.Size(352, 122);
label10.TabIndex = 29;
label10.Text = resources.GetString("label10.Text");
//
// cancel
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
@ -243,8 +216,6 @@ namespace CodeImp.DoomBuilder.Interface
//
// tabnodebuilder
//
this.tabnodebuilder.Controls.Add(label8);
this.tabnodebuilder.Controls.Add(this.nodebuilder3d);
this.tabnodebuilder.Controls.Add(label7);
this.tabnodebuilder.Controls.Add(this.nodebuildertest);
this.tabnodebuilder.Controls.Add(label2);
@ -259,19 +230,6 @@ namespace CodeImp.DoomBuilder.Interface
this.tabnodebuilder.Text = "Nodebuilder";
this.tabnodebuilder.UseVisualStyleBackColor = true;
//
// nodebuilder3d
//
this.nodebuilder3d.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.nodebuilder3d.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.nodebuilder3d.FormattingEnabled = true;
this.nodebuilder3d.Location = new System.Drawing.Point(167, 167);
this.nodebuilder3d.Name = "nodebuilder3d";
this.nodebuilder3d.Size = new System.Drawing.Size(229, 22);
this.nodebuilder3d.Sorted = true;
this.nodebuilder3d.TabIndex = 27;
this.nodebuilder3d.SelectedIndexChanged += new System.EventHandler(this.nodebuilder3d_SelectedIndexChanged);
//
// nodebuildertest
//
this.nodebuildertest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
@ -302,7 +260,6 @@ namespace CodeImp.DoomBuilder.Interface
//
this.tabtesting.Controls.Add(this.testresult);
this.tabtesting.Controls.Add(this.labelresult);
this.tabtesting.Controls.Add(label10);
this.tabtesting.Controls.Add(this.testparameters);
this.tabtesting.Controls.Add(label4);
this.tabtesting.Controls.Add(this.browsewad);
@ -323,15 +280,17 @@ namespace CodeImp.DoomBuilder.Interface
this.testresult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.testresult.BackColor = System.Drawing.SystemColors.Control;
this.testresult.Location = new System.Drawing.Point(86, 276);
this.testresult.Location = new System.Drawing.Point(86, 217);
this.testresult.Multiline = true;
this.testresult.Name = "testresult";
this.testresult.Size = new System.Drawing.Size(307, 20);
this.testresult.ReadOnly = true;
this.testresult.Size = new System.Drawing.Size(307, 79);
this.testresult.TabIndex = 31;
//
// labelresult
//
this.labelresult.AutoSize = true;
this.labelresult.Location = new System.Drawing.Point(38, 279);
this.labelresult.Location = new System.Drawing.Point(38, 220);
this.labelresult.Name = "labelresult";
this.labelresult.Size = new System.Drawing.Size(40, 14);
this.labelresult.TabIndex = 30;
@ -342,8 +301,9 @@ namespace CodeImp.DoomBuilder.Interface
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.Multiline = true;
this.testparameters.Name = "testparameters";
this.testparameters.Size = new System.Drawing.Size(307, 20);
this.testparameters.Size = new System.Drawing.Size(307, 79);
this.testparameters.TabIndex = 28;
//
// browsewad
@ -434,7 +394,6 @@ namespace CodeImp.DoomBuilder.Interface
private ResourceListEditor configdata;
private System.Windows.Forms.ComboBox nodebuildertest;
private System.Windows.Forms.ComboBox nodebuildersave;
private System.Windows.Forms.ComboBox nodebuilder3d;
private System.Windows.Forms.TextBox testparameters;
private System.Windows.Forms.Button browsewad;
private System.Windows.Forms.TextBox testapplication;

View file

@ -58,7 +58,6 @@ namespace CodeImp.DoomBuilder.Interface
// Fill comboboxes with nodebuilders
nodebuildersave.Items.AddRange(General.Nodebuilders.ToArray());
nodebuildertest.Items.AddRange(General.Nodebuilders.ToArray());
nodebuilder3d.Items.AddRange(General.Nodebuilders.ToArray());
}
// Configuration item selected
@ -111,22 +110,6 @@ namespace CodeImp.DoomBuilder.Interface
}
}
// Go for all nodebuilder 3d items
nodebuilder3d.SelectedIndex = -1;
for(int i = 0; i < nodebuilder3d.Items.Count; i++)
{
// Get item
ni = nodebuilder3d.Items[i] as NodebuilderInfo;
// Item matches configuration setting?
if(string.Compare(ni.Name, ci.Nodebuilder3D, false) == 0)
{
// Select this item
nodebuilder3d.SelectedIndex = i;
break;
}
}
// Set test application and parameters
testapplication.Text = ci.TestProgram;
testparameters.Text = ci.TestParameters;
@ -144,7 +127,6 @@ namespace CodeImp.DoomBuilder.Interface
configdata.EditResourceLocationList(new DataLocationList());
nodebuildersave.SelectedIndex = -1;
nodebuildertest.SelectedIndex = -1;
nodebuilder3d.SelectedIndex = -1;
testapplication.Text = "";
testparameters.Text = "";
tabs.Enabled = false;
@ -199,20 +181,6 @@ namespace CodeImp.DoomBuilder.Interface
ci.NodebuilderTest = (nodebuildertest.SelectedItem as NodebuilderInfo).Name;
}
// Nodebuilder selection changed
private void nodebuilder3d_SelectedIndexChanged(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;
if(nodebuilder3d.SelectedItem != null)
ci.Nodebuilder3D = (nodebuilder3d.SelectedItem as NodebuilderInfo).Name;
}
// Test application changed
private void testapplication_TextChanged(object sender, EventArgs e)
{

View file

@ -136,7 +136,7 @@
<value>False</value>
</metadata>
<data name="label3.Text" xml:space="preserve">
<value>The nodebuilder is a compiler which builds geometry structures for your map. You need these structures both for playing and 3D mode. For each purpose you can choose the desired nodebuilder configuration here.</value>
<value>The nodebuilder is a compiler which builds geometry structures for your map. You need these structures to be able to play the map in the game. For each purpose you can choose the desired nodebuilder configuration here.</value>
</data>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
@ -150,18 +150,15 @@
<metadata name="label7.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="label9.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<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>
@ -174,22 +171,6 @@
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label10.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label10.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<data name="label10.Text" xml:space="preserve">
<value>%F indicates the edited PWAD file to be tested.
%WP indicates the IWAD resource files to be used (paths included).
%WF indicates the IWAD resource files to be used (without paths).
%L indicates the map lump name as is set in the map options.
%AP indicates the additional resources (if any, paths included).
%AF indicates the additional resources (if any, without paths).
%E indicates the Episode number from E#M# map name.
%M indicates the Map number from E#M# or MAP## map name.</value>
</data>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -208,9 +189,6 @@
<metadata name="tabnodebuilder.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodebuilder3d.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="nodebuildertest.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>