GZDoom Builder 1.11:

Enhanced scripting workflow.
Thing and linedef arguments can now have default value in configuration files.
Fixed laggy visual camera movement on systems with big uptime.
Fixed incorrect alignment of Things with "hangs" flag in GZDoom Visual mode.
Fixed Editor crash when nodebuilder fails to build map. A window with error description will be shown instead.
Doom light levels were used even in maps in non-doom map format.

Tag Explorer plugin:
Elements list wasn't updated when map element was deleted.
Pugin wasn't disposed properly, which may led to Doom Builder 2 crash on map close.
Fixed plugin crash after opening another map.
Fixed unresponsive text entry in Filter text box.
Fixed plugin crash when Doom Builder can't determmine thing category ("UNKNOWN" category will be used instead).
This commit is contained in:
MaxED 2012-07-10 10:20:45 +00:00
parent fcd29375c8
commit 5cb573d938
52 changed files with 2654 additions and 2047 deletions

View file

@ -19,18 +19,22 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Intensity";
default = 64;
}
}
9801
@ -39,22 +43,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Start intensity";
default = 64;
}
arg4
{
title = "End intensity";
default = 32;
}
}
9802
@ -63,22 +72,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Primary intensity";
default = 64;
}
arg4
{
title = "Secondary intensity";
default = 32;
}
}
9803
@ -87,18 +101,22 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Intensity scale";
default = 4;
}
}
9804
@ -107,22 +125,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Minimal intensity";
default = 32;
}
arg4
{
title = "Maximal intensity";
default = 64;
}
}
9810
@ -131,18 +154,22 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Intensity";
default = 64;
}
}
9811
@ -151,22 +178,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Start intensity";
default = 32;
}
arg4
{
title = "End intensity";
default = 64;
}
}
9812
@ -175,22 +207,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Primary intensity";
default = 64;
}
arg4
{
title = "Secondary intensity";
default = 32;
}
}
9813
@ -199,18 +236,22 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Intensity scale";
default = 4;
}
}
9814
@ -219,22 +260,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Minimal intensity";
default = 32;
}
arg4
{
title = "Maximal intensity";
default = 64;
}
}
9820
@ -243,18 +289,22 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Radius";
default = 64;
}
}
9821
@ -263,22 +313,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Start intensity";
default = 32;
}
arg4
{
title = "End intensity";
default = 64;
}
}
9822
@ -287,22 +342,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Primary intensity";
default = 32;
}
arg4
{
title = "Secondary intensity";
default = 64;
}
}
9823
@ -311,18 +371,22 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Intensity scale";
default = 4;
}
}
9824
@ -331,22 +395,27 @@ gzdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
title = "Minimal intensity";
default = 32;
}
arg4
{
title = "Maximal intensity";
default = 64;
}
}
9825 = "Vavoom Light";
@ -356,6 +425,7 @@ gzdoom
arg0
{
title = "Radius";
default = 16;
}
}
1503
@ -364,18 +434,22 @@ gzdoom
arg0
{
title = "Radius";
default = 16;
}
arg1
{
title = "Red";
default = 255;
}
arg2
{
title = "Green";
default = 255;
}
arg3
{
title = "Blue";
default = 255;
}
}
}

View file

@ -59,12 +59,6 @@ common
include("Boom_misc.cfg", "colormaps");
}
// DEFAULT SECTOR BRIGHTNESS LEVELS
sectorbrightness
{
include("Doom_misc.cfg", "sectorbrightness");
}
// Generalized sector types
gen_sectortypes
{
@ -112,6 +106,12 @@ mapformat_doom
{
include("Boom_generalized.cfg", "gen_linedeftypes");
}
// DEFAULT SECTOR BRIGHTNESS LEVELS
sectorbrightness
{
include("Doom_misc.cfg", "sectorbrightness");
}
// SECTOR TYPES
sectortypes
@ -204,6 +204,12 @@ mapformat_hexen
// Generalized actions
generalizedlinedefs = false;
// DEFAULT SECTOR BRIGHTNESS LEVELS
sectorbrightness
{
include("ZDoom_misc.cfg", "sectorbrightness");
}
// SECTOR TYPES
sectortypes
@ -318,6 +324,12 @@ mapformat_udmf
// Generalized actions
generalizedlinedefs = false;
// DEFAULT SECTOR BRIGHTNESS LEVELS
sectorbrightness
{
include("ZDoom_misc.cfg", "sectorbrightness");
}
// SECTOR TYPES
sectortypes

View file

@ -206,6 +206,11 @@ universalfields
add = "Additive";
}
}
arg0str
{
type = 2;
default = "";
}
}
sidedef
@ -343,6 +348,11 @@ universalfields
type = 0;
default = 0;
}
arg0str
{
type = 2;
default = "";
}
}
sector

View file

@ -540,14 +540,17 @@ zdoom
arg0
{
title = "Red";
default = 255;
}
arg1
{
title = "Green";
default = 255;
}
arg2
{
title = "Blue";
default = 255;
}
arg3
{
@ -560,14 +563,17 @@ zdoom
arg0
{
title = "Red";
default = 128;
}
arg1
{
title = "Green";
default = 128;
}
arg2
{
title = "Blue";
default = 128;
}
}
9041
@ -759,10 +765,12 @@ zdoom
arg2
{
title = "X Scale (64=100%)";
default = 64;
}
arg3
{
title = "Y Scale (64=100%) ";
default = 64;
}
arg4
{
@ -798,6 +806,7 @@ zdoom
arg0
{
title = "Flat Transparency";
default = 128;
}
}
@ -807,6 +816,7 @@ zdoom
arg0
{
title = "Flat Transparency";
default = 128;
}
}
}

View file

@ -233,9 +233,13 @@
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="New settings">
<param name="Local" value="gz_settings.html">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="Enhanced scripting workflow">
<param name="Local" value="gz_acsex.html">
</OBJECT>
<UL>
</UL>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="New editing modes">
<param name="Local" value="gz_editmodes.html">

39
Help/gz_acsex.html Normal file
View file

@ -0,0 +1,39 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GZDoom Builder features</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" title="Default" />
</head>
<body>
<object type="application/x-oleobject" classid="clsid:1e2a7bd0-dab9-11d0-b93a-00c04fc99f9e">
<param name="keyword" value="Template">
</object>
<div id="gz_title"><h1>Enhanced scripting workflow</h1></div>
<div id="contents">
<p><img style="float:left; margin-right:10px" src="gz_scripteditor.jpg"/><b>GZDoom Builder</b> includes several features to help you edit and assign scripts easier.</br></br>
Script editor now has "Script names" drop down, which allows you to view and select individual scripts faster.</br>
<h3>Pseudo-named scripts</h3>
If you add a comment after script opening brace like so:</br>
<code>script 1 (void)</br>
{ //My Pseudo-named script</br>
...</br>
}</br></code>
it will be used as script name in "Script names" drop down and in Thing and Linedef Edit windows drop downs (example script will be named as "[1] My Pseudo-named script").</br></br>
<b>Notice:</b> "Script names" drop down items are updated when you compile script successfully.
</p>
</div>
<div id="contents" style="clear: left">
<p><img style="float:left; margin-right:10px" src="gz_thing1.jpg"/><img style="float:left; clear: left; margin-right:10px" src="gz_thing2.jpg"/>Thing and Linedef scripts can now be set much easier.</br></br>
<b>Notice:</b> to remove named or regular script, clear script selector text box</p>
</div>
<div id="contents" style="clear: left">
<p><img style="float:left; margin-right:10px" src="gz_infoex.jpg"/>If a Thing or Linedef has named script, it will be shown in info panel.</p>
</div>
</body>

View file

@ -18,8 +18,18 @@
</div>
<div id="contents">
<p><b>basegame</b> - indicates on which game current configuration is based. Used to load game-specific GLDEFS lumps (DOOMDEFS, HTICDEFS, HEXNDEFS or STRFDEFS)</br>
<p><h3>General settings:</h3></br><b>basegame</b> - indicates on which game current configuration is based. Used to load game-specific GLDEFS lumps (DOOMDEFS, HTICDEFS, HEXNDEFS or STRFDEFS)</br>
<b>Possile values:</b> 0 (DOOM), 1 (HERETIC), 2 (HEXEN) or 3 (STRIFE).</br>
<b>Example:</b> <code>basegame = 0;</code></p>
<h3>Thing and linedef definition:</h3>
Default values can be set in Thing and Linedef argument definitions.</br>
<b>Example:</b> </br>
<code>arg1</br>
{</br>
title = "Speed";</br>
default = 100;</br>
}</br></code></p>
</div>
</body>

View file

@ -22,6 +22,7 @@
<li>Dynamic lights (all types) are rendered in Visual modes.</li>
<li>Dynamic lights defined in GLDEFS are rendered in Visual modes.</li>
<li>Animated lights.</li>
<li><a href="gz_acsex.html">Enhanced scripting workflow</a>.</li>
<li>Partial <a href="gz_gldefs.html">GLDEFS</a> and <a href="gz_mapinfo.html">(Z)MAPINFO support.</a></li>
<li>Fog rendering (including colored fog in maps in UDMF format).</li>
<li><a href="gz_gldefs.html">MD2 and MD3 models</a> rendering in 2D and 3D modes.</li>
@ -30,6 +31,7 @@
<li><a href="gz_actions.html#newtestmap">"Test Map from current position"</a> feature.</li>
<li><a href="gz_settings.html">"Sync camera position between 2D and 3D modes"</a> feature.</li>
<li><a href="gz_actions.html#movethingtocursor">"Place Things at cursor position in Visual Modes"</a> feature.</li>
<li>PNG image format support.</li>
<li><a href="gz_plug_colorpicker.html">Color Picker plugin.</a></li>
<li><a href="gz_plug_udmfcontrols.html">UDMF Controls plugin.</a></li>

BIN
Help/gz_infoex.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
Help/gz_scripteditor.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

BIN
Help/gz_thing1.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
Help/gz_thing2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View file

@ -718,6 +718,7 @@
<Compile Include="GZBuilder\Data\GZDoomLight.cs" />
<Compile Include="GZBuilder\Data\MapInfo.cs" />
<Compile Include="GZBuilder\Data\ModeldefEntry.cs" />
<Compile Include="GZBuilder\Data\ScriptItem.cs" />
<Compile Include="GZBuilder\Data\TextureData.cs" />
<Compile Include="GZBuilder\Data\ThingBoundingBox.cs" />
<Compile Include="GZBuilder\GZDoom\GldefsParser.cs" />
@ -727,6 +728,7 @@
<Compile Include="GZBuilder\GZGeneral.cs" />
<Compile Include="GZBuilder\md3\GZModel.cs" />
<Compile Include="GZBuilder\md3\ModelReader.cs" />
<Compile Include="GZBuilder\ZDoom\AcsParser.cs" />
<Compile Include="IO\DoomColormapReader.cs" />
<Compile Include="Map\SelectionType.cs" />
<Compile Include="Map\MapElementCollection.cs" />

View file

