mirror of
https://git.do.srb2.org/STJr/UltimateZoneBuilder.git
synced 2025-01-18 14:31:50 +00:00
Script type can now be chosen when creating a new map and changed in Map Options form.
BCC script compiler (https://github.com/wormt/bcc/) is now bundled with GZDB. Main Form, "File" menu: only existing files are now added to the "recent files" list.
This commit is contained in:
parent
755a554964
commit
00688d4c7c
40 changed files with 3323 additions and 60 deletions
15
Build/Compilers/BCC/bcc.cfg
Normal file
15
Build/Compilers/BCC/bcc.cfg
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
compilers
|
||||
{
|
||||
// This defines what files a compiler uses
|
||||
// The setting named "program" defines what .exe to run
|
||||
// The "interface" setting defines what interal interface to use for processing and error feedback
|
||||
// All others are the required files (the setting names do not matter)
|
||||
bcc
|
||||
{
|
||||
interface = "AccCompiler";
|
||||
program = "bcc.exe";
|
||||
zcommon = "zcommon.acs";
|
||||
std = "std.acs";
|
||||
}
|
||||
}
|
BIN
Build/Compilers/BCC/bcc.exe
Normal file
BIN
Build/Compilers/BCC/bcc.exe
Normal file
Binary file not shown.
1408
Build/Compilers/BCC/std.acs
Normal file
1408
Build/Compilers/BCC/std.acs
Normal file
File diff suppressed because it is too large
Load diff
3
Build/Compilers/BCC/zcommon.acs
Normal file
3
Build/Compilers/BCC/zcommon.acs
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "std.acs"
|
||||
|
||||
import upmost: region = std;
|
|
@ -187,6 +187,9 @@ mapformat_hexen
|
|||
// The format interface handles the map data format
|
||||
formatinterface = "HexenMapSetIO";
|
||||
|
||||
//mxd. The default script compiler to use
|
||||
defaultscriptcompiler = "zdoom_acs.cfg";
|
||||
|
||||
maplumpnames
|
||||
{
|
||||
include("Doom_misc.cfg", "hexenmaplumpnames");
|
||||
|
@ -295,6 +298,9 @@ mapformat_udmf
|
|||
// The format interface handles the map data format
|
||||
formatinterface = "UniversalMapSetIO";
|
||||
|
||||
//mxd. The default script compiler to use
|
||||
defaultscriptcompiler = "zdoom_acs.cfg";
|
||||
|
||||
// Maximum length of texture name length in characters (0 for unlimited)
|
||||
// WARNING: changing this may destroy your WAD file. Only change it when
|
||||
// you know what you're doing!
|
||||
|
|
|
@ -398,6 +398,7 @@ required = Lump is required to exist.
|
|||
blindcopy = Lump will be copied along with the map blindly. (useful for lumps Doom Builder doesn't use)
|
||||
nodebuild = The nodebuilder generates this lump.
|
||||
allowempty = The nodebuilder is allowed to leave this lump empty.
|
||||
scriptbuild = This lump is a text-based script, which should be compiled using current script compiler;
|
||||
script = This lump is a text-based script. Specify the filename of the script configuration to use.
|
||||
*/
|
||||
|
||||
|
@ -428,7 +429,7 @@ hexenmaplumpnames
|
|||
{
|
||||
required = false;
|
||||
nodebuild = false;
|
||||
script = "ZDoom_ACS.cfg";
|
||||
scriptbuild = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -474,7 +475,7 @@ udmfmaplumpnames
|
|||
{
|
||||
required = false;
|
||||
nodebuild = false;
|
||||
script = "ZDoom_ACS.cfg";
|
||||
scriptbuild = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to Hexen map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_hexen");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Doom games
|
||||
include("Includes\\Game_Doom.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to text map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_udmf");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Doom games
|
||||
include("Includes\\Game_Doom.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to Hexen map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_hexen");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Heretic games
|
||||
include("Includes\\Game_Heretic.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to text map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_udmf");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Heretic games
|
||||
include("Includes\\Game_Heretic.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to Hexen map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_hexen");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Hexen games
|
||||
include("Includes\\Game_Hexen.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to text map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_udmf");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Hexen games
|
||||
include("Includes\\Game_Hexen.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to Hexen map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_hexen");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Strife games
|
||||
include("Includes\\Game_Strife.cfg");
|
||||
|
||||
|
|
|
@ -26,6 +26,9 @@ include("Includes\\ZDoom_common.cfg", "common");
|
|||
// Settings common to text map format
|
||||
include("Includes\\ZDoom_common.cfg", "mapformat_udmf");
|
||||
|
||||
// mxd. Default script compiler
|
||||
defaultscriptcompiler = "zandronum_acs.cfg";
|
||||
|
||||
// Settings common to Strife games
|
||||
include("Includes\\Game_Strife.cfg");
|
||||
|
||||
|
|
1168
Build/Scripting/BCS.cfg
Normal file
1168
Build/Scripting/BCS.cfg
Normal file
File diff suppressed because it is too large
Load diff
|
@ -10,6 +10,7 @@ casesensitive = false;
|
|||
insertcase = 1; // 0=Normal, 1=Lowercase, 2=Uppercase
|
||||
lexer = 35; // CPP-style, case-insensitive
|
||||
keywordhelp = "http://zdoom.org/wiki/MODELDEF";
|
||||
scripttype = 2; //0 = unknown script, 1 = acc, 2 = modeldef, 3 = decorate
|
||||
|
||||
keywords
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ argumentdelimiter = ",";
|
|||
terminator = ";";
|
||||
keywordhelp = "http://www.zdoom.org/wiki/index.php?title=%K";
|
||||
snippetsdir = "acs";
|
||||
scripttype = 1; //0 = unknown script, 1 = acc, 2 = modeldef, 3 = decorate
|
||||
|
||||
keywords
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ argumentdelimiter = ",";
|
|||
terminator = ";";
|
||||
keywordhelp = "http://www.zdoom.org/wiki/index.php?title=%K";
|
||||
snippetsdir = "acs";
|
||||
scripttype = 1; //0 = unknown script, 1 = acc, 2 = modeldef, 3 = decorate
|
||||
|
||||
keywords
|
||||
{
|
||||
|
|
|
@ -14,6 +14,7 @@ functionclose = ")";
|
|||
argumentdelimiter = ",";
|
||||
terminator = ";";
|
||||
keywordhelp = "http://www.zdoom.org/wiki/index.php?title=%K";
|
||||
scripttype = 3; //0 = unknown script, 1 = acc, 2 = modeldef, 3 = decorate
|
||||
|
||||
keywords
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@ parameters = "-I \"%PT\" -I \"%PS\" %FI %FO";
|
|||
resultlump = "BEHAVIOR";
|
||||
|
||||
// Editor settings
|
||||
description = "Skulltag ACS script";
|
||||
description = "Zandronum ACS script";
|
||||
codepage = 0;
|
||||
extensions = "acs";
|
||||
casesensitive = false;
|
||||
|
@ -20,6 +20,7 @@ argumentdelimiter = ",";
|
|||
terminator = ";";
|
||||
keywordhelp = "http://www.zdoom.org/wiki/index.php?title=%K";
|
||||
snippetsdir = "acs";
|
||||
scripttype = 1; //0 = unknown script, 1 = acc, 2 = modeldef, 3 = decorate
|
||||
|
||||
keywords
|
||||
{
|
|
@ -704,6 +704,12 @@
|
|||
<Compile Include="Controls\PasteOptionsControl.Designer.cs">
|
||||
<DependentUpon>PasteOptionsControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\SectorSlopeControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\SectorSlopeControl.Designer.cs">
|
||||
<DependentUpon>SectorSlopeControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\StatisticsControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
|
@ -796,7 +802,6 @@
|
|||
<Compile Include="GZBuilder\Data\ModelData.cs" />
|
||||
<Compile Include="GZBuilder\Data\ModelLoadState.cs" />
|
||||
<Compile Include="GZBuilder\Data\ScriptItem.cs" />
|
||||
<Compile Include="GZBuilder\Data\ScriptType.cs" />
|
||||
<Compile Include="GZBuilder\Data\SharpCompressHelper.cs" />
|
||||
<Compile Include="GZBuilder\Data\TextureData.cs" />
|
||||
<Compile Include="GZBuilder\Rendering\SizelessVisualThingCage.cs" />
|
||||
|
@ -931,6 +936,9 @@
|
|||
<SubType>Designer</SubType>
|
||||
<DependentUpon>PasteOptionsControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\SectorSlopeControl.resx">
|
||||
<DependentUpon>SectorSlopeControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\StatisticsControl.resx">
|
||||
<DependentUpon>StatisticsControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
|
@ -53,6 +53,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private string defaultlumpname;
|
||||
private string nodebuildersave;
|
||||
private string nodebuildertest;
|
||||
private readonly string defaultscriptcompiler; //mxd
|
||||
private DataLocationList resources;
|
||||
private Configuration config; //mxd
|
||||
private bool enabled; //mxd
|
||||
|
@ -76,6 +77,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public string DefaultLumpName { get { return defaultlumpname; } }
|
||||
public string NodebuilderSave { get { return nodebuildersave; } internal set { nodebuildersave = value; } }
|
||||
public string NodebuilderTest { get { return nodebuildertest; } internal set { nodebuildertest = value; } }
|
||||
public string DefaultScriptCompiler { get { return defaultscriptcompiler; } } //mxd
|
||||
internal DataLocationList Resources { get { return resources; } }
|
||||
internal Configuration Configuration { get { return config; } } //mxd
|
||||
public bool Enabled { get { return enabled; } internal set { enabled = value; } } //mxd
|
||||
|
@ -116,6 +118,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
// Load settings from program configuration
|
||||
this.nodebuildersave = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildersave", MISSING_NODEBUILDER);
|
||||
this.nodebuildertest = General.Settings.ReadSetting("configurations." + settingskey + ".nodebuildertest", MISSING_NODEBUILDER);
|
||||
this.defaultscriptcompiler = cfg.ReadSetting("defaultscriptcompiler", ""); //mxd
|
||||
this.resources = new DataLocationList(General.Settings.Config, "configurations." + settingskey + ".resources");
|
||||
this.startmode = General.Settings.ReadSetting("configurations." + settingskey + ".startmode", "VerticesMode");
|
||||
this.enabled = General.Settings.ReadSetting("configurations." + settingskey + ".enabled", config.ReadSetting("enabledbydefault", false)); //mxd
|
||||
|
|
|
@ -25,12 +25,13 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public struct MapLumpInfo
|
||||
{
|
||||
// Members
|
||||
public string name;
|
||||
public bool required;
|
||||
public bool blindcopy;
|
||||
public bool nodebuild;
|
||||
public bool allowempty;
|
||||
internal ScriptConfiguration script;
|
||||
public readonly string name;
|
||||
public readonly bool required;
|
||||
public readonly bool blindcopy;
|
||||
public readonly bool nodebuild;
|
||||
public readonly bool allowempty;
|
||||
public readonly bool scriptbuild; //mxd
|
||||
internal readonly ScriptConfiguration script;
|
||||
|
||||
// Construct from IDictionary
|
||||
internal MapLumpInfo(string name, Configuration cfg)
|
||||
|
@ -42,6 +43,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
this.blindcopy = cfg.ReadSetting("maplumpnames." + name + ".blindcopy", false);
|
||||
this.nodebuild = cfg.ReadSetting("maplumpnames." + name + ".nodebuild", false);
|
||||
this.allowempty = cfg.ReadSetting("maplumpnames." + name + ".allowempty", false);
|
||||
this.scriptbuild = cfg.ReadSetting("maplumpnames." + name + ".scriptbuild", false); //mxd
|
||||
string scriptconfig = cfg.ReadSetting("maplumpnames." + name + ".script", "");
|
||||
|
||||
// Find script configuration
|
||||
|
|
|
@ -26,6 +26,14 @@ using CodeImp.DoomBuilder.IO;
|
|||
|
||||
namespace CodeImp.DoomBuilder.Config
|
||||
{
|
||||
//mxd
|
||||
internal enum ScriptType {
|
||||
UNKNOWN = 0,
|
||||
ACS = 1,
|
||||
MODELDEF = 2,
|
||||
DECORATE = 3,
|
||||
}
|
||||
|
||||
internal class ScriptConfiguration : IComparable<ScriptConfiguration>
|
||||
{
|
||||
#region ================== Constants
|
||||
|
@ -52,6 +60,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private readonly string argumentdelimiter;
|
||||
private readonly string terminator;
|
||||
private readonly string functionregex;
|
||||
private readonly ScriptType scripttype; //mxd
|
||||
|
||||
// Collections
|
||||
private readonly Dictionary<string, string> keywords;
|
||||
|
@ -82,6 +91,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public string ArgumentDelimiter { get { return argumentdelimiter; } }
|
||||
public string Terminator { get { return terminator; } }
|
||||
public string FunctionRegEx { get { return functionregex; } }
|
||||
public ScriptType ScriptType { get { return scripttype; } } //mxd
|
||||
public Dictionary<string, string[]> Snippets { get { return snippets; } } //mxd
|
||||
|
||||
// Collections
|
||||
|
@ -116,6 +126,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
terminator = "";
|
||||
functionregex = "";
|
||||
description = "Plain text";
|
||||
scripttype = ScriptType.UNKNOWN; //mxd
|
||||
extensions = new[] { "txt" };
|
||||
snippets = new Dictionary<string, string[]>(StringComparer.Ordinal); //mxd
|
||||
}
|
||||
|
@ -146,6 +157,7 @@ namespace CodeImp.DoomBuilder.Config
|
|||
argumentdelimiter = cfg.ReadSetting("argumentdelimiter", "");
|
||||
terminator = cfg.ReadSetting("terminator", "");
|
||||
functionregex = cfg.ReadSetting("functionregex", "");
|
||||
scripttype = (ScriptType)cfg.ReadSetting("scripttype", (int)ScriptType.UNKNOWN); //mxd
|
||||
|
||||
// Make extensions array
|
||||
extensions = extensionsstring.Split(',');
|
||||
|
@ -262,6 +274,12 @@ namespace CodeImp.DoomBuilder.Config
|
|||
{
|
||||
return string.Compare(this.description, other.description, true);
|
||||
}
|
||||
|
||||
//mxd
|
||||
public override string ToString()
|
||||
{
|
||||
return description;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
|
@ -310,8 +310,24 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
protected void updateNavigator()
|
||||
{
|
||||
//mxd. known script type?
|
||||
if (Array.IndexOf(ScriptTypes.TYPES, config.Description) != -1) {
|
||||
updateNavigator(new MemoryStream(editor.GetText()), config.Description);
|
||||
if (config.ScriptType != ScriptType.UNKNOWN) {
|
||||
switch(config.ScriptType) {
|
||||
case ScriptType.ACS:
|
||||
updateNavigatorAcs(new MemoryStream(editor.GetText()));
|
||||
break;
|
||||
|
||||
case ScriptType.DECORATE:
|
||||
updateNavigatorDecorate(new MemoryStream(editor.GetText()));
|
||||
break;
|
||||
|
||||
case ScriptType.MODELDEF:
|
||||
updateNavigatorModeldef(new MemoryStream(editor.GetText()));
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Script type " + config.ScriptType + " navigator support is not implemented!");
|
||||
}
|
||||
|
||||
navigator.Enabled = true;
|
||||
}else{
|
||||
navigator.Items.Clear();
|
||||
|
@ -319,18 +335,6 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void updateNavigator(MemoryStream stream, string scriptType)
|
||||
{
|
||||
if (scriptType == ScriptTypes.TYPES[(int)ScriptType.ACS]) {
|
||||
updateNavigatorAcs(stream);
|
||||
} else if (scriptType == ScriptTypes.TYPES[(int)ScriptType.MODELDEF]) {
|
||||
updateNavigatorModeldef(stream);
|
||||
} else if (scriptType == ScriptTypes.TYPES[(int)ScriptType.DECORATE]) {
|
||||
updateNavigatorDecorate(stream);
|
||||
}
|
||||
}
|
||||
|
||||
//mxd
|
||||
private void updateNavigatorDecorate(MemoryStream stream)
|
||||
{
|
||||
|
@ -384,7 +388,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
{
|
||||
ScriptTypeParserSE parser = new ScriptTypeParserSE();
|
||||
if (parser.Parse(new MemoryStream(editor.GetText()), config.Description)) {
|
||||
if (parser.ScriptType != (int)ScriptType.UNKNOWN && config.Description != ScriptTypes.TYPES[(int)parser.ScriptType])
|
||||
if (parser.ScriptType != ScriptType.UNKNOWN && config.ScriptType != parser.ScriptType)
|
||||
return parser.ScriptType;
|
||||
}
|
||||
return ScriptType.UNKNOWN;
|
||||
|
|
|
@ -114,6 +114,12 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
// Load this!
|
||||
ScriptLumpDocumentTab t = new ScriptLumpDocumentTab(this, maplumpinfo.name, maplumpinfo.script);
|
||||
tabs.TabPages.Add(t);
|
||||
}
|
||||
else if(maplumpinfo.scriptbuild) //mxd
|
||||
{
|
||||
// Load this!
|
||||
ScriptLumpDocumentTab t = new ScriptLumpDocumentTab(this, maplumpinfo.name, General.CompiledScriptConfigs[General.Map.Options.ScriptCompiler]);
|
||||
tabs.TabPages.Add(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -525,9 +531,8 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
//mxd
|
||||
ScriptType st = t.VerifyScriptType();
|
||||
if (st != ScriptType.UNKNOWN) {
|
||||
string cfgType = ScriptTypes.TYPES[(int)st];
|
||||
foreach (ScriptConfiguration cfg in scriptconfigs) {
|
||||
if (cfg.Description == cfgType) {
|
||||
if (cfg.ScriptType == st) {
|
||||
t.ChangeScriptConfig(cfg);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
SetTitle("Untitled" + ext);
|
||||
editor.ClearUndoRedo();
|
||||
//mxd
|
||||
navigator.Enabled = Array.IndexOf(ScriptTypes.TYPES, config.Description) != -1;
|
||||
navigator.Enabled = (config.ScriptType != ScriptType.UNKNOWN);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -119,7 +119,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
}
|
||||
|
||||
//mxd. Should be called only if script is compiled successfully
|
||||
if (compiler.Errors.Length == 0 && config.Description == ScriptTypes.TYPES[(int)ScriptType.ACS]) {
|
||||
if (compiler.Errors.Length == 0 && config.ScriptType == ScriptType.ACS) {
|
||||
General.Map.UpdateScriptNames();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ namespace CodeImp.DoomBuilder.Controls
|
|||
success = General.Map.CompileLump(lumpname, true);
|
||||
|
||||
//mxd
|
||||
if (success && config.Description == ScriptTypes.TYPES[(int)ScriptType.ACS])
|
||||
if (success && config.ScriptType == ScriptType.ACS)
|
||||
General.Map.UpdateScriptNames();
|
||||
|
||||
// Feed errors to panel
|
||||
|
|
201
Source/Core/Controls/SectorSlopeControl.Designer.cs
generated
Normal file
201
Source/Core/Controls/SectorSlopeControl.Designer.cs
generated
Normal file
|
@ -0,0 +1,201 @@
|
|||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
partial class SectorSlopeControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if(disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.slopeangle = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.label23 = new System.Windows.Forms.Label();
|
||||
this.sloperotation = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.label24 = new System.Windows.Forms.Label();
|
||||
this.reset = new System.Windows.Forms.Button();
|
||||
this.slopeoffset = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
|
||||
this.label18 = new System.Windows.Forms.Label();
|
||||
this.rotationcontrol = new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl();
|
||||
this.angletrackbar = new System.Windows.Forms.TrackBar();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.pivotmodeselector = new System.Windows.Forms.ComboBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.angletrackbar)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// slopeangle
|
||||
//
|
||||
this.slopeangle.AllowDecimal = true;
|
||||
this.slopeangle.AllowNegative = true;
|
||||
this.slopeangle.AllowRelative = true;
|
||||
this.slopeangle.ButtonStep = 1;
|
||||
this.slopeangle.ButtonStepFloat = 1F;
|
||||
this.slopeangle.Location = new System.Drawing.Point(85, 78);
|
||||
this.slopeangle.Name = "slopeangle";
|
||||
this.slopeangle.Size = new System.Drawing.Size(82, 24);
|
||||
this.slopeangle.StepValues = null;
|
||||
this.slopeangle.TabIndex = 29;
|
||||
this.slopeangle.WhenTextChanged += new System.EventHandler(this.slopeangle_WhenTextChanged);
|
||||
//
|
||||
// label23
|
||||
//
|
||||
this.label23.Location = new System.Drawing.Point(3, 83);
|
||||
this.label23.Name = "label23";
|
||||
this.label23.Size = new System.Drawing.Size(76, 14);
|
||||
this.label23.TabIndex = 28;
|
||||
this.label23.Text = "Slope angle:";
|
||||
this.label23.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// sloperotation
|
||||
//
|
||||
this.sloperotation.AllowDecimal = true;
|
||||
this.sloperotation.AllowNegative = true;
|
||||
this.sloperotation.AllowRelative = true;
|
||||
this.sloperotation.ButtonStep = 1;
|
||||
this.sloperotation.ButtonStepFloat = 1F;
|
||||
this.sloperotation.Location = new System.Drawing.Point(85, 48);
|
||||
this.sloperotation.Name = "sloperotation";
|
||||
this.sloperotation.Size = new System.Drawing.Size(82, 24);
|
||||
this.sloperotation.StepValues = null;
|
||||
this.sloperotation.TabIndex = 27;
|
||||
this.sloperotation.WhenTextChanged += new System.EventHandler(this.sloperotation_WhenTextChanged);
|
||||
//
|
||||
// label24
|
||||
//
|
||||
this.label24.Location = new System.Drawing.Point(3, 53);
|
||||
this.label24.Name = "label24";
|
||||
this.label24.Size = new System.Drawing.Size(76, 14);
|
||||
this.label24.TabIndex = 26;
|
||||
this.label24.Text = "Rotation:";
|
||||
this.label24.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// reset
|
||||
//
|
||||
this.reset.Location = new System.Drawing.Point(85, 138);
|
||||
this.reset.Name = "reset";
|
||||
this.reset.Size = new System.Drawing.Size(82, 23);
|
||||
this.reset.TabIndex = 25;
|
||||
this.reset.Text = "Reset";
|
||||
this.reset.UseVisualStyleBackColor = true;
|
||||
this.reset.Click += new System.EventHandler(this.reset_Click);
|
||||
//
|
||||
// slopeoffset
|
||||
//
|
||||
this.slopeoffset.AllowDecimal = true;
|
||||
this.slopeoffset.AllowNegative = true;
|
||||
this.slopeoffset.AllowRelative = true;
|
||||
this.slopeoffset.ButtonStep = 1;
|
||||
this.slopeoffset.ButtonStepFloat = 16F;
|
||||
this.slopeoffset.Location = new System.Drawing.Point(85, 108);
|
||||
this.slopeoffset.Name = "slopeoffset";
|
||||
this.slopeoffset.Size = new System.Drawing.Size(82, 24);
|
||||
this.slopeoffset.StepValues = null;
|
||||
this.slopeoffset.TabIndex = 24;
|
||||
this.slopeoffset.WhenTextChanged += new System.EventHandler(this.slopeoffset_WhenTextChanged);
|
||||
//
|
||||
// label18
|
||||
//
|
||||
this.label18.Location = new System.Drawing.Point(3, 113);
|
||||
this.label18.Name = "label18";
|
||||
this.label18.Size = new System.Drawing.Size(76, 14);
|
||||
this.label18.TabIndex = 23;
|
||||
this.label18.Text = "Height offset:";
|
||||
this.label18.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// rotationcontrol
|
||||
//
|
||||
this.rotationcontrol.Angle = 0;
|
||||
this.rotationcontrol.Location = new System.Drawing.Point(173, 36);
|
||||
this.rotationcontrol.Name = "rotationcontrol";
|
||||
this.rotationcontrol.Size = new System.Drawing.Size(44, 44);
|
||||
this.rotationcontrol.TabIndex = 56;
|
||||
this.rotationcontrol.AngleChanged += new CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl.AngleChangedDelegate(this.rotationcontrol_AngleChanged);
|
||||
//
|
||||
// angletrackbar
|
||||
//
|
||||
this.angletrackbar.Location = new System.Drawing.Point(173, 82);
|
||||
this.angletrackbar.Maximum = 85;
|
||||
this.angletrackbar.Minimum = -85;
|
||||
this.angletrackbar.Name = "angletrackbar";
|
||||
this.angletrackbar.Size = new System.Drawing.Size(175, 45);
|
||||
this.angletrackbar.TabIndex = 57;
|
||||
this.angletrackbar.TickFrequency = 10;
|
||||
this.angletrackbar.ValueChanged += new System.EventHandler(this.angletrackbar_ValueChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(3, 12);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(76, 14);
|
||||
this.label1.TabIndex = 58;
|
||||
this.label1.Text = "Pivot:";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// pivotmodeselector
|
||||
//
|
||||
this.pivotmodeselector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.pivotmodeselector.FormattingEnabled = true;
|
||||
this.pivotmodeselector.Items.AddRange(new object[] {
|
||||
"Origin",
|
||||
"Selection center",
|
||||
"Sector center"});
|
||||
this.pivotmodeselector.Location = new System.Drawing.Point(85, 9);
|
||||
this.pivotmodeselector.Name = "pivotmodeselector";
|
||||
this.pivotmodeselector.Size = new System.Drawing.Size(132, 21);
|
||||
this.pivotmodeselector.TabIndex = 59;
|
||||
this.pivotmodeselector.SelectedIndexChanged += new System.EventHandler(this.pivotmodeselector_SelectedIndexChanged);
|
||||
//
|
||||
// SectorSlopeControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
|
||||
this.Controls.Add(this.pivotmodeselector);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.angletrackbar);
|
||||
this.Controls.Add(this.rotationcontrol);
|
||||
this.Controls.Add(this.slopeangle);
|
||||
this.Controls.Add(this.label23);
|
||||
this.Controls.Add(this.sloperotation);
|
||||
this.Controls.Add(this.label24);
|
||||
this.Controls.Add(this.reset);
|
||||
this.Controls.Add(this.slopeoffset);
|
||||
this.Controls.Add(this.label18);
|
||||
this.Name = "SectorSlopeControl";
|
||||
this.Size = new System.Drawing.Size(353, 169);
|
||||
((System.ComponentModel.ISupportInitialize)(this.angletrackbar)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ButtonsNumericTextbox slopeangle;
|
||||
private System.Windows.Forms.Label label23;
|
||||
private ButtonsNumericTextbox sloperotation;
|
||||
private System.Windows.Forms.Label label24;
|
||||
private System.Windows.Forms.Button reset;
|
||||
private ButtonsNumericTextbox slopeoffset;
|
||||
private System.Windows.Forms.Label label18;
|
||||
private CodeImp.DoomBuilder.GZBuilder.Controls.AngleControl rotationcontrol;
|
||||
private System.Windows.Forms.TrackBar angletrackbar;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox pivotmodeselector;
|
||||
}
|
||||
}
|
165
Source/Core/Controls/SectorSlopeControl.cs
Normal file
165
Source/Core/Controls/SectorSlopeControl.cs
Normal file
|
@ -0,0 +1,165 @@
|
|||
using System;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Geometry;
|
||||
|
||||
namespace CodeImp.DoomBuilder.Controls
|
||||
{
|
||||
#region ================== Enums
|
||||
|
||||
internal enum SlopePivotMode
|
||||
{
|
||||
ORIGIN, // pivot around 0, 0
|
||||
GLOBAL, // pivot around globalslopepivot
|
||||
LOCAL, // pivot around localslopepivots
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public partial class SectorSlopeControl : UserControl
|
||||
{
|
||||
|
||||
#region ================== Events
|
||||
|
||||
public event EventHandler OnValuesChanged; //mxd
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Variables
|
||||
|
||||
private static SlopePivotMode pivotmode = SlopePivotMode.LOCAL;
|
||||
internal SlopePivotMode PivotMode { get { return pivotmode; } }
|
||||
|
||||
private bool blockUpdate;
|
||||
|
||||
//slope values
|
||||
private float anglexy;
|
||||
private float anglez;
|
||||
private float offset;
|
||||
|
||||
public float AngleXY { get { return anglexy; } }
|
||||
public float AngleZ { get { return anglez; } }
|
||||
public float Offset { get { return offset; } }
|
||||
|
||||
#endregion
|
||||
|
||||
public SectorSlopeControl() {
|
||||
InitializeComponent();
|
||||
pivotmodeselector.SelectedIndex = (int) pivotmode;
|
||||
}
|
||||
|
||||
#region ================== Methods
|
||||
|
||||
public void SetValues(float anglexy, float anglez, float offset, bool first) {
|
||||
blockUpdate = true;
|
||||
|
||||
//update values
|
||||
if (first) {
|
||||
this.anglexy = anglexy;
|
||||
this.anglez = anglez;
|
||||
this.offset = offset;
|
||||
} else {
|
||||
if(!float.IsNaN(this.anglexy) && this.anglexy != anglexy) this.anglexy = float.NaN;
|
||||
if(!float.IsNaN(this.anglez) && this.anglez != anglez) this.anglez = float.NaN;
|
||||
if(!float.IsNaN(this.offset) && this.offset != offset) this.offset = float.NaN;
|
||||
}
|
||||
|
||||
//update controls
|
||||
if(float.IsNaN(this.anglexy)) {
|
||||
sloperotation.Text = "";
|
||||
rotationcontrol.Angle = 0;
|
||||
} else {
|
||||
sloperotation.Text = this.anglexy.ToString();
|
||||
rotationcontrol.Angle = (int)Math.Round(Angle2D.RadToDeg(this.anglexy));
|
||||
}
|
||||
|
||||
if(float.IsNaN(this.anglez)) {
|
||||
slopeangle.Text = "";
|
||||
angletrackbar.Value = 0;
|
||||
} else {
|
||||
slopeangle.Text = this.anglez.ToString();
|
||||
angletrackbar.Value = General.Clamp((int)Math.Round(Angle2D.RadToDeg(this.anglez)), angletrackbar.Minimum, angletrackbar.Maximum);
|
||||
}
|
||||
|
||||
slopeoffset.Text = float.IsNaN(this.offset) ? "" : this.offset.ToString();
|
||||
|
||||
blockUpdate = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ================== Events
|
||||
|
||||
private void sloperotation_WhenTextChanged(object sender, EventArgs e) {
|
||||
if(blockUpdate) return;
|
||||
blockUpdate = true;
|
||||
|
||||
anglexy = Angle2D.DegToRad(sloperotation.GetResultFloat(0f));
|
||||
rotationcontrol.Angle = (int)Math.Round(sloperotation.GetResultFloat(0f));
|
||||
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
blockUpdate = false;
|
||||
}
|
||||
|
||||
private void rotationcontrol_AngleChanged() {
|
||||
if(blockUpdate) return;
|
||||
blockUpdate = true;
|
||||
|
||||
sloperotation.Text = rotationcontrol.Angle.ToString();
|
||||
anglexy = Angle2D.DegToRad(rotationcontrol.Angle);
|
||||
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
blockUpdate = false;
|
||||
}
|
||||
|
||||
private void slopeangle_WhenTextChanged(object sender, EventArgs e) {
|
||||
if(blockUpdate) return;
|
||||
blockUpdate = true;
|
||||
|
||||
int anglezdeg = General.Clamp((int)Math.Round(slopeangle.GetResultFloat(0f)), angletrackbar.Minimum, angletrackbar.Maximum);
|
||||
angletrackbar.Value = anglezdeg;
|
||||
anglez = Angle2D.DegToRad(anglezdeg);
|
||||
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
blockUpdate = false;
|
||||
}
|
||||
|
||||
private void angletrackbar_ValueChanged(object sender, EventArgs e) {
|
||||
if(blockUpdate) return;
|
||||
blockUpdate = true;
|
||||
|
||||
slopeangle.Text = angletrackbar.Value.ToString();
|
||||
anglez = Angle2D.DegToRad(angletrackbar.Value);
|
||||
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
blockUpdate = false;
|
||||
}
|
||||
|
||||
private void slopeoffset_WhenTextChanged(object sender, EventArgs e) {
|
||||
offset = slopeoffset.GetResultFloat(0f);
|
||||
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void reset_Click(object sender, EventArgs e) {
|
||||
blockUpdate = true;
|
||||
|
||||
sloperotation.Text = "0";
|
||||
rotationcontrol.Angle = 0;
|
||||
slopeangle.Text = "0";
|
||||
angletrackbar.Value = 0;
|
||||
slopeoffset.Text = "0";
|
||||
anglexy = 0f;
|
||||
anglez = 0f;
|
||||
offset = 0f;
|
||||
|
||||
if (OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
|
||||
blockUpdate = false;
|
||||
}
|
||||
|
||||
private void pivotmodeselector_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
pivotmode = (SlopePivotMode)pivotmodeselector.SelectedIndex;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
120
Source/Core/Controls/SectorSlopeControl.resx
Normal file
120
Source/Core/Controls/SectorSlopeControl.resx
Normal file
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -26,7 +26,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Controls
|
|||
private bool allowValueLinking;
|
||||
private bool linkValues;
|
||||
private bool blockUpdate;
|
||||
private int bResetOffsetX;
|
||||
private readonly int bResetOffsetX;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.Data {
|
||||
internal enum ScriptType {
|
||||
UNKNOWN = 0,
|
||||
ACS = 1,
|
||||
MODELDEF = 2,
|
||||
DECORATE = 3,
|
||||
}
|
||||
|
||||
internal struct ScriptTypes {
|
||||
private static string[] knownScriptTypes = { "UNKNOWN SCRIPT", "ZDoom ACS script", "GZDoom MODELDEF", "ZDoom DECORATE" };
|
||||
internal static string[] TYPES { get { return knownScriptTypes; } }
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.ZDoom;
|
||||
using CodeImp.DoomBuilder.GZBuilder.Data;
|
||||
|
||||
//mxd. Parser used to determine which script type given text is.
|
||||
namespace CodeImp.DoomBuilder.GZBuilder.GZDoom {
|
||||
|
|
|
@ -176,6 +176,7 @@ namespace CodeImp.DoomBuilder
|
|||
private static List<CompilerInfo> compilers;
|
||||
private static List<NodebuilderInfo> nodebuilders;
|
||||
private static Dictionary<string, ScriptConfiguration> scriptconfigs;
|
||||
private static Dictionary<string, ScriptConfiguration> compiledscriptconfigs; //mxd
|
||||
|
||||
// States
|
||||
private static bool debugbuild;
|
||||
|
@ -216,6 +217,7 @@ namespace CodeImp.DoomBuilder
|
|||
internal static List<NodebuilderInfo> Nodebuilders { get { return nodebuilders; } }
|
||||
internal static List<CompilerInfo> Compilers { get { return compilers; } }
|
||||
internal static Dictionary<string, ScriptConfiguration> ScriptConfigs { get { return scriptconfigs; } }
|
||||
internal static Dictionary<string, ScriptConfiguration> CompiledScriptConfigs { get { return compiledscriptconfigs; } } //mxd
|
||||
public static MapManager Map { get { return map; } }
|
||||
public static ActionManager Actions { get { return actions; } }
|
||||
public static HintsManager Hints { get { return hints; } } //mxd
|
||||
|
@ -404,6 +406,7 @@ namespace CodeImp.DoomBuilder
|
|||
|
||||
// Make collection
|
||||
scriptconfigs = new Dictionary<string, ScriptConfiguration>(StringComparer.Ordinal);
|
||||
compiledscriptconfigs = new Dictionary<string, ScriptConfiguration>(StringComparer.Ordinal); //mxd
|
||||
|
||||
// Go for all cfg files in the scripts directory
|
||||
filenames = Directory.GetFiles(scriptspath, "*.cfg", SearchOption.TopDirectoryOnly);
|
||||
|
@ -429,6 +432,10 @@ namespace CodeImp.DoomBuilder
|
|||
ScriptConfiguration scfg = new ScriptConfiguration(cfg);
|
||||
string filename = Path.GetFileName(filepath);
|
||||
scriptconfigs.Add(filename.ToLowerInvariant(), scfg);
|
||||
|
||||
//mxd. Store acc compilers in a separate dictionary
|
||||
if(scfg.ScriptType == ScriptType.ACS)
|
||||
compiledscriptconfigs.Add(filename.ToLowerInvariant(), scfg);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
|
|
@ -1398,7 +1398,7 @@ namespace CodeImp.DoomBuilder {
|
|||
// Go for all the map lumps
|
||||
foreach (MapLumpInfo lumpinfo in config.MapLumps.Values) {
|
||||
// Is this a script lump?
|
||||
if (lumpinfo.script != null) {
|
||||
if(lumpinfo.script != null || lumpinfo.scriptbuild) {
|
||||
// Compile it now
|
||||
success &= CompileLump(lumpinfo.name, false);
|
||||
}
|
||||
|
@ -1416,7 +1416,12 @@ namespace CodeImp.DoomBuilder {
|
|||
string reallumpname = lumpname;
|
||||
|
||||
//mxd. Does lump require compiling?
|
||||
ScriptConfiguration scriptconfig = config.MapLumps[lumpname].script;
|
||||
ScriptConfiguration scriptconfig;
|
||||
if(config.MapLumps[lumpname].scriptbuild) {
|
||||
scriptconfig = General.CompiledScriptConfigs[General.Map.Options.ScriptCompiler];
|
||||
} else {
|
||||
scriptconfig = config.MapLumps[lumpname].script;
|
||||
}
|
||||
if (scriptconfig.Compiler == null) return true;
|
||||
|
||||
// Find the lump
|
||||
|
|
|
@ -57,6 +57,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Script files opened
|
||||
private List<string> scriptfiles;
|
||||
|
||||
// mxd. Script compiler
|
||||
private string scriptcompiler;
|
||||
|
||||
//mxd. Sector drawing options
|
||||
private string defaultfloortexture;
|
||||
private string defaultceiltexture;
|
||||
|
@ -85,6 +88,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
internal DataLocationList Resources { get { return resources; } }
|
||||
internal bool StrictPatches { get { return strictpatches; } set { strictpatches = value; } }
|
||||
internal List<string> ScriptFiles { get { return scriptfiles; } set { scriptfiles = value; } }
|
||||
internal string ScriptCompiler { get { return scriptcompiler; } set { scriptcompiler = value; } } //mxd
|
||||
internal string PreviousName { get { return previousname; } set { previousname = value; } }
|
||||
internal string CurrentName
|
||||
{
|
||||
|
@ -140,6 +144,7 @@ namespace CodeImp.DoomBuilder.Map
|
|||
this.resources = new DataLocationList();
|
||||
this.mapconfig = new Configuration(true);
|
||||
this.scriptfiles = new List<string>();
|
||||
this.scriptcompiler = ""; //mxd
|
||||
this.tagLabels = new Dictionary<int, string>(); //mxd
|
||||
|
||||
//mxd. Sector drawing options
|
||||
|
@ -182,6 +187,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
tagLabels.Add(tag, label);
|
||||
}
|
||||
|
||||
//mxd. Script compiler
|
||||
scriptcompiler = this.mapconfig.ReadSetting("scriptcompiler", string.Empty);
|
||||
|
||||
//mxd. Read Sector drawing options
|
||||
defaultfloortexture = this.mapconfig.ReadSetting("defaultfloortexture", string.Empty);
|
||||
defaultceiltexture = this.mapconfig.ReadSetting("defaultceiltexture", string.Empty);
|
||||
|
@ -321,6 +329,9 @@ namespace CodeImp.DoomBuilder.Map
|
|||
// Write grid settings
|
||||
General.Map.Grid.WriteToConfig(mapconfig, "grid");
|
||||
|
||||
//mxd. Write script compiler
|
||||
if(!string.IsNullOrEmpty(scriptcompiler)) mapconfig.WriteSetting("scriptcompiler", scriptcompiler);
|
||||
|
||||
// Write scripts to config
|
||||
mapconfig.DeleteSetting("scripts");
|
||||
for(int i = 0; i < scriptfiles.Count; i++)
|
||||
|
|
|
@ -2300,7 +2300,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
|
||||
// Get configuration setting
|
||||
filename = General.Settings.ReadSetting("recentfiles.file" + i, "");
|
||||
if(filename != "")
|
||||
if(filename != "" && File.Exists(filename))
|
||||
{
|
||||
// Set up item
|
||||
int number = i + 1;
|
||||
|
|
48
Source/Core/Windows/MapOptionsForm.Designer.cs
generated
48
Source/Core/Windows/MapOptionsForm.Designer.cs
generated
|
@ -33,6 +33,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
System.Windows.Forms.Label label1;
|
||||
System.Windows.Forms.GroupBox panelsettings;
|
||||
System.Windows.Forms.Label label4;
|
||||
this.scriptcompiler = new System.Windows.Forms.ComboBox();
|
||||
this.scriptcompilerlabel = new System.Windows.Forms.Label();
|
||||
this.levelname = new System.Windows.Forms.TextBox();
|
||||
this.config = new System.Windows.Forms.ComboBox();
|
||||
this.apply = new System.Windows.Forms.Button();
|
||||
|
@ -52,7 +54,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new System.Drawing.Point(239, 60);
|
||||
label3.Location = new System.Drawing.Point(239, 83);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new System.Drawing.Size(90, 14);
|
||||
label3.TabIndex = 9;
|
||||
|
@ -61,7 +63,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new System.Drawing.Point(58, 60);
|
||||
label2.Location = new System.Drawing.Point(58, 83);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new System.Drawing.Size(65, 14);
|
||||
label2.TabIndex = 7;
|
||||
|
@ -69,17 +71,19 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new System.Drawing.Point(18, 27);
|
||||
label1.Location = new System.Drawing.Point(13, 27);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new System.Drawing.Size(105, 14);
|
||||
label1.Size = new System.Drawing.Size(110, 14);
|
||||
label1.TabIndex = 5;
|
||||
label1.Text = "Game Configuration:";
|
||||
label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// panelsettings
|
||||
//
|
||||
panelsettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
panelsettings.Controls.Add(this.scriptcompiler);
|
||||
panelsettings.Controls.Add(this.scriptcompilerlabel);
|
||||
panelsettings.Controls.Add(label3);
|
||||
panelsettings.Controls.Add(this.levelname);
|
||||
panelsettings.Controls.Add(label2);
|
||||
|
@ -87,15 +91,35 @@ 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(397, 88);
|
||||
panelsettings.Size = new System.Drawing.Size(397, 112);
|
||||
panelsettings.TabIndex = 0;
|
||||
panelsettings.TabStop = false;
|
||||
panelsettings.Text = " Settings ";
|
||||
//
|
||||
// scriptcompiler
|
||||
//
|
||||
this.scriptcompiler.DropDownHeight = 206;
|
||||
this.scriptcompiler.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.scriptcompiler.FormattingEnabled = true;
|
||||
this.scriptcompiler.IntegralHeight = false;
|
||||
this.scriptcompiler.Location = new System.Drawing.Point(129, 52);
|
||||
this.scriptcompiler.Name = "scriptcompiler";
|
||||
this.scriptcompiler.Size = new System.Drawing.Size(254, 22);
|
||||
this.scriptcompiler.TabIndex = 10;
|
||||
//
|
||||
// scriptcompilerlabel
|
||||
//
|
||||
this.scriptcompilerlabel.Location = new System.Drawing.Point(13, 55);
|
||||
this.scriptcompilerlabel.Name = "scriptcompilerlabel";
|
||||
this.scriptcompilerlabel.Size = new System.Drawing.Size(110, 14);
|
||||
this.scriptcompilerlabel.TabIndex = 11;
|
||||
this.scriptcompilerlabel.Text = "Script Language:";
|
||||
this.scriptcompilerlabel.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// levelname
|
||||
//
|
||||
this.levelname.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
|
||||
this.levelname.Location = new System.Drawing.Point(129, 57);
|
||||
this.levelname.Location = new System.Drawing.Point(129, 80);
|
||||
this.levelname.MaxLength = 8;
|
||||
this.levelname.Name = "levelname";
|
||||
this.levelname.Size = new System.Drawing.Size(94, 20);
|
||||
|
@ -128,7 +152,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(297, 358);
|
||||
this.apply.Location = new System.Drawing.Point(297, 378);
|
||||
this.apply.Name = "apply";
|
||||
this.apply.Size = new System.Drawing.Size(112, 25);
|
||||
this.apply.TabIndex = 2;
|
||||
|
@ -140,7 +164,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(179, 358);
|
||||
this.cancel.Location = new System.Drawing.Point(179, 378);
|
||||
this.cancel.Name = "cancel";
|
||||
this.cancel.Size = new System.Drawing.Size(112, 25);
|
||||
this.cancel.TabIndex = 3;
|
||||
|
@ -155,7 +179,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
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, 106);
|
||||
this.panelres.Location = new System.Drawing.Point(12, 130);
|
||||
this.panelres.Name = "panelres";
|
||||
this.panelres.Size = new System.Drawing.Size(397, 240);
|
||||
this.panelres.TabIndex = 1;
|
||||
|
@ -188,7 +212,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
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(421, 391);
|
||||
this.ClientSize = new System.Drawing.Size(421, 411);
|
||||
this.Controls.Add(this.panelres);
|
||||
this.Controls.Add(this.cancel);
|
||||
this.Controls.Add(this.apply);
|
||||
|
@ -221,6 +245,8 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
private System.Windows.Forms.GroupBox panelres;
|
||||
private CodeImp.DoomBuilder.Controls.ResourceListEditor datalocations;
|
||||
private System.Windows.Forms.CheckBox strictpatches;
|
||||
private System.Windows.Forms.ComboBox scriptcompiler;
|
||||
private System.Windows.Forms.Label scriptcompilerlabel;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#region ================== Namespaces
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Data;
|
||||
|
@ -96,6 +97,46 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd
|
||||
if(General.Map != null) datalocations.StartPath = General.Map.FilePathName;
|
||||
|
||||
//mxd. Set script compiler
|
||||
if (config.SelectedIndex != -1)
|
||||
{
|
||||
ConfigurationInfo ci = config.SelectedItem as ConfigurationInfo;
|
||||
|
||||
foreach(KeyValuePair<string, ScriptConfiguration> group in General.CompiledScriptConfigs)
|
||||
{
|
||||
scriptcompiler.Items.Add(group.Value);
|
||||
if(group.Key == options.ScriptCompiler)
|
||||
scriptcompiler.SelectedIndex = scriptcompiler.Items.Count - 1;
|
||||
}
|
||||
|
||||
//Nothing selected? Let's try default one form the game configuration, if we have any
|
||||
if(scriptcompiler.SelectedIndex == -1 && !string.IsNullOrEmpty(ci.DefaultScriptCompiler))
|
||||
{
|
||||
int cfgindex = 0;
|
||||
|
||||
foreach(KeyValuePair<string, ScriptConfiguration> group in General.CompiledScriptConfigs)
|
||||
{
|
||||
if(group.Key == ci.DefaultScriptCompiler)
|
||||
{
|
||||
scriptcompiler.SelectedIndex = cfgindex;
|
||||
break;
|
||||
}
|
||||
cfgindex++;
|
||||
}
|
||||
}
|
||||
|
||||
if(General.CompiledScriptConfigs.Count == 0 || string.IsNullOrEmpty(ci.DefaultScriptCompiler))
|
||||
{
|
||||
scriptcompiler.Enabled = false;
|
||||
scriptcompilerlabel.Enabled = false;
|
||||
}
|
||||
else if (scriptcompiler.SelectedIndex == -1 && scriptcompiler.Items.Count > 0)
|
||||
{
|
||||
scriptcompiler.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set the level name
|
||||
if (!string.IsNullOrEmpty(options.CurrentName)) levelname.Text = options.CurrentName; //mxd
|
||||
|
||||
|
@ -208,6 +249,21 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
options.CurrentName = levelname.Text.Trim().ToUpper();
|
||||
options.StrictPatches = strictpatches.Checked;
|
||||
options.CopyResources(datalocations.GetResources());
|
||||
|
||||
//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
|
||||
this.DialogResult = DialogResult.OK;
|
||||
|
@ -237,6 +293,22 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
// Get default lump name from configuration
|
||||
levelname.Text = ci.DefaultLumpName;
|
||||
}
|
||||
|
||||
//mxd
|
||||
bool enablescriptcompiler = !string.IsNullOrEmpty(ci.DefaultScriptCompiler);
|
||||
scriptcompiler.Enabled = enablescriptcompiler;
|
||||
scriptcompilerlabel.Enabled = enablescriptcompiler;
|
||||
|
||||
//mxd. Select default script compiler for this game configuration
|
||||
if (scriptcompiler.Enabled)
|
||||
{
|
||||
if (General.CompiledScriptConfigs.ContainsKey(ci.DefaultScriptCompiler))
|
||||
scriptcompiler.SelectedItem = General.CompiledScriptConfigs[ci.DefaultScriptCompiler];
|
||||
}
|
||||
else
|
||||
{
|
||||
scriptcompiler.SelectedIndex = -1;
|
||||
}
|
||||
|
||||
// Show resources
|
||||
datalocations.FixedResourceLocationList(ci.Resources);
|
||||
|
|
Loading…
Reference in a new issue