- added option to load patches between P_START and P_END only, for the WAD file being opened/created

- removed dummy action for developers
This commit is contained in:
codeimp 2009-01-31 09:09:49 +00:00
parent d6811ccc5b
commit 743b6db2e6
11 changed files with 104 additions and 33 deletions

View file

@ -57,8 +57,8 @@ namespace CodeImp.DoomBuilder.Data
// Copy information from Configuration to ResourceLocation
if(rlinfo.Contains("type") && (rlinfo["type"] is int)) res.type = (int)rlinfo["type"];
if(rlinfo.Contains("location") && (rlinfo["location"] is string)) res.location = (string)rlinfo["location"];
if(rlinfo.Contains("textures") && (rlinfo["textures"] is int)) res.option1 = General.Int2Bool((int)rlinfo["textures"]);
if(rlinfo.Contains("flats") && (rlinfo["flats"] is int)) res.option2 = General.Int2Bool((int)rlinfo["flats"]);
if(rlinfo.Contains("option1") && (rlinfo["option1"] is int)) res.option1 = General.Int2Bool((int)rlinfo["option1"]);
if(rlinfo.Contains("option2") && (rlinfo["option2"] is int)) res.option2 = General.Int2Bool((int)rlinfo["option2"]);
// Add resource
Add(res);
@ -92,8 +92,8 @@ namespace CodeImp.DoomBuilder.Data
rlinfo = new ListDictionary();
rlinfo.Add("type", this[i].type);
rlinfo.Add("location", this[i].location);
rlinfo.Add("textures", General.Bool2Int(this[i].option1));
rlinfo.Add("flats", General.Bool2Int(this[i].option2));
rlinfo.Add("option1", General.Bool2Int(this[i].option1));
rlinfo.Add("option2", General.Bool2Int(this[i].option2));
// Add structure
resinfo.Add("resource" + i.ToString(CultureInfo.InvariantCulture), rlinfo);

View file

@ -89,6 +89,7 @@ namespace CodeImp.DoomBuilder
// SendMessage API
internal const int WM_USER = 0x400;
internal const int CB_SETITEMHEIGHT = 0x153;
internal const int CB_SHOWDROPDOWN = 0x14F;
internal const int EM_GETSCROLLPOS = WM_USER + 221;
internal const int EM_SETSCROLLPOS = WM_USER + 222;
@ -1313,7 +1314,7 @@ namespace CodeImp.DoomBuilder
// Convert bool to integer
internal static int Bool2Int(bool v)
{
if(v) return 1; else return 0;
return v ? 1 : 0;
}
// Convert integer to bool
@ -1410,7 +1411,7 @@ namespace CodeImp.DoomBuilder
internal static string MakeTempDirname()
{
string dirname;
string chars = "abcdefghijklmnopqrstuvwxyz1234567890";
const string chars = "abcdefghijklmnopqrstuvwxyz1234567890";
Random rnd = new Random();
int i;
@ -1539,6 +1540,7 @@ namespace CodeImp.DoomBuilder
#endregion
/*
[BeginAction("testaction")]
internal static void TestAction()
{
@ -1546,6 +1548,7 @@ namespace CodeImp.DoomBuilder
t.ShowDialog(mainwindow);
t.Dispose();
}
*/
}
}

View file

@ -352,7 +352,7 @@ namespace CodeImp.DoomBuilder
// Load data manager
General.WriteLogLine("Loading data resources...");
data = new DataManager();
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, false, false);
maplocation = new DataLocation(DataLocation.RESOURCE_WAD, filepathname, options.StrictPatches, false);
data.Load(configinfo.Resources, options.Resources, maplocation);
// Update structures

View file