@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TagExplorer", "..\Plugins\T
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UDMFControls", "..\Plugins\UMDFControls\UDMFControls.csproj", "{2D11C828-295C-463A-8545-CA1AD6D51518}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ColorPicker", "..\Plugins\ColorPicker\ColorPicker.csproj", "{A4761900-0EA3-4FE4-A919-847FD5080EFC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -71,6 +73,16 @@ Global
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{2D11C828-295C-463A-8545-CA1AD6D51518}.Release|x86.ActiveCfg = Release|Any CPU
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Any CPU.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|Mixed Platforms.Build.0 = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.ActiveCfg = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Debug|x86.Build.0 = Debug|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Any CPU.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|Mixed Platforms.Build.0 = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.ActiveCfg = Release|x86
{A4761900-0EA3-4FE4-A919-847FD5080EFC}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -89,11 +89,15 @@ namespace CodeImp.DoomBuilder.Compilers
processinfo = new ProcessStartInfo();
processinfo.Arguments = args;
processinfo.FileName = Path.Combine(this.tempdir.FullName, info.ProgramFile);
processinfo.CreateNoWindow = false;
processinfo.CreateNoWindow = true; //mxd. was false
processinfo.ErrorDialog = false;
processinfo.UseShellExecute = true;
processinfo.UseShellExecute = false; //mxd. was true
processinfo.WindowStyle = ProcessWindowStyle.Hidden;
processinfo.WorkingDirectory = this.workingdir;
//mxd
processinfo.RedirectStandardError = true;
processinfo.RedirectStandardOutput = true;
// Output info
General.WriteLogLine("Running compiler...");
@ -111,12 +115,37 @@ namespace CodeImp.DoomBuilder.Compilers
General.ShowErrorMessage("Unable to start the compiler (" + info.Name + "). " + e.GetType().Name + ": " + e.Message, MessageBoxButtons.OK);
return false;
}
//mxd
string outErr = process.StandardError.ReadToEnd();
string outMsg = process.StandardOutput.ReadToEnd();
// Wait for compiler to complete
process.WaitForExit();
//mxd
bool errorsInNormalOurput = (outMsg.Length > 0 && outMsg.ToLowerInvariant().IndexOf("error") != -1);
//zdbsp actually writes building process here, not error info
bool errorsInErrorOutput = (outErr.Length > 0 && outErr.ToLowerInvariant().IndexOf("error") != -1);
deltatime = TimeSpan.FromTicks(process.ExitTime.Ticks - process.StartTime.Ticks);
General.WriteLogLine("Compiler process has finished.");
General.WriteLogLine("Compiler process has finished " + (errorsInNormalOurput || errorsInErrorOutput ? "with errors." : ".")); //mxd
General.WriteLogLine("Compile time: " + deltatime.TotalSeconds.ToString("########0.00") + " seconds");
//mxd
if (process.ExitCode > 0 || errorsInNormalOurput || errorsInErrorOutput) {
if (errorsInNormalOurput) {
ReportError(new CompilerError(outMsg));
General.WriteLogLine("Normal output: " + outMsg);
}
if (errorsInErrorOutput) {
ReportError(new CompilerError(outErr));
General.WriteLogLine("Error output: " + outErr);
}
return false;
}
return true;
}

View file

@ -42,6 +42,8 @@ namespace CodeImp.DoomBuilder.Config
private bool used;
private int type;
private EnumList enumlist;
//mxd
private object defaultValue;
#endregion
@ -51,6 +53,8 @@ namespace CodeImp.DoomBuilder.Config
public bool Used { get { return used; } }
public int Type { get { return type; } }
public EnumList Enum { get { return enumlist; } }
//mxd
public object DefaultValue { get { return defaultValue; } }
#endregion
@ -65,6 +69,9 @@ namespace CodeImp.DoomBuilder.Config
this.title = cfg.ReadSetting(argspath + ".arg" + istr + ".title", "Argument " + (argindex + 1));
this.type = cfg.ReadSetting(argspath + ".arg" + istr + ".type", 0);
//mxd
this.defaultValue = cfg.ReadSetting(argspath + ".arg" + istr + ".default", 0);
// Determine enum type
EnumList enumlist = null;
IDictionary argdic = cfg.ReadSetting(argspath + ".arg" + istr, new Hashtable());

View file

@ -41,6 +41,8 @@ namespace CodeImp.DoomBuilder.Controls
private TypeHandler typehandler;
private bool ignorebuttonchange = false;
//mxd
private ArgumentInfo arginfo;
#endregion
@ -171,7 +173,9 @@ namespace CodeImp.DoomBuilder.Controls
// This sets up the control for a specific argument
public void Setup(ArgumentInfo arginfo)
{
int oldvalue = 0;
this.arginfo = arginfo; //mxd
int oldvalue = 0;
// Get the original value
if(typehandler != null) oldvalue = typehandler.GetIntValue();
@ -225,6 +229,14 @@ namespace CodeImp.DoomBuilder.Controls
combobox_Validating(this, new CancelEventArgs());
}
//mxd. this sets default value
public void SetDefaultValue() {
typehandler.SetDefaultValue();
combobox.SelectedItem = null;
combobox.Text = typehandler.GetStringValue();
combobox_Validating(this, new CancelEventArgs());
}
// This clears the value
public void ClearValue()
{

View file

@ -33,6 +33,7 @@ using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using CodeImp.DoomBuilder.Map;
using System.Globalization;
using CodeImp.DoomBuilder.Types;
#endregion
@ -237,6 +238,48 @@ namespace CodeImp.DoomBuilder.Controls
// Sort fields
Sort();
}
//mxd
public object GetValue(string name) {
//have required row?
foreach (DataGridViewRow row in fieldslist.Rows) {
// Row is a field?
if (row is FieldsEditorRow) {
FieldsEditorRow frow = row as FieldsEditorRow;
// Row name matches with field
if (frow.Name == name) {
// Apply value of field to row
if (frow.IsDefined && !frow.IsEmpty)
return frow.GetResult(null);
return null;
}
}
}
return null;
}
//mxd
public void SetValue(string name, object value, UniversalType type) {
//have required row?
foreach (DataGridViewRow row in fieldslist.Rows) {
// Row is a field?
if (row is FieldsEditorRow) {
FieldsEditorRow frow = row as FieldsEditorRow;
// Row name matches with field
if (frow.Name == name) {
// Apply value of field to row
frow.Define(value);
return;
}
}
}
//no such row... let's add it
FieldsEditorRow newfrow = new FieldsEditorRow(fieldslist, name, (int)type, value);
fieldslist.Rows.Insert(fieldslist.Rows.Count - 1, newfrow);
}
// This applies the current fields to a UniFields object
public void Apply(UniFields tofields)

View file

@ -29,6 +29,7 @@ using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.GZBuilder;
#endregion
@ -113,9 +114,12 @@ namespace CodeImp.DoomBuilder.Controls
angle.Text = l.AngleDeg.ToString() + "\u00B0";
tag.Text = l.Tag.ToString();
unpegged.Text = peggedness;
//mxd
bool hasArg0Str = General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, l.Action) != -1 && l.Fields.ContainsKey("arg0str");
// Arguments
arglbl1.Text = act.Args[0].Title + ":";
arglbl1.Text = hasArg0Str ? "Script name:" : act.Args[0].Title + ":"; //mxd
arglbl2.Text = act.Args[1].Title + ":";
arglbl3.Text = act.Args[2].Title + ":";
arglbl4.Text = act.Args[3].Title + ":";
@ -130,8 +134,14 @@ namespace CodeImp.DoomBuilder.Controls
arg3.Enabled = act.Args[2].Used;
arg4.Enabled = act.Args[3].Used;
arg5.Enabled = act.Args[4].Used;
th = General.Types.GetArgumentHandler(act.Args[0]);
th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue();
//mxd
if (hasArg0Str) {
arg1.Text = '"' + l.Fields["arg0str"].Value.ToString() + '"';
} else {
th = General.Types.GetArgumentHandler(act.Args[0]);
th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue();
}
th = General.Types.GetArgumentHandler(act.Args[1]);
th.SetValue(l.Args[1]); arg2.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[2]);

View file

@ -39,8 +39,9 @@ namespace CodeImp.DoomBuilder.Controls
internal abstract class ScriptDocumentTab : TabPage
{
#region ================== Constants
private const int EDITOR_BORDER_TOP = 8;
private const int NAVIGATOR_BORDER_TOP = 8; //mxd
private const int EDITOR_BORDER_TOP = 33;
private const int EDITOR_BORDER_BOTTOM = 4;
private const int EDITOR_BORDER_LEFT = 4;
private const int EDITOR_BORDER_RIGHT = 4;
@ -51,6 +52,8 @@ namespace CodeImp.DoomBuilder.Controls
// The script edit control
protected ScriptEditorControl editor;
//mxd
protected ComboBox navigator;
// Derived classes must set this!
protected ScriptConfiguration config;
@ -82,6 +85,17 @@ namespace CodeImp.DoomBuilder.Controls
{
// Keep panel
this.panel = panel;
//mxd
navigator = new ComboBox();
navigator.Location = new Point(EDITOR_BORDER_LEFT, NAVIGATOR_BORDER_TOP);
navigator.Width = this.ClientSize.Width - EDITOR_BORDER_LEFT - EDITOR_BORDER_RIGHT;
navigator.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
navigator.DropDownStyle = ComboBoxStyle.DropDownList;
navigator.Name = "navigator";
navigator.TabStop = true;
navigator.TabIndex = 0;
this.Controls.Add(navigator);
// Make the script control
editor = new ScriptEditorControl();
@ -91,7 +105,7 @@ namespace CodeImp.DoomBuilder.Controls
editor.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
editor.Name = "editor";
editor.TabStop = true;
editor.TabIndex = 0;
editor.TabIndex = 1;
this.Controls.Add(editor);
// Bind events

View file

@ -137,7 +137,18 @@ namespace CodeImp.DoomBuilder.Controls
}
// Select the first tab
if(tabs.TabPages.Count > 0) tabs.SelectedIndex = 0;
//if(tabs.TabPages.Count > 0) tabs.SelectedIndex = 0;
//mxd. Select "Scripts" tab, because that's what user will want 99% of time
if (tabs.TabPages.Count > 0) {
foreach (TabPage p in tabs.TabPages) {
if (p.Text == "SCRIPTS") {
tabs.SelectedTab = p;
break;
}
}
if (tabs.SelectedIndex == -1) tabs.SelectedIndex = 0;
}
// If the map has remembered any compile errors, then show them
ShowErrors(General.Map.Errors);

View file

@ -20,6 +20,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
@ -31,6 +32,8 @@ using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.IO;
using System.IO;
using CodeImp.DoomBuilder.Compilers;
//mxd
using CodeImp.DoomBuilder.GZBuilder.Data;
#endregion
@ -91,6 +94,14 @@ namespace CodeImp.DoomBuilder.Controls
SetTitle(General.Map.Options.CurrentName);
else
SetTitle(this.lumpname.ToUpper());
//mxd
if (this.Text == "SCRIPTS") {
updateNavigator();
navigator.SelectedIndexChanged += new EventHandler(navigator_SelectedIndexChanged);
}else{
navigator.Enabled = false;
}
}
// Disposer
@ -102,6 +113,37 @@ namespace CodeImp.DoomBuilder.Controls
#endregion
#region ================== Methods
//mxd
private void updateNavigator() {
string selectedItem = "";
int selectedIndex = 0;
if (navigator.SelectedIndex != -1) selectedItem = navigator.Text;
navigator.Items.Clear();
//add named scripts
int i = 0;
if (General.Map.UDMF) {
ScriptItem[] namedScripts = new ScriptItem[General.Map.NamedScripts.Count];
foreach (ScriptItem si in General.Map.NamedScripts) {
namedScripts[i++] = si;
if (si.Name == selectedItem) selectedIndex = i - 1;
}
navigator.Items.AddRange(namedScripts);
}
//add numbered scripts
ScriptItem[] numberedScripts = new ScriptItem[General.Map.NumberedScripts.Count];
int c = 0;
foreach (ScriptItem si in General.Map.NumberedScripts) {
numberedScripts[c++] = si;
if (si.Name == selectedItem) selectedIndex = i - 1 + c;
}
navigator.Items.AddRange(numberedScripts);
if (navigator.Items.Count > 0) navigator.SelectedIndex = selectedIndex;
}
// Compile script
public override void Compile()
@ -114,6 +156,14 @@ namespace CodeImp.DoomBuilder.Controls
// Feed errors to panel
panel.ShowErrors(General.Map.Errors);
//mxd
if (General.Map.Errors.Count == 0) {
General.Map.UpdateScriptNames();
navigator.SelectedIndexChanged -= navigator_SelectedIndexChanged;
updateNavigator();
navigator.SelectedIndexChanged += new EventHandler(navigator_SelectedIndexChanged);
}
}
// Implicit save
@ -135,7 +185,17 @@ namespace CodeImp.DoomBuilder.Controls
#endregion
#region ================== Events
//mxd
private void navigator_SelectedIndexChanged(object sender, EventArgs e) {
if (navigator.SelectedItem is ScriptItem) {
ScriptItem si = navigator.SelectedItem as ScriptItem;
editor.EnsureLineVisible(editor.LineFromPosition(si.SelectionStart));
editor.SelectionStart = si.SelectionStart;
editor.SelectionEnd = si.SelectionEnd;
}
}
#endregion
}
}

