diff --git a/Documents/testparameters.txt b/Documents/testparameters.txt new file mode 100644 index 00000000..b06ba972 --- /dev/null +++ b/Documents/testparameters.txt @@ -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. diff --git a/Source/Config/ConfigurationInfo.cs b/Source/Config/ConfigurationInfo.cs index d1e6e3e8..3c0ba0c9 100644 --- a/Source/Config/ConfigurationInfo.cs +++ b/Source/Config/ConfigurationInfo.cs @@ -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; diff --git a/Source/Data/DataManager.cs b/Source/Data/DataManager.cs index f8b0c8bc..a8de9916 100644 --- a/Source/Data/DataManager.cs +++ b/Source/Data/DataManager.cs @@ -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 } } diff --git a/Source/Data/WADReader.cs b/Source/Data/WADReader.cs index 57ef2d74..0c6be81d 100644 --- a/Source/Data/WADReader.cs +++ b/Source/Data/WADReader.cs @@ -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(); } diff --git a/Source/General/General.cs b/Source/General/General.cs index 19291d44..ef148bbf 100644 --- a/Source/General/General.cs +++ b/Source/General/General.cs @@ -836,6 +836,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 diff --git a/Source/Interface/ConfigForm.Designer.cs b/Source/Interface/ConfigForm.Designer.cs index a608bdf2..33769604 100644 --- a/Source/Interface/ConfigForm.Designer.cs +++ b/Source/Interface/ConfigForm.Designer.cs @@ -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; diff --git a/Source/Interface/ConfigForm.cs b/Source/Interface/ConfigForm.cs index 9fb7c4f4..3c425083 100644 --- a/Source/Interface/ConfigForm.cs +++ b/Source/Interface/ConfigForm.cs @@ -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 @@ -110,22 +109,6 @@ namespace CodeImp.DoomBuilder.Interface break; } } - - // 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; @@ -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; @@ -198,20 +180,6 @@ namespace CodeImp.DoomBuilder.Interface if(nodebuildertest.SelectedItem != null) 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) diff --git a/Source/Interface/ConfigForm.resx b/Source/Interface/ConfigForm.resx index 3bff8a77..d5a63d38 100644 --- a/Source/Interface/ConfigForm.resx +++ b/Source/Interface/ConfigForm.resx @@ -136,7 +136,7 @@ False - 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. + 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. True @@ -150,18 +150,15 @@ False - - True - - - False - True False + + 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. + True @@ -174,22 +171,6 @@ False - - True - - - False - - - %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. - True @@ -208,9 +189,6 @@ True - - True - True