Visual mode: added "Look Through Selection" action (default key is "Y"). This action places visual camera at the same position as selected/highlighted thing and rotates it to match thing's angle. Special handling is available if targeted thing is AimingCamera, MovingCamera or SecurityCamera.

Script editor: pressing "F1" now opens keyword help instead of program manual.
Linedef edit form, Thing edit form: rewritten script support logic. It should now work in the same manner as the rest of controls.
Thing info panel: thing arguments now have proper labels.
Edit forms, UDMF: fields, which are handled by UI, are no longer shown in "Custom" tab.
Visual mode: fixed a crash when loading a model on a video card without Shader model 2.0 support.
Fixed incorrect argument number and changed most of labels in "Cameras and interpolation" section of zdoom_things.cfg.
This commit is contained in:
MaxED 2013-08-08 11:04:13 +00:00
parent 0a5ff0bdaf
commit 724709e435
39 changed files with 798 additions and 1008 deletions

View file

@ -215,35 +215,6 @@ universalfields
type = 2; type = 2;
default = ""; default = "";
} }
alpha
{
type = 1;
default = 1.0f;
}
renderstyle
{
type = 16;
default = "translucent";
enum
{
translucent = "Translucent";
add = "Additive";
}
}
locknumber
{
type = 0;
default = 0;
}
arg0str
{
type = 2;
default = "";
}
} }
sidedef sidedef
@ -253,90 +224,6 @@ universalfields
type = 2; type = 2;
default = ""; default = "";
} }
light
{
type = 0;
default = 0;
}
lightabsolute
{
type = 3;
default = false;
}
offsetx_top
{
type = 1;
default = 0.0f;
}
offsety_top
{
type = 1;
default = 0.0f;
}
offsetx_mid
{
type = 1;
default = 0.0f;
}
offsety_mid
{
type = 1;
default = 0.0f;
}
offsetx_bottom
{
type = 1;
default = 0.0f;
}
offsety_bottom
{
type = 1;
default = 0.0f;
}
scalex_top
{
type = 1;
default = 1.0f;
}
scaley_top
{
type = 1;
default = 1.0f;
}
scalex_mid
{
type = 1;
default = 1.0f;
}
scaley_mid
{
type = 1;
default = 1.0f;
}
scalex_bottom
{
type = 1;
default = 1.0f;
}
scaley_bottom
{
type = 1;
default = 1.0f;
}
} }
thing thing
@ -347,12 +234,6 @@ universalfields
default = ""; default = "";
} }
conversation
{
type = 0;
default = 0;
}
skill6 skill6
{ {
type = 3; type = 3;
@ -483,12 +364,6 @@ universalfields
type = 3; type = 3;
default = false; default = false;
} }
arg0str
{
type = 2;
default = "";
}
} }
sector sector
@ -498,154 +373,6 @@ universalfields
type = 2; type = 2;
default = ""; default = "";
} }
xpanningfloor
{
type = 1;
default = 0.0f;
}
ypanningfloor
{
type = 1;
default = 0.0f;
}
xpanningceiling
{
type = 1;
default = 0.0f;
}
ypanningceiling
{
type = 1;
default = 0.0f;
}
xscalefloor
{
type = 1;
default = 1.0f;
}
yscalefloor
{
type = 1;
default = 1.0f;
}
xscaleceiling
{
type = 1;
default = 1.0f;
}
yscaleceiling
{
type = 1;
default = 1.0f;
}
rotationfloor
{
type = 17;
default = 0.0f;
}
rotationceiling
{
type = 17;
default = 0.0f;
}
lightfloor
{
type = 0;
default = 0.0f;
}
lightceiling
{
type = 0;
default = 0.0f;
}
lightfloorabsolute
{
type = 3;
default = false;
}
lightceilingabsolute
{
type = 3;
default = false;
}
alphafloor
{
type = 1;
default = 1.0f;
}
alphaceiling
{
type = 1;
default = 1.0f;
}
renderstylefloor
{
type = 16;
default = "translucent";
enum
{
translucent = "Translucent";
add = "Additive";
}
}
renderstyleceiling
{
type = 16;
default = "translucent";
enum
{
translucent = "Translucent";
add = "Additive";
}
}
gravity
{
type = 1;
default = 1.0f;
}
lightcolor
{
type = 10;
default = 16777215;
}
fadecolor
{
type = 10;
default = 0;
}
desaturation
{
type = 1;
default = 0.0f;
}
soundsequence
{
type = 2;
default = "";
}
} }
} }

View file