View file

@ -30,6 +30,9 @@ using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Types;
using CodeImp.DoomBuilder.IO;
//mxd
using CodeImp.DoomBuilder.GZBuilder.Data;
using CodeImp.DoomBuilder.GZBuilder;
#endregion
@ -166,7 +169,10 @@ namespace CodeImp.DoomBuilder.Controls
// Arguments
if(act != null)
{
arglbl1.Text = act.Args[0].Title + ":";
//mxd
bool hasArg0Str = General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, t.Action) != -1 && t.Fields.ContainsKey("arg0str");
arglbl1.Text = hasArg0Str ? "Script name:" : act.Args[0].Title + ":"; //mxd
arglbl2.Text = act.Args[1].Title + ":";
arglbl3.Text = act.Args[2].Title + ":";
arglbl4.Text = act.Args[3].Title + ":";
@ -181,8 +187,14 @@ namespace CodeImp.DoomBuilder.Controls
arg3.Enabled = act.Args[2].Used;
arg4.Enabled = act.Args[3].Used;
arg5.Enabled = act.Args[4].Used;
th = General.Types.GetArgumentHandler(act.Args[0]);
th.SetValue(t.Args[0]); arg1.Text = th.GetStringValue();
//mxd
if (hasArg0Str) {
arg1.Text = '"' + t.Fields["arg0str"].Value.ToString() + '"';
} else {
th = General.Types.GetArgumentHandler(act.Args[0]);
th.SetValue(t.Args[0]); arg1.Text = th.GetStringValue();
}
th = General.Types.GetArgumentHandler(act.Args[1]);
th.SetValue(t.Args[1]); arg2.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[2]);

View file

@ -17,47 +17,6 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data
Color = new Color3();
Offset = new Vector3();
}
public static int[] GetDefaultLightSettings(int type) {
int light_id = Array.IndexOf(GZBuilder.GZGeneral.GZ_LIGHTS, type);
if (light_id != -1) {
int[] args = new int[5];
if (light_id == (int)GZDoomLightType.VAVOOM_COLORED) {
args[0] = 16;
args[1] = 255;
args[2] = 255;
args[3] = 255;
} else if (light_id == (int)GZDoomLightType.VAVOOM) {
args[0] = 16;
} else {
int n;
if (light_id < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[0]) {
n = 0;
} else if (light_id < GZBuilder.GZGeneral.GZ_LIGHT_TYPES[1]) {
n = 10;
} else {
n = 20;
}
light_id = type - 9800 - n;
args[0] = 255;
args[1] = 255;
args[2] = 255;
if (light_id == (int)GZDoomLightType.SECTOR)
args[3] = 4;
else
args[3] = 64;
if (Array.IndexOf(GZBuilder.GZGeneral.GZ_ANIMATED_LIGHT_TYPES, light_id) != -1) {
args[4] = 32;
}
}
return args;
}
return null;
}
}
public enum GZDoomLightType : int

View file

@ -0,0 +1,34 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CodeImp.DoomBuilder.GZBuilder.Data {
public sealed class ScriptItem : Object {
private string name;
private int index;
private int selectionStart;
private int selectionEnd;
public string Name { get { return name; } }
public int Index { get { return index; } }
public int SelectionStart { get { return selectionStart; } }
public int SelectionEnd { get { return selectionEnd; } }
public ScriptItem(int index, string name, int selectionStart, int selectionEnd) {
this.name = name;
this.index = index;
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
}
public ScriptItem(int index, string name) {
this.name = name;
this.index = index;
}
public override string ToString() {
return name;
}
}
}

View file

@ -27,10 +27,12 @@ namespace CodeImp.DoomBuilder.GZBuilder
private static int[] gzAnimatedLightTypes = { (int)GZDoomLightType.FLICKER, (int)GZDoomLightType.RANDOM, (int)GZDoomLightType.PULSE };
public static int[] GZ_ANIMATED_LIGHT_TYPES { get { return gzAnimatedLightTypes; } }
public static bool UDMF;
//asc script action specials
private static int[] acsSpecials = { 80, 81, 82, 83, 84, 85, 226 };
public static int[] ACS_SPECIALS { get { return acsSpecials; } }
//version
public const float Version = 1.10f;
public const float Version = 1.11f;
//debug console
#if DEBUG
@ -52,14 +54,6 @@ namespace CodeImp.DoomBuilder.GZBuilder
#endif
}
public static void OnMapOpenEnd() {
UDMF = (General.Map.Config.FormatInterface == "UniversalMapSetIO");
General.MainWindow.UpdateGZDoomPannel();
//dbg
//GZBuilder.GZGeneral.Trace("GameConfiguration: loaded gametype " + General.Map.Config.GameType);
}
public static void OnReloadResources() {
#if DEBUG
((ConsoleDocker)console.Control).Clear();
@ -174,4 +168,4 @@ namespace CodeImp.DoomBuilder.GZBuilder
General.Map.Data.ReloadMapInfo();
}
}
}
}

View file

@ -0,0 +1,79 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using CodeImp.DoomBuilder.ZDoom;
using CodeImp.DoomBuilder.GZBuilder.Data;
namespace CodeImp.DoomBuilder.GZBuilder.ZDoom
{
public class AcsParser : ZDTextParser
{
private List<ScriptItem> namedScripts;
private List<ScriptItem> numberedScripts;
public List<ScriptItem> NamedScripts { get { return namedScripts; } }
public List<ScriptItem> NumberedScripts { get { return numberedScripts; } }
public AcsParser() {
namedScripts = new List<ScriptItem>();
numberedScripts = new List<ScriptItem>();
}
public override bool Parse(Stream stream, string sourcefilename) {
base.Parse(stream, sourcefilename);
// Continue until at the end of the stream
while (SkipWhitespace(true)) {
string token = ReadToken();
if (!string.IsNullOrEmpty(token)) {
token = token.ToLowerInvariant();
if (token == "script") {
int startPos = (int)stream.Position - 7;
SkipWhitespace(true);
token = ReadToken();
//is it named script?
if (token.IndexOf('"') != -1) {
token = StripTokenQuotes(token);
ScriptItem i = new ScriptItem(0, token, startPos, (int)stream.Position-1);
namedScripts.Add(i);
} else { //should be numbered script
int n = 0;
if (int.TryParse(token, NumberStyles.Integer, CultureInfo.InvariantCulture, out n)) {
int endPos = (int)stream.Position - 1;
//now find opening brace
do {
SkipWhitespace(true);
token = ReadToken();
} while (token != "{");
token = ReadLine();
string name = "";
if (token.Length > 0) {
int commentStart = token.IndexOf("//");
if (commentStart != -1) { //found comment
commentStart += 2;
name = token.Substring(commentStart, token.Length - commentStart);
}
}
name = (name != "" ? "[" + n + "] " + name : "Script " + n);
ScriptItem i = new ScriptItem(n, name, startPos, endPos);
numberedScripts.Add(i);
}
}
}
}
}
return true;
}
}
}

View file

