Script type can now be chosen when opening a map.

Updated documentation.
This commit is contained in:
MaxED 2014-07-12 13:10:41 +00:00
parent a485b40bee
commit c8510b7b0f
5 changed files with 98 additions and 21 deletions

View file

@ -85,6 +85,9 @@
<ul>
<li><a href="scripting/acs.html">Enhanced scripting workflow</a>.</li>
<li><span class="style1"><strong>[new]</strong></span> <a href="scripting/snippets.html">Code snippets.</a></li>
<li><span class="style1"><strong>[new]</strong></span> Added support for multiple ACC compilers. </li>
<li><span class="style1"><strong>[new]</strong></span> BCC script compiler (<a href="https://github.com/wormt/bcc/">https://github.com/wormt/bcc/</a>) is bundled with GZDB.</li>
<li><span class="style1"><strong>[new]</strong></span> Script type can be chosen when creating or opening a map, and can be changed in Map Options form.</li>
</ul>
</li>
<li>

View file

@ -113,7 +113,7 @@ namespace CodeImp.DoomBuilder.Windows
this.scriptcompilerlabel.Name = "scriptcompilerlabel";
this.scriptcompilerlabel.Size = new System.Drawing.Size(110, 14);
this.scriptcompilerlabel.TabIndex = 11;
this.scriptcompilerlabel.Text = "Script Language:";
this.scriptcompilerlabel.Text = "Script Type:";
this.scriptcompilerlabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// levelname

View file

@ -39,6 +39,8 @@ 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.scriptcompiler = new System.Windows.Forms.ComboBox();
this.scriptcompilerlabel = new System.Windows.Forms.Label();
columnHeader1 = new System.Windows.Forms.ColumnHeader();
label1 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
@ -52,16 +54,16 @@ namespace CodeImp.DoomBuilder.Windows
//
// label1
//
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(30, 24);
label1.Location = new System.Drawing.Point(15, 24);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(105, 14);
label1.Size = new System.Drawing.Size(120, 14);
label1.TabIndex = 14;
label1.Text = "Game Configuration:";
label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// label2
//
label2.Location = new System.Drawing.Point(12, 57);
label2.Location = new System.Drawing.Point(12, 89);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(396, 30);
label2.TabIndex = 16;
@ -86,7 +88,7 @@ namespace CodeImp.DoomBuilder.Windows
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, 215);
this.panelres.Location = new System.Drawing.Point(12, 246);
this.panelres.Name = "panelres";
this.panelres.Size = new System.Drawing.Size(396, 240);
this.panelres.TabIndex = 2;
@ -116,7 +118,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(296, 465);
this.apply.Location = new System.Drawing.Point(296, 496);
this.apply.Name = "apply";
this.apply.Size = new System.Drawing.Size(112, 25);
this.apply.TabIndex = 3;
@ -128,7 +130,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(178, 464);
this.cancel.Location = new System.Drawing.Point(178, 495);
this.cancel.Name = "cancel";
this.cancel.Size = new System.Drawing.Size(112, 25);
this.cancel.TabIndex = 4;
@ -158,7 +160,7 @@ namespace CodeImp.DoomBuilder.Windows
this.mapslist.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.mapslist.HideSelection = false;
this.mapslist.LabelWrap = false;
this.mapslist.Location = new System.Drawing.Point(12, 90);
this.mapslist.Location = new System.Drawing.Point(12, 122);
this.mapslist.MultiSelect = false;
this.mapslist.Name = "mapslist";
this.mapslist.ShowGroups = false;
@ -170,13 +172,37 @@ namespace CodeImp.DoomBuilder.Windows
this.mapslist.DoubleClick += new System.EventHandler(this.mapslist_DoubleClick);
this.mapslist.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.mapslist_ItemSelectionChanged);
//
// scriptcompiler
//
this.scriptcompiler.DropDownHeight = 206;
this.scriptcompiler.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.scriptcompiler.Enabled = false;
this.scriptcompiler.FormattingEnabled = true;
this.scriptcompiler.IntegralHeight = false;
this.scriptcompiler.Location = new System.Drawing.Point(141, 49);
this.scriptcompiler.Name = "scriptcompiler";
this.scriptcompiler.Size = new System.Drawing.Size(267, 22);
this.scriptcompiler.TabIndex = 17;
//
// scriptcompilerlabel
//
this.scriptcompilerlabel.Enabled = false;
this.scriptcompilerlabel.Location = new System.Drawing.Point(15, 52);
this.scriptcompilerlabel.Name = "scriptcompilerlabel";
this.scriptcompilerlabel.Size = new System.Drawing.Size(120, 14);
this.scriptcompilerlabel.TabIndex = 18;
this.scriptcompilerlabel.Text = "Script Type:";
this.scriptcompilerlabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// OpenMapOptionsForm
//
this.AcceptButton = this.apply;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.cancel;
this.ClientSize = new System.Drawing.Size(420, 499);
this.ClientSize = new System.Drawing.Size(420, 530);
this.Controls.Add(this.scriptcompiler);
this.Controls.Add(this.scriptcompilerlabel);
this.Controls.Add(this.mapslist);
this.Controls.Add(label2);
this.Controls.Add(this.config);
@ -199,7 +225,6 @@ namespace CodeImp.DoomBuilder.Windows
this.panelres.ResumeLayout(false);
this.panelres.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -212,6 +237,8 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.ListView mapslist;
private CodeImp.DoomBuilder.Controls.ResourceListEditor datalocations;
private System.Windows.Forms.CheckBox strictpatches;
private System.Windows.Forms.ComboBox scriptcompiler;
private System.Windows.Forms.Label scriptcompilerlabel;
}

