This commit is contained in:
codeimp 2007-09-30 20:07:14 +00:00
parent fc2685a0b5
commit da9a1af21a
6 changed files with 138 additions and 67 deletions

View file

@ -105,7 +105,18 @@ namespace CodeImp.DoomBuilder.Interface
this.config.Location = new System.Drawing.Point(129, 31);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
this.config.Sorted = true;
this.config.TabIndex = 6;
this.config.SelectedIndexChanged += new System.EventHandler(this.config_SelectedIndexChanged);
//
// label4
//
label4.Location = new System.Drawing.Point(15, 161);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(336, 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.";
//
// apply
//
@ -145,20 +156,12 @@ namespace CodeImp.DoomBuilder.Interface
//
// resourcelocations
//
this.resourcelocations.DialogOffset = new System.Drawing.Point(40, 20);
this.resourcelocations.Location = new System.Drawing.Point(15, 28);
this.resourcelocations.Name = "resourcelocations";
this.resourcelocations.Size = new System.Drawing.Size(336, 130);
this.resourcelocations.TabIndex = 18;
//
// label4
//
label4.Location = new System.Drawing.Point(15, 161);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(336, 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.";
//
// MapOptionsForm
//
this.AcceptButton = this.apply;

View file

@ -40,6 +40,8 @@ namespace CodeImp.DoomBuilder.Interface
// Constructor
public MapOptionsForm(MapOptions options)
{
int index;
// Initialize
InitializeComponent();
@ -50,13 +52,13 @@ namespace CodeImp.DoomBuilder.Interface
for(int i = 0; i < General.Configs.Count; i++)
{
// Add config name to list
config.Items.Add(General.Configs[i].Name);
index = config.Items.Add(General.Configs[i]);
// Is this configuration currently selected?
if(string.Compare(General.Configs[i].Filename, options.ConfigFile, true) == 0)
{
// Select this item
config.SelectedIndex = config.Items.Count - 1;
config.SelectedIndex = index;
}
}
@ -106,5 +108,21 @@ namespace CodeImp.DoomBuilder.Interface
this.DialogResult = DialogResult.Cancel;
this.Hide();
}
// Game configuration chosen
private void config_SelectedIndexChanged(object sender, EventArgs e)
{
ConfigurationInfo ci;
// Anything selected?
if(config.SelectedIndex > -1)
{
// Get the info
ci = (ConfigurationInfo)config.SelectedItem;
// Show resources
resourcelocations.FixedResourceLocationList(ci.Resources);
}
}
}
}

View file

@ -117,19 +117,55 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="label3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label3.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="label2.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="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="levelname.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="config.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<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="apply.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>
<metadata name="panelres.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="resourcelocations.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>
</root>

View file

@ -91,6 +91,7 @@ namespace CodeImp.DoomBuilder.Interface
//
// resourcelocations
//
this.resourcelocations.DialogOffset = new System.Drawing.Point(40, 20);
this.resourcelocations.Location = new System.Drawing.Point(14, 26);
this.resourcelocations.Name = "resourcelocations";
this.resourcelocations.Size = new System.Drawing.Size(336, 127);
@ -126,6 +127,7 @@ namespace CodeImp.DoomBuilder.Interface
this.config.Location = new System.Drawing.Point(141, 21);
this.config.Name = "config";
this.config.Size = new System.Drawing.Size(213, 22);
this.config.Sorted = true;
this.config.TabIndex = 15;
this.config.SelectedIndexChanged += new System.EventHandler(this.config_SelectedIndexChanged);
//

View file