@ -14,126 +14,36 @@
#endregion
#region ================== Namespaces
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
#endregion
using SlimDX;
namespace CodeImp.DoomBuilder
{
public class Clock
{
#region ================== Declarations
//#if !LINUX
[DllImport("kernel32.dll")]
private static extern short QueryPerformanceCounter(out long x);
[DllImport("kernel32.dll")]
private static extern short QueryPerformanceFrequency(out long x);
//#endif
#endregion
#region ================== Constants
#endregion
#region ================== Variables
// Settings
private double currenttime;
// Disposing
private bool isdisposed = false;
#endregion
#region ================== Properties
// Settings
public double CurrentTime { get { return currenttime; } }
// Disposing
public bool IsDisposed { get { return isdisposed; } }
#endregion
#region ================== Constructor / Disposer
// Constructor
public Clock()
{
public Clock(){
// We have no destructor
GC.SuppressFinalize(this);
}
// Disposer
public void Dispose()
{
public void Dispose(){
// Not already disposed?
if(!isdisposed)
{
// Clean up
// Done
if(!isdisposed) {
isdisposed = true;
}
}
#endregion
#region ================== Methods
// This queries the system for the current time
public double GetCurrentTime()
{
// Only windows has QPC
//#if !LINUX
long timefrequency;
// Get the high resolution clock frequency
if(QueryPerformanceFrequency(out timefrequency) == 0)
{
// No high resolution clock available
currenttime = (double)Environment.TickCount;
}
else
{
long timecount;
// Get the high resolution count
QueryPerformanceCounter(out timecount);
// Calculate high resolution time in milliseconds
// TODO: It seems there is a loss of precision here when the
// result of this math is assigned to currenttime, WHY?!
currenttime = (double)timecount / (double)timefrequency * (double)1000.0;
}
/*
#else
// In LINUX always use standard clock
currenttime = (double)Environment.TickCount;
#endif
*/
// Return the current time
return currenttime;
public double GetCurrentTime(){
return SlimDX.Configuration.Timer.ElapsedMilliseconds;
}
#endregion
}
}

View file

@ -671,7 +671,7 @@ namespace CodeImp.DoomBuilder
General.WriteLogLine("Creating types manager...");
types = new TypesManager();
//mxd. init gzdoombuilder
//mxd. init gzdoom builder
GZBuilder.GZGeneral.Init();
// Do auto map loading when window is delayed
@ -1019,6 +1019,8 @@ namespace CodeImp.DoomBuilder
mainwindow.RedrawDisplay();
mainwindow.UpdateThingsFilters();
mainwindow.UpdateInterface();
//mxd
mainwindow.UpdateGZDoomPannel();
mainwindow.HideInfo();
if(errorlogger.IsErrorAdded)
@ -1068,6 +1070,8 @@ namespace CodeImp.DoomBuilder
mainwindow.RedrawDisplay();
mainwindow.HideInfo();
mainwindow.UpdateThingsFilters();
//mxd
mainwindow.UpdateGZDoomPannel();
mainwindow.UpdateInterface();
mainwindow.DisplayReady();
General.WriteLogLine("Map unload done");
@ -1104,6 +1108,9 @@ namespace CodeImp.DoomBuilder
// Open map file
OpenMapFile(openfile.FileName, null);
//mxd
mainwindow.UpdateGZDoomPannel();
}
openfile.Dispose();

File diff suppressed because it is too large Load diff

View file

@ -188,13 +188,13 @@ namespace CodeImp.DoomBuilder.Plugins
/// <summary>
/// Occurs before test map is launched. Return false if map launch is not desired.
/// </summary>
public virtual bool OnMapTestBegin() { return true; }
//public virtual bool OnMapTestBegin() { return true; }
//mxd
/// <summary>
/// Occurs after game engine is closed.
/// </summary>
public virtual void OnMapTestEnd() { }
//public virtual void OnMapTestEnd() { }
/// <summary>
/// Occurs before the MapSet is changed. This means that the active MapSet will be disposed and changed to a new one.

View file

@ -303,7 +303,7 @@ namespace CodeImp.DoomBuilder.Plugins
public void OnPresentDisplayBegin() { foreach(Plugin p in plugins) p.Plug.OnPresentDisplayBegin(); }
//mxd. test map events
public bool OnMapTestBegin() {
/*public bool OnMapTestBegin() {
bool canLaunch;
foreach (Plugin p in plugins) {
canLaunch = p.Plug.OnMapTestBegin();
@ -311,7 +311,7 @@ namespace CodeImp.DoomBuilder.Plugins
}
return true;
}
public void OnMapTestEnd() { foreach (Plugin p in plugins) p.Plug.OnMapTestEnd(); }
public void OnMapTestEnd() { foreach (Plugin p in plugins) p.Plug.OnMapTestEnd(); }*/
#endregion
}

View file

@ -1097,10 +1097,7 @@ namespace CodeImp.DoomBuilder.Rendering
//mxd. returns true if sector has fog color
private bool getFogColor(Sector sector, out Color4 color) {
/*if(sector.Fields == null){
color = new Color4(); //black
return false;
} else*/ if (GZBuilder.GZGeneral.UDMF && sector.Fields.ContainsKey("fadecolor")) {
if (General.Map.UDMF && sector.Fields.ContainsKey("fadecolor")) {
color = new Color4((int)sector.Fields["fadecolor"].Value);
return true;
} else if (General.Map.Data.MapInfo.HasOutsideFogColor && sector.CeilTexture == General.Map.Config.SkyFlatName) {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 KiB

After

Width:  |  Height:  |  Size: 229 KiB

View file

@ -25,6 +25,7 @@ using CodeImp.DoomBuilder.IO;
using CodeImp.DoomBuilder.Data;
using System.IO;
using System.Diagnostics;
using CodeImp.DoomBuilder.Config;
#endregion
@ -40,6 +41,7 @@ namespace CodeImp.DoomBuilder.Types
#region ================== Variables
private int value;
private int defaultValue; //mxd
#endregion
@ -49,6 +51,12 @@ namespace CodeImp.DoomBuilder.Types
#region ================== Methods
//mxd
public override void SetupArgument(TypeHandlerAttribute attr, ArgumentInfo arginfo) {
defaultValue = (int)arginfo.DefaultValue;
base.SetupArgument(attr, arginfo);
}
public override void SetValue(object value)
{
int result;
@ -83,6 +91,10 @@ namespace CodeImp.DoomBuilder.Types
}
}
public override void SetDefaultValue() {
value = defaultValue;
}
public override object GetValue()
{
return this.value;
@ -90,7 +102,7 @@ namespace CodeImp.DoomBuilder.Types
public override int GetIntValue()
{
return this.value;
return this.value;
}
public override string GetStringValue()

View file

@ -64,7 +64,7 @@ namespace CodeImp.DoomBuilder.Types
public override void SetValue(object value)
{
if(value != null)
this.value = value.ToString();
this.value = value.ToString().Replace("\"", ""); //mxd
else
this.value = "";
}

View file

@ -133,6 +133,11 @@ namespace CodeImp.DoomBuilder.Types
// How the value is actually validated and stored is up to the implementation
public abstract void SetValue(object value);
//mxd. this should replace current value with default one
public virtual void SetDefaultValue() {
throw new NotSupportedException("Override this method to support default value for this type");
}
// This must return the value as one of the primitive data types
// supported by UDMF: int, string, float or bool
public abstract object GetValue();

View file

@ -45,6 +45,8 @@ namespace CodeImp.DoomBuilder.Windows
this.apply = new System.Windows.Forms.Button();
this.actiongroup = new System.Windows.Forms.GroupBox();
this.argspanel = new System.Windows.Forms.Panel();
this.arg0str = new System.Windows.Forms.ComboBox();
this.cbArgStr = new System.Windows.Forms.CheckBox();
this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg0 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
@ -282,26 +284,47 @@ namespace CodeImp.DoomBuilder.Windows
//
// argspanel
//
this.argspanel.Controls.Add(this.arg0str);
this.argspanel.Controls.Add(this.arg2);
this.argspanel.Controls.Add(this.arg1);
this.argspanel.Controls.Add(this.arg0);
this.argspanel.Controls.Add(this.arg3);
this.argspanel.Controls.Add(this.arg4);
this.argspanel.Controls.Add(this.arg1label);
this.argspanel.Controls.Add(this.arg0label);
this.argspanel.Controls.Add(this.arg3label);
this.argspanel.Controls.Add(this.arg2label);
this.argspanel.Controls.Add(this.arg4label);
this.argspanel.Controls.Add(this.cbArgStr);
this.argspanel.Controls.Add(this.arg0label);
this.argspanel.Location = new System.Drawing.Point(6, 54);
this.argspanel.Name = "argspanel";
this.argspanel.Size = new System.Drawing.Size(521, 83);
this.argspanel.TabIndex = 2;
this.argspanel.Visible = false;
//
// arg0str
//
this.arg0str.FormattingEnabled = true;
this.arg0str.Location = new System.Drawing.Point(272, 55);
this.arg0str.Name = "arg0str";
this.arg0str.Size = new System.Drawing.Size(125, 22);
this.arg0str.TabIndex = 38;
this.arg0str.Leave += new System.EventHandler(this.arg0str_Leave);
//
// cbArgStr
//
this.cbArgStr.Location = new System.Drawing.Point(8, -4);
this.cbArgStr.Name = "cbArgStr";
this.cbArgStr.Size = new System.Drawing.Size(63, 40);
this.cbArgStr.TabIndex = 37;
this.cbArgStr.Text = "Named script";
this.cbArgStr.UseVisualStyleBackColor = true;
this.cbArgStr.CheckedChanged += new System.EventHandler(this.cbArgStr_CheckedChanged);
//
// arg2
//
this.arg2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.arg2.Location = new System.Drawing.Point(123, 55);
this.arg2.Location = new System.Drawing.Point(157, 55);
this.arg2.Name = "arg2";
this.arg2.Size = new System.Drawing.Size(93, 24);
this.arg2.TabIndex = 2;
@ -309,7 +332,7 @@ namespace CodeImp.DoomBuilder.Windows
// arg1
//
this.arg1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.arg1.Location = new System.Drawing.Point(123, 29);
this.arg1.Location = new System.Drawing.Point(157, 29);
this.arg1.Name = "arg1";
this.arg1.Size = new System.Drawing.Size(93, 24);
this.arg1.TabIndex = 1;
@ -317,7 +340,7 @@ namespace CodeImp.DoomBuilder.Windows
// arg0
//
this.arg0.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.arg0.Location = new System.Drawing.Point(123, 3);
this.arg0.Location = new System.Drawing.Point(157, 3);
this.arg0.Name = "arg0";
this.arg0.Size = new System.Drawing.Size(93, 24);
this.arg0.TabIndex = 0;
@ -325,7 +348,7 @@ namespace CodeImp.DoomBuilder.Windows
// arg3
//
this.arg3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.arg3.Location = new System.Drawing.Point(364, 3);
this.arg3.Location = new System.Drawing.Point(398, 3);
this.arg3.Name = "arg3";
this.arg3.Size = new System.Drawing.Size(93, 24);
this.arg3.TabIndex = 3;
@ -333,14 +356,14 @@ namespace CodeImp.DoomBuilder.Windows
// arg4
//
this.arg4.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.arg4.Location = new System.Drawing.Point(364, 29);
this.arg4.Location = new System.Drawing.Point(398, 29);
this.arg4.Name = "arg4";
this.arg4.Size = new System.Drawing.Size(93, 24);
this.arg4.TabIndex = 4;
//
// arg1label
//
this.arg1label.Location = new System.Drawing.Point(-62, 34);
this.arg1label.Location = new System.Drawing.Point(-28, 34);
this.arg1label.Name = "arg1label";
this.arg1label.Size = new System.Drawing.Size(179, 14);
this.arg1label.TabIndex = 33;
@ -350,7 +373,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// arg0label
//
this.arg0label.Location = new System.Drawing.Point(-62, 8);
this.arg0label.Location = new System.Drawing.Point(-28, 8);
this.arg0label.Name = "arg0label";
this.arg0label.Size = new System.Drawing.Size(179, 14);
this.arg0label.TabIndex = 32;
@ -360,7 +383,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// arg3label
//
this.arg3label.Location = new System.Drawing.Point(179, 8);
this.arg3label.Location = new System.Drawing.Point(213, 8);
this.arg3label.Name = "arg3label";
this.arg3label.Size = new System.Drawing.Size(179, 14);
this.arg3label.TabIndex = 36;
@ -370,7 +393,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// arg2label
//
this.arg2label.Location = new System.Drawing.Point(-62, 60);
this.arg2label.Location = new System.Drawing.Point(-28, 60);
this.arg2label.Name = "arg2label";
this.arg2label.Size = new System.Drawing.Size(179, 14);
this.arg2label.TabIndex = 35;
@ -380,7 +403,7 @@ namespace CodeImp.DoomBuilder.Windows
//
// arg4label
//
this.arg4label.Location = new System.Drawing.Point(179, 34);
this.arg4label.Location = new System.Drawing.Point(213, 34);
this.arg4label.Name = "arg4label";
this.arg4label.Size = new System.Drawing.Size(179, 14);
this.arg4label.TabIndex = 34;
@ -838,6 +861,7 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
//
// heightpanel1
//
@ -960,5 +984,7 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backoffsety;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backoffsetx;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backsector;
private System.Windows.Forms.CheckBox cbArgStr;
private System.Windows.Forms.ComboBox arg0str;
}
}

View file

@ -29,6 +29,8 @@ using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Controls;
//mxd
using CodeImp.DoomBuilder.GZBuilder.Data;
#endregion
@ -150,6 +152,12 @@ namespace CodeImp.DoomBuilder.Windows
if(fl.Flags.ContainsKey(ai.Key)) c.Checked = fl.Flags[ai.Key];
}
//mxd. setup arg0str
arg0str.Location = arg0.Location;
// Custom fields
fieldslist.SetValues(fl.Fields, true);
// Action/tags
action.Value = fl.Action;
tag.Text = fl.Tag.ToString();
@ -191,9 +199,6 @@ namespace CodeImp.DoomBuilder.Windows
backoffsety.Text = fl.Back.OffsetY.ToString();
}
// Custom fields
fieldslist.SetValues(fl.Fields, true);
////////////////////////////////////////////////////////////////////////
// Now go for all lines and change the options when a setting is different
////////////////////////////////////////////////////////////////////////
@ -305,6 +310,58 @@ namespace CodeImp.DoomBuilder.Windows
preventchanges = false;
}
//mxd
private void setNumberedScripts(Linedef l) {
arg0str.Items.Clear();
if (General.Map.NumberedScripts.Count > 0) {
foreach (ScriptItem si in General.Map.NumberedScripts) {
arg0str.Items.Add(si);
if (si.Index == l.Args[0])
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
//script number is not among known scripts...
if (arg0str.SelectedIndex == -1 && l.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(l.Args[0], "Script " + l.Args[0]));
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
} else if (l.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(l.Args[0], "Script " + l.Args[0]));
arg0str.SelectedIndex = 0;
}
}
//mxd
private void setNamedScripts(string selectedValue) {
arg0str.Items.Clear();
//update arg0str items
if (General.Map.NamedScripts.Count > 0) {
//dbg
GZBuilder.GZGeneral.Trace("Got " + General.Map.NamedScripts.Count + " script names");
ScriptItem[] sn = new ScriptItem[General.Map.NamedScripts.Count];
General.Map.NamedScripts.CopyTo(sn, 0);
arg0str.Items.AddRange(sn);
for (int i = 0; i < sn.Length; i++) {
if (sn[i].Name == selectedValue) {
arg0str.SelectedIndex = i;
break;
}
}
//int index = General.Map.NamedScripts.IndexOf(selectedValue);
//if (index != -1)
// arg0str.SelectedIndex = index;
}
else {
arg0str.Text = selectedValue;
}
}
// Front side (un)checked
private void frontside_CheckStateChanged(object sender, EventArgs e)
@ -362,6 +419,10 @@ namespace CodeImp.DoomBuilder.Windows
// Make undo
if(lines.Count > 1) undodesc = lines.Count + " linedefs";
General.Map.UndoRedo.CreateUndo("Edit " + undodesc);
//nxd
bool hasAcs = Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1;
bool hasArg0str = General.Map.UDMF && !action.Empty && hasAcs && arg0str.Text.Length > 0;
// Go for all the lines
foreach(Linedef l in lines)
@ -388,7 +449,16 @@ namespace CodeImp.DoomBuilder.Windows
// Action/tags
l.Tag = General.Clamp(tag.GetResult(l.Tag), General.Map.FormatInterface.MinTag, General.Map.FormatInterface.MaxTag);
if(!action.Empty) l.Action = action.Value;
l.Args[0] = arg0.GetResult(l.Args[0]);
//mxd
if (hasAcs && !cbArgStr.Checked) {
if (arg0str.SelectedItem != null)
l.Args[0] = ((ScriptItem)arg0str.SelectedItem).Index;
else if (!int.TryParse(arg0str.Text.Trim(), out l.Args[0]))
l.Args[0] = 0;
} else {
l.Args[0] = arg0.GetResult(l.Args[0]);
}
l.Args[1] = arg1.GetResult(l.Args[1]);
l.Args[2] = arg2.GetResult(l.Args[2]);
l.Args[3] = arg3.GetResult(l.Args[3]);
@ -466,6 +536,17 @@ namespace CodeImp.DoomBuilder.Windows
// Custom fields
fieldslist.Apply(l.Fields);
//mxd. apply arg0str
if (hasArg0str && cbArgStr.Checked) {
if (l.Fields.ContainsKey("arg0str"))
l.Fields["arg0str"].Value = arg0str.Text;
else
l.Fields.Add("arg0str", new UniValue(2, arg0str.Text));
}
else if (l.Fields.ContainsKey("arg0str")) {
l.Fields.Remove("arg0str");
}
}
// Update the used textures
@ -524,12 +605,38 @@ namespace CodeImp.DoomBuilder.Windows
// Zero all arguments when linedef action 0 (normal) is chosen
if(!preventchanges && (showaction == 0))
{
arg0.SetValue(0);
//mxd
arg0.SetDefaultValue();
arg1.SetDefaultValue();
arg2.SetDefaultValue();
arg3.SetDefaultValue();
arg4.SetDefaultValue();
/*arg0.SetValue(0);
arg1.SetValue(0);
arg2.SetValue(0);
arg3.SetValue(0);
arg4.SetValue(0);
arg4.SetValue(0);*/
}
//mxd. update arg0str
if (Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, showaction) != -1) {
arg0str.Visible = true;
if (General.Map.UDMF && fieldslist.GetValue("arg0str") != null) {
cbArgStr.Visible = true;
cbArgStr.Checked = true;
setNamedScripts((string)fieldslist.GetValue("arg0str"));
} else { //use script numbers
cbArgStr.Visible = General.Map.UDMF;
cbArgStr.Checked = false;
Linedef l = General.GetByIndex(lines, 0);
setNumberedScripts(l);
}
} else {
cbArgStr.Checked = false;
cbArgStr.Visible = false;
arg0str.Visible = false;
}
}
// Browse Action clicked
@ -572,6 +679,31 @@ namespace CodeImp.DoomBuilder.Windows
General.Map.UndoRedo.WithdrawUndo();
}
//mxd
private void cbArgStr_CheckedChanged(object sender, EventArgs e) {
arg0str.Text = "";
if (cbArgStr.Checked) {
setNamedScripts((string)fieldslist.GetValue("arg0str"));
}
else if (!cbArgStr.Checked) {
setNumberedScripts(General.GetByIndex(lines, 0));
}
arg0label.Text = cbArgStr.Checked ? "Script name:" : "Script number:";
}
//mxd
private void arg0str_Leave(object sender, EventArgs e) {
if (cbArgStr.Checked) fieldslist.SetValue("arg0str", arg0str.Text, CodeImp.DoomBuilder.Types.UniversalType.String);
}
//mxd
private void fieldslist_OnFieldValueChanged(string fieldname) {
if (cbArgStr.Checked && fieldname == "arg0str")
arg0str.Text = (string)fieldslist.GetValue(fieldname);
}
// Help!
private void LinedefEditForm_HelpRequested(object sender, HelpEventArgs hlpevent)
{

View file

@ -204,36 +204,6 @@
<metadata name="argspanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg4.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg1label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg0label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg3label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="arg4label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="hexenpanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -68,8 +68,12 @@ namespace CodeImp.DoomBuilder.Windows
}
}
//mxd. Still better than nothing :)
if (config.SelectedIndex == -1 && General.Configs.Count > 0) config.SelectedIndex = 0;
// Set the level name
levelname.Text = options.CurrentName;
if (options.CurrentName.Length > 0) //mxd
levelname.Text = options.CurrentName;
// Set strict patches loading
strictpatches.Checked = options.StrictPatches;
@ -213,11 +217,11 @@ namespace CodeImp.DoomBuilder.Windows
ci = (ConfigurationInfo)config.SelectedItem;
// No lump name in the name field?
if(levelname.Text.Trim().Length == 0)
{
// Get default lump name from configuration
levelname.Text = ci.DefaultLumpName;
}
if (levelname.Text.Trim().Length == 0)
{
// Get default lump name from configuration
levelname.Text = ci.DefaultLumpName;
}
// Show resources
datalocations.FixedResourceLocationList(ci.Resources);