@ -48,6 +48,9 @@ namespace CodeImp.DoomBuilder.Map
private string currentname;
private string previousname; // When zero length string, map has not renamed
// Strict pathes loading?
private bool strictpatches;
// Additional resources
private DataLocationList resources;
@ -60,6 +63,7 @@ namespace CodeImp.DoomBuilder.Map
public string ConfigFile { get { return configfile; } set { configfile = value; } }
public DataLocationList Resources { get { return resources; } }
public bool StrictPatches { get { return strictpatches; } set { strictpatches = value; } }
public List<string> ScriptFiles { get { return scriptfiles; } set { scriptfiles = value; } }
public string PreviousName { get { return previousname; } set { previousname = value; } }
public string CurrentName
@ -88,6 +92,7 @@ namespace CodeImp.DoomBuilder.Map
this.previousname = "";
this.currentname = "";
this.configfile = "";
this.strictpatches = false;
this.resources = new DataLocationList();
this.mapconfig = new Configuration(true);
this.scriptfiles = new List<string>();
@ -102,6 +107,7 @@ namespace CodeImp.DoomBuilder.Map
// Initialize
this.previousname = "";
this.currentname = mapname;
this.strictpatches = General.Int2Bool(cfg.ReadSetting("strictpatches", 0));
this.configfile = cfg.ReadSetting("gameconfig", "");
this.resources = new DataLocationList();
this.mapconfig = new Configuration(true);
@ -171,6 +177,7 @@ namespace CodeImp.DoomBuilder.Map
// Write configuration type information
wadcfg.WriteSetting("type", "Doom Builder Map Settings Configuration");
wadcfg.WriteSetting("gameconfig", configfile);
wadcfg.WriteSetting("strictpatches", General.Bool2Int(strictpatches));
// Update the settings file with this map configuration
wadcfg.WriteSetting("maps." + currentname, mapconfig.Root);

View file

@ -34,6 +34,7 @@ categories
// allowkeys and allowmouse are true by default, the others are false by default.
//
/*
testaction
{
title = "Developer Test";
@ -43,6 +44,7 @@ testaction
allowmouse = true;
allowscroll = true;
}
*/
newmap
{

View file

@ -39,6 +39,7 @@ namespace CodeImp.DoomBuilder.Windows
this.cancel = new System.Windows.Forms.Button();
this.panelres = new System.Windows.Forms.GroupBox();
this.datalocations = new CodeImp.DoomBuilder.Controls.ResourceListEditor();
this.strictpatches = new System.Windows.Forms.CheckBox();
label3 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
label1 = new System.Windows.Forms.Label();
@ -86,7 +87,7 @@ namespace CodeImp.DoomBuilder.Windows
panelsettings.Controls.Add(label1);
panelsettings.Location = new System.Drawing.Point(12, 12);
panelsettings.Name = "panelsettings";
panelsettings.Size = new System.Drawing.Size(367, 118);
panelsettings.Size = new System.Drawing.Size(397, 118);
panelsettings.TabIndex = 10;
panelsettings.TabStop = false;
panelsettings.Text = " Settings ";
@ -102,8 +103,10 @@ namespace CodeImp.DoomBuilder.Windows
//
// config
//
this.config.DropDownHeight = 206;
this.config.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.config.FormattingEnabled = true;
this.config.IntegralHeight = false;
this.config.Location = new System.Drawing.Point(129, 31);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
@ -112,9 +115,9 @@ namespace CodeImp.DoomBuilder.Windows
//
// label4
//
label4.Location = new System.Drawing.Point(15, 161);
label4.Location = new System.Drawing.Point(15, 190);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(336, 34);
label4.Size = new System.Drawing.Size(349, 34);
label4.TabIndex = 17;
label4.Text = "Drag items to change order (lower items override higher items). Grayed items are " +
"loaded according to the game configuration.";
@ -122,7 +125,7 @@ namespace CodeImp.DoomBuilder.Windows
// apply
//
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(149, 355);
this.apply.Location = new System.Drawing.Point(179, 392);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 12;
@ -134,7 +137,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(267, 355);
this.cancel.Location = new System.Drawing.Point(297, 392);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 13;
@ -146,30 +149,41 @@ namespace CodeImp.DoomBuilder.Windows
//
this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelres.Controls.Add(this.strictpatches);
this.panelres.Controls.Add(this.datalocations);
this.panelres.Controls.Add(label4);
this.panelres.Location = new System.Drawing.Point(12, 141);
this.panelres.Name = "panelres";
this.panelres.Size = new System.Drawing.Size(367, 198);
this.panelres.Size = new System.Drawing.Size(397, 230);
this.panelres.TabIndex = 14;
this.panelres.TabStop = false;
this.panelres.Text = " Custom Resources ";
this.panelres.Text = " Resources ";
//
// datalocations
//
this.datalocations.DialogOffset = new System.Drawing.Point(40, 20);
this.datalocations.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.datalocations.Location = new System.Drawing.Point(15, 28);
this.datalocations.Location = new System.Drawing.Point(15, 57);
this.datalocations.Name = "datalocations";
this.datalocations.Size = new System.Drawing.Size(336, 130);
this.datalocations.Size = new System.Drawing.Size(368, 130);
this.datalocations.TabIndex = 18;
//
// strictpatches
//
this.strictpatches.AutoSize = true;
this.strictpatches.Location = new System.Drawing.Point(15, 27);
this.strictpatches.Name = "strictpatches";
this.strictpatches.Size = new System.Drawing.Size(352, 18);
this.strictpatches.TabIndex = 20;
this.strictpatches.Text = "Strictly load patches between P_START and P_END only for this file";
this.strictpatches.UseVisualStyleBackColor = true;
//
// MapOptionsForm
//
this.AcceptButton = this.apply;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(391, 392);
this.ClientSize = new System.Drawing.Size(421, 429);
this.Controls.Add(this.panelres);
this.Controls.Add(this.cancel);
this.Controls.Add(this.apply);
@ -187,6 +201,7 @@ namespace CodeImp.DoomBuilder.Windows
panelsettings.ResumeLayout(false);
panelsettings.PerformLayout();
this.panelres.ResumeLayout(false);
this.panelres.PerformLayout();
this.ResumeLayout(false);
}
@ -199,6 +214,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Button cancel;
private System.Windows.Forms.GroupBox panelres;
private CodeImp.DoomBuilder.Controls.ResourceListEditor datalocations;
private System.Windows.Forms.CheckBox strictpatches;
}