@ -59,6 +59,7 @@ namespace CodeImp.DoomBuilder.Interface
{
string dbsfile;
string gameconfig;
int index;
// Busy
Cursor.Current = Cursors.WaitCursor;
@ -91,13 +92,13 @@ namespace CodeImp.DoomBuilder.Interface
for(int i = 0; i < General.Configs.Count; i++)
{
// Add config name to list
config.Items.Add(General.Configs[i].Name);
index = config.Items.Add(General.Configs[i]);
// This is the preferred game configuration?
if(General.Configs[i].Filename == gameconfig)
{
// Select this item
config.SelectedIndex = i;
config.SelectedIndex = index;
}
}
@ -178,75 +179,86 @@ namespace CodeImp.DoomBuilder.Interface
private void config_SelectedIndexChanged(object sender, EventArgs e)
{
List<ListViewItem> mapnames;
ConfigurationInfo ci;
Configuration cfg;
IDictionary maplumpnames;
int scanindex, checkoffset;
int lumpsfound, lumpsrequired = 0;
string lumpname, selectedname = "";
// Keep selected name, if any
if(mapslist.SelectedItems.Count > 0)
selectedname = mapslist.SelectedItems[0].Text;
// Anything selected?
if(config.SelectedIndex > -1)
{
// Keep selected name, if any
if(mapslist.SelectedItems.Count > 0)
selectedname = mapslist.SelectedItems[0].Text;
// Make an array for the map names
mapnames = new List<ListViewItem>();
// Load this configuration
cfg = General.LoadGameConfiguration(General.Configs[config.SelectedIndex].Filename);
// Get the map lump names
maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
// Count how many required lumps we have to find
foreach(DictionaryEntry ml in maplumpnames)
{
// Read lump setting and count it
if(cfg.ReadSetting("maplumpnames." + ml.Key + ".required", false)) lumpsrequired++;
}
// Go for all the lumps in the wad
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++)
{
// Make sure this lump is not part of the map
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name))
// Make an array for the map names
mapnames = new List<ListViewItem>();
// Get selected configuration info
ci = (ConfigurationInfo)config.SelectedItem;
// Load this configuration
cfg = General.LoadGameConfiguration(ci.Filename);
// Get the map lump names
maplumpnames = cfg.ReadSetting("maplumpnames", new Hashtable());
// Count how many required lumps we have to find
foreach(DictionaryEntry ml in maplumpnames)
{
// Reset check
lumpsfound = 0;
checkoffset = 1;
// Read lump setting and count it
if(cfg.ReadSetting("maplumpnames." + ml.Key + ".required", false)) lumpsrequired++;
}
// Continue while still within bounds and lumps are still recognized
while(((scanindex + checkoffset) < wadfile.Lumps.Count) &&
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name))
// Go for all the lumps in the wad
for(scanindex = 0; scanindex < (wadfile.Lumps.Count - 1); scanindex++)
{
// Make sure this lump is not part of the map
if(!maplumpnames.Contains(wadfile.Lumps[scanindex].Name))
{
// Count the lump when it is marked as required
lumpname = wadfile.Lumps[scanindex + checkoffset].Name;
if(cfg.ReadSetting("maplumpnames." + lumpname + ".required", false)) lumpsfound++;
// Reset check
lumpsfound = 0;
checkoffset = 1;
// Check the next lump
checkoffset++;
// Continue while still within bounds and lumps are still recognized
while(((scanindex + checkoffset) < wadfile.Lumps.Count) &&
maplumpnames.Contains(wadfile.Lumps[scanindex + checkoffset].Name))
{
// Count the lump when it is marked as required
lumpname = wadfile.Lumps[scanindex + checkoffset].Name;
if(cfg.ReadSetting("maplumpnames." + lumpname + ".required", false)) lumpsfound++;
// Check the next lump
checkoffset++;
}
// Map found? Then add it to the list
if(lumpsfound >= lumpsrequired)
mapnames.Add(new ListViewItem(wadfile.Lumps[scanindex].Name));
}
// Map found? Then add it to the list
if(lumpsfound >= lumpsrequired)
mapnames.Add(new ListViewItem(wadfile.Lumps[scanindex].Name));
}
}
// Clear the list and add the new map names
mapslist.Items.Clear();
mapslist.Items.AddRange(mapnames.ToArray());
mapslist.Sort();
// Go for all items in the list
foreach(ListViewItem item in mapslist.Items)
{
// Was this item previously selected?
if(item.Text == selectedname)
// Clear the list and add the new map names
mapslist.Items.Clear();
mapslist.Items.AddRange(mapnames.ToArray());
mapslist.Sort();
// Go for all items in the list
foreach(ListViewItem item in mapslist.Items)
{
// Select it again
item.Selected = true;
break;
// Was this item previously selected?
if(item.Text == selectedname)
{
// Select it again
item.Selected = true;
break;
}
}
// Show configuration resources
resourcelocations.FixedResourceLocationList(ci.Resources);
}
}

View file

@ -63,7 +63,7 @@ namespace CodeImp.DoomBuilder.Interface
}
// Go for all items
for(int i = list.Count; i >= 0; i--)
for(int i = list.Count - 1; i >= 0; i--)
{
// Add item as fixed
resourceitems.Items.Insert(0, new ListViewItem(list[i].location));