View file

@ -28,39 +28,39 @@ namespace CodeImp.DoomBuilder.Windows
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptEditorForm));
this.editor = new CodeImp.DoomBuilder.Controls.ScriptEditorPanel();
this.SuspendLayout();
//
// editor
//
this.editor.BackColor = System.Drawing.SystemColors.Control;
this.editor.Dock = System.Windows.Forms.DockStyle.Fill;
this.editor.Location = new System.Drawing.Point(0, 0);
this.editor.Name = "editor";
this.editor.Size = new System.Drawing.Size(729, 578);
this.editor.TabIndex = 0;
this.editor.TabStop = false;
//
// ScriptEditorForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(729, 578);
this.Controls.Add(this.editor);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "ScriptEditorForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "Doom Builder Script Editor";
this.Load += new System.EventHandler(this.ScriptEditorForm_Load);
this.Shown += new System.EventHandler(this.ScriptEditorForm_Shown);
this.Move += new System.EventHandler(this.ScriptEditorForm_Move);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptEditorForm_FormClosing);
this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.ScriptEditorForm_HelpRequested);
this.ResizeEnd += new System.EventHandler(this.ScriptEditorForm_ResizeEnd);
this.ResumeLayout(false);
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptEditorForm));
this.editor = new CodeImp.DoomBuilder.Controls.ScriptEditorPanel();
this.SuspendLayout();
//
// editor
//
this.editor.BackColor = System.Drawing.SystemColors.Control;
this.editor.Dock = System.Windows.Forms.DockStyle.Fill;
this.editor.Location = new System.Drawing.Point(0, 0);
this.editor.Name = "editor";
this.editor.Size = new System.Drawing.Size(729, 578);
this.editor.TabIndex = 0;
this.editor.TabStop = false;
//
// ScriptEditorForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(729, 578);
this.Controls.Add(this.editor);
this.DoubleBuffered = true;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "ScriptEditorForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "GZDoom Builder Script Editor";
this.Load += new System.EventHandler(this.ScriptEditorForm_Load);
this.Shown += new System.EventHandler(this.ScriptEditorForm_Shown);
this.Move += new System.EventHandler(this.ScriptEditorForm_Move);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptEditorForm_FormClosing);
this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.ScriptEditorForm_HelpRequested);
this.ResizeEnd += new System.EventHandler(this.ScriptEditorForm_ResizeEnd);
this.ResumeLayout(false);
}

View file

@ -50,6 +50,8 @@ namespace CodeImp.DoomBuilder.Windows
this.tabeffects = new System.Windows.Forms.TabPage();
this.actiongroup = new System.Windows.Forms.GroupBox();
this.hexenpanel = new System.Windows.Forms.Panel();
this.arg0str = new System.Windows.Forms.ComboBox();
this.cbArgStr = new System.Windows.Forms.CheckBox();
this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg0 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
@ -351,6 +353,8 @@ namespace CodeImp.DoomBuilder.Windows
this.hexenpanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.hexenpanel.Controls.Add(this.arg0str);
this.hexenpanel.Controls.Add(this.cbArgStr);
this.hexenpanel.Controls.Add(this.arg2);
this.hexenpanel.Controls.Add(this.arg1);
this.hexenpanel.Controls.Add(this.arg0);
@ -366,6 +370,25 @@ namespace CodeImp.DoomBuilder.Windows
this.hexenpanel.Size = new System.Drawing.Size(628, 221);
this.hexenpanel.TabIndex = 13;
//
// arg0str
//
this.arg0str.FormattingEnabled = true;
this.arg0str.Location = new System.Drawing.Point(179, 93);
this.arg0str.Name = "arg0str";
this.arg0str.Size = new System.Drawing.Size(125, 22);
this.arg0str.TabIndex = 22;
this.arg0str.Leave += new System.EventHandler(this.arg0str_Leave);
//
// cbArgStr
//
this.cbArgStr.Location = new System.Drawing.Point(14, 3);
this.cbArgStr.Name = "cbArgStr";
this.cbArgStr.Size = new System.Drawing.Size(63, 40);
this.cbArgStr.TabIndex = 21;
this.cbArgStr.Text = "Named script";
this.cbArgStr.UseVisualStyleBackColor = true;
this.cbArgStr.CheckedChanged += new System.EventHandler(this.cbArgStr_CheckedChanged);
//
// arg2
//
this.arg2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@ -556,6 +579,7 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
//
// cancel
//
@ -657,5 +681,7 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox posX;
private System.Windows.Forms.CheckBox cbArgStr;
private System.Windows.Forms.ComboBox arg0str;
}
}