@ -343,18 +343,18 @@ zdoom
9025 9025
{ {
title = "Camera"; title = "Security Camera";
arg0 arg0
{ {
title = "Pitch"; title = "Pitch";
} }
arg1 arg1
{ {
title = "Pan"; title = "Max. yaw per second";
} }
arg2 arg2
{ {
title = "Time"; title = "Time (in otics)";
} }
} }
9073 9073
@ -366,15 +366,15 @@ zdoom
} }
arg1 arg1
{ {
title = "Max Angle"; title = "Max. yaw per second";
} }
arg2 arg2
{ {
title = "Max Pitch"; title = "Max. pitch per second";
} }
arg4 arg3
{ {
title = "Thing"; title = "Target Thing Tag";
type = 14; type = 14;
} }
} }
@ -389,7 +389,7 @@ zdoom
sprite = "internal:SkyboxPicker"; sprite = "internal:SkyboxPicker";
arg0 arg0
{ {
title = "Thing"; title = "Target Thing Tag";
type = 14; type = 14;
} }
arg1 arg1
@ -410,11 +410,11 @@ zdoom
sprite = "internal:actormover"; sprite = "internal:actormover";
arg0 arg0
{ {
title = "Point"; title = "Interp. Point Tag";
} }
arg1 arg1
{ {
title = "High Point"; title = "Interp. Point HiTag";
} }
arg2 arg2
{ {
@ -425,19 +425,19 @@ zdoom
1 = "Linear path"; 1 = "Linear path";
2 = "Use point angle"; 2 = "Use point angle";
4 = "Use point pitch"; 4 = "Use point pitch";
8 = "Face movement direction"; 8 = "Face thing/movement direction";
128 = "Nonsolid"; 128 = "Nonsolid";
} }
} }
arg3 arg3
{ {
title = "Thing"; title = "Target Thing Tag";
type = 14; type = 14;
} }
} }
9070 9070
{ {
title = "Interpolation point"; title = "Interpolation Point";
sprite = "internal:InterpolationPoint"; sprite = "internal:InterpolationPoint";
arg0 arg0
{ {
@ -453,11 +453,11 @@ zdoom
} }
arg3 arg3
{ {
title = "Next"; title = "Next Point Tag";
} }
arg4 arg4
{ {
title = "High Next"; title = "Next Point HiTag";
} }
} }
9075 9075
@ -470,11 +470,11 @@ zdoom
title = "Moving Camera"; title = "Moving Camera";
arg0 arg0
{ {
title = "Point"; title = "Interp. Point Tag";
} }
arg1 arg1
{ {
title = "High Point"; title = "Interp. Point HiTag";
} }
arg2 arg2
{ {
@ -491,7 +491,7 @@ zdoom
} }
arg3 arg3
{ {
title = "Thing"; title = "Target Thing Tag";
type = 14; type = 14;
} }
} }
@ -501,11 +501,11 @@ zdoom
sprite = "internal:PathFollower"; sprite = "internal:PathFollower";
arg0 arg0
{ {
title = "Point"; title = "Interp. Point Tag";
} }
arg1 arg1
{ {
title = "High Point"; title = "Interp. Point HiTag";
} }
arg2 arg2
{ {

View file

@ -928,6 +928,7 @@
<None Include="Resources\Link.png" /> <None Include="Resources\Link.png" />
<Content Include="Resources\Model.png" /> <Content Include="Resources\Model.png" />
<Content Include="Resources\Model_selected.png" /> <Content Include="Resources\Model_selected.png" />
<EmbeddedResource Include="Resources\UDMF_UI.cfg" />
<None Include="Resources\Unlink.png" /> <None Include="Resources\Unlink.png" />
<None Include="Resources\Unpin.png" /> <None Include="Resources\Unpin.png" />
<None Include="Resources\Pin.png" /> <None Include="Resources\Pin.png" />

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Properties #region ================== Properties
public ICollection<ImageData> Textures { get { return textures; } } public ICollection<ImageData> Textures { get { return textures; } }
public ICollection<ImageData> Flats { get { return flats; } } public ICollection<ImageData> Flats { get { if(General.Map.Config.MixTexturesFlats) return textures; return flats; } } //mxd
#endregion #endregion

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Properties #region ================== Properties
public ICollection<ImageData> Textures { get { return textures; } } public ICollection<ImageData> Textures { get { return textures; } }
public ICollection<ImageData> Flats { get { return flats; } } public ICollection<ImageData> Flats { get { if(General.Map.Config.MixTexturesFlats) return textures; return flats; } } //mxd
#endregion #endregion

View file

@ -45,6 +45,8 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Properties #region ================== Properties
public override string Text { get { return combobox.Text; } } //mxd
#endregion #endregion
#region ================== Constructor #region ================== Constructor

View file

@ -60,6 +60,7 @@ namespace CodeImp.DoomBuilder.Controls
private string elementname; private string elementname;
private string lasteditfieldname; private string lasteditfieldname;
private bool autoinsertuserprefix; private bool autoinsertuserprefix;
private List<string> uifields;//mxd
#endregion #endregion
@ -95,6 +96,9 @@ namespace CodeImp.DoomBuilder.Controls
// Keep element name // Keep element name
this.elementname = elementname; this.elementname = elementname;
//mxd. get proper UIFields
uifields = General.Map.FormatInterface.UIFields[elementname];
// Make types list // Make types list
fieldtype.Items.Clear(); fieldtype.Items.Clear();
fieldtype.Items.AddRange(General.Types.GetCustomUseAttributes()); fieldtype.Items.AddRange(General.Types.GetCustomUseAttributes());
@ -117,8 +121,10 @@ namespace CodeImp.DoomBuilder.Controls
public void ListFixedFields(List<UniversalFieldInfo> list) public void ListFixedFields(List<UniversalFieldInfo> list)
{ {
// Add all fields // Add all fields
foreach(UniversalFieldInfo uf in list) foreach(UniversalFieldInfo uf in list) {
if(uifields.Contains(uf.Name)) continue; //mxd
fieldslist.Rows.Add(new FieldsEditorRow(fieldslist, uf)); fieldslist.Rows.Add(new FieldsEditorRow(fieldslist, uf));
}
// Sort fields // Sort fields
Sort(); Sort();
@ -153,6 +159,8 @@ namespace CodeImp.DoomBuilder.Controls
// Go for all the fields // Go for all the fields
foreach(KeyValuePair<string, UniValue> f in fromfields) foreach(KeyValuePair<string, UniValue> f in fromfields)
{ {
if(uifields.Contains(f.Key)) continue; //mxd
// Go for all rows // Go for all rows
bool foundrow = false; bool foundrow = false;
foreach(DataGridViewRow row in fieldslist.Rows) foreach(DataGridViewRow row in fieldslist.Rows)
@ -231,7 +239,7 @@ namespace CodeImp.DoomBuilder.Controls
} }
//mxd //mxd
public object GetValue(string name) { /*public object GetValue(string name) {
//have required row? //have required row?
foreach (DataGridViewRow row in fieldslist.Rows) { foreach (DataGridViewRow row in fieldslist.Rows) {
// Row is a field? // Row is a field?
@ -248,10 +256,10 @@ namespace CodeImp.DoomBuilder.Controls
} }
return null; return null;
} }*/
//mxd //mxd
public void SetValue(string name, object value, UniversalType type) { /*public void SetValue(string name, object value, UniversalType type) {
//have required row? //have required row?
foreach (DataGridViewRow row in fieldslist.Rows) { foreach (DataGridViewRow row in fieldslist.Rows) {
// Row is a field? // Row is a field?
@ -269,7 +277,7 @@ namespace CodeImp.DoomBuilder.Controls
//no such row... let's add it //no such row... let's add it
FieldsEditorRow newfrow = new FieldsEditorRow(fieldslist, name, (int)type, value); FieldsEditorRow newfrow = new FieldsEditorRow(fieldslist, name, (int)type, value);
fieldslist.Rows.Insert(fieldslist.Rows.Count - 1, newfrow); fieldslist.Rows.Insert(fieldslist.Rows.Count - 1, newfrow);
} }*/
// This applies the current fields to a UniFields object // This applies the current fields to a UniFields object
@ -279,8 +287,9 @@ namespace CodeImp.DoomBuilder.Controls
// Go for all the fields // Go for all the fields
UniFields tempfields = new UniFields(tofields); UniFields tempfields = new UniFields(tofields);
foreach(KeyValuePair<string, UniValue> f in tempfields) foreach(KeyValuePair<string, UniValue> f in tempfields) {
{ if (uifields.Contains(f.Key)) continue; //mxd
// Go for all rows // Go for all rows
bool foundrow = false; bool foundrow = false;
foreach(DataGridViewRow row in fieldslist.Rows) foreach(DataGridViewRow row in fieldslist.Rows)
@ -534,7 +543,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Make a valid UDMF field name // Make a valid UDMF field name
string validname = UniValue.ValidateName(row.Cells[0].Value.ToString()); string validname = UniValue.ValidateName(row.Cells[0].Value.ToString());
if(validname.Length > 0) if(validname.Length > 0 && !uifields.Contains(validname)) //mxd
{ {
// Check if no other row already has this name // Check if no other row already has this name
foreach(DataGridViewRow r in fieldslist.Rows) foreach(DataGridViewRow r in fieldslist.Rows)
@ -578,7 +587,7 @@ namespace CodeImp.DoomBuilder.Controls
{ {
// Make a valid UDMF field name // Make a valid UDMF field name
string validname = UniValue.ValidateName(row.Cells[0].Value.ToString()); string validname = UniValue.ValidateName(row.Cells[0].Value.ToString());
if(validname.Length > 0) if(validname.Length > 0 && !uifields.Contains(validname)) //mxd
{ {
// Check if no other row already has this name // Check if no other row already has this name
foreach(DataGridViewRow r in fieldslist.Rows) foreach(DataGridViewRow r in fieldslist.Rows)

View file

@ -130,9 +130,9 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Methods #region ================== Methods
// This launches keyword help website // This launches keyword help website
public void LaunchKeywordHelp() public bool LaunchKeywordHelp()
{ {
editor.LaunchKeywordHelp(); return editor.LaunchKeywordHelp();
} }
// This refreshes the style settings // This refreshes the style settings

View file

@ -166,7 +166,7 @@ namespace CodeImp.DoomBuilder.Controls
#region ================== Methods #region ================== Methods
// This launches keyword help website // This launches keyword help website
public void LaunchKeywordHelp() public bool LaunchKeywordHelp()
{ {
string helpsite = scriptconfig.KeywordHelp; string helpsite = scriptconfig.KeywordHelp;
string currentword = GetCurrentWord(); string currentword = GetCurrentWord();
@ -175,7 +175,9 @@ namespace CodeImp.DoomBuilder.Controls
currentword = scriptconfig.GetKeywordCase(currentword); currentword = scriptconfig.GetKeywordCase(currentword);
helpsite = helpsite.Replace("%K", currentword); helpsite = helpsite.Replace("%K", currentword);
General.OpenWebsite(helpsite); General.OpenWebsite(helpsite);
return true;
} }
return !string.IsNullOrEmpty(helpsite); //mxd
} }
// This replaces the selection with the given text // This replaces the selection with the given text

View file

@ -564,6 +564,13 @@ namespace CodeImp.DoomBuilder.Controls
buttonopen_Click(this, EventArgs.Empty); buttonopen_Click(this, EventArgs.Empty);
} }
//mxd. This launches keyword help website
public bool LaunchKeywordHelp() {
// Get script
ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab);
return t.LaunchKeywordHelp();
}
#endregion #endregion
#region ================== Events #region ================== Events
@ -578,9 +585,7 @@ namespace CodeImp.DoomBuilder.Controls
// Keyword help requested // Keyword help requested
private void buttonkeywordhelp_Click(object sender, EventArgs e) private void buttonkeywordhelp_Click(object sender, EventArgs e)
{ {
// Get script LaunchKeywordHelp();
ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab);
t.LaunchKeywordHelp();
} }
// When the user changes the script configuration // When the user changes the script configuration

View file

@ -115,7 +115,6 @@ namespace CodeImp.DoomBuilder.Controls
// Hangs from ceiling? // Hangs from ceiling?
if(ti.Hangs) if(ti.Hangs)
{ {
//zvalue = (float)t.Sector.CeilHeight + t.Position.z;
zvalue = (float)t.Sector.CeilHeight - t.Position.z - ti.Height; //mxd zvalue = (float)t.Sector.CeilHeight - t.Position.z - ti.Height; //mxd
zinfo = zvalue.ToString(); zinfo = zvalue.ToString();
} }
@ -157,67 +156,49 @@ namespace CodeImp.DoomBuilder.Controls
spritetex.BackgroundImage = null; spritetex.BackgroundImage = null;
} }
// Arguments // Arguments
if(act != null) ArgumentInfo[] arginfo = (((t.Action == 0 || act == null) && ti.Args[0] != null) ? ti.Args : act.Args); //mxd
{
//mxd //mxd
bool hasArg0Str = General.Map.UDMF && Array.IndexOf(GZGeneral.ACS_SPECIALS, t.Action) != -1 && t.Fields.ContainsKey("arg0str"); 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 arglbl1.Text = hasArg0Str ? "Script name:" : arginfo[0].Title + ":"; //mxd
arglbl2.Text = act.Args[1].Title + ":"; arglbl2.Text = arginfo[1].Title + ":";
arglbl3.Text = act.Args[2].Title + ":"; arglbl3.Text = arginfo[2].Title + ":";
arglbl4.Text = act.Args[3].Title + ":"; arglbl4.Text = arginfo[3].Title + ":";
arglbl5.Text = act.Args[4].Title + ":"; arglbl5.Text = arginfo[4].Title + ":";
arglbl1.Enabled = act.Args[0].Used; arglbl1.Enabled = arginfo[0].Used;
arglbl2.Enabled = act.Args[1].Used; arglbl2.Enabled = arginfo[1].Used;
arglbl3.Enabled = act.Args[2].Used; arglbl3.Enabled = arginfo[2].Used;
arglbl4.Enabled = act.Args[3].Used; arglbl4.Enabled = arginfo[3].Used;
arglbl5.Enabled = act.Args[4].Used; arglbl5.Enabled = arginfo[4].Used;
arg1.Enabled = act.Args[0].Used; arg1.Enabled = arginfo[0].Used;
arg2.Enabled = act.Args[1].Used; arg2.Enabled = arginfo[1].Used;
arg3.Enabled = act.Args[2].Used; arg3.Enabled = arginfo[2].Used;
arg4.Enabled = act.Args[3].Used; arg4.Enabled = arginfo[3].Used;
arg5.Enabled = act.Args[4].Used; arg5.Enabled = arginfo[4].Used;
//mxd //mxd
if(hasArg0Str) { if(hasArg0Str) {
arg1.Text = '"' + t.Fields["arg0str"].Value.ToString() + '"'; arg1.Text = '"' + t.Fields["arg0str"].Value.ToString() + '"';
} else { } else {
th = General.Types.GetArgumentHandler(act.Args[0]); th = General.Types.GetArgumentHandler(arginfo[0]);
th.SetValue(t.Args[0]); arg1.Text = th.GetStringValue(); 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]);
th.SetValue(t.Args[2]); arg3.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[3]);
th.SetValue(t.Args[3]); arg4.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[4]);
th.SetValue(t.Args[4]); arg5.Text = th.GetStringValue();
}
else
{
arglbl1.Text = "Argument 1:";
arglbl2.Text = "Argument 2:";
arglbl3.Text = "Argument 3:";
arglbl4.Text = "Argument 4:";
arglbl5.Text = "Argument 5:";
arglbl1.Enabled = false;
arglbl2.Enabled = false;
arglbl3.Enabled = false;
arglbl4.Enabled = false;
arglbl5.Enabled = false;
arg1.Enabled = false;
arg2.Enabled = false;
arg3.Enabled = false;
arg4.Enabled = false;
arg5.Enabled = false;
arg1.Text = "-";
arg2.Text = "-";
arg3.Text = "-";
arg4.Text = "-";
arg5.Text = "-";
} }
th = General.Types.GetArgumentHandler(arginfo[1]);
th.SetValue(t.Args[1]);
arg2.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(arginfo[2]);
th.SetValue(t.Args[2]);
arg3.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(arginfo[3]);
th.SetValue(t.Args[3]);
arg4.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(arginfo[4]);
th.SetValue(t.Args[4]);
arg5.Text = th.GetStringValue();
// Show the whole thing // Show the whole thing
this.Show(); this.Show();

View file

@ -152,7 +152,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
if (result.ProcessInterpolationPoints) { if (result.ProcessInterpolationPoints) {
foreach (KeyValuePair<int, List<Thing>> group in interpolationPoints) { foreach (KeyValuePair<int, List<Thing>> group in interpolationPoints) {
foreach(Thing t in group.Value) { foreach(Thing t in group.Value) {
int targetTag = t.Args[3] + t.Args[4] * 256; int targetTag = t.Args[3] + (t.Args[4] << 8);
if(targetTag == 0) continue; //no goal if(targetTag == 0) continue; //no goal
if(interpolationPoints.ContainsKey(targetTag)) { if(interpolationPoints.ContainsKey(targetTag)) {
@ -172,7 +172,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
//process cameras //process cameras
if (result.ProcessCameras) { if (result.ProcessCameras) {
foreach (Thing t in cameras) { foreach (Thing t in cameras) {
int targetTag = t.Args[0] + t.Args[1] * 256; int targetTag = t.Args[0] + (t.Args[1] << 8);
if (targetTag == 0) continue; //no goal if (targetTag == 0) continue; //no goal
if(interpolationPoints.ContainsKey(targetTag)) { if(interpolationPoints.ContainsKey(targetTag)) {
@ -191,7 +191,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
//process actor movers //process actor movers
if(result.ProcessActorMovers) { if(result.ProcessActorMovers) {
foreach(Thing t in actorMovers) { foreach(Thing t in actorMovers) {
int targetTag = t.Args[0] + t.Args[1] * 256; int targetTag = t.Args[0] + (t.Args[1] << 8);
if(targetTag == 0) continue; //no goal if(targetTag == 0) continue; //no goal
//add interpolation point target //add interpolation point target

View file

@ -1,4 +1,6 @@
using System; #region ================== Namespaces
using System;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using System.Drawing.Imaging; using System.Drawing.Imaging;
@ -12,11 +14,15 @@ using SlimDX;
using SlimDX.Direct3D9; using SlimDX.Direct3D9;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
#endregion
//mxd. Original version taken from here: http://colladadotnet.codeplex.com/SourceControl/changeset/view/40680 //mxd. Original version taken from here: http://colladadotnet.codeplex.com/SourceControl/changeset/view/40680
namespace CodeImp.DoomBuilder.GZBuilder.MD3 namespace CodeImp.DoomBuilder.GZBuilder.MD3
{ {
internal static class ModelReader internal static class ModelReader
{ {
#region ================== Variables
private const float VERTICAL_STRETCH = 1 / 1.2f; private const float VERTICAL_STRETCH = 1 / 1.2f;
private class MD3LoadResult private class MD3LoadResult
@ -31,11 +37,27 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
} }
} }
private static VertexElement[] vertexElements;
#endregion
#region ================== Load
public static void Load(ModelData mde, List<DataReader> containers, Device device) { public static void Load(ModelData mde, List<DataReader> containers, Device device) {
mde.Model = new GZModel(); mde.Model = new GZModel();
BoundingBoxSizes bbs = new BoundingBoxSizes(); BoundingBoxSizes bbs = new BoundingBoxSizes();
MD3LoadResult result = new MD3LoadResult(); MD3LoadResult result = new MD3LoadResult();
if(vertexElements == null) {
vertexElements = new[] {
new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
new VertexElement(0, 24, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0),
VertexElement.VertexDeclarationEnd
};
}
//load models and textures //load models and textures
for(int i = 0; i < mde.ModelNames.Count; i++) { for(int i = 0; i < mde.ModelNames.Count; i++) {
//need to use model skins? //need to use model skins?
@ -144,6 +166,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
mde.Model.BoundingBox = BoundingBoxTools.CalculateBoundingBox(bbs); mde.Model.BoundingBox = BoundingBoxTools.CalculateBoundingBox(bbs);
} }
#endregion
#region ================== MD3
private static MD3LoadResult ReadMD3Model(ref BoundingBoxSizes bbs, ModelData mde, bool useSkins, MemoryStream s, Device device) { private static MD3LoadResult ReadMD3Model(ref BoundingBoxSizes bbs, ModelData mde, bool useSkins, MemoryStream s, Device device) {
long start = s.Position; long start = s.Position;
MD3LoadResult result = new MD3LoadResult(); MD3LoadResult result = new MD3LoadResult();
@ -337,7 +363,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
private static void CreateMesh(Device device, ref MD3LoadResult result, List<WorldVertex> vertList, List<int> polyIndecesList) { private static void CreateMesh(Device device, ref MD3LoadResult result, List<WorldVertex> vertList, List<int> polyIndecesList) {
//create mesh //create mesh
Mesh mesh = new Mesh(device, polyIndecesList.Count / 3, vertList.Count, MeshFlags.Use32Bit | MeshFlags.IndexBufferManaged | MeshFlags.VertexBufferManaged, General.Map.Graphics.Shaders.World3D.VertexElements); Mesh mesh = new Mesh(device, polyIndecesList.Count / 3, vertList.Count, MeshFlags.Use32Bit | MeshFlags.IndexBufferManaged | MeshFlags.VertexBufferManaged, vertexElements);
using(DataStream stream = mesh.LockVertexBuffer(LockFlags.None)) { using(DataStream stream = mesh.LockVertexBuffer(LockFlags.None)) {
stream.WriteRange(vertList.ToArray()); stream.WriteRange(vertList.ToArray());
@ -354,6 +380,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
result.Meshes.Add(mesh); result.Meshes.Add(mesh);
} }
#endregion
#region ================== MD2
private static MD3LoadResult ReadMD2Model(ref BoundingBoxSizes bbs, ModelData mde, MemoryStream s, Device D3DDevice) { private static MD3LoadResult ReadMD2Model(ref BoundingBoxSizes bbs, ModelData mde, MemoryStream s, Device D3DDevice) {
long start = s.Position; long start = s.Position;
MD3LoadResult result = new MD3LoadResult(); MD3LoadResult result = new MD3LoadResult();
@ -504,7 +534,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
} }
//mesh //mesh
Mesh mesh = new Mesh(D3DDevice, polyIndecesList.Count / 3, vertList.Count, MeshFlags.Use32Bit | MeshFlags.IndexBufferManaged | MeshFlags.VertexBufferManaged, General.Map.Graphics.Shaders.World3D.VertexElements); Mesh mesh = new Mesh(D3DDevice, polyIndecesList.Count / 3, vertList.Count, MeshFlags.Use32Bit | MeshFlags.IndexBufferManaged | MeshFlags.VertexBufferManaged, vertexElements);
using (DataStream stream = mesh.LockVertexBuffer(LockFlags.None)) { using (DataStream stream = mesh.LockVertexBuffer(LockFlags.None)) {
stream.WriteRange(vertList.ToArray()); stream.WriteRange(vertList.ToArray());
@ -526,6 +556,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
return result; return result;
} }
#endregion
#region ================== Utility
//util //util
private static MemoryStream LoadFile(List<DataReader> containers, string path, bool isModel) { private static MemoryStream LoadFile(List<DataReader> containers, string path, bool isModel) {
foreach(DataReader dr in containers) { foreach(DataReader dr in containers) {
@ -590,5 +624,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
} }
return NAME; return NAME;
} }
#endregion
} }
} }

View file

@ -119,12 +119,7 @@ namespace CodeImp.DoomBuilder {
//mxd //mxd
public bool UDMF { get { return config.FormatInterface == "UniversalMapSetIO"; } } public bool UDMF { get { return config.FormatInterface == "UniversalMapSetIO"; } }
internal List<ScriptItem> NamedScripts { internal List<ScriptItem> NamedScripts { get { return namedScripts; } }
get {
if (!UDMF) throw new Exception("ScriptNames cannot be used in '" + config.FormatInterface + "' format!");
return namedScripts;
}
}
internal List<ScriptItem> NumberedScripts { get { return numberedScripts; } } internal List<ScriptItem> NumberedScripts { get { return numberedScripts; } }
internal List<string> ScriptIncludes { get { return scriptincludes; } } internal List<string> ScriptIncludes { get { return scriptincludes; } }

View file

@ -81,6 +81,7 @@ namespace CodeImp.DoomBuilder.IO
public override float MinCoordinate { get { return (float)short.MinValue; } } public override float MinCoordinate { get { return (float)short.MinValue; } }
public override int MaxThingAngle { get { return short.MaxValue; } } public override int MaxThingAngle { get { return short.MaxValue; } }
public override int MinThingAngle { get { return short.MinValue; } } public override int MinThingAngle { get { return short.MinValue; } }
public override Dictionary<string, List<string>> UIFields { get { return null; } } //mxd
#endregion #endregion

View file

@ -81,6 +81,7 @@ namespace CodeImp.DoomBuilder.IO
public override float MinCoordinate { get { return (float)short.MinValue; } } public override float MinCoordinate { get { return (float)short.MinValue; } }
public override int MaxThingAngle { get { return short.MaxValue; } } public override int MaxThingAngle { get { return short.MaxValue; } }
public override int MinThingAngle { get { return short.MinValue; } } public override int MinThingAngle { get { return short.MinValue; } }
public override Dictionary<string, List<string>> UIFields { get { return null; } } //mxd
#endregion #endregion

View file

@ -16,6 +16,8 @@
#region ================== Namespaces #region ================== Namespaces
using System.Collections.Generic;
#endregion #endregion
namespace CodeImp.DoomBuilder.IO namespace CodeImp.DoomBuilder.IO
@ -59,5 +61,6 @@ namespace CodeImp.DoomBuilder.IO
float MinCoordinate { get; } float MinCoordinate { get; }
int MaxThingAngle { get; } int MaxThingAngle { get; }
int MinThingAngle { get; } int MinThingAngle { get; }
Dictionary<string, List<string>> UIFields { get; } //mxd. Element type (like "sector"), list of uifields.
} }
} }

View file

@ -21,6 +21,7 @@ using System.Globalization;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using System.Reflection; using System.Reflection;
using System.Diagnostics; using System.Diagnostics;
using System.Collections.Generic;
#endregion #endregion
@ -81,6 +82,7 @@ namespace CodeImp.DoomBuilder.IO
public abstract float MinCoordinate { get; } public abstract float MinCoordinate { get; }
public abstract int MaxThingAngle { get; } public abstract int MaxThingAngle { get; }
public abstract int MinThingAngle { get; } public abstract int MinThingAngle { get; }
public abstract Dictionary<string, List<string>> UIFields { get; } //mxd
#endregion #endregion

View file

@ -22,6 +22,7 @@ using System.Text;
using System.IO; using System.IO;
using CodeImp.DoomBuilder.Map; using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Config;
using System.Collections;
#endregion #endregion
@ -32,34 +33,32 @@ namespace CodeImp.DoomBuilder.IO
#region ================== Constants #region ================== Constants
// Name of the UDMF configuration file // Name of the UDMF configuration file
private const string UDMF_CONFIG_NAME = "UDMF.cfg"; private const string UDMF_UI_CONFIG_NAME = "UDMF_UI.cfg";
#endregion #endregion
#region ================== Variables #region ================== Variables
//private Configuration config; private Dictionary<string, List<string>> uifields;
#endregion #endregion
#region ================== Constructor / Disposer #region ================== Constructor / Disposer
// Constructor // Constructor
public UniversalMapSetIO(WAD wad, MapManager manager) : base(wad, manager) { } public UniversalMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
/*public UniversalMapSetIO(WAD wad, MapManager manager) : base(wad, manager)
{ {
if((manager != null) && (manager.Config != null)) if((manager != null) && (manager.Config != null))
{ {
// Make configuration // Make configuration
config = new Configuration(); Configuration config = new Configuration();
// Find a resource named UDMF.cfg // Find a resource named UDMF_UI.cfg
string[] resnames = General.ThisAssembly.GetManifestResourceNames(); string[] resnames = General.ThisAssembly.GetManifestResourceNames();
foreach(string rn in resnames) foreach(string rn in resnames)
{ {
// Found it? // Found it?
if(rn.EndsWith(UDMF_CONFIG_NAME, StringComparison.InvariantCultureIgnoreCase)) if(rn.EndsWith(UDMF_UI_CONFIG_NAME, StringComparison.InvariantCultureIgnoreCase))
{ {
// Get a stream from the resource // Get a stream from the resource
Stream udmfcfg = General.ThisAssembly.GetManifestResourceStream(rn); Stream udmfcfg = General.ThisAssembly.GetManifestResourceStream(rn);
@ -67,30 +66,19 @@ namespace CodeImp.DoomBuilder.IO
// Load configuration from stream // Load configuration from stream
config.InputConfiguration(udmfcfgreader.ReadToEnd()); config.InputConfiguration(udmfcfgreader.ReadToEnd());
string[] elements = new string[] { "vertex", "linedef", "sidedef", "sector", "thing" };
uifields = new Dictionary<string, List<string>>();
// Now we add the linedef flags, activations and thing flags foreach(string elementname in elements) {
// to this list, so that these don't show up in the custom IDictionary dic = config.ReadSetting("uifields." + elementname, new Hashtable());
// fields list either. We use true as dummy value (it has no meaning)
// Add linedef flags List<string> values = new List<string>();
foreach(KeyValuePair<string, string> flag in manager.Config.LinedefFlags) foreach(DictionaryEntry de in dic) {
config.WriteSetting("managedfields.linedef." + flag.Key, true); values.Add(de.Key.ToString());
}
// Add linedef activations uifields.Add(elementname, values);
foreach(LinedefActivateInfo activate in manager.Config.LinedefActivates) }
config.WriteSetting("managedfields.linedef." + activate.Key, true);
// Add thing flags
foreach(KeyValuePair<string, string> flag in manager.Config.ThingFlags)
config.WriteSetting("managedfields.thing." + flag.Key, true);
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in manager.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
//mxd. Add sidedef flags
foreach(KeyValuePair<string, string> flag in manager.Config.SidedefFlags)
config.WriteSetting("managedfields.sidedef." + flag.Key, true);
// Done // Done
udmfcfgreader.Dispose(); udmfcfgreader.Dispose();
@ -99,7 +87,7 @@ namespace CodeImp.DoomBuilder.IO
} }
} }
} }
}*/ }
#endregion #endregion
@ -142,6 +130,7 @@ namespace CodeImp.DoomBuilder.IO
public override float MinCoordinate { get { return float.MinValue; } } public override float MinCoordinate { get { return float.MinValue; } }
public override int MaxThingAngle { get { return int.MaxValue; } } public override int MaxThingAngle { get { return int.MaxValue; } }
public override int MinThingAngle { get { return int.MinValue; } } public override int MinThingAngle { get { return int.MinValue; } }
public override Dictionary<string, List<string>> UIFields { get { return uifields; } } //mxd
#endregion #endregion

View file

@ -83,6 +83,14 @@ namespace CodeImp.DoomBuilder.IO
foreach(LinedefActivateInfo activate in General.Map.Config.LinedefActivates) foreach(LinedefActivateInfo activate in General.Map.Config.LinedefActivates)
config.WriteSetting("managedfields.linedef." + activate.Key, true); config.WriteSetting("managedfields.linedef." + activate.Key, true);
//mxd. Add sidedef flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SidedefFlags)
config.WriteSetting("managedfields.sidedef." + flag.Key, true);
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
// Add thing flags // Add thing flags
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags) foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)
config.WriteSetting("managedfields.thing." + flag.Key, true); config.WriteSetting("managedfields.thing." + flag.Key, true);

View file

@ -305,7 +305,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Create frustum // Create frustum
frustum = new ProjectedFrustum2D(pos, anglexy, anglez, PROJ_NEAR_PLANE, frustum = new ProjectedFrustum2D(pos, anglexy, anglez, PROJ_NEAR_PLANE,
General.Settings.ViewDistance, Angle2D.DegToRad((float)General.Settings.VisualFOV)); General.Settings.ViewDistance, Angle2D.DegToRad(General.Settings.VisualFOV));
// Make the view matrix // Make the view matrix
view3d = Matrix.LookAtRH(D3DDevice.V3(pos), D3DDevice.V3(lookat), new Vector3(0f, 0f, 1f)); view3d = Matrix.LookAtRH(D3DDevice.V3(pos), D3DDevice.V3(lookat), new Vector3(0f, 0f, 1f));

View file

@ -68,7 +68,6 @@ namespace CodeImp.DoomBuilder.Rendering
public Vector4 CameraPosition { set { if (manager.Enabled) effect.SetValue(camPosHandle, value); } } public Vector4 CameraPosition { set { if (manager.Enabled) effect.SetValue(camPosHandle, value); } }
public Matrix World { set { if (manager.Enabled) effect.SetValue<Matrix>(worldHandle, value); } } public Matrix World { set { if (manager.Enabled) effect.SetValue<Matrix>(worldHandle, value); } }
public VertexElement[] VertexElements { get { return vertexElements; } }
#endregion #endregion

View file

@ -0,0 +1,66 @@
/********************************************************************\
Configuration for UDMF map reader/writer (UniversalMapSetIO)
\********************************************************************/
//mxd. These are the fields, which are managed by GZDoom Builder's UI, but are still stored as UniversalFields. I should turn all of these into properties one day. But not today.
uifields
{
linedef
{
alpha;
renderstyle;
arg0str;
locknumber;
}
sidedef
{
scalex_top;
scaley_top;
scalex_mid;
scaley_mid;
scalex_bottom;
scaley_bottom;
offsetx_top;
offsety_top;
offsetx_mid;
offsety_mid;
offsetx_bottom;
offsety_bottom;
light;
lightabsolute;
}
sector
{
xpanningfloor;
ypanningfloor;
xpanningceiling;
ypanningceiling;
xscalefloor;
yscalefloor;
xscaleceiling;
yscaleceiling;
rotationfloor;
rotationceiling;
lightfloor;
lightfloorabsolute;
lightceiling;
lightceilingabsolute;
alphafloor;
alphaceiling;
renderstylefloor;
renderstyleceiling;
gravity;
lightcolor;
fadecolor;
desaturation;
soundsequence;
}
thing
{
arg0str;
conversation;
}
}

View file

@ -108,13 +108,12 @@ namespace CodeImp.DoomBuilder.VisualModes
public int CameraDistance3D { get { return cameraDistance3D; } } public int CameraDistance3D { get { return cameraDistance3D; } }
public bool Sizeless { get { return sizeless; } } public bool Sizeless { get { return sizeless; } }
public Vector3 Center { public Vector3 Center {
get get {
{ if (isGldefsLight) return position_v3 + lightOffset;
if (isGldefsLight)
return position_v3 + lightOffset;
return new Vector3(position_v3.X, position_v3.Y, position_v3.Z + thingHeight / 2); return new Vector3(position_v3.X, position_v3.Y, position_v3.Z + thingHeight / 2);
} }
} }
public Vector3D CenterV3D { get { return D3DDevice.V3D(Center); } }
public Vector3 PositionV3 { get { return position_v3; } } public Vector3 PositionV3 { get { return position_v3; } }
public Vector3[] BoundingBox { get { return boundingBox; } } public Vector3[] BoundingBox { get { return boundingBox; } }
//mxd. light properties //mxd. light properties

View file

@ -59,12 +59,12 @@ namespace CodeImp.DoomBuilder.Windows
this.elements = elements; this.elements = elements;
this.Text = title; this.Text = title;
// Fill universal fields list
fieldslist.ListFixedFields(fixedfields);
// Initialize custom fields editor // Initialize custom fields editor
fieldslist.Setup(elementname); fieldslist.Setup(elementname);
// Fill universal fields list
fieldslist.ListFixedFields(fixedfields);
// Setup from first element // Setup from first element
MapElement fe = General.GetByIndex(elements, 0); MapElement fe = General.GetByIndex(elements, 0);
fieldslist.SetValues(fe.Fields, true); fieldslist.SetValues(fe.Fields, true);

View file

@ -46,7 +46,8 @@ namespace CodeImp.DoomBuilder.Windows
this.apply = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button();
this.actiongroup = new System.Windows.Forms.GroupBox(); this.actiongroup = new System.Windows.Forms.GroupBox();
this.argspanel = new System.Windows.Forms.Panel(); this.argspanel = new System.Windows.Forms.Panel();
this.arg0str = new System.Windows.Forms.ComboBox(); this.scriptNumbers = new System.Windows.Forms.ComboBox();
this.scriptNames = new System.Windows.Forms.ComboBox();
this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox(); this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox(); this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg0 = new CodeImp.DoomBuilder.Controls.ArgumentBox(); this.arg0 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
@ -327,7 +328,8 @@ namespace CodeImp.DoomBuilder.Windows
// //
// argspanel // argspanel
// //
this.argspanel.Controls.Add(this.arg0str); this.argspanel.Controls.Add(this.scriptNumbers);
this.argspanel.Controls.Add(this.scriptNames);
this.argspanel.Controls.Add(this.arg2); this.argspanel.Controls.Add(this.arg2);
this.argspanel.Controls.Add(this.arg1); this.argspanel.Controls.Add(this.arg1);
this.argspanel.Controls.Add(this.arg0); this.argspanel.Controls.Add(this.arg0);
@ -345,16 +347,27 @@ namespace CodeImp.DoomBuilder.Windows
this.argspanel.TabIndex = 2; this.argspanel.TabIndex = 2;
this.argspanel.Visible = false; this.argspanel.Visible = false;
// //
// arg0str // scriptNumbers
// //
this.arg0str.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.scriptNumbers.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.arg0str.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.scriptNumbers.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.arg0str.FormattingEnabled = true; this.scriptNumbers.BackColor = System.Drawing.Color.LemonChiffon;
this.arg0str.Location = new System.Drawing.Point(272, 55); this.scriptNumbers.FormattingEnabled = true;
this.arg0str.Name = "arg0str"; this.scriptNumbers.Location = new System.Drawing.Point(407, 55);
this.arg0str.Size = new System.Drawing.Size(125, 22); this.scriptNumbers.Name = "scriptNumbers";
this.arg0str.TabIndex = 38; this.scriptNumbers.Size = new System.Drawing.Size(120, 22);
this.arg0str.Leave += new System.EventHandler(this.arg0str_Leave); this.scriptNumbers.TabIndex = 39;
//
// scriptNames
//
this.scriptNames.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptNames.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptNames.BackColor = System.Drawing.Color.Honeydew;
this.scriptNames.FormattingEnabled = true;
this.scriptNames.Location = new System.Drawing.Point(283, 55);
this.scriptNames.Name = "scriptNames";
this.scriptNames.Size = new System.Drawing.Size(120, 22);
this.scriptNames.TabIndex = 38;
// //
// arg2 // arg2
// //
@ -1306,7 +1319,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true; this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100; this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true; this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
// //
// heightpanel1 // heightpanel1
// //
@ -1430,7 +1442,7 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox frontsector; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox frontsector;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backsector; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox backsector;
private System.Windows.Forms.CheckBox cbArgStr; private System.Windows.Forms.CheckBox cbArgStr;
private System.Windows.Forms.ComboBox arg0str; private System.Windows.Forms.ComboBox scriptNames;
private CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector tagSelector; private CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector tagSelector;
private System.Windows.Forms.TabControl udmfPropertiesFront; private System.Windows.Forms.TabControl udmfPropertiesFront;
private System.Windows.Forms.TabPage tabFrontOffsets; private System.Windows.Forms.TabPage tabFrontOffsets;
@ -1464,5 +1476,6 @@ namespace CodeImp.DoomBuilder.Windows
private CodeImp.DoomBuilder.GZBuilder.Controls.PairedIntControl backTextureOffset; private CodeImp.DoomBuilder.GZBuilder.Controls.PairedIntControl backTextureOffset;
private CodeImp.DoomBuilder.Controls.CheckboxArrayControl flagsFront; private CodeImp.DoomBuilder.Controls.CheckboxArrayControl flagsFront;
private CodeImp.DoomBuilder.Controls.CheckboxArrayControl flagsBack; private CodeImp.DoomBuilder.Controls.CheckboxArrayControl flagsBack;
private System.Windows.Forms.ComboBox scriptNumbers;
} }
} }

View file

@ -41,7 +41,6 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Constants #region ================== Constants
private const string EMPTY_TEXTURE = "-";
#endregion #endregion
@ -50,6 +49,8 @@ namespace CodeImp.DoomBuilder.Windows
private ICollection<Linedef> lines; private ICollection<Linedef> lines;
private List<LinedefProperties> linedefProps; //mxd private List<LinedefProperties> linedefProps; //mxd
private bool preventchanges = false; private bool preventchanges = false;
private string arg0str; //mxd
private bool haveArg0Str; //mxd
//Value linking //Value linking
private static bool linkFrontTopScale; private static bool linkFrontTopScale;
@ -166,9 +167,6 @@ namespace CodeImp.DoomBuilder.Windows
activation.Items.AddRange(General.Map.Config.LinedefActivates.ToArray()); activation.Items.AddRange(General.Map.Config.LinedefActivates.ToArray());
foreach(LinedefActivateInfo ai in General.Map.Config.LinedefActivates) udmfactivates.Add(ai.Title, ai); foreach(LinedefActivateInfo ai in General.Map.Config.LinedefActivates) udmfactivates.Add(ai.Title, ai);
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.LinedefFields);
// Initialize image selectors // Initialize image selectors
fronthigh.Initialize(); fronthigh.Initialize();
frontmid.Initialize(); frontmid.Initialize();
@ -177,9 +175,53 @@ namespace CodeImp.DoomBuilder.Windows
backmid.Initialize(); backmid.Initialize();
backlow.Initialize(); backlow.Initialize();
//mxd. Setup script numbers
scriptNumbers.Location = arg0.Location;
foreach(ScriptItem si in General.Map.NumberedScripts)
scriptNumbers.Items.Add(si);
if(General.Map.FormatInterface.HasCustomFields) { //mxd
//mxd. Setup script names
scriptNames.Location = arg0.Location;
foreach(ScriptItem nsi in General.Map.NamedScripts)
scriptNames.Items.Add(nsi);
// Initialize custom fields editor // Initialize custom fields editor
fieldslist.Setup("linedef"); fieldslist.Setup("linedef");
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.LinedefFields);
//initialize controls
frontUdmfControls = new List<PairedFieldsControl>() { pfcFrontOffsetTop, pfcFrontOffsetMid, pfcFrontOffsetBottom, pfcFrontScaleTop, pfcFrontScaleMid, pfcFrontScaleBottom };
backUdmfControls = new List<PairedFieldsControl>() { pfcBackOffsetTop, pfcBackOffsetMid, pfcBackOffsetBottom, pfcBackScaleTop, pfcBackScaleMid, pfcBackScaleBottom };
//Restore value linking
pfcFrontScaleTop.LinkValues = linkFrontTopScale;
pfcFrontScaleMid.LinkValues = linkFrontMidScale;
pfcFrontScaleBottom.LinkValues = linkFrontBottomScale;
pfcBackScaleTop.LinkValues = linkBackTopScale;
pfcBackScaleMid.LinkValues = linkBackMidScale;
pfcBackScaleBottom.LinkValues = linkBackBottomScale;
} else {
//Hide unused controls
tabs.TabPages.Remove(tabcustom);
settingsGroup.Visible = false;
customfrontbutton.Visible = false;
custombackbutton.Visible = false;
labelLightFront.Visible = false;
lightFront.Visible = false;
cbLightAbsoluteFront.Visible = false;
labelLightBack.Visible = false;
lightBack.Visible = false;
cbLightAbsoluteBack.Visible = false;
udmfPropertiesFront.Visible = false;
udmfPropertiesBack.Visible = false;
}
// Mixed activations? (UDMF) // Mixed activations? (UDMF)
if(General.Map.FormatInterface.HasMixedActivations) if(General.Map.FormatInterface.HasMixedActivations)
udmfpanel.Visible = true; udmfpanel.Visible = true;
@ -216,33 +258,6 @@ namespace CodeImp.DoomBuilder.Windows
{ {
idgroup.Visible = false; idgroup.Visible = false;
} }
//mxd. Setup UDMF controls
if(!General.Map.FormatInterface.HasCustomFields) {
tabs.TabPages.Remove(tabcustom);
settingsGroup.Visible = false;
customfrontbutton.Visible = false;
custombackbutton.Visible = false;
labelLightFront.Visible = false;
lightFront.Visible = false;
cbLightAbsoluteFront.Visible = false;
labelLightBack.Visible = false;
lightBack.Visible = false;
cbLightAbsoluteBack.Visible = false;
udmfPropertiesFront.Visible = false;
udmfPropertiesBack.Visible = false;
} else {
frontUdmfControls = new List<PairedFieldsControl>() { pfcFrontOffsetTop, pfcFrontOffsetMid, pfcFrontOffsetBottom, pfcFrontScaleTop, pfcFrontScaleMid, pfcFrontScaleBottom };
backUdmfControls = new List<PairedFieldsControl>() { pfcBackOffsetTop, pfcBackOffsetMid, pfcBackOffsetBottom, pfcBackScaleTop, pfcBackScaleMid, pfcBackScaleBottom };
//Restore value linking
pfcFrontScaleTop.LinkValues = linkFrontTopScale;
pfcFrontScaleMid.LinkValues = linkFrontMidScale;
pfcFrontScaleBottom.LinkValues = linkFrontBottomScale;
pfcBackScaleTop.LinkValues = linkBackTopScale;
pfcBackScaleMid.LinkValues = linkBackMidScale;
pfcBackScaleBottom.LinkValues = linkBackBottomScale;
}
} }
#endregion #endregion
@ -289,18 +304,16 @@ namespace CodeImp.DoomBuilder.Windows
if(fl.Flags.ContainsKey(ai.Key)) c.Checked = fl.Flags[ai.Key]; 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);
//mxd. UDMF Settings //mxd. UDMF Settings
if(General.Map.FormatInterface.HasCustomFields) { if(General.Map.FormatInterface.HasCustomFields) {
fieldslist.SetValues(fl.Fields, true); // Custom fields
string renderStyle = fl.Fields.GetValue("renderstyle", ""); string renderStyle = fl.Fields.GetValue("renderstyle", "");
cbRenderStyle.SelectedIndex = (renderStyle == "add" ? 1 : 0); cbRenderStyle.SelectedIndex = (renderStyle == "add" ? 1 : 0);
alpha.Text = General.Clamp(fl.Fields.GetValue("alpha", 1.0f), 0f, 1f).ToString(); alpha.Text = General.Clamp(fl.Fields.GetValue("alpha", 1.0f), 0f, 1f).ToString();
lockNumber.Text = fl.Fields.GetValue("locknumber", 0).ToString(); lockNumber.Text = fl.Fields.GetValue("locknumber", 0).ToString();
arg0str = fl.Fields.GetValue("arg0str", string.Empty);
haveArg0Str = !string.IsNullOrEmpty(arg0str);
} }
// Action/tags // Action/tags
@ -432,6 +445,14 @@ namespace CodeImp.DoomBuilder.Windows
if(!string.IsNullOrEmpty(lockNumber.Text) && lockNumber.GetResult(0) != l.Fields.GetValue("locknumber", 0)) if(!string.IsNullOrEmpty(lockNumber.Text) && lockNumber.GetResult(0) != l.Fields.GetValue("locknumber", 0))
lockNumber.Text = ""; lockNumber.Text = "";
if(arg0str != l.Fields.GetValue("arg0str", string.Empty)) {
haveArg0Str = true;
arg0str = string.Empty;
}
l.Fields.BeforeFieldsChange();
fieldslist.SetValues(l.Fields, false);
} }
// Action/tags // Action/tags
@ -443,12 +464,6 @@ namespace CodeImp.DoomBuilder.Windows
if(l.Args[3] != arg3.GetResult(-1)) arg3.ClearValue(); if(l.Args[3] != arg3.GetResult(-1)) arg3.ClearValue();
if(l.Args[4] != arg4.GetResult(-1)) arg4.ClearValue(); if(l.Args[4] != arg4.GetResult(-1)) arg4.ClearValue();
//mxd. Check if we have different arg0str values
if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1 && cbArgStr.Checked && !string.IsNullOrEmpty(arg0str.Text) && l.Fields.ContainsKey("arg0str") && l.Fields["arg0str"].Value.ToString() != arg0str.Text) {
arg0str.SelectedIndex = -1;
arg0str.Text = string.Empty;
}
// Front side checkbox // Front side checkbox
if((l.Front != null) != frontside.Checked) if((l.Front != null) != frontside.Checked)
{ {
@ -524,9 +539,6 @@ namespace CodeImp.DoomBuilder.Windows
foreach(PairedFieldsControl pfc in backUdmfControls) foreach(PairedFieldsControl pfc in backUdmfControls)
pfc.SetValuesFrom(l.Back.Fields, false); pfc.SetValuesFrom(l.Back.Fields, false);
//if(!string.IsNullOrEmpty(lightBack.Text) && lightBack.Text != UDMFTools.GetInteger(fl.Back.Fields, "light", 0).ToString())
//lightBack.Text = "";
if(!string.IsNullOrEmpty(lightBack.Text)) { if(!string.IsNullOrEmpty(lightBack.Text)) {
int light = UDMFTools.GetInteger(l.Back.Fields, "light", 0); int light = UDMFTools.GetInteger(l.Back.Fields, "light", 0);
if(light != lightBack.GetResult(light)) lightBack.Text = ""; if(light != lightBack.GetResult(light)) lightBack.Text = "";
@ -556,10 +568,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
linedefProps.Add(new LinedefProperties(l)); linedefProps.Add(new LinedefProperties(l));
// Custom fields
l.Fields.BeforeFieldsChange(); //mxd
fieldslist.SetValues(l.Fields, false);
} }
// Refresh controls so that they show their image // Refresh controls so that they show their image
@ -571,62 +579,56 @@ namespace CodeImp.DoomBuilder.Windows
frontlow.Refresh(); frontlow.Refresh();
preventchanges = false; preventchanges = false;
}
//mxd updateScriptControls(); //mxd
private void setNumberedScripts(Linedef l) {
arg0str.Items.Clear();
if (General.Map.NumberedScripts.Count > 0) { //mxd. Set intial script-related values, if required
foreach (ScriptItem si in General.Map.NumberedScripts) { if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1) {
arg0str.Items.Add(si); if(haveArg0Str) {
if (si.Index == l.Args[0]) scriptNames.Text = arg0str;
arg0str.SelectedIndex = arg0str.Items.Count - 1; arg0label.Text = "Script Name:";
} } else {
int a0 = arg0.GetResult(0);
//script number is not among known scripts... if(a0 > 0) {
if (arg0str.SelectedIndex == -1 && l.Args[0] > 0) { for(int i = 0; i < General.Map.NumberedScripts.Count; i++) {
arg0str.Items.Add(new ScriptItem(l.Args[0], "Script " + l.Args[0])); if(General.Map.NumberedScripts[i].Index == a0) {
arg0str.SelectedIndex = arg0str.Items.Count - 1; scriptNumbers.SelectedIndex = i;
}
} 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) {
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; break;
} }
} }
if(scriptNumbers.SelectedIndex == -1) {
scriptNumbers.Items.Add(new ScriptItem(a0, "Script " + a0));
scriptNumbers.SelectedIndex = scriptNumbers.Items.Count - 1;
}
} else { } else {
arg0str.Text = selectedValue; scriptNumbers.Text = arg0.Text;
}
}
} else {
scriptNumbers.Text = "0";
}
}
//mxd
private void updateScriptControls() {
if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1) {
bool showNamedScripts = General.Map.UDMF && haveArg0Str;
cbArgStr.Visible = General.Map.UDMF;
cbArgStr.Checked = showNamedScripts;
scriptNames.Visible = showNamedScripts;
scriptNumbers.Visible = !showNamedScripts;
} else {
cbArgStr.Visible = false;
scriptNames.Visible = false;
scriptNumbers.Visible = false;
cbArgStr.Checked = false;
} }
} }
#endregion #endregion
// This selects all text in a textbox #region ================== Events
/*private void SelectAllText(object sender, EventArgs e)
{
(sender as TextBox).SelectAll();
}*/
#region Events
// Apply clicked // Apply clicked
private void apply_Click(object sender, EventArgs e) private void apply_Click(object sender, EventArgs e)
@ -653,7 +655,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
bool hasAcs = !action.Empty && Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1; bool hasAcs = !action.Empty && Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1;
bool hasArg0str = General.Map.UDMF && hasAcs && !string.IsNullOrEmpty(arg0str.Text);
int lockNum = lockNumber.GetResult(0); int lockNum = lockNumber.GetResult(0);
// Go for all the lines // Go for all the lines
@ -673,17 +674,32 @@ namespace CodeImp.DoomBuilder.Windows
// Action/tags // Action/tags
l.Tag = tagSelector.GetTag(l.Tag); //mxd l.Tag = tagSelector.GetTag(l.Tag); //mxd
if(!action.Empty) l.Action = action.Value; if(!action.Empty) {
l.Action = action.Value;
//mxd //mxd. Script name/number handling
if (hasAcs && !cbArgStr.Checked) { if(hasAcs) {
if (arg0str.SelectedItem != null) if(!cbArgStr.Checked) { //apply script number
l.Args[0] = ((ScriptItem)arg0str.SelectedItem).Index; if(!string.IsNullOrEmpty(scriptNumbers.Text)) {
else if (!int.TryParse(arg0str.Text.Trim(), out l.Args[0])) if(scriptNumbers.SelectedItem != null)
l.Args[0] = ((ScriptItem)scriptNumbers.SelectedItem).Index;
else if(!int.TryParse(scriptNumbers.Text.Trim(), out l.Args[0]))
l.Args[0] = 0; l.Args[0] = 0;
if(l.Fields.ContainsKey("arg0str")) l.Fields.Remove("arg0str");
}
} else { //apply arg0str
if(!string.IsNullOrEmpty(scriptNames.Text))
l.Fields["arg0str"] = new UniValue(UniversalType.String, scriptNames.Text);
}
} else {
l.Args[0] = arg0.GetResult(l.Args[0]);
if(l.Fields.ContainsKey("arg0str")) l.Fields.Remove("arg0str");
}
}else{ }else{
l.Args[0] = arg0.GetResult(l.Args[0]); l.Args[0] = arg0.GetResult(l.Args[0]);
} }
l.Args[1] = arg1.GetResult(l.Args[1]); l.Args[1] = arg1.GetResult(l.Args[1]);
l.Args[2] = arg2.GetResult(l.Args[2]); l.Args[2] = arg2.GetResult(l.Args[2]);
l.Args[3] = arg3.GetResult(l.Args[3]); l.Args[3] = arg3.GetResult(l.Args[3]);
@ -744,14 +760,9 @@ namespace CodeImp.DoomBuilder.Windows
} }
//mxd. UDMF Settings //mxd. UDMF Settings
if(General.Map.FormatInterface.HasCustomFields) if(General.Map.FormatInterface.HasCustomFields) {
fieldslist.Apply(l.Fields);
UDMFTools.SetInteger(l.Fields, "locknumber", lockNum, 0, false); UDMFTools.SetInteger(l.Fields, "locknumber", lockNum, 0, false);
//mxd. apply arg0str
if(cbArgStr.Visible && cbArgStr.Checked && hasArg0str) {
l.Fields["arg0str"] = new UniValue(UniversalType.String, arg0str.Text);
} else if(l.Fields.ContainsKey("arg0str") && (string.IsNullOrEmpty(l.Fields["arg0str"].Value.ToString()) || !hasAcs || (hasAcs && !cbArgStr.Checked))) {
l.Fields.Remove("arg0str");
} }
} }
@ -847,26 +858,7 @@ namespace CodeImp.DoomBuilder.Windows
} }
} }
//mxd. update arg0str if(!preventchanges) updateScriptControls(); //mxd
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 {
if(cbArgStr.Checked) cbArgStr.Checked = false;
cbArgStr.Visible = false;
arg0label.Text = General.Map.Config.LinedefActions[showaction].Args[0].Title + ":";
arg0str.Visible = false;
}
} }
// Browse Action clicked // Browse Action clicked
@ -877,20 +869,10 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
private void cbArgStr_CheckedChanged(object sender, EventArgs e) { private void cbArgStr_CheckedChanged(object sender, EventArgs e) {
arg0str.Text = ""; if(!cbArgStr.Visible) return;
scriptNames.Visible = cbArgStr.Checked;
if (cbArgStr.Checked) { scriptNumbers.Visible = !cbArgStr.Checked;
setNamedScripts((string)fieldslist.GetValue("arg0str")); arg0label.Text = cbArgStr.Checked ? "Script Name:" : "Script Number:";
} 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, UniversalType.String);
} }
//mxd //mxd
@ -968,44 +950,6 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
} }
private void fieldslist_OnFieldValueChanged(string fieldname) {
if(preventchanges) return;
Linedef fl = null;
foreach(Linedef l in lines) {
fieldslist.Apply(l.Fields);
if(fl == null) fl = l;
}
if(fl == null) return;
//update interface... yaaaay...
switch(fieldname) {
case "arg0str":
if(cbArgStr.Checked) arg0str.Text = (string)fieldslist.GetValue(fieldname);
break;
case "alpha":
alpha.Text = (string)fieldslist.GetValue(fieldname);
break;
case "locknumber":
lockNumber.Text = (string)fieldslist.GetValue(fieldname);
break;
case "renderstyle":
string renderstyle = (string)fieldslist.GetValue(fieldname);
if(renderstyle == "add") {
cbRenderStyle.SelectedIndex = 1;
} else if(renderstyle == "translucent") {
cbRenderStyle.SelectedIndex = 0;
} else {
cbRenderStyle.SelectedIndex = -1;
}
break;
}
}
#endregion #endregion
#region Reltime events (sides) #region Reltime events (sides)
@ -1075,7 +1019,6 @@ namespace CodeImp.DoomBuilder.Windows
// Edit these // Edit these
if(!CustomFieldsForm.ShowDialog(this, "Back side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return; if(!CustomFieldsForm.ShowDialog(this, "Back side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return;
//General.Map.UndoRedo.WithdrawUndo();
//Apply values //Apply values
Sidedef fs = General.GetByIndex(sides, 0) as Sidedef; Sidedef fs = General.GetByIndex(sides, 0) as Sidedef;
@ -1136,7 +1079,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0; int i = 0;
foreach(Linedef l in lines) { foreach(Linedef l in lines) {
if(l.Front != null) l.Front.SetTextureHigh(linedefProps[i].Front != null ? linedefProps[i].Front.TextureTop : EMPTY_TEXTURE); if(l.Front != null) l.Front.SetTextureHigh(linedefProps[i].Front != null ? linedefProps[i].Front.TextureTop : "-");
i++; i++;
} }
//update values //update values
@ -1160,7 +1103,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0; int i = 0;
foreach(Linedef l in lines) { foreach(Linedef l in lines) {
if(l.Front != null) l.Front.SetTextureMid(linedefProps[i].Front != null ? linedefProps[i].Front.TextureMid : EMPTY_TEXTURE); if(l.Front != null) l.Front.SetTextureMid(linedefProps[i].Front != null ? linedefProps[i].Front.TextureMid : "-");
i++; i++;
} }
//update values //update values
@ -1184,7 +1127,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0; int i = 0;
foreach(Linedef l in lines) { foreach(Linedef l in lines) {
if(l.Front != null) l.Front.SetTextureLow(linedefProps[i].Front != null ? linedefProps[i].Front.TextureLow : EMPTY_TEXTURE); if(l.Front != null) l.Front.SetTextureLow(linedefProps[i].Front != null ? linedefProps[i].Front.TextureLow : "-");
i++; i++;
} }
//update values //update values
@ -1208,7 +1151,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0; int i = 0;
foreach(Linedef l in lines) { foreach(Linedef l in lines) {
if(l.Back != null) l.Back.SetTextureHigh(linedefProps[i].Back != null ? linedefProps[i].Back.TextureTop : EMPTY_TEXTURE); if(l.Back != null) l.Back.SetTextureHigh(linedefProps[i].Back != null ? linedefProps[i].Back.TextureTop : "-");
i++; i++;
} }
//update values //update values
@ -1232,7 +1175,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0; int i = 0;
foreach(Linedef l in lines) { foreach(Linedef l in lines) {
if(l.Back != null) l.Back.SetTextureMid(linedefProps[i].Back != null ? linedefProps[i].Back.TextureMid : EMPTY_TEXTURE); if(l.Back != null) l.Back.SetTextureMid(linedefProps[i].Back != null ? linedefProps[i].Back.TextureMid : "-");
i++; i++;
} }
//update values //update values
@ -1256,7 +1199,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0; int i = 0;
foreach(Linedef l in lines) { foreach(Linedef l in lines) {
if(l.Back != null) l.Back.SetTextureLow(linedefProps[i].Back != null ? linedefProps[i].Back.TextureLow : EMPTY_TEXTURE); if(l.Back != null) l.Back.SetTextureLow(linedefProps[i].Back != null ? linedefProps[i].Back.TextureLow : "-");
i++; i++;
} }
//update values //update values

View file

@ -179,7 +179,7 @@ namespace CodeImp.DoomBuilder.Windows
// Help // Help
private void ScriptEditorForm_HelpRequested(object sender, HelpEventArgs hlpevent) private void ScriptEditorForm_HelpRequested(object sender, HelpEventArgs hlpevent)
{ {
General.ShowHelp("w_scripteditor.html"); if(!editor.LaunchKeywordHelp()) General.ShowHelp("w_scripteditor.html"); //mxd
hlpevent.Handled = true; hlpevent.Handled = true;
} }

View file

@ -837,8 +837,6 @@
this.fieldslist.TypeColumnVisible = true; this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100; this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true; this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldUndefined += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
// //
// cancel // cancel
// //

View file

@ -105,6 +105,9 @@ namespace CodeImp.DoomBuilder.Windows
// Fill effects list // Fill effects list
effect.AddInfo(General.Map.Config.SortedSectorEffects.ToArray()); effect.AddInfo(General.Map.Config.SortedSectorEffects.ToArray());
// Initialize custom fields editor
fieldslist.Setup("sector");
// Fill universal fields list // Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.SectorFields); fieldslist.ListFixedFields(General.Map.Config.SectorFields);
@ -115,13 +118,6 @@ namespace CodeImp.DoomBuilder.Windows
// Set steps for brightness field // Set steps for brightness field
brightness.StepValues = General.Map.Config.BrightnessLevels; brightness.StepValues = General.Map.Config.BrightnessLevels;
// Custom fields?
if(!General.Map.FormatInterface.HasCustomFields)
tabs.TabPages.Remove(tabcustom);
// Initialize custom fields editor
fieldslist.Setup("sector");
// Value linking // Value linking
ceilScale.LinkValues = linkCeilingScale; ceilScale.LinkValues = linkCeilingScale;
floorScale.LinkValues = linkFloorScale; floorScale.LinkValues = linkFloorScale;
@ -262,8 +258,7 @@ namespace CodeImp.DoomBuilder.Windows
//Texture brightness //Texture brightness
if(s.Fields.GetValue("lightceiling", 0).ToString() != ceilBrightness.Text) ceilBrightness.Text = ""; if(s.Fields.GetValue("lightceiling", 0).ToString() != ceilBrightness.Text) ceilBrightness.Text = "";
if(s.Fields.GetValue("lightfloor", 0).ToString() != floorBrightness.Text) if(s.Fields.GetValue("lightfloor", 0).ToString() != floorBrightness.Text) floorBrightness.Text = "";
floorBrightness.Text = "";
if(s.Fields.GetValue("lightceilingabsolute", false) != ceilLightAbsolute.Checked) { if(s.Fields.GetValue("lightceilingabsolute", false) != ceilLightAbsolute.Checked) {
ceilLightAbsolute.ThreeState = true; ceilLightAbsolute.ThreeState = true;
@ -377,6 +372,9 @@ namespace CodeImp.DoomBuilder.Windows
// Action // Action
s.Tag = tagSelector.GetTag(s.Tag); //mxd s.Tag = tagSelector.GetTag(s.Tag); //mxd
//Fields
fieldslist.Apply(s.Fields);
//alpha //alpha
if(!string.IsNullOrEmpty(ceilAlpha.Text)) { if(!string.IsNullOrEmpty(ceilAlpha.Text)) {
float ceilAlphaVal = General.Clamp(ceilAlpha.GetResultFloat(s.Fields.GetValue("alphaceiling", 1.0f)), 0f, 1f); float ceilAlphaVal = General.Clamp(ceilAlpha.GetResultFloat(s.Fields.GetValue("alphaceiling", 1.0f)), 0f, 1f);
@ -620,114 +618,6 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
} }
private void fieldslist_OnFieldValueChanged(string fieldname) {
if(blockUpdate) return;
Sector sc = null;
foreach(Sector s in sectors) {
fieldslist.Apply(s.Fields);
s.UpdateNeeded = true;
if(sc == null) sc = s;
}
if(sc == null) return;
//update interface... yaaaay...
switch(fieldname) {
case "xpanningfloor":
case "ypanningfloor":
floorOffsets.SetValuesFrom(sc.Fields, true);
break;
case "xpanningceiling":
case "ypanningceiling":
ceilOffsets.SetValuesFrom(sc.Fields, true);
break;
case "xscalefloor":
case "yscalefloor":
floorScale.SetValuesFrom(sc.Fields, true);
break;
case "xscaleceiling":
case "yscaleceiling":
ceilScale.SetValuesFrom(sc.Fields, true);
break;
case "rotationceiling":
ceilRotation.Text = sc.Fields.GetValue("rotationceiling", 0f).ToString();
break;
case "rotationfloor":
floorRotation.Text = sc.Fields.GetValue("rotationfloor", 0f).ToString();
break;
case "lightfloor":
floorBrightness.Text = sc.Fields.GetValue("lightfloor", 0).ToString();
break;
case "lightceiling":
ceilBrightness.Text = sc.Fields.GetValue("lightceiling", 0).ToString();
break;
case "lightfloorabsolute":
floorLightAbsolute.Checked = sc.Fields.GetValue("lightfloorabsolute", false);
break;
case "lightceilingabsolute":
ceilLightAbsolute.Checked = sc.Fields.GetValue("lightceilingabsolute", false);
break;
case "alphafloor":
floorAlpha.Text = sc.Fields.GetValue("alphafloor", 1.0f).ToString();
break;
case "alphaceiling":
floorAlpha.Text = sc.Fields.GetValue("alphaceiling", 1.0f).ToString();
break;
case "gravity":
gravity.Text = sc.Fields.GetValue("gravity", 1.0f).ToString();
break;
case "desaturation":
desaturation.Text = sc.Fields.GetValue("desaturation", 0f).ToString();
break;
case "lightcolor":
lightColor.SetValueFrom(sc.Fields);
break;
case "fadecolor":
fadeColor.SetValueFrom(sc.Fields);
break;
case "renderstylefloor":
string rsf = sc.Fields.GetValue("renderstylefloor", string.Empty);
if(string.IsNullOrEmpty(rsf) || rsf.ToLower() == "translucent") {
floorRenderStyle.SelectedIndex = 0;
} else {
floorRenderStyle.SelectedIndex = 1;
}
break;
case "renderstyleceiling":
string rsc = sc.Fields.GetValue("renderstyleceiling", string.Empty);
if(string.IsNullOrEmpty(rsc) || rsc.ToLower() == "translucent") {
ceilRenderStyle.SelectedIndex = 0;
} else {
ceilRenderStyle.SelectedIndex = 1;
}
break;
case "soundsequence":
soundSequence.Text = sc.Fields.GetValue("soundsequence", string.Empty);
break;
}
}
private void lightColor_OnValueChanged(object sender, EventArgs e) { private void lightColor_OnValueChanged(object sender, EventArgs e) {
if(blockUpdate) return; if(blockUpdate) return;
int i = 0; int i = 0;

View file

@ -411,13 +411,13 @@ namespace CodeImp.DoomBuilder.Windows
browser.BeginAdding(false); browser.BeginAdding(false);
if (browseFlats) { if (browseFlats) {
// Add all used flats
foreach (ImageData img in set.Flats)
if (img.UsedInMap) browser.Add(img.Name, img, img, usedgroup);
// Add all available flats // Add all available flats
foreach(ImageData img in set.Flats) foreach(ImageData img in set.Flats)
browser.Add(img.Name, img, img, availgroup); browser.Add(img.Name, img, img, availgroup);
// Add all used flats
foreach(ImageData img in set.Flats)
if(img.UsedInMap) browser.Add(img.Name, img, img, usedgroup);
}else{ }else{
// Add all available textures and mark the images for temporary loading // Add all available textures and mark the images for temporary loading
foreach (ImageData img in set.Textures) foreach (ImageData img in set.Textures)

View file

@ -51,7 +51,8 @@ namespace CodeImp.DoomBuilder.Windows
this.tabeffects = new System.Windows.Forms.TabPage(); this.tabeffects = new System.Windows.Forms.TabPage();
this.actiongroup = new System.Windows.Forms.GroupBox(); this.actiongroup = new System.Windows.Forms.GroupBox();
this.hexenpanel = new System.Windows.Forms.Panel(); this.hexenpanel = new System.Windows.Forms.Panel();
this.arg0str = new System.Windows.Forms.ComboBox(); this.scriptNumbers = new System.Windows.Forms.ComboBox();
this.scriptNames = new System.Windows.Forms.ComboBox();
this.cbArgStr = new System.Windows.Forms.CheckBox(); this.cbArgStr = new System.Windows.Forms.CheckBox();
this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox(); this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox(); this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
@ -67,6 +68,8 @@ namespace CodeImp.DoomBuilder.Windows
this.browseaction = new System.Windows.Forms.Button(); this.browseaction = new System.Windows.Forms.Button();
this.doompanel = new System.Windows.Forms.Panel(); this.doompanel = new System.Windows.Forms.Panel();
this.groupBox3 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox();
this.conversationID = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.labelID = new System.Windows.Forms.Label();
this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector(); this.tagSelector = new CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector();
this.tabcustom = new System.Windows.Forms.TabPage(); this.tabcustom = new System.Windows.Forms.TabPage();
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl(); this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
@ -373,7 +376,8 @@ namespace CodeImp.DoomBuilder.Windows
this.hexenpanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 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.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.hexenpanel.Controls.Add(this.arg0str); this.hexenpanel.Controls.Add(this.scriptNumbers);
this.hexenpanel.Controls.Add(this.scriptNames);
this.hexenpanel.Controls.Add(this.cbArgStr); this.hexenpanel.Controls.Add(this.cbArgStr);
this.hexenpanel.Controls.Add(this.arg2); this.hexenpanel.Controls.Add(this.arg2);
this.hexenpanel.Controls.Add(this.arg1); this.hexenpanel.Controls.Add(this.arg1);
@ -390,16 +394,27 @@ namespace CodeImp.DoomBuilder.Windows
this.hexenpanel.Size = new System.Drawing.Size(628, 246); this.hexenpanel.Size = new System.Drawing.Size(628, 246);
this.hexenpanel.TabIndex = 13; this.hexenpanel.TabIndex = 13;
// //
// arg0str // scriptNumbers
// //
this.arg0str.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest; this.scriptNumbers.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.arg0str.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.scriptNumbers.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.arg0str.FormattingEnabled = true; this.scriptNumbers.BackColor = System.Drawing.Color.LemonChiffon;
this.arg0str.Location = new System.Drawing.Point(179, 93); this.scriptNumbers.FormattingEnabled = true;
this.arg0str.Name = "arg0str"; this.scriptNumbers.Location = new System.Drawing.Point(179, 121);
this.arg0str.Size = new System.Drawing.Size(127, 22); this.scriptNumbers.Name = "scriptNumbers";
this.arg0str.TabIndex = 22; this.scriptNumbers.Size = new System.Drawing.Size(127, 22);
this.arg0str.Leave += new System.EventHandler(this.arg0str_Leave); this.scriptNumbers.TabIndex = 23;
//
// scriptNames
//
this.scriptNames.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptNames.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptNames.BackColor = System.Drawing.Color.Honeydew;
this.scriptNames.FormattingEnabled = true;
this.scriptNames.Location = new System.Drawing.Point(179, 93);
this.scriptNames.Name = "scriptNames";
this.scriptNames.Size = new System.Drawing.Size(127, 22);
this.scriptNames.TabIndex = 22;
// //
// cbArgStr // cbArgStr
// //
@ -539,6 +554,8 @@ namespace CodeImp.DoomBuilder.Windows
// //
// groupBox3 // groupBox3
// //
this.groupBox3.Controls.Add(this.conversationID);
this.groupBox3.Controls.Add(this.labelID);
this.groupBox3.Controls.Add(this.tagSelector); this.groupBox3.Controls.Add(this.tagSelector);
this.groupBox3.Location = new System.Drawing.Point(6, 6); this.groupBox3.Location = new System.Drawing.Point(6, 6);
this.groupBox3.Name = "groupBox3"; this.groupBox3.Name = "groupBox3";
@ -547,6 +564,28 @@ namespace CodeImp.DoomBuilder.Windows
this.groupBox3.TabStop = false; this.groupBox3.TabStop = false;
this.groupBox3.Text = " Identification "; this.groupBox3.Text = " Identification ";
// //
// conversationID
//
this.conversationID.AllowDecimal = false;
this.conversationID.AllowNegative = false;
this.conversationID.AllowRelative = false;
this.conversationID.ButtonStep = 1;
this.conversationID.ButtonStepFloat = 1F;
this.conversationID.Location = new System.Drawing.Point(493, 26);
this.conversationID.Name = "conversationID";
this.conversationID.Size = new System.Drawing.Size(72, 24);
this.conversationID.StepValues = null;
this.conversationID.TabIndex = 14;
//
// labelID
//
this.labelID.AutoSize = true;
this.labelID.Location = new System.Drawing.Point(401, 31);
this.labelID.Name = "labelID";
this.labelID.Size = new System.Drawing.Size(86, 14);
this.labelID.TabIndex = 10;
this.labelID.Text = "Conversation ID:";
//
// tagSelector // tagSelector
// //
this.tagSelector.Location = new System.Drawing.Point(6, 19); this.tagSelector.Location = new System.Drawing.Point(6, 19);
@ -585,7 +624,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true; this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100; this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true; this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
// //
// cancel // cancel
// //
@ -642,6 +680,7 @@ namespace CodeImp.DoomBuilder.Windows
this.actiongroup.PerformLayout(); this.actiongroup.PerformLayout();
this.hexenpanel.ResumeLayout(false); this.hexenpanel.ResumeLayout(false);
this.groupBox3.ResumeLayout(false); this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.tabcustom.ResumeLayout(false); this.tabcustom.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
@ -685,10 +724,13 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox posX; private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox posX;
private System.Windows.Forms.CheckBox cbArgStr; private System.Windows.Forms.CheckBox cbArgStr;
private System.Windows.Forms.ComboBox arg0str; private System.Windows.Forms.ComboBox scriptNames;
private System.Windows.Forms.CheckBox cbAbsoluteHeight; private System.Windows.Forms.CheckBox cbAbsoluteHeight;
private System.Windows.Forms.CheckBox cbRandomAngle; private System.Windows.Forms.CheckBox cbRandomAngle;
private System.Windows.Forms.Label labelAngle; private System.Windows.Forms.Label labelAngle;
private CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector tagSelector; private CodeImp.DoomBuilder.GZBuilder.Controls.TagSelector tagSelector;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox conversationID;
private System.Windows.Forms.Label labelID;
private System.Windows.Forms.ComboBox scriptNumbers;
} }
} }

View file

@ -25,6 +25,8 @@ using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Config; using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Geometry; using CodeImp.DoomBuilder.Geometry;
using CodeImp.DoomBuilder.GZBuilder.Data; using CodeImp.DoomBuilder.GZBuilder.Data;
using CodeImp.DoomBuilder.GZBuilder.Tools;
using CodeImp.DoomBuilder.Types;
#endregion #endregion
@ -45,11 +47,13 @@ namespace CodeImp.DoomBuilder.Windows
private ICollection<Thing> things; private ICollection<Thing> things;
private ThingTypeInfo thinginfo; private ThingTypeInfo thinginfo;
private bool preventchanges = false; private bool preventchanges;
//mxd //mxd
private Vector3D initialPosition; //initial position of a thing used to fill posX, posY and posZ fields private Vector3D initialPosition; //initial position of a thing used to fill posX, posY and posZ fields
private int initialFloorHeight; //floor height of the sector first thing is in private int initialFloorHeight; //floor height of the sector first thing is in
private static bool useAbsoluteHeight; private static bool useAbsoluteHeight;
private string arg0str;
private bool haveArg0Str;
private List<ThingProperties> thingProps; //mxd private List<ThingProperties> thingProps; //mxd
@ -88,19 +92,33 @@ namespace CodeImp.DoomBuilder.Windows
action.GeneralizedCategories = General.Map.Config.GenActionCategories; action.GeneralizedCategories = General.Map.Config.GenActionCategories;
action.AddInfo(General.Map.Config.SortedLinedefActions.ToArray()); action.AddInfo(General.Map.Config.SortedLinedefActions.ToArray());
// Fill universal fields list if(General.Map.FormatInterface.HasCustomFields) { //mxd
fieldslist.ListFixedFields(General.Map.Config.ThingFields);
// Initialize custom fields editor // Initialize custom fields editor
fieldslist.Setup("thing"); fieldslist.Setup("thing");
// Custom fields? // Fill universal fields list
if(!General.Map.FormatInterface.HasCustomFields) fieldslist.ListFixedFields(General.Map.Config.ThingFields);
} else {
tabs.TabPages.Remove(tabcustom); tabs.TabPages.Remove(tabcustom);
// Hide unused controls
labelID.Visible = false; //mxd
conversationID.Visible = false; //mxd
}
// Tag/Effects? // Tag/Effects?
if(!General.Map.FormatInterface.HasThingAction && !General.Map.FormatInterface.HasThingTag) if(!General.Map.FormatInterface.HasThingAction && !General.Map.FormatInterface.HasThingTag){
tabs.TabPages.Remove(tabeffects); tabs.TabPages.Remove(tabeffects);
} else { //mxd. Setup script names and numbers
scriptNames.Location = arg0.Location;
scriptNumbers.Location = arg0.Location;
foreach(ScriptItem nsi in General.Map.NamedScripts)
scriptNames.Items.Add(nsi);
foreach(ScriptItem si in General.Map.NumberedScripts)
scriptNumbers.Items.Add(si);
}
// Thing height? // Thing height?
posZ.Visible = General.Map.FormatInterface.HasThingHeight; posZ.Visible = General.Map.FormatInterface.HasThingHeight;
@ -163,15 +181,16 @@ namespace CodeImp.DoomBuilder.Windows
posY.ButtonStep = General.Map.Grid.GridSize; posY.ButtonStep = General.Map.Grid.GridSize;
posZ.ButtonStep = General.Map.Grid.GridSize; posZ.ButtonStep = General.Map.Grid.GridSize;
//mxd. setup arg0str //mxd. Custom fields
arg0str.Location = arg0.Location; if(General.Map.FormatInterface.HasCustomFields) {
// Custom fields
fieldslist.SetValues(ft.Fields, true); fieldslist.SetValues(ft.Fields, true);
conversationID.Text = ft.Fields.GetValue("conversation", 0).ToString();
arg0str = ft.Fields.GetValue("arg0str", string.Empty);
haveArg0Str = !string.IsNullOrEmpty(arg0str);
}
// Action/tags // Action/tags
action.Value = ft.Action; action.Value = ft.Action;
//tag.Text = ft.Tag.ToString(); //mxd
if(General.Map.FormatInterface.HasThingTag) {//mxd if(General.Map.FormatInterface.HasThingTag) {//mxd
tagSelector.Setup(); tagSelector.Setup();
tagSelector.SetTag(ft.Tag); tagSelector.SetTag(ft.Tag);
@ -216,13 +235,12 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
if (useAbsoluteHeight && t.Sector != null) { if (useAbsoluteHeight && t.Sector != null) {
if(((int)t.Position.z + t.Sector.FloorHeight).ToString() != posZ.Text) posZ.Text = ""; if(((int)t.Position.z + t.Sector.FloorHeight).ToString() != posZ.Text) posZ.Text = "";
} else { } else if(((int)t.Position.z).ToString() != posZ.Text){
if(((int)t.Position.z).ToString() != posZ.Text) posZ.Text = ""; posZ.Text = "";
} }
// Action/tags // Action/tags
if(t.Action != action.Value) action.Empty = true; if(t.Action != action.Value) action.Empty = true;
//if(t.Tag.ToString() != tag.Text) tag.Text = ""; //mxd
if(General.Map.FormatInterface.HasThingTag && t.Tag != ft.Tag) tagSelector.ClearTag(); //mxd if(General.Map.FormatInterface.HasThingTag && t.Tag != ft.Tag) tagSelector.ClearTag(); //mxd
if(t.Args[0] != arg0.GetResult(-1)) arg0.ClearValue(); if(t.Args[0] != arg0.GetResult(-1)) arg0.ClearValue();
if(t.Args[1] != arg1.GetResult(-1)) arg1.ClearValue(); if(t.Args[1] != arg1.GetResult(-1)) arg1.ClearValue();
@ -230,10 +248,20 @@ namespace CodeImp.DoomBuilder.Windows
if(t.Args[3] != arg3.GetResult(-1)) arg3.ClearValue(); if(t.Args[3] != arg3.GetResult(-1)) arg3.ClearValue();
if(t.Args[4] != arg4.GetResult(-1)) arg4.ClearValue(); if(t.Args[4] != arg4.GetResult(-1)) arg4.ClearValue();
// Custom fields //mxd. Custom fields
if(General.Map.FormatInterface.HasCustomFields){
t.Fields.BeforeFieldsChange(); //mxd t.Fields.BeforeFieldsChange(); //mxd
fieldslist.SetValues(t.Fields, false); fieldslist.SetValues(t.Fields, false);
if(t.Fields.GetValue("conversation", 0).ToString() != conversationID.Text)
conversationID.Text = "";
if (arg0str != t.Fields.GetValue("arg0str", string.Empty)) {
haveArg0Str = true;
arg0str = string.Empty;
}
}
//mxd. Store initial properties //mxd. Store initial properties
thingProps.Add(new ThingProperties(t)); thingProps.Add(new ThingProperties(t));
@ -247,50 +275,50 @@ namespace CodeImp.DoomBuilder.Windows
} }
preventchanges = false; preventchanges = false;
}
//mxd updateScriptControls(); //mxd
private void setNumberedScripts(Thing t) {
arg0str.Items.Clear();
if (General.Map.NumberedScripts.Count > 0) { //mxd. Set intial script-related values, if required
foreach (ScriptItem si in General.Map.NumberedScripts) { if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1) {
arg0str.Items.Add(si); if(haveArg0Str) {
if (si.Index == t.Args[0]) scriptNames.Text = arg0str;
arg0str.SelectedIndex = arg0str.Items.Count - 1; arg0label.Text = "Script Name:";
} } else {
int a0 = arg0.GetResult(0);
//script number is not among known scripts... if(a0 > 0) {
if (arg0str.SelectedIndex == -1 && t.Args[0] > 0) { for(int i = 0; i < General.Map.NumberedScripts.Count; i++) {
arg0str.Items.Add(new ScriptItem(t.Args[0], "Script " + t.Args[0])); if(General.Map.NumberedScripts[i].Index == a0) {
arg0str.SelectedIndex = arg0str.Items.Count - 1; scriptNumbers.SelectedIndex = i;
}
} 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) {
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; break;
} }
} }
if(scriptNumbers.SelectedIndex == -1) {
scriptNumbers.Items.Add(new ScriptItem(a0, "Script " + a0));
scriptNumbers.SelectedIndex = scriptNumbers.Items.Count - 1;
}
} else { } else {
arg0str.Text = selectedValue; scriptNumbers.Text = arg0.Text;
}
}
} else {
scriptNumbers.Text = "0";
}
}
//mxd
private void updateScriptControls() {
if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1) {
bool showNamedScripts = General.Map.UDMF && haveArg0Str;
cbArgStr.Visible = General.Map.UDMF;
cbArgStr.Checked = showNamedScripts;
scriptNames.Visible = showNamedScripts;
scriptNumbers.Visible = !showNamedScripts;
} else {
cbArgStr.Visible = false;
scriptNames.Visible = false;
scriptNumbers.Visible = false;
cbArgStr.Checked = false;
} }
} }
@ -347,25 +375,7 @@ namespace CodeImp.DoomBuilder.Windows
arg4.SetDefaultValue(); arg4.SetDefaultValue();
} }
//update arg0str if(!preventchanges) updateScriptControls(); //mxd
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 // Browse Action clicked
@ -393,7 +403,6 @@ namespace CodeImp.DoomBuilder.Windows
{ {
List<string> defaultflags = new List<string>(); List<string> defaultflags = new List<string>();
//mxd
// Verify the tag // Verify the tag
if(General.Map.FormatInterface.HasThingTag) //mxd if(General.Map.FormatInterface.HasThingTag) //mxd
{ {
@ -418,18 +427,13 @@ namespace CodeImp.DoomBuilder.Windows
return; return;
} }
//mxd bool hasAcs = !action.Empty && Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1; //mxd
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 // Go for all the things
foreach(Thing t in things) foreach(Thing t in things)
{ {
// Coordination // Coordination
//mxd if(cbRandomAngle.Checked) t.Rotate(General.Random(0, 359)); //mxd
if(cbRandomAngle.Checked) {
t.Rotate(General.Random(0, 359));
}
//mxd. Check position //mxd. Check position
float px = General.Clamp(t.Position.x, General.Map.Config.LeftBoundary, General.Map.Config.RightBoundary); float px = General.Clamp(t.Position.x, General.Map.Config.LeftBoundary, General.Map.Config.RightBoundary);
@ -437,7 +441,6 @@ namespace CodeImp.DoomBuilder.Windows
if(t.Position.x != px || t.Position.y != py) if(t.Position.x != px || t.Position.y != py)
t.Move(new Vector2D(px, py)); t.Move(new Vector2D(px, py));
// Apply all flags // Apply all flags
foreach(CheckBox c in flags.Checkboxes) foreach(CheckBox c in flags.Checkboxes)
{ {
@ -447,33 +450,43 @@ namespace CodeImp.DoomBuilder.Windows
// Action/tags // Action/tags
t.Tag = tagSelector.GetTag(t.Tag); //mxd t.Tag = tagSelector.GetTag(t.Tag); //mxd
if(!action.Empty) t.Action = action.Value; if (!action.Empty) {
t.Action = action.Value;
//mxd //mxd. Script name/number handling
if (hasAcs && !cbArgStr.Checked) { if(hasAcs) {
if(arg0str.SelectedItem != null) if(!cbArgStr.Checked) { //apply script number
t.Args[0] = ((ScriptItem)arg0str.SelectedItem).Index; if(!string.IsNullOrEmpty(scriptNumbers.Text)) {
else if(!int.TryParse(arg0str.Text.Trim(), out t.Args[0])) if(scriptNumbers.SelectedItem != null)
t.Args[0] = ((ScriptItem)scriptNumbers.SelectedItem).Index;
else if(!int.TryParse(scriptNumbers.Text.Trim(), out t.Args[0]))
t.Args[0] = 0; t.Args[0] = 0;
if(t.Fields.ContainsKey("arg0str")) t.Fields.Remove("arg0str");
}
} else { //apply arg0str
if(!string.IsNullOrEmpty(scriptNames.Text))
t.Fields["arg0str"] = new UniValue(UniversalType.String, scriptNames.Text);
}
} else {
t.Args[0] = arg0.GetResult(t.Args[0]);
if(t.Fields.ContainsKey("arg0str")) t.Fields.Remove("arg0str");
}
}else{ }else{
t.Args[0] = arg0.GetResult(t.Args[0]); t.Args[0] = arg0.GetResult(t.Args[0]);
} }
t.Args[1] = arg1.GetResult(t.Args[1]); t.Args[1] = arg1.GetResult(t.Args[1]);
t.Args[2] = arg2.GetResult(t.Args[2]); t.Args[2] = arg2.GetResult(t.Args[2]);
t.Args[3] = arg3.GetResult(t.Args[3]); t.Args[3] = arg3.GetResult(t.Args[3]);
t.Args[4] = arg4.GetResult(t.Args[4]); t.Args[4] = arg4.GetResult(t.Args[4]);
// Custom fields //mxd. Custom fields
if(General.Map.FormatInterface.HasCustomFields){
fieldslist.Apply(t.Fields); fieldslist.Apply(t.Fields);
//mxd. apply arg0str if(!string.IsNullOrEmpty(conversationID.Text))
if (hasArg0str && cbArgStr.Checked) { UDMFTools.SetInteger(t.Fields, "conversation", conversationID.GetResult(t.Fields.GetValue("conversation", 0)), 0, false);
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 // Update settings
@ -507,26 +520,10 @@ namespace CodeImp.DoomBuilder.Windows
//mxd //mxd
private void cbArgStr_CheckedChanged(object sender, EventArgs e) { private void cbArgStr_CheckedChanged(object sender, EventArgs e) {
arg0str.Text = ""; if(!cbArgStr.Visible) return;
scriptNames.Visible = cbArgStr.Checked;
if (cbArgStr.Checked){ scriptNumbers.Visible = !cbArgStr.Checked;
setNamedScripts((string)fieldslist.GetValue("arg0str")); arg0label.Text = cbArgStr.Checked ? "Script Name:" : "Script Number:";
} 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);
} }
//mxd //mxd

View file

@ -138,6 +138,21 @@
<metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="actiongroup.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="hexenpanel.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="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="groupBox3.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
@ -147,43 +162,4 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="actiongroup.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>
<metadata name="doompanel.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>
<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="arg2label.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="arg2label.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="doompanel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="groupBox3.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>
</root> </root>

View file

@ -35,6 +35,8 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label6; System.Windows.Forms.Label label6;
this.groupposition = new System.Windows.Forms.GroupBox(); this.groupposition = new System.Windows.Forms.GroupBox();
this.panelHeightControls = new System.Windows.Forms.Panel(); this.panelHeightControls = new System.Windows.Forms.Panel();
this.clearZFloor = new System.Windows.Forms.Button();
this.clearZCeiling = new System.Windows.Forms.Button();
this.zceiling = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.zceiling = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.zfloor = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.zfloor = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
this.positiony = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox(); this.positiony = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
@ -44,8 +46,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl(); this.fieldslist = new CodeImp.DoomBuilder.Controls.FieldsEditorControl();
this.cancel = new System.Windows.Forms.Button(); this.cancel = new System.Windows.Forms.Button();
this.apply = new System.Windows.Forms.Button(); this.apply = new System.Windows.Forms.Button();
this.clearZCeiling = new System.Windows.Forms.Button();
this.clearZFloor = new System.Windows.Forms.Button();
tabproperties = new System.Windows.Forms.TabPage(); tabproperties = new System.Windows.Forms.TabPage();
label2 = new System.Windows.Forms.Label(); label2 = new System.Windows.Forms.Label();
label3 = new System.Windows.Forms.Label(); label3 = new System.Windows.Forms.Label();
@ -100,12 +100,33 @@ namespace CodeImp.DoomBuilder.Windows
this.panelHeightControls.Size = new System.Drawing.Size(361, 100); this.panelHeightControls.Size = new System.Drawing.Size(361, 100);
this.panelHeightControls.TabIndex = 30; this.panelHeightControls.TabIndex = 30;
// //
// clearZFloor
//
this.clearZFloor.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear;
this.clearZFloor.Location = new System.Drawing.Point(314, 32);
this.clearZFloor.Name = "clearZFloor";
this.clearZFloor.Size = new System.Drawing.Size(26, 24);
this.clearZFloor.TabIndex = 31;
this.clearZFloor.UseVisualStyleBackColor = true;
this.clearZFloor.Click += new System.EventHandler(this.clearZFloor_Click);
//
// clearZCeiling
//
this.clearZCeiling.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear;
this.clearZCeiling.Location = new System.Drawing.Point(314, 0);
this.clearZCeiling.Name = "clearZCeiling";
this.clearZCeiling.Size = new System.Drawing.Size(26, 24);
this.clearZCeiling.TabIndex = 30;
this.clearZCeiling.UseVisualStyleBackColor = true;
this.clearZCeiling.Click += new System.EventHandler(this.clearZCeiling_Click);
//
// zceiling // zceiling
// //
this.zceiling.AllowDecimal = false; this.zceiling.AllowDecimal = false;
this.zceiling.AllowNegative = true; this.zceiling.AllowNegative = true;
this.zceiling.AllowRelative = true; this.zceiling.AllowRelative = true;
this.zceiling.ButtonStep = 1; this.zceiling.ButtonStep = 1;
this.zceiling.ButtonStepFloat = 1F;
this.zceiling.Location = new System.Drawing.Point(188, 0); this.zceiling.Location = new System.Drawing.Point(188, 0);
this.zceiling.Name = "zceiling"; this.zceiling.Name = "zceiling";
this.zceiling.Size = new System.Drawing.Size(120, 24); this.zceiling.Size = new System.Drawing.Size(120, 24);
@ -119,6 +140,7 @@ namespace CodeImp.DoomBuilder.Windows
this.zfloor.AllowNegative = true; this.zfloor.AllowNegative = true;
this.zfloor.AllowRelative = true; this.zfloor.AllowRelative = true;
this.zfloor.ButtonStep = 1; this.zfloor.ButtonStep = 1;
this.zfloor.ButtonStepFloat = 1F;
this.zfloor.Location = new System.Drawing.Point(188, 32); this.zfloor.Location = new System.Drawing.Point(188, 32);
this.zfloor.Name = "zfloor"; this.zfloor.Name = "zfloor";
this.zfloor.Size = new System.Drawing.Size(120, 24); this.zfloor.Size = new System.Drawing.Size(120, 24);
@ -150,6 +172,7 @@ namespace CodeImp.DoomBuilder.Windows
this.positiony.AllowNegative = true; this.positiony.AllowNegative = true;
this.positiony.AllowRelative = true; this.positiony.AllowRelative = true;
this.positiony.ButtonStep = 1; this.positiony.ButtonStep = 1;
this.positiony.ButtonStepFloat = 1F;
this.positiony.Location = new System.Drawing.Point(236, 34); this.positiony.Location = new System.Drawing.Point(236, 34);
this.positiony.Name = "positiony"; this.positiony.Name = "positiony";
this.positiony.Size = new System.Drawing.Size(120, 24); this.positiony.Size = new System.Drawing.Size(120, 24);
@ -163,6 +186,7 @@ namespace CodeImp.DoomBuilder.Windows
this.positionx.AllowNegative = true; this.positionx.AllowNegative = true;
this.positionx.AllowRelative = true; this.positionx.AllowRelative = true;
this.positionx.ButtonStep = 1; this.positionx.ButtonStep = 1;
this.positionx.ButtonStepFloat = 1F;
this.positionx.Location = new System.Drawing.Point(68, 34); this.positionx.Location = new System.Drawing.Point(68, 34);
this.positionx.Name = "positionx"; this.positionx.Name = "positionx";
this.positionx.Size = new System.Drawing.Size(120, 24); this.positionx.Size = new System.Drawing.Size(120, 24);
@ -236,7 +260,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true; this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100; this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true; this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
// //
// cancel // cancel
// //
@ -261,26 +284,6 @@ namespace CodeImp.DoomBuilder.Windows
this.apply.UseVisualStyleBackColor = true; this.apply.UseVisualStyleBackColor = true;
this.apply.Click += new System.EventHandler(this.apply_Click); this.apply.Click += new System.EventHandler(this.apply_Click);
// //
// clearZCeiling
//
this.clearZCeiling.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear;
this.clearZCeiling.Location = new System.Drawing.Point(314, 0);
this.clearZCeiling.Name = "clearZCeiling";
this.clearZCeiling.Size = new System.Drawing.Size(26, 24);
this.clearZCeiling.TabIndex = 30;
this.clearZCeiling.UseVisualStyleBackColor = true;
this.clearZCeiling.Click += new System.EventHandler(this.clearZCeiling_Click);
//
// clearZFloor
//
this.clearZFloor.Image = global::CodeImp.DoomBuilder.Properties.Resources.SearchClear;
this.clearZFloor.Location = new System.Drawing.Point(314, 32);
this.clearZFloor.Name = "clearZFloor";
this.clearZFloor.Size = new System.Drawing.Size(26, 24);
this.clearZFloor.TabIndex = 31;
this.clearZFloor.UseVisualStyleBackColor = true;
this.clearZFloor.Click += new System.EventHandler(this.clearZFloor_Click);
//
// VertexEditForm // VertexEditForm
// //
this.AcceptButton = this.apply; this.AcceptButton = this.apply;

View file

@ -71,12 +71,16 @@ namespace CodeImp.DoomBuilder.Windows
{ {
InitializeComponent(); InitializeComponent();
if(General.Map.FormatInterface.HasCustomFields) { //mxd
// Initialize custom fields editor
fieldslist.Setup("vertex");
// Fill universal fields list // Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.VertexFields); fieldslist.ListFixedFields(General.Map.Config.VertexFields);
} else {
// Custom fields?
if(!General.Map.FormatInterface.HasCustomFields)
tabs.TabPages.Remove(tabcustom); tabs.TabPages.Remove(tabcustom);
panelHeightControls.Visible = false;
}
// Decimals allowed? // Decimals allowed?
if(General.Map.FormatInterface.VertexDecimals > 0) if(General.Map.FormatInterface.VertexDecimals > 0)
@ -88,11 +92,6 @@ namespace CodeImp.DoomBuilder.Windows
zceiling.AllowDecimal = true; zceiling.AllowDecimal = true;
zfloor.AllowDecimal = true; zfloor.AllowDecimal = true;
} }
if(!General.Map.UDMF) panelHeightControls.Visible = false;
// Initialize custom fields editor
fieldslist.Setup("vertex");
} }
#endregion #endregion
@ -130,6 +129,7 @@ namespace CodeImp.DoomBuilder.Windows
positiony.Enabled = allowPositionChange; positiony.Enabled = allowPositionChange;
// Custom fields // Custom fields
if(General.Map.FormatInterface.HasCustomFields) //mxd
fieldslist.SetValues(vc.Fields, true); fieldslist.SetValues(vc.Fields, true);
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
@ -144,8 +144,10 @@ namespace CodeImp.DoomBuilder.Windows
if(positiony.Text != v.Position.y.ToString()) positiony.Text = ""; if(positiony.Text != v.Position.y.ToString()) positiony.Text = "";
// Custom fields // Custom fields
if(General.Map.FormatInterface.HasCustomFields) { //mxd
v.Fields.BeforeFieldsChange();//mxd v.Fields.BeforeFieldsChange();//mxd
fieldslist.SetValues(v.Fields, false); fieldslist.SetValues(v.Fields, false);
}
//mxd. Store initial properties //mxd. Store initial properties
vertexProps.Add(new VertexProperties(v)); vertexProps.Add(new VertexProperties(v));
@ -278,16 +280,6 @@ namespace CodeImp.DoomBuilder.Windows
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
} }
private void fieldslist_OnFieldValueChanged(string fieldname) {
if(blockUpdate) return;
foreach(Vertex v in vertices)
fieldslist.Apply(v.Fields);
General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);
}
//mxd //mxd
private void clearZFloor_Click(object sender, EventArgs e) { private void clearZFloor_Click(object sender, EventArgs e) {
zfloor.Text = CLEAR_VALUE; zfloor.Text = CLEAR_VALUE;
@ -305,6 +297,11 @@ namespace CodeImp.DoomBuilder.Windows
// OK clicked // OK clicked
private void apply_Click(object sender, EventArgs e) private void apply_Click(object sender, EventArgs e)
{ {
//apply custom fields
if(General.Map.FormatInterface.HasCustomFields) { //mxd
foreach(Vertex v in vertices) fieldslist.Apply(v.Fields);
}
General.Map.IsChanged = true; General.Map.IsChanged = true;
if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty); if(OnValuesChanged != null) OnValuesChanged(this, EventArgs.Empty);

View file

@ -150,9 +150,6 @@
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value> <value>True</value>
</metadata> </metadata>

View file

@ -1077,6 +1077,18 @@ rotatethingsccw
default = 262139; default = 262139;
} }
//mxd
lookthroughthing
{
title = "Look Through Selection";
category = "visual";
description = "Places visual camera at the same position as selected thing and rotates it to match thing's angle.";
allowkeys = true;
allowmouse = false;
allowscroll = true;
default = 89; //Y
}
//mxd. moved from GZDoomEditing plugin //mxd. moved from GZDoomEditing plugin
gzdbvisualmode gzdbvisualmode
{ {

View file

@ -2647,6 +2647,102 @@ namespace CodeImp.DoomBuilder.BuilderModes
ShowTargetInfo(); ShowTargetInfo();
} }
//mxd
[BeginAction("lookthroughthing")]
public void LookThroughThing() {
List<VisualThing> visualThings = GetSelectedVisualThings(true);
if(visualThings.Count != 1) {
General.Interface.DisplayStatus(StatusType.Warning, "Look Through Selection action requires 1 selected Thing!");
return;
}
//set position and angles
Thing t = visualThings[0].Thing;
if((t.Type == 9072 || t.Type == 9073) && t.Args[3] > 0) { //AimingCamera or MovingCamera with target?
//position
if(t.Type == 9072 && (t.Args[0] > 0 || t.Args[1] > 0)) { //positon MovingCamera at targeted interpolation point
int ipTag = t.Args[0] + (t.Args[1] << 8);
Thing ip = null;
//find interpolation point
foreach(Thing tgt in General.Map.Map.Things) {
if(tgt.Tag == ipTag && tgt.Type == 9070) {
ip = tgt;
break;
}
}
if(ip != null) {
VisualThing vTarget = null;
if(!VisualThingExists(ip))
vTarget = CreateVisualThing(ip);
else
vTarget = GetVisualThing(ip);
Vector3D targetPos = new Vector3D();
if(vTarget == null) {
targetPos = ip.Position;
if(ip.Sector != null) targetPos.z += ip.Sector.FloorHeight;
} else {
targetPos = vTarget.CenterV3D;
}
General.Map.VisualCamera.Position = targetPos; //position at interpolation point
} else {
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at camera
}
}else{
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at camera
}
//angle
Thing target = null;
foreach(Thing tgt in General.Map.Map.Things) {
if(tgt.Tag == t.Args[3]) {
target = tgt;
break;
}
}
if (target == null) {
General.Interface.DisplayStatus(StatusType.Warning, "Camera target with Tag " + t.Args[3] + " does not exist!");
General.Map.VisualCamera.AngleXY = t.Angle - Angle2D.PI;
General.Map.VisualCamera.AngleZ = Angle2D.PI;
} else {
VisualThing vTarget = null;
if (!VisualThingExists(target))
vTarget = CreateVisualThing(target);
else
vTarget = GetVisualThing(target);
Vector3D targetPos = new Vector3D();
if(vTarget == null) {
targetPos = target.Position;
if(target.Sector != null) targetPos.z += target.Sector.FloorHeight;
} else {
targetPos = vTarget.CenterV3D;
}
bool pitch = (t.Args[2] & 4) != 0;
Vector3D delta = General.Map.VisualCamera.Position - targetPos;
General.Map.VisualCamera.AngleXY = delta.GetAngleXY();
General.Map.VisualCamera.AngleZ = pitch ? -delta.GetAngleZ() : Angle2D.PI;
}
} else if((t.Type == 9025 || t.Type == 9073) && t.Args[0] != 0) { //SecurityCamera or AimingCamera with pitch?
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at camera
General.Map.VisualCamera.AngleXY = t.Angle - Angle2D.PI;
General.Map.VisualCamera.AngleZ = Angle2D.PI + Angle2D.DegToRad(t.Args[0]);
} else { //nope, just a generic thing
General.Map.VisualCamera.Position = visualThings[0].CenterV3D; //position at thing
General.Map.VisualCamera.AngleXY = t.Angle - Angle2D.PI;
General.Map.VisualCamera.AngleZ = Angle2D.PI;
}
}
//mxd //mxd
[BeginAction("toggleslope")] [BeginAction("toggleslope")]
public void ToggleSlope() { public void ToggleSlope() {