View file

@ -36,7 +36,7 @@ namespace CodeImp.DoomBuilder.Windows
private Configuration mapsettings;
private MapOptions options;
private WAD wadfile;
private string filepathname;
private readonly string filepathname;
private string selectedmapname;
// Properties
@ -117,6 +117,11 @@ namespace CodeImp.DoomBuilder.Windows
gameconfig = mapsettings.ReadSetting("gameconfig", "");
}
//mxd. Fill script compilers list
foreach(KeyValuePair<string, ScriptConfiguration> group in General.CompiledScriptConfigs) {
scriptcompiler.Items.Add(group.Value);
}
//mxd. Go for all enabled configurations
for(int i = 0; i < General.Configs.Count; i++) {
if(!General.Configs[i].Enabled) continue;
@ -311,6 +316,14 @@ namespace CodeImp.DoomBuilder.Windows
mapslist.Items[0].Selected = true;
mapslist.EndUpdate();
//mxd. Disable script compiler selector when there are no maps detected using current configuration
if (mapslist.Items.Count == 0)
{
scriptcompiler.Enabled = false;
scriptcompiler.SelectedIndex = -1;
scriptcompilerlabel.Enabled = false;
}
// Show configuration resources
datalocations.FixedResourceLocationList(ci.Resources);
}
@ -358,6 +371,21 @@ namespace CodeImp.DoomBuilder.Windows
options.StrictPatches = strictpatches.Checked;
options.CopyResources(locations);
//mxd. Store script compiler
if(scriptcompiler.Enabled && scriptcompiler.SelectedIndex > -1)
{
ScriptConfiguration scriptcfg = scriptcompiler.SelectedItem as ScriptConfiguration;
foreach(KeyValuePair<string, ScriptConfiguration> group in General.CompiledScriptConfigs)
{
if(group.Value == scriptcfg)
{
options.ScriptCompiler = group.Key;
break;
}
}
}
// Hide window
wadfile.Dispose();
this.DialogResult = DialogResult.OK;
@ -393,8 +421,11 @@ namespace CodeImp.DoomBuilder.Windows
// Map name selected
private void mapslist_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
if(!e.IsSelected) return; //mxd. Don't want to trigger this for every item in mapslist
DataLocationList locations;
DataLocationList listedlocations;
string scriptconfig = string.Empty;
// Map previously selected?
if(!string.IsNullOrEmpty(selectedmapname))
@ -431,6 +462,31 @@ namespace CodeImp.DoomBuilder.Windows
// Set new data locations
datalocations.EditResourceLocationList(listedlocations);
//mxd. Select script compiler
if (!string.IsNullOrEmpty(options.ScriptCompiler) && General.CompiledScriptConfigs.ContainsKey(options.ScriptCompiler)) {
scriptconfig = options.ScriptCompiler;
}
else
{
string defaultscriptconfig = (config.SelectedItem as ConfigurationInfo).Configuration.ReadSetting("defaultscriptcompiler", string.Empty);
if(!string.IsNullOrEmpty(defaultscriptconfig) && General.CompiledScriptConfigs.ContainsKey(defaultscriptconfig))
scriptconfig = defaultscriptconfig;
}
}
//mxd. Select proper script compiler
if (!string.IsNullOrEmpty(scriptconfig))
{
scriptcompiler.Enabled = true;
scriptcompiler.SelectedItem = General.CompiledScriptConfigs[scriptconfig];
scriptcompilerlabel.Enabled = true;
}
else
{
scriptcompiler.Enabled = false;
scriptcompiler.SelectedIndex = -1;
scriptcompilerlabel.Enabled = false;
}
}

View file

@ -120,15 +120,9 @@
<metadata name="columnHeader1.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="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>
@ -147,7 +141,4 @@
<metadata name="datalocations.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="mapslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>