View file

@ -44,10 +44,8 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Variables
private ICollection<Thing> things;
private List<TreeNode> nodes;
private ThingTypeInfo thinginfo;
private bool preventchanges = false;
//mxd
private Vector2D initialPosition; //initial position of a thing used to fill posX and posY fields
@ -129,7 +127,13 @@ namespace CodeImp.DoomBuilder.Windows
posY.Text = ((int)ft.Position.y).ToString();
posX.ButtonStep = General.Map.Grid.GridSize;
posY.ButtonStep = General.Map.Grid.GridSize;
//mxd. setup arg0str
arg0str.Location = arg0.Location;
// Custom fields
fieldslist.SetValues(ft.Fields, true);
// Action/tags
action.Value = ft.Action;
tag.Text = ft.Tag.ToString();
@ -139,9 +143,6 @@ namespace CodeImp.DoomBuilder.Windows
arg3.SetValue(ft.Args[3]);
arg4.SetValue(ft.Args[4]);
// Custom fields
fieldslist.SetValues(ft.Fields, true);
////////////////////////////////////////////////////////////////////////
// Now go for all lines and change the options when a setting is different
////////////////////////////////////////////////////////////////////////
@ -186,6 +187,55 @@ namespace CodeImp.DoomBuilder.Windows
preventchanges = false;
}
//mxd
private void setNumberedScripts(Thing t) {
arg0str.Items.Clear();
if (General.Map.NumberedScripts.Count > 0) {
foreach (ScriptItem si in General.Map.NumberedScripts) {
arg0str.Items.Add(si);
if (si.Index == t.Args[0])
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
//script number is not among known scripts...
if (arg0str.SelectedIndex == -1 && t.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(t.Args[0], "Script " + t.Args[0]));
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
} else if (t.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(t.Args[0], "Script " + t.Args[0]));
arg0str.SelectedIndex = 0;
}
}
//mxd
private void setNamedScripts(string selectedValue) {
arg0str.Items.Clear();
//update arg0str items
if (General.Map.NamedScripts.Count > 0) {
//dbg
GZBuilder.GZGeneral.Trace("Got " + General.Map.NamedScripts.Count + " script names");
ScriptItem[] sn = new ScriptItem[General.Map.NamedScripts.Count];
General.Map.NamedScripts.CopyTo(sn, 0);
arg0str.Items.AddRange(sn);
for(int i = 0; i < sn.Length; i++){
if (sn[i].Name == selectedValue) {
arg0str.SelectedIndex = i;
break;
}
}
//int index = General.Map.NamedScripts.IndexOf(selectedValue);
//if (index != -1)
//arg0str.SelectedIndex = index;
} else {
arg0str.Text = selectedValue;
}
}
#endregion
@ -264,22 +314,33 @@ namespace CodeImp.DoomBuilder.Windows
// Zero all arguments when linedef action 0 (normal) is chosen
if(!preventchanges && (showaction == 0))
{
//mxd. If thing is light, set default light settings
int[] args = GZDoomLight.GetDefaultLightSettings(thingtype.GetResult(1));
if (args != null) {
arg0.SetValue(args[0]);
arg1.SetValue(args[1]);
arg2.SetValue(args[2]);
arg3.SetValue(args[3]);
arg4.SetValue(args[4]);
} else {
arg0.SetValue(0);
arg1.SetValue(0);
arg2.SetValue(0);
arg3.SetValue(0);
arg4.SetValue(0);
}
//mxd
arg0.SetDefaultValue();
arg1.SetDefaultValue();
arg2.SetDefaultValue();
arg3.SetDefaultValue();
arg4.SetDefaultValue();
}
//update arg0str
if (Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, showaction) != -1) {
arg0str.Visible = true;
if (General.Map.UDMF && fieldslist.GetValue("arg0str") != null) {
cbArgStr.Visible = true;
cbArgStr.Checked = true;
setNamedScripts((string)fieldslist.GetValue("arg0str"));
} else { //use script numbers
cbArgStr.Visible = General.Map.UDMF;
cbArgStr.Checked = false;
Thing t = General.GetByIndex(things, 0);
setNumberedScripts(t);
}
} else {
cbArgStr.Checked = false;
cbArgStr.Visible = false;
arg0str.Visible = false;
}
}
// Browse Action clicked
@ -333,7 +394,9 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
Vector2D delta = new Vector2D((float)posX.GetResult((int)initialPosition.x) - initialPosition.x, (float)posY.GetResult((int)initialPosition.y) - initialPosition.y);
bool hasAcs = Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1;
bool hasArg0str = General.Map.UDMF && !action.Empty && hasAcs && arg0str.Text.Length > 0;
// Go for all the things
foreach(Thing t in things)
{
@ -356,7 +419,16 @@ namespace CodeImp.DoomBuilder.Windows
// Action/tags
t.Tag = tag.GetResult(t.Tag);
if(!action.Empty) t.Action = action.Value;
t.Args[0] = arg0.GetResult(t.Args[0]);
//mxd
if (hasAcs && !cbArgStr.Checked) {
if(arg0str.SelectedItem != null)
t.Args[0] = ((ScriptItem)arg0str.SelectedItem).Index;
else if(!int.TryParse(arg0str.Text.Trim(), out t.Args[0]))
t.Args[0] = 0;
} else {
t.Args[0] = arg0.GetResult(t.Args[0]);
}
t.Args[1] = arg1.GetResult(t.Args[1]);
t.Args[2] = arg2.GetResult(t.Args[2]);
t.Args[3] = arg3.GetResult(t.Args[3]);
@ -364,6 +436,16 @@ namespace CodeImp.DoomBuilder.Windows
// Custom fields
fieldslist.Apply(t.Fields);
//mxd. apply arg0str
if (hasArg0str && cbArgStr.Checked) {
if (t.Fields.ContainsKey("arg0str"))
t.Fields["arg0str"].Value = arg0str.Text;
else
t.Fields.Add("arg0str", new UniValue(2, arg0str.Text));
} else if (t.Fields.ContainsKey("arg0str")) {
t.Fields.Remove("arg0str");
}
// Update settings
t.UpdateConfiguration();
@ -390,6 +472,30 @@ namespace CodeImp.DoomBuilder.Windows
this.Close();
}
//mxd
private void cbArgStr_CheckedChanged(object sender, EventArgs e) {
arg0str.Text = "";
if (cbArgStr.Checked){
setNamedScripts((string)fieldslist.GetValue("arg0str"));
} else if (!cbArgStr.Checked) {
setNumberedScripts(General.GetByIndex(things, 0));
}
arg0label.Text = cbArgStr.Checked ? "Script name:" : "Script number:";
}
//mxd
private void arg0str_Leave(object sender, EventArgs e) {
if(cbArgStr.Checked) fieldslist.SetValue("arg0str", arg0str.Text, CodeImp.DoomBuilder.Types.UniversalType.String);
}
//mxd
private void fieldslist_OnFieldValueChanged(string fieldname) {
if (cbArgStr.Checked && fieldname == "arg0str")
arg0str.Text = (string)fieldslist.GetValue(fieldname);
}
// Help
private void ThingEditForm_HelpRequested(object sender, HelpEventArgs hlpevent)
{

View file

@ -126,12 +126,18 @@
<metadata name="thingtype.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="thingtype.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox2.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="label5.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
<metadata name="taglabel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
@ -210,6 +216,15 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="tag.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="newtag.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="fieldslist.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

@ -561,10 +561,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
}
// Time to pick a new target?
if(General.Clock.CurrentTime > (lastpicktime + PICK_INTERVAL))
if(General.Clock.GetCurrentTime() > (lastpicktime + PICK_INTERVAL))
{
PickTargetUnlocked();
lastpicktime = General.Clock.CurrentTime;
lastpicktime = General.Clock.GetCurrentTime();
}
// The mouse is always in motion

View file