View file

@ -71,6 +71,9 @@ namespace CodeImp.DoomBuilder.Windows
// Set the level name
levelname.Text = options.CurrentName;
// Set strict patches loading
strictpatches.Checked = options.StrictPatches;
// Fill the resources list
datalocations.EditResourceLocationList(options.Resources);
}
@ -162,6 +165,7 @@ namespace CodeImp.DoomBuilder.Windows
options.ClearResources();
options.ConfigFile = General.Configs[config.SelectedIndex].Filename;
options.CurrentName = levelname.Text.Trim().ToUpper();
options.StrictPatches = strictpatches.Checked;
options.CopyResources(datalocations.GetResources());
// Hide window

View file

@ -135,12 +135,12 @@
<metadata name="label1.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="panelsettings.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="panelsettings.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="panelsettings.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="levelname.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -162,9 +162,18 @@
<metadata name="panelres.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="strictpatches.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="datalocations.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="datalocations.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="strictpatches.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -38,6 +38,7 @@ namespace CodeImp.DoomBuilder.Windows
this.cancel = new System.Windows.Forms.Button();
this.config = new System.Windows.Forms.ComboBox();
this.mapslist = new System.Windows.Forms.ListView();
this.strictpatches = new System.Windows.Forms.CheckBox();
columnHeader1 = new System.Windows.Forms.ColumnHeader();
label1 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
@ -62,16 +63,16 @@ namespace CodeImp.DoomBuilder.Windows
//
label2.Location = new System.Drawing.Point(12, 57);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(365, 30);
label2.Size = new System.Drawing.Size(396, 30);
label2.TabIndex = 16;
label2.Text = "With the above selected configuration, the maps shown below were found in the cho" +
"sen WAD file. Please select the map to load for editing.";
//
// label3
//
label3.Location = new System.Drawing.Point(14, 161);
label3.Location = new System.Drawing.Point(14, 193);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(336, 34);
label3.Size = new System.Drawing.Size(347, 34);
label3.TabIndex = 17;
label3.Text = "Drag items to change order (lower items override higher items). Grayed items are " +
"loaded according to the game configuration.";
@ -80,27 +81,29 @@ namespace CodeImp.DoomBuilder.Windows
//
this.panelres.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panelres.Controls.Add(this.strictpatches);
this.panelres.Controls.Add(this.datalocations);
this.panelres.Controls.Add(label3);
this.panelres.Location = new System.Drawing.Point(12, 214);
this.panelres.Location = new System.Drawing.Point(12, 215);
this.panelres.Name = "panelres";
this.panelres.Size = new System.Drawing.Size(365, 198);
this.panelres.Size = new System.Drawing.Size(396, 231);
this.panelres.TabIndex = 11;
this.panelres.TabStop = false;
this.panelres.Text = " Custom Resources ";
this.panelres.Text = " Resources ";
//
// datalocations
//
this.datalocations.DialogOffset = new System.Drawing.Point(40, 20);
this.datalocations.Location = new System.Drawing.Point(14, 26);
this.datalocations.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.datalocations.Location = new System.Drawing.Point(14, 58);
this.datalocations.Name = "datalocations";
this.datalocations.Size = new System.Drawing.Size(336, 127);
this.datalocations.Size = new System.Drawing.Size(368, 127);
this.datalocations.TabIndex = 18;
//
// apply
//
this.apply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.apply.Location = new System.Drawing.Point(147, 428);
this.apply.Location = new System.Drawing.Point(178, 462);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 12;
@ -112,7 +115,7 @@ namespace CodeImp.DoomBuilder.Windows
//
this.cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancel.Location = new System.Drawing.Point(265, 428);
this.cancel.Location = new System.Drawing.Point(296, 462);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 13;
@ -122,11 +125,13 @@ namespace CodeImp.DoomBuilder.Windows
//
// config
//
this.config.DropDownHeight = 206;
this.config.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.config.FormattingEnabled = true;
this.config.IntegralHeight = false;
this.config.Location = new System.Drawing.Point(141, 21);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
this.config.Size = new System.Drawing.Size(242, 22);
this.config.TabIndex = 15;
this.config.SelectedIndexChanged += new System.EventHandler(this.config_SelectedIndexChanged);
//
@ -144,7 +149,7 @@ namespace CodeImp.DoomBuilder.Windows
this.mapslist.MultiSelect = false;
this.mapslist.Name = "mapslist";
this.mapslist.ShowGroups = false;
this.mapslist.Size = new System.Drawing.Size(365, 110);
this.mapslist.Size = new System.Drawing.Size(396, 110);
this.mapslist.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.mapslist.TabIndex = 18;
this.mapslist.UseCompatibleStateImageBehavior = false;
@ -152,12 +157,22 @@ namespace CodeImp.DoomBuilder.Windows
this.mapslist.DoubleClick += new System.EventHandler(this.mapslist_DoubleClick);
this.mapslist.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.mapslist_ItemSelectionChanged);
//
// strictpatches
//
this.strictpatches.AutoSize = true;
this.strictpatches.Location = new System.Drawing.Point(14, 27);
this.strictpatches.Name = "strictpatches";
this.strictpatches.Size = new System.Drawing.Size(352, 18);
this.strictpatches.TabIndex = 19;
this.strictpatches.Text = "Strictly load patches between P_START and P_END only for this file";
this.strictpatches.UseVisualStyleBackColor = true;
//
// OpenMapOptionsForm
//
this.AcceptButton = this.apply;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(389, 465);
this.ClientSize = new System.Drawing.Size(420, 499);
this.Controls.Add(this.mapslist);
this.Controls.Add(label2);
this.Controls.Add(this.config);
@ -177,6 +192,7 @@ namespace CodeImp.DoomBuilder.Windows
this.Text = "Open Map Options";
this.Shown += new System.EventHandler(this.OpenMapOptionsForm_Shown);
this.panelres.ResumeLayout(false);
this.panelres.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -190,6 +206,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.GroupBox panelres;
private System.Windows.Forms.ListView mapslist;
private CodeImp.DoomBuilder.Controls.ResourceListEditor datalocations;
private System.Windows.Forms.CheckBox strictpatches;
}

View file

@ -101,6 +101,9 @@ namespace CodeImp.DoomBuilder.Windows
else
mapsettings = new Configuration(true);
// Check strict patches box
strictpatches.Checked = mapsettings.ReadSetting("strictpatches", false);
// Check what game configuration is preferred
gameconfig = mapsettings.ReadSetting("gameconfig", "");
@ -333,6 +336,7 @@ namespace CodeImp.DoomBuilder.Windows
options.ClearResources();
options.ConfigFile = configinfo.Filename;
options.CurrentName = mapslist.SelectedItems[0].Text;
options.StrictPatches = strictpatches.Checked;
options.CopyResources(locations);
// Hide window

View file

@ -141,6 +141,12 @@
<metadata name="panelres.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="strictpatches.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="datalocations.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="datalocations.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -156,6 +162,9 @@
<metadata name="mapslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="strictpatches.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>