@ -29,8 +29,8 @@ namespace CodeImp.DoomBuilder.ColorPicker
private Point formLocation; //used to keep form's location constant
public override void OnInitialize() {
if (GZBuilder.GZGeneral.Version < 1.06f) {
General.ErrorLogger.Add(ErrorType.Error, "ColorPicker plugin: GZDoomBuilder 1.06 or later required!");
if (GZBuilder.GZGeneral.Version < 1.11f) {
General.ErrorLogger.Add(ErrorType.Error, "ColorPicker plugin: GZDoomBuilder 1.11 or later required!");
return;
}
@ -76,7 +76,7 @@ namespace CodeImp.DoomBuilder.ColorPicker
form = new LightColorPicker();
} else if (currentModeName == "SectorsMode") {
if (GZBuilder.GZGeneral.UDMF) {
if (General.Map.UDMF) {
if (General.Map.Map.SelectedSectorsCount == 0) {
General.Interface.DisplayStatus(StatusType.Warning, "Select some sectors first!");
return;
@ -92,17 +92,17 @@ namespace CodeImp.DoomBuilder.ColorPicker
if ( ((VisualMode)General.Editing.Mode).GetSelectedVisualThings(true).Count == 0 ) {
//check sectors
int selectedSectorsCount = ((VisualMode)General.Editing.Mode).GetSelectedVisualSectors(true).Count;
if (GZBuilder.GZGeneral.UDMF && (selectedSectorsCount > 0 || General.Map.Map.SelectedSectorsCount > 0)) {
if (General.Map.UDMF && (selectedSectorsCount > 0 || General.Map.Map.SelectedSectorsCount > 0)) {
form = new SectorColorPicker();
} else {
General.Interface.DisplayStatus(StatusType.Warning, "Select some lights " + (GZBuilder.GZGeneral.UDMF ? ", sectors or surfaces " : "") + "first!");
General.Interface.DisplayStatus(StatusType.Warning, "Select some lights " + (General.Map.UDMF ? ", sectors or surfaces " : "") + "first!");
return;
}
} else {
form = new LightColorPicker();
}
} else { //wrong mode
General.Interface.DisplayStatus(StatusType.Warning, "Switch to" + (GZBuilder.GZGeneral.UDMF ? " Sectors," : "") + " Things or GZDoom Visual Mode first!");
General.Interface.DisplayStatus(StatusType.Warning, "Switch to" + (General.Map.UDMF ? " Sectors," : "") + " Things or GZDoom Visual Mode first!");
return;
}

View file

@ -767,10 +767,10 @@ namespace CodeImp.DoomBuilder.GZDoomEditing
}
// Time to pick a new target?
if(General.Clock.CurrentTime > (lastpicktime + PICK_INTERVAL))
if(General.Clock.GetCurrentTime() > (lastpicktime + PICK_INTERVAL))
{
PickTargetUnlocked();
lastpicktime = General.Clock.CurrentTime;
lastpicktime = General.Clock.GetCurrentTime();
}
// The mouse is always in motion

View file

@ -44,9 +44,10 @@ namespace CodeImp.DoomBuilder.TagExplorer
}
// This is called after a map has been closed
public override void OnMapCloseEnd() {
public override void OnMapCloseBegin() {
// If we have a Tag Explorer panel, remove it
if (tagExplorer != null) {
tagExplorer.Terminate();
General.Interface.RemoveDocker(docker);
docker = null;
tagExplorer.Dispose();
@ -57,24 +58,24 @@ namespace CodeImp.DoomBuilder.TagExplorer
// Geometry pasted
public override void OnPasteEnd(PasteOptions options) {
if (tagExplorer != null)
tagExplorer.UpdateTree();
tagExplorer.UpdateTree(true);
}
// Undo performed
public override void OnUndoEnd() {
if (tagExplorer != null)
tagExplorer.UpdateTree();
tagExplorer.UpdateTree(true);
}
// Redo performed
public override void OnRedoEnd() {
if (tagExplorer != null)
tagExplorer.UpdateTree();
tagExplorer.UpdateTree(true);
}
public override void OnActionEnd(CodeImp.DoomBuilder.Actions.Action action) {
if (tagExplorer != null && action.Name == "builder_deleteitem")
tagExplorer.UpdateTree();
tagExplorer.UpdateTree(true);
}
}
}

View file

@ -68,7 +68,6 @@ namespace CodeImp.DoomBuilder.TagExplorer
// Disposer
protected override void Dispose(bool disposing) {
if (this.ParentForm != null) this.ParentForm.Activated -= ParentForm_Activated;
General.Settings.WritePluginSetting("sortmode", cbSortMode.SelectedIndex);
General.Settings.WritePluginSetting("displaymode", cbDisplayMode.SelectedIndex);
General.Settings.WritePluginSetting("centeronselected", cbCenterOnSelected.Checked);
@ -81,12 +80,14 @@ namespace CodeImp.DoomBuilder.TagExplorer
public void Setup() {
if (this.ParentForm != null) this.ParentForm.Activated += ParentForm_Activated;
UpdateTree();
UpdateTree(true);
}
public void UpdateTree() {
treeView.Nodes.Clear();
public void Terminate() {
if (this.ParentForm != null) this.ParentForm.Activated -= ParentForm_Activated;
}
public void UpdateTree(bool focusDisplay) {
bool showTags = (currentDisplayMode == DISPLAY_TAGS || currentDisplayMode == DISPLAY_TAGS_AND_ACTIONS);
bool showActions = (currentDisplayMode == DISPLAY_ACTIONS || currentDisplayMode == DISPLAY_TAGS_AND_ACTIONS);
bool hasComment = false;
@ -101,295 +102,314 @@ namespace CodeImp.DoomBuilder.TagExplorer
TreeNode selectedNode = null;
this.SuspendLayout();
treeView.Nodes.Clear();
//add things
List<TreeNode> nodes = new List<TreeNode>();
ICollection<Thing> things = General.Map.Map.Things;
foreach (Thing t in things) {
if ((showTags && t.Tag > 0) || (showActions && t.Action > 0)) {
if (filteredTag != -1 && t.Tag != filteredTag)
continue;
if (filteredAction != -1 && t.Action != filteredAction)
continue;
NodeInfo info = new NodeInfo(t);
string name = info.GetName(ref comment, currentSortMode);
hasComment = comment.Length > 0;
if (!hasComment && cbCommentsOnly.Checked)
continue;
if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) {
TreeNode node = new TreeNode(name, 1, 1);
node.Tag = info;
if (hasComment) node.ForeColor = commentColor;
nodes.Add(node);
if (info.Index == selection.Index && info.Type == selection.Type)
selectedNode = node;
}
}
}
//sort nodes
sort(ref nodes, currentSortMode);
//add "things" category
if (nodes.Count > 0) {
if (currentSortMode == SortMode.SORT_BY_ACTION) { //create action categories
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noAction = new TreeNode("No Action", 0, 0);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Action == 0) {
noAction.Nodes.Add(node);
if (!(things is MapElementCollection<Linedef>)) { //don't want to enumerate when array is locked
foreach (Thing t in things) {
if ((showTags && t.Tag > 0) || (showActions && t.Action > 0)) {
if (filteredTag != -1 && t.Tag != filteredTag)
continue;
if (filteredAction != -1 && t.Action != filteredAction)
continue;
NodeInfo info = new NodeInfo(t);
string name = info.GetName(ref comment, currentSortMode);
hasComment = comment.Length > 0;
if (!hasComment && cbCommentsOnly.Checked)
continue;
if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) {
TreeNode node = new TreeNode(name, 1, 1);
node.Tag = info;
if (hasComment) node.ForeColor = commentColor;
nodes.Add(node);
if (info.Index == selection.Index && info.Type == selection.Type)
selectedNode = node;
}
}
}
//sort nodes
sort(ref nodes, currentSortMode);
//add "things" category
if (nodes.Count > 0) {
if (currentSortMode == SortMode.SORT_BY_ACTION) { //create action categories
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noAction = new TreeNode("No Action", 0, 0);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Action == 0) {
noAction.Nodes.Add(node);
continue;
}
LinedefActionInfo lai = General.Map.Config.GetLinedefActionInfo(nodeInfo.Action);
if (!categories.ContainsKey(lai.Index))
categories.Add(lai.Index, new TreeNode(lai.Index + " - " + lai.Name, 0, 0, new TreeNode[] { node }));
else
categories[lai.Index].Nodes.Add(node);
}
LinedefActionInfo lai = General.Map.Config.GetLinedefActionInfo(nodeInfo.Action);
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
TreeNode category = new TreeNode(CAT_THINGS, 0, 0, catNodes);
if (noAction.Nodes.Count > 0)
category.Nodes.Add(noAction);
treeView.Nodes.Add(category);
} else if (currentSortMode == SortMode.SORT_BY_INDEX) { //create thing categories
Dictionary<string, TreeNode> categories = new Dictionary<string, TreeNode>();
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
ThingTypeInfo tti = General.Map.Data.GetThingInfoEx(General.Map.Map.GetThingByIndex(nodeInfo.Index).Type);
if (tti != null) {
if (!categories.ContainsKey(tti.Category.Title))
categories.Add(tti.Category.Title, new TreeNode(tti.Category.Title, 0, 0, new TreeNode[] { node }));
else
categories[tti.Category.Title].Nodes.Add(node);
} else {
if (!categories.ContainsKey("UNKNOWN"))
categories.Add("UNKNOWN", new TreeNode("UNKNOWN", 0, 0, new TreeNode[] { node }));
else
categories["UNKNOWN"].Nodes.Add(node);
}
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
treeView.Nodes.Add(new TreeNode(CAT_THINGS, 0, 0, catNodes));
if (!categories.ContainsKey(lai.Index))
categories.Add(lai.Index, new TreeNode(lai.Index + " - " + lai.Name, 0, 0, new TreeNode[] { node }));
else
categories[lai.Index].Nodes.Add(node);
}
else { //sort by tag
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noTag = new TreeNode("No Tag", 0, 0);
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
TreeNode category = new TreeNode(CAT_THINGS, 0, 0, catNodes);
if (noAction.Nodes.Count > 0)
category.Nodes.Add(noAction);
if (nodeInfo.Tag == 0) {
noTag.Nodes.Add(node);
continue;
}
treeView.Nodes.Add(category);
} else if (currentSortMode == SortMode.SORT_BY_INDEX) { //create thing categories
Dictionary<string, TreeNode> categories = new Dictionary<string, TreeNode>();
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
ThingTypeInfo tti = General.Map.Data.GetThingInfoEx(General.Map.Map.GetThingByIndex(nodeInfo.Index).Type);
if (!categories.ContainsKey(tti.Category.Title))
categories.Add(tti.Category.Title, new TreeNode(tti.Category.Title, 0, 0, new TreeNode[] { node }));
else
categories[tti.Category.Title].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
treeView.Nodes.Add(new TreeNode(CAT_THINGS, 0, 0, catNodes));
} else { //sort by tag
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noTag = new TreeNode("No Tag", 0, 0);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Tag == 0) {
noTag.Nodes.Add(node);
continue;
if (!categories.ContainsKey(nodeInfo.Tag))
categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 0, 0, new TreeNode[] { node }));
else
categories[nodeInfo.Tag].Nodes.Add(node);
}
if (!categories.ContainsKey(nodeInfo.Tag))
categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 0, 0, new TreeNode[] { node }));
else
categories[nodeInfo.Tag].Nodes.Add(node);
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
TreeNode category = new TreeNode(CAT_THINGS, 0, 0, catNodes);
if (noTag.Nodes.Count > 0)
category.Nodes.Add(noTag);
treeView.Nodes.Add(category);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
TreeNode category = new TreeNode(CAT_THINGS, 0, 0, catNodes);
if (noTag.Nodes.Count > 0)
category.Nodes.Add(noTag);
treeView.Nodes.Add(category);
}
}
//add sectors
nodes = new List<TreeNode>();
ICollection<Sector> sectors = General.Map.Map.Sectors;
foreach (Sector s in sectors) {
if ((showTags && s.Tag > 0) || (showActions && s.Effect > 0)) {
if (filteredTag != -1 && s.Tag != filteredTag)
continue;
if (filteredAction != -1 && s.Effect != filteredAction)
continue;
NodeInfo info = new NodeInfo(s);
string name = info.GetName(ref comment, currentSortMode);
hasComment = comment.Length > 0;
if (!hasComment && cbCommentsOnly.Checked)
continue;
if (!(sectors is MapElementCollection<Linedef>)) { //don't want to enumerate when array is locked
foreach (Sector s in sectors) {
if ((showTags && s.Tag > 0) || (showActions && s.Effect > 0)) {
if (filteredTag != -1 && s.Tag != filteredTag)
continue;
if (filteredAction != -1 && s.Effect != filteredAction)
continue;
if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) {
TreeNode node = new TreeNode(name, 3, 3);
node.Tag = info;
if (hasComment) node.ForeColor = commentColor;
nodes.Add(node);
NodeInfo info = new NodeInfo(s);
string name = info.GetName(ref comment, currentSortMode);
hasComment = comment.Length > 0;
if (info.Index == selection.Index && info.Type == selection.Type)
selectedNode = node;
if (!hasComment && cbCommentsOnly.Checked)
continue;
if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) {
TreeNode node = new TreeNode(name, 3, 3);
node.Tag = info;
if (hasComment) node.ForeColor = commentColor;
nodes.Add(node);
if (info.Index == selection.Index && info.Type == selection.Type)
selectedNode = node;
}
}
}
}
//sort nodes
sort(ref nodes, currentSortMode);
//sort nodes
sort(ref nodes, currentSortMode);
//add category
if (nodes.Count > 0) {
if (currentSortMode == SortMode.SORT_BY_ACTION) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noAction = new TreeNode("No Effect", 2, 2);
//add category
if (nodes.Count > 0) {
if (currentSortMode == SortMode.SORT_BY_ACTION) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noAction = new TreeNode("No Effect", 2, 2);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Action == 0) {
noAction.Nodes.Add(node);
continue;
if (nodeInfo.Action == 0) {
noAction.Nodes.Add(node);
continue;
}
SectorEffectInfo sei = General.Map.Config.GetSectorEffectInfo(nodeInfo.Action);
if (!categories.ContainsKey(sei.Index))
categories.Add(sei.Index, new TreeNode(sei.Index + " - " + sei.Title, 2, 2, new TreeNode[] { node }));
else
categories[sei.Index].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
SectorEffectInfo sei = General.Map.Config.GetSectorEffectInfo(nodeInfo.Action);
TreeNode category = new TreeNode(CAT_SECTORS, 2, 2, catNodes);
if (noAction.Nodes.Count > 0)
category.Nodes.Add(noAction);
if (!categories.ContainsKey(sei.Index))
categories.Add(sei.Index, new TreeNode(sei.Index + " - " + sei.Title, 2, 2, new TreeNode[] { node }));
else
categories[sei.Index].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
treeView.Nodes.Add(category);
} else if (currentSortMode == SortMode.SORT_BY_TAG) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noTag = new TreeNode("No Tag", 2, 2);
TreeNode category = new TreeNode(CAT_SECTORS, 2, 2, catNodes);
if (noAction.Nodes.Count > 0)
category.Nodes.Add(noAction);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
treeView.Nodes.Add(category);
} else if (currentSortMode == SortMode.SORT_BY_TAG) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noTag = new TreeNode("No Tag", 2, 2);
if (nodeInfo.Tag == 0) {
noTag.Nodes.Add(node);
continue;
}
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Tag == 0) {
noTag.Nodes.Add(node);
continue;
if (!categories.ContainsKey(nodeInfo.Tag))
categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 2, 2, new TreeNode[] { node }));
else
categories[nodeInfo.Tag].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
if (!categories.ContainsKey(nodeInfo.Tag))
categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 2, 2, new TreeNode[] { node }));
else
categories[nodeInfo.Tag].Nodes.Add(node);
TreeNode category = new TreeNode(CAT_SECTORS, 2, 2, catNodes);
if (noTag.Nodes.Count > 0)
category.Nodes.Add(noTag);
treeView.Nodes.Add(category);
} else {//just add them as they are
treeView.Nodes.Add(new TreeNode(CAT_SECTORS, 2, 2, nodes.ToArray()));
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
TreeNode category = new TreeNode(CAT_SECTORS, 2, 2, catNodes);
if (noTag.Nodes.Count > 0)
category.Nodes.Add(noTag);
treeView.Nodes.Add(category);
} else {//just add them as they are
treeView.Nodes.Add(new TreeNode(CAT_SECTORS, 2, 2, nodes.ToArray()));
}
}
//add linedefs
nodes = new List<TreeNode>();
ICollection<Linedef> linedefs = General.Map.Map.Linedefs;
foreach (Linedef l in linedefs) {
if ((showTags && l.Tag > 0) || (showActions && l.Action > 0)) {
if (filteredTag != -1 && l.Tag != filteredTag)
continue;
if (filteredAction != -1 && l.Action != filteredAction)
continue;
NodeInfo info = new NodeInfo(l);
string name = info.GetName(ref comment, currentSortMode);
hasComment = comment.Length > 0;
if (!hasComment && cbCommentsOnly.Checked)
continue;
if (!(linedefs is MapElementCollection<Linedef>)) { //don't want to enumerate when array is locked
foreach (Linedef l in linedefs) {
if ((showTags && l.Tag > 0) || (showActions && l.Action > 0)) {
if (filteredTag != -1 && l.Tag != filteredTag)
continue;
if (filteredAction != -1 && l.Action != filteredAction)
continue;
if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) {
TreeNode node = new TreeNode(name, 5, 5);
node.Tag = info;
if (hasComment) node.ForeColor = commentColor;
nodes.Add(node);
NodeInfo info = new NodeInfo(l);
string name = info.GetName(ref comment, currentSortMode);
hasComment = comment.Length > 0;
if (info.Index == selection.Index && info.Type == selection.Type)
selectedNode = node;
if (!hasComment && cbCommentsOnly.Checked)
continue;
if (!udmf || serachStr.Length == 0 || (hasComment && comment.ToLowerInvariant().IndexOf(serachStr) != -1)) {
TreeNode node = new TreeNode(name, 5, 5);
node.Tag = info;
if (hasComment) node.ForeColor = commentColor;
nodes.Add(node);
if (info.Index == selection.Index && info.Type == selection.Type)
selectedNode = node;
}
}
}
}
//sort nodes
sort(ref nodes, currentSortMode);
//sort nodes
sort(ref nodes, currentSortMode);
//add category
if (nodes.Count > 0) {
if (currentSortMode == SortMode.SORT_BY_ACTION) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noAction = new TreeNode("No Action", 4, 4);
//add category
if (nodes.Count > 0) {
if (currentSortMode == SortMode.SORT_BY_ACTION) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noAction = new TreeNode("No Action", 4, 4);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Action == 0) {
noAction.Nodes.Add(node);
continue;
if (nodeInfo.Action == 0) {
noAction.Nodes.Add(node);
continue;
}
LinedefActionInfo lai = General.Map.Config.GetLinedefActionInfo(nodeInfo.Action);
if (!categories.ContainsKey(lai.Index))
categories.Add(lai.Index, new TreeNode(lai.Index + " - " + lai.Name, 4, 4, new TreeNode[] { node }));
else
categories[lai.Index].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
LinedefActionInfo lai = General.Map.Config.GetLinedefActionInfo(nodeInfo.Action);
TreeNode category = new TreeNode(CAT_LINEDEFS, 4, 4, catNodes);
if (noAction.Nodes.Count > 0)
category.Nodes.Add(noAction);
if (!categories.ContainsKey(lai.Index))
categories.Add(lai.Index, new TreeNode(lai.Index + " - " + lai.Name, 4, 4, new TreeNode[] { node }));
else
categories[lai.Index].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
treeView.Nodes.Add(category);
TreeNode category = new TreeNode(CAT_LINEDEFS, 4, 4, catNodes);
if (noAction.Nodes.Count > 0)
category.Nodes.Add(noAction);
} else if (currentSortMode == SortMode.SORT_BY_TAG) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noTag = new TreeNode("No Tag", 4, 4);
treeView.Nodes.Add(category);
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
} else if (currentSortMode == SortMode.SORT_BY_TAG) {
Dictionary<int, TreeNode> categories = new Dictionary<int, TreeNode>();
TreeNode noTag = new TreeNode("No Tag", 4, 4);
if (nodeInfo.Tag == 0) {
noTag.Nodes.Add(node);
continue;
}
foreach (TreeNode node in nodes) {
NodeInfo nodeInfo = node.Tag as NodeInfo;
if (nodeInfo.Tag == 0) {
noTag.Nodes.Add(node);
continue;
if (!categories.ContainsKey(nodeInfo.Tag))
categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 4, 4, new TreeNode[] { node }));
else
categories[nodeInfo.Tag].Nodes.Add(node);
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
if (!categories.ContainsKey(nodeInfo.Tag))
categories.Add(nodeInfo.Tag, new TreeNode("Tag " + nodeInfo.Tag, 4, 4, new TreeNode[] { node }));
else
categories[nodeInfo.Tag].Nodes.Add(node);
TreeNode category = new TreeNode(CAT_LINEDEFS, 4, 4, catNodes);
if (noTag.Nodes.Count > 0)
category.Nodes.Add(noTag);
treeView.Nodes.Add(category);
} else { //just add them as they are
treeView.Nodes.Add(new TreeNode(CAT_LINEDEFS, 4, 4, nodes.ToArray()));
}
TreeNode[] catNodes = new TreeNode[categories.Values.Count];
categories.Values.CopyTo(catNodes, 0);
TreeNode category = new TreeNode(CAT_LINEDEFS, 4, 4, catNodes);
if (noTag.Nodes.Count > 0)
category.Nodes.Add(noTag);
treeView.Nodes.Add(category);
} else { //just add them as they are
treeView.Nodes.Add(new TreeNode(CAT_LINEDEFS, 4, 4, nodes.ToArray()));
}
}
@ -399,9 +419,13 @@ namespace CodeImp.DoomBuilder.TagExplorer
if (selectedNode != null)
treeView.SelectedNode = selectedNode;
else if (treeView.Nodes.Count > 0)
treeView.SelectedNode = treeView.Nodes[0];
this.ResumeLayout();
//loose focus
General.Interface.FocusDisplay();
if(focusDisplay) General.Interface.FocusDisplay();
}
//tag/action search
@ -479,12 +503,12 @@ namespace CodeImp.DoomBuilder.TagExplorer
//EVENTS
private void cbDisplayMode_SelectedIndexChanged(object sender, EventArgs e) {
currentDisplayMode = cbDisplayMode.SelectedItem.ToString();
UpdateTree();
UpdateTree(true);
}
private void cbSortMode_SelectedIndexChanged(object sender, EventArgs e) {
currentSortMode = cbSortMode.SelectedItem.ToString();
UpdateTree();
UpdateTree(true);
}
private void treeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) {
@ -518,7 +542,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
}
General.Map.Map.Update();
UpdateTree();
UpdateTree(true);
} else {
//select element?
@ -646,9 +670,9 @@ namespace CodeImp.DoomBuilder.TagExplorer
General.Interface.FocusDisplay();
}
//it is called every time a dialog window closes.
//It is called every time a dialog window closes.
private void ParentForm_Activated(object sender, EventArgs e){
UpdateTree();
UpdateTree(true);
}
private void btnClearSearch_Click(object sender, EventArgs e) {
@ -657,11 +681,11 @@ namespace CodeImp.DoomBuilder.TagExplorer
}
private void tbSearch_TextChanged(object sender, EventArgs e) {
if (tbSearch.Text.Length > 1 || tbSearch.Text.Length == 0) UpdateTree();
if (tbSearch.Text.Length > 1 || tbSearch.Text.Length == 0) UpdateTree(false);
}
private void cbCommentsOnly_CheckedChanged(object sender, EventArgs e) {
UpdateTree();
UpdateTree(true);
}
}

View file

@ -186,7 +186,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
string combinedName = "";
switch (sortMode) {
case SortMode.SORT_BY_ACTION:
combinedName = (action > 0 ? "Action:" + action + "; " : "") + (tag > 0 ? "Tag:" + tag + "; " : "") + name + (isDefaultName ? " " + index : "");
combinedName = (tag > 0 ? "Tag:" + tag + "; " : "") + name + (isDefaultName ? " " + index : "");
break;
case SortMode.SORT_BY_INDEX:
@ -194,7 +194,7 @@ namespace CodeImp.DoomBuilder.TagExplorer
break;
case SortMode.SORT_BY_TAG:
combinedName = (tag > 0 ? "Tag:" + tag + "; " : "") + (action > 0 ? "Action:" + action + "; " : "") + name + (isDefaultName ? " " + index : "");
combinedName = (action > 0 ? "Action:" + action + "; " : "") + name + (isDefaultName ? " " + index : "");
break;
default:

View file

@ -22,8 +22,8 @@ namespace CodeImp.DoomBuilder.UDMFControls
private Point formLocation; //used to keep form's location constant
public override void OnInitialize() {
if (GZBuilder.GZGeneral.Version < 1.09f) {
General.ErrorLogger.Add(ErrorType.Error, "UDMFControls plugin: GZDoomBuilder 1.09 or later required!");
if (GZBuilder.GZGeneral.Version < 1.11f) {
General.ErrorLogger.Add(ErrorType.Error, "UDMFControls plugin: GZDoomBuilder 1.11 or later required!");
return;
}
@ -65,7 +65,7 @@ namespace CodeImp.DoomBuilder.UDMFControls
if (General.Editing.Mode == null)
return;
if (!GZBuilder.GZGeneral.UDMF) {
if (!General.Map.UDMF) {
General.Interface.DisplayStatus(StatusType.Warning, "Map in UDMF format required!");
return;
}
@ -102,4 +102,4 @@ namespace CodeImp.DoomBuilder.UDMFControls
form = null;
}
}
}
}