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;
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
@ -253,90 +224,6 @@ universalfields
type = 2;
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
@ -347,12 +234,6 @@ universalfields
default = "";
}
conversation
{
type = 0;
default = 0;
}
skill6
{
type = 3;
@ -483,12 +364,6 @@ universalfields
type = 3;
default = false;
}
arg0str
{
type = 2;
default = "";
}
}
sector
@ -498,154 +373,6 @@ universalfields
type = 2;
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
{
title = "Camera";
title = "Security Camera";
arg0
{
title = "Pitch";
}
arg1
{
title = "Pan";
title = "Max. yaw per second";
}
arg2
{
title = "Time";
title = "Time (in otics)";
}
}
9073
@ -366,30 +366,30 @@ zdoom
}
arg1
{
title = "Max Angle";
title = "Max. yaw per second";
}
arg2
{
title = "Max Pitch";
title = "Max. pitch per second";
}
arg4
arg3
{
title = "Thing";
title = "Target Thing Tag";
type = 14;
}
}
9080
{
title = "Skybox Viewpoint";
title = "Skybox Viewpoint";
sprite = "internal:SkyboxViewpoint";
}
}
9081
{
title = "Skybox Picker";
sprite = "internal:SkyboxPicker";
arg0
{
title = "Thing";
title = "Target Thing Tag";
type = 14;
}
arg1
@ -410,11 +410,11 @@ zdoom
sprite = "internal:actormover";
arg0
{
title = "Point";
title = "Interp. Point Tag";
}
arg1
{
title = "High Point";
title = "Interp. Point HiTag";
}
arg2
{
@ -425,19 +425,19 @@ zdoom
1 = "Linear path";
2 = "Use point angle";
4 = "Use point pitch";
8 = "Face movement direction";
8 = "Face thing/movement direction";
128 = "Nonsolid";
}
}
arg3
{
title = "Thing";
title = "Target Thing Tag";
type = 14;
}
}
9070
{
title = "Interpolation point";
title = "Interpolation Point";
sprite = "internal:InterpolationPoint";
arg0
{
@ -453,28 +453,28 @@ zdoom
}
arg3
{
title = "Next";
title = "Next Point Tag";
}
arg4
{
title = "High Next";
title = "Next Point HiTag";
}
}
9075
{
title = "Interpolation Special";
sprite = "internal:InterpolationSpecial";
}
{
title = "Interpolation Special";
sprite = "internal:InterpolationSpecial";
}
9072
{
title = "Moving Camera";
arg0
{
title = "Point";
title = "Interp. Point Tag";
}
arg1
{
title = "High Point";
title = "Interp. Point HiTag";
}
arg2
{
@ -491,7 +491,7 @@ zdoom
}
arg3
{
title = "Thing";
title = "Target Thing Tag";
type = 14;
}
}
@ -501,11 +501,11 @@ zdoom
sprite = "internal:PathFollower";
arg0
{
title = "Point";
title = "Interp. Point Tag";
}
arg1
{
title = "High Point";
title = "Interp. Point HiTag";
}
arg2
{

View file

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

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Properties
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

View file

@ -42,7 +42,7 @@ namespace CodeImp.DoomBuilder.Config
#region ================== Properties
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

View file

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

View file

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

View file

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

View file

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

View file

@ -563,6 +563,13 @@ namespace CodeImp.DoomBuilder.Controls
{
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
@ -578,9 +585,7 @@ namespace CodeImp.DoomBuilder.Controls
// Keyword help requested
private void buttonkeywordhelp_Click(object sender, EventArgs e)
{
// Get script
ScriptDocumentTab t = (tabs.SelectedTab as ScriptDocumentTab);
t.LaunchKeywordHelp();
LaunchKeywordHelp();
}
// When the user changes the script configuration

View file

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

View file

@ -152,7 +152,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
if (result.ProcessInterpolationPoints) {
foreach (KeyValuePair<int, List<Thing>> group in interpolationPoints) {
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(interpolationPoints.ContainsKey(targetTag)) {
@ -172,7 +172,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
//process cameras
if (result.ProcessCameras) {
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(interpolationPoints.ContainsKey(targetTag)) {
@ -191,7 +191,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.Data {
//process actor movers
if(result.ProcessActorMovers) {
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
//add interpolation point target

View file

@ -1,4 +1,6 @@
using System;
#region ================== Namespaces
using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
@ -12,11 +14,15 @@ using SlimDX;
using SlimDX.Direct3D9;
using CodeImp.DoomBuilder.Geometry;
#endregion
//mxd. Original version taken from here: http://colladadotnet.codeplex.com/SourceControl/changeset/view/40680
namespace CodeImp.DoomBuilder.GZBuilder.MD3
{
internal static class ModelReader
{
{
#region ================== Variables
private const float VERTICAL_STRETCH = 1 / 1.2f;
private class MD3LoadResult
@ -30,12 +36,28 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
Meshes = new List<Mesh>();
}
}
private static VertexElement[] vertexElements;
#endregion
#region ================== Load
public static void Load(ModelData mde, List<DataReader> containers, Device device) {
mde.Model = new GZModel();
BoundingBoxSizes bbs = new BoundingBoxSizes();
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
for(int i = 0; i < mde.ModelNames.Count; i++) {
//need to use model skins?
@ -142,7 +164,11 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
mde.Model.BoundingBox = BoundingBoxTools.CalculateBoundingBox(bbs);
}
}
#endregion
#region ================== MD3
private static MD3LoadResult ReadMD3Model(ref BoundingBoxSizes bbs, ModelData mde, bool useSkins, MemoryStream s, Device device) {
long start = s.Position;
@ -337,7 +363,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
private static void CreateMesh(Device device, ref MD3LoadResult result, List<WorldVertex> vertList, List<int> polyIndecesList) {
//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)) {
stream.WriteRange(vertList.ToArray());
@ -354,6 +380,10 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
result.Meshes.Add(mesh);
}
#endregion
#region ================== MD2
private static MD3LoadResult ReadMD2Model(ref BoundingBoxSizes bbs, ModelData mde, MemoryStream s, Device D3DDevice) {
long start = s.Position;
MD3LoadResult result = new MD3LoadResult();
@ -504,7 +534,7 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
//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)) {
stream.WriteRange(vertList.ToArray());
@ -524,7 +554,11 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
}
return result;
}
}
#endregion
#region ================== Utility
//util
private static MemoryStream LoadFile(List<DataReader> containers, string path, bool isModel) {
@ -589,6 +623,8 @@ namespace CodeImp.DoomBuilder.GZBuilder.MD3
br.ReadChar();
}
return NAME;
}
}
}
#endregion
}
}

View file

@ -119,12 +119,7 @@ namespace CodeImp.DoomBuilder {
//mxd
public bool UDMF { get { return config.FormatInterface == "UniversalMapSetIO"; } }
internal List<ScriptItem> NamedScripts {
get {
if (!UDMF) throw new Exception("ScriptNames cannot be used in '" + config.FormatInterface + "' format!");
return namedScripts;
}
}
internal List<ScriptItem> NamedScripts { get { return namedScripts; } }
internal List<ScriptItem> NumberedScripts { get { return numberedScripts; } }
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 int MaxThingAngle { get { return short.MaxValue; } }
public override int MinThingAngle { get { return short.MinValue; } }
public override Dictionary<string, List<string>> UIFields { get { return null; } } //mxd
#endregion

View file

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

View file

@ -16,6 +16,8 @@
#region ================== Namespaces
using System.Collections.Generic;
#endregion
namespace CodeImp.DoomBuilder.IO
@ -59,5 +61,6 @@ namespace CodeImp.DoomBuilder.IO
float MinCoordinate { get; }
int MaxThingAngle { 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 System.Reflection;
using System.Diagnostics;
using System.Collections.Generic;
#endregion
@ -81,6 +82,7 @@ namespace CodeImp.DoomBuilder.IO
public abstract float MinCoordinate { get; }
public abstract int MaxThingAngle { get; }
public abstract int MinThingAngle { get; }
public abstract Dictionary<string, List<string>> UIFields { get; } //mxd
#endregion

View file

@ -22,6 +22,7 @@ using System.Text;
using System.IO;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Config;
using System.Collections;
#endregion
@ -32,34 +33,32 @@ namespace CodeImp.DoomBuilder.IO
#region ================== Constants
// 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
#region ================== Variables
//private Configuration config;
private Dictionary<string, List<string>> uifields;
#endregion
#region ================== Constructor / Disposer
// 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))
{
// 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();
foreach(string rn in resnames)
{
// 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
Stream udmfcfg = General.ThisAssembly.GetManifestResourceStream(rn);
@ -67,30 +66,19 @@ namespace CodeImp.DoomBuilder.IO
// Load configuration from stream
config.InputConfiguration(udmfcfgreader.ReadToEnd());
// Now we add the linedef flags, activations and thing flags
// to this list, so that these don't show up in the custom
// fields list either. We use true as dummy value (it has no meaning)
// Add linedef flags
foreach(KeyValuePair<string, string> flag in manager.Config.LinedefFlags)
config.WriteSetting("managedfields.linedef." + flag.Key, true);
// Add linedef activations
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);
string[] elements = new string[] { "vertex", "linedef", "sidedef", "sector", "thing" };
uifields = new Dictionary<string, List<string>>();
//mxd. Add sector flags
foreach(KeyValuePair<string, string> flag in manager.Config.SectorFlags)
config.WriteSetting("managedfields.sector." + flag.Key, true);
foreach(string elementname in elements) {
IDictionary dic = config.ReadSetting("uifields." + elementname, new Hashtable());
//mxd. Add sidedef flags
foreach(KeyValuePair<string, string> flag in manager.Config.SidedefFlags)
config.WriteSetting("managedfields.sidedef." + flag.Key, true);
List<string> values = new List<string>();
foreach(DictionaryEntry de in dic) {
values.Add(de.Key.ToString());
}
uifields.Add(elementname, values);
}
// Done
udmfcfgreader.Dispose();
@ -99,7 +87,7 @@ namespace CodeImp.DoomBuilder.IO
}
}
}
}*/
}
#endregion
@ -142,6 +130,7 @@ namespace CodeImp.DoomBuilder.IO
public override float MinCoordinate { get { return float.MinValue; } }
public override int MaxThingAngle { get { return int.MaxValue; } }
public override int MinThingAngle { get { return int.MinValue; } }
public override Dictionary<string, List<string>> UIFields { get { return uifields; } } //mxd
#endregion

View file

@ -83,6 +83,14 @@ namespace CodeImp.DoomBuilder.IO
foreach(LinedefActivateInfo activate in General.Map.Config.LinedefActivates)
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
foreach(KeyValuePair<string, string> flag in General.Map.Config.ThingFlags)
config.WriteSetting("managedfields.thing." + flag.Key, true);

View file

@ -305,7 +305,7 @@ namespace CodeImp.DoomBuilder.Rendering
// Create frustum
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
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 Matrix World { set { if (manager.Enabled) effect.SetValue<Matrix>(worldHandle, value); } }
public VertexElement[] VertexElements { get { return vertexElements; } }
#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 bool Sizeless { get { return sizeless; } }
public Vector3 Center {
get
{
if (isGldefsLight)
return position_v3 + lightOffset;
get {
if (isGldefsLight) return position_v3 + lightOffset;
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[] BoundingBox { get { return boundingBox; } }
//mxd. light properties

View file

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

View file

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

View file

@ -41,7 +41,6 @@ namespace CodeImp.DoomBuilder.Windows
#region ================== Constants
private const string EMPTY_TEXTURE = "-";
#endregion
@ -50,6 +49,8 @@ namespace CodeImp.DoomBuilder.Windows
private ICollection<Linedef> lines;
private List<LinedefProperties> linedefProps; //mxd
private bool preventchanges = false;
private string arg0str; //mxd
private bool haveArg0Str; //mxd
//Value linking
private static bool linkFrontTopScale;
@ -166,9 +167,6 @@ namespace CodeImp.DoomBuilder.Windows
activation.Items.AddRange(General.Map.Config.LinedefActivates.ToArray());
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
fronthigh.Initialize();
frontmid.Initialize();
@ -177,8 +175,52 @@ namespace CodeImp.DoomBuilder.Windows
backmid.Initialize();
backlow.Initialize();
// Initialize custom fields editor
fieldslist.Setup("linedef");
//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
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)
if(General.Map.FormatInterface.HasMixedActivations)
@ -216,33 +258,6 @@ namespace CodeImp.DoomBuilder.Windows
{
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
@ -289,18 +304,16 @@ namespace CodeImp.DoomBuilder.Windows
if(fl.Flags.ContainsKey(ai.Key)) c.Checked = fl.Flags[ai.Key];
}
//mxd. setup arg0str
arg0str.Location = arg0.Location;
// Custom fields
fieldslist.SetValues(fl.Fields, true);
//mxd. UDMF Settings
if(General.Map.FormatInterface.HasCustomFields) {
fieldslist.SetValues(fl.Fields, true); // Custom fields
string renderStyle = fl.Fields.GetValue("renderstyle", "");
cbRenderStyle.SelectedIndex = (renderStyle == "add" ? 1 : 0);
alpha.Text = General.Clamp(fl.Fields.GetValue("alpha", 1.0f), 0f, 1f).ToString();
lockNumber.Text = fl.Fields.GetValue("locknumber", 0).ToString();
arg0str = fl.Fields.GetValue("arg0str", string.Empty);
haveArg0Str = !string.IsNullOrEmpty(arg0str);
}
// Action/tags
@ -432,6 +445,14 @@ namespace CodeImp.DoomBuilder.Windows
if(!string.IsNullOrEmpty(lockNumber.Text) && lockNumber.GetResult(0) != l.Fields.GetValue("locknumber", 0))
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
@ -442,12 +463,6 @@ namespace CodeImp.DoomBuilder.Windows
if(l.Args[2] != arg2.GetResult(-1)) arg2.ClearValue();
if(l.Args[3] != arg3.GetResult(-1)) arg3.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
if((l.Front != null) != frontside.Checked)
@ -524,9 +539,6 @@ namespace CodeImp.DoomBuilder.Windows
foreach(PairedFieldsControl pfc in backUdmfControls)
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)) {
int light = UDMFTools.GetInteger(l.Back.Fields, "light", 0);
if(light != lightBack.GetResult(light)) lightBack.Text = "";
@ -556,10 +568,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
linedefProps.Add(new LinedefProperties(l));
// Custom fields
l.Fields.BeforeFieldsChange(); //mxd
fieldslist.SetValues(l.Fields, false);
}
// Refresh controls so that they show their image
@ -571,62 +579,56 @@ namespace CodeImp.DoomBuilder.Windows
frontlow.Refresh();
preventchanges = false;
updateScriptControls(); //mxd
//mxd. Set intial script-related values, if required
if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1) {
if(haveArg0Str) {
scriptNames.Text = arg0str;
arg0label.Text = "Script Name:";
} else {
int a0 = arg0.GetResult(0);
if(a0 > 0) {
for(int i = 0; i < General.Map.NumberedScripts.Count; i++) {
if(General.Map.NumberedScripts[i].Index == a0) {
scriptNumbers.SelectedIndex = i;
break;
}
}
if(scriptNumbers.SelectedIndex == -1) {
scriptNumbers.Items.Add(new ScriptItem(a0, "Script " + a0));
scriptNumbers.SelectedIndex = scriptNumbers.Items.Count - 1;
}
} else {
scriptNumbers.Text = arg0.Text;
}
}
} else {
scriptNumbers.Text = "0";
}
}
//mxd
private void setNumberedScripts(Linedef l) {
arg0str.Items.Clear();
if (General.Map.NumberedScripts.Count > 0) {
foreach (ScriptItem si in General.Map.NumberedScripts) {
arg0str.Items.Add(si);
if (si.Index == l.Args[0])
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
//script number is not among known scripts...
if (arg0str.SelectedIndex == -1 && l.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(l.Args[0], "Script " + l.Args[0]));
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
} else if (l.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(l.Args[0], "Script " + l.Args[0]));
arg0str.SelectedIndex = 0;
}
}
//mxd
private void setNamedScripts(string selectedValue) {
arg0str.Items.Clear();
//update arg0str items
if (General.Map.NamedScripts.Count > 0) {
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;
}
}
} else {
arg0str.Text = selectedValue;
}
//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
// This selects all text in a textbox
/*private void SelectAllText(object sender, EventArgs e)
{
(sender as TextBox).SelectAll();
}*/
#region Events
#region ================== Events
// Apply clicked
private void apply_Click(object sender, EventArgs e)
@ -653,7 +655,6 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
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);
// Go for all the lines
@ -673,17 +674,32 @@ namespace CodeImp.DoomBuilder.Windows
// Action/tags
l.Tag = tagSelector.GetTag(l.Tag); //mxd
if(!action.Empty) l.Action = action.Value;
//mxd
if (hasAcs && !cbArgStr.Checked) {
if (arg0str.SelectedItem != null)
l.Args[0] = ((ScriptItem)arg0str.SelectedItem).Index;
else if (!int.TryParse(arg0str.Text.Trim(), out l.Args[0]))
l.Args[0] = 0;
} else {
l.Args[0] = arg0.GetResult(l.Args[0]);
}
if(!action.Empty) {
l.Action = action.Value;
//mxd. Script name/number handling
if(hasAcs) {
if(!cbArgStr.Checked) { //apply script number
if(!string.IsNullOrEmpty(scriptNumbers.Text)) {
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;
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{
l.Args[0] = arg0.GetResult(l.Args[0]);
}
l.Args[1] = arg1.GetResult(l.Args[1]);
l.Args[2] = arg2.GetResult(l.Args[2]);
l.Args[3] = arg3.GetResult(l.Args[3]);
@ -744,14 +760,9 @@ namespace CodeImp.DoomBuilder.Windows
}
//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);
//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 (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;
}
if(!preventchanges) updateScriptControls(); //mxd
}
// Browse Action clicked
@ -877,20 +869,10 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void cbArgStr_CheckedChanged(object sender, EventArgs e) {
arg0str.Text = "";
if (cbArgStr.Checked) {
setNamedScripts((string)fieldslist.GetValue("arg0str"));
} else if (!cbArgStr.Checked) {
setNumberedScripts(General.GetByIndex(lines, 0));
}
arg0label.Text = cbArgStr.Checked ? "Script name:" : "Script number:";
}
//mxd
private void arg0str_Leave(object sender, EventArgs e) {
if (cbArgStr.Checked) fieldslist.SetValue("arg0str", arg0str.Text, UniversalType.String);
if(!cbArgStr.Visible) return;
scriptNames.Visible = cbArgStr.Checked;
scriptNumbers.Visible = !cbArgStr.Checked;
arg0label.Text = cbArgStr.Checked ? "Script Name:" : "Script Number:";
}
//mxd
@ -968,44 +950,6 @@ namespace CodeImp.DoomBuilder.Windows
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
#region Reltime events (sides)
@ -1075,7 +1019,6 @@ namespace CodeImp.DoomBuilder.Windows
// Edit these
if(!CustomFieldsForm.ShowDialog(this, "Back side custom fields", "sidedef", sides, General.Map.Config.SidedefFields)) return;
//General.Map.UndoRedo.WithdrawUndo();
//Apply values
Sidedef fs = General.GetByIndex(sides, 0) as Sidedef;
@ -1136,7 +1079,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0;
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++;
}
//update values
@ -1160,7 +1103,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0;
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++;
}
//update values
@ -1184,7 +1127,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0;
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++;
}
//update values
@ -1208,7 +1151,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0;
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++;
}
//update values
@ -1232,7 +1175,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0;
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++;
}
//update values
@ -1256,7 +1199,7 @@ namespace CodeImp.DoomBuilder.Windows
int i = 0;
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++;
}
//update values

View file

@ -179,7 +179,7 @@ namespace CodeImp.DoomBuilder.Windows
// Help
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;
}

View file

@ -837,8 +837,6 @@
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
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
//

View file

@ -105,6 +105,9 @@ namespace CodeImp.DoomBuilder.Windows
// Fill effects list
effect.AddInfo(General.Map.Config.SortedSectorEffects.ToArray());
// Initialize custom fields editor
fieldslist.Setup("sector");
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.SectorFields);
@ -115,13 +118,6 @@ namespace CodeImp.DoomBuilder.Windows
// Set steps for brightness field
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
ceilScale.LinkValues = linkCeilingScale;
floorScale.LinkValues = linkFloorScale;
@ -262,8 +258,7 @@ namespace CodeImp.DoomBuilder.Windows
//Texture brightness
if(s.Fields.GetValue("lightceiling", 0).ToString() != ceilBrightness.Text) ceilBrightness.Text = "";
if(s.Fields.GetValue("lightfloor", 0).ToString() != floorBrightness.Text)
floorBrightness.Text = "";
if(s.Fields.GetValue("lightfloor", 0).ToString() != floorBrightness.Text) floorBrightness.Text = "";
if(s.Fields.GetValue("lightceilingabsolute", false) != ceilLightAbsolute.Checked) {
ceilLightAbsolute.ThreeState = true;
@ -377,6 +372,9 @@ namespace CodeImp.DoomBuilder.Windows
// Action
s.Tag = tagSelector.GetTag(s.Tag); //mxd
//Fields
fieldslist.Apply(s.Fields);
//alpha
if(!string.IsNullOrEmpty(ceilAlpha.Text)) {
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);
}
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) {
if(blockUpdate) return;
int i = 0;

View file

@ -411,13 +411,13 @@ namespace CodeImp.DoomBuilder.Windows
browser.BeginAdding(false);
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
foreach(ImageData img in set.Flats)
browser.Add(img.Name, img, img, availgroup);
// Add all available flats
foreach (ImageData img in set.Flats)
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{
// Add all available textures and mark the images for temporary loading
foreach (ImageData img in set.Textures)

View file

@ -51,7 +51,8 @@ namespace CodeImp.DoomBuilder.Windows
this.tabeffects = new System.Windows.Forms.TabPage();
this.actiongroup = new System.Windows.Forms.GroupBox();
this.hexenpanel = new System.Windows.Forms.Panel();
this.arg0str = new System.Windows.Forms.ComboBox();
this.scriptNumbers = new System.Windows.Forms.ComboBox();
this.scriptNames = new System.Windows.Forms.ComboBox();
this.cbArgStr = new System.Windows.Forms.CheckBox();
this.arg2 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
this.arg1 = new CodeImp.DoomBuilder.Controls.ArgumentBox();
@ -67,6 +68,8 @@ namespace CodeImp.DoomBuilder.Windows
this.browseaction = new System.Windows.Forms.Button();
this.doompanel = new System.Windows.Forms.Panel();
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.tabcustom = new System.Windows.Forms.TabPage();
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)
| System.Windows.Forms.AnchorStyles.Left)
| 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.arg2);
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.TabIndex = 13;
//
// arg0str
// scriptNumbers
//
this.arg0str.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.arg0str.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.arg0str.FormattingEnabled = true;
this.arg0str.Location = new System.Drawing.Point(179, 93);
this.arg0str.Name = "arg0str";
this.arg0str.Size = new System.Drawing.Size(127, 22);
this.arg0str.TabIndex = 22;
this.arg0str.Leave += new System.EventHandler(this.arg0str_Leave);
this.scriptNumbers.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
this.scriptNumbers.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.scriptNumbers.BackColor = System.Drawing.Color.LemonChiffon;
this.scriptNumbers.FormattingEnabled = true;
this.scriptNumbers.Location = new System.Drawing.Point(179, 121);
this.scriptNumbers.Name = "scriptNumbers";
this.scriptNumbers.Size = new System.Drawing.Size(127, 22);
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
//
@ -539,6 +554,8 @@ namespace CodeImp.DoomBuilder.Windows
//
// groupBox3
//
this.groupBox3.Controls.Add(this.conversationID);
this.groupBox3.Controls.Add(this.labelID);
this.groupBox3.Controls.Add(this.tagSelector);
this.groupBox3.Location = new System.Drawing.Point(6, 6);
this.groupBox3.Name = "groupBox3";
@ -547,6 +564,28 @@ namespace CodeImp.DoomBuilder.Windows
this.groupBox3.TabStop = false;
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
//
this.tagSelector.Location = new System.Drawing.Point(6, 19);
@ -585,7 +624,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
//
// cancel
//
@ -642,6 +680,7 @@ namespace CodeImp.DoomBuilder.Windows
this.actiongroup.PerformLayout();
this.hexenpanel.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.tabcustom.ResumeLayout(false);
this.ResumeLayout(false);
@ -685,10 +724,13 @@ namespace CodeImp.DoomBuilder.Windows
private System.Windows.Forms.Label label1;
private CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox posX;
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 cbRandomAngle;
private System.Windows.Forms.Label labelAngle;
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.Geometry;
using CodeImp.DoomBuilder.GZBuilder.Data;
using CodeImp.DoomBuilder.GZBuilder.Tools;
using CodeImp.DoomBuilder.Types;
#endregion
@ -45,11 +47,13 @@ namespace CodeImp.DoomBuilder.Windows
private ICollection<Thing> things;
private ThingTypeInfo thinginfo;
private bool preventchanges = false;
private bool preventchanges;
//mxd
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 static bool useAbsoluteHeight;
private string arg0str;
private bool haveArg0Str;
private List<ThingProperties> thingProps; //mxd
@ -88,19 +92,33 @@ namespace CodeImp.DoomBuilder.Windows
action.GeneralizedCategories = General.Map.Config.GenActionCategories;
action.AddInfo(General.Map.Config.SortedLinedefActions.ToArray());
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.ThingFields);
// Initialize custom fields editor
fieldslist.Setup("thing");
if(General.Map.FormatInterface.HasCustomFields) { //mxd
// Initialize custom fields editor
fieldslist.Setup("thing");
// Custom fields?
if(!General.Map.FormatInterface.HasCustomFields)
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.ThingFields);
} else {
tabs.TabPages.Remove(tabcustom);
// Hide unused controls
labelID.Visible = false; //mxd
conversationID.Visible = false; //mxd
}
// Tag/Effects?
if(!General.Map.FormatInterface.HasThingAction && !General.Map.FormatInterface.HasThingTag)
if(!General.Map.FormatInterface.HasThingAction && !General.Map.FormatInterface.HasThingTag){
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?
posZ.Visible = General.Map.FormatInterface.HasThingHeight;
@ -163,15 +181,16 @@ namespace CodeImp.DoomBuilder.Windows
posY.ButtonStep = General.Map.Grid.GridSize;
posZ.ButtonStep = General.Map.Grid.GridSize;
//mxd. setup arg0str
arg0str.Location = arg0.Location;
// Custom fields
fieldslist.SetValues(ft.Fields, true);
//mxd. Custom fields
if(General.Map.FormatInterface.HasCustomFields) {
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.Value = ft.Action;
//tag.Text = ft.Tag.ToString(); //mxd
if(General.Map.FormatInterface.HasThingTag) {//mxd
tagSelector.Setup();
tagSelector.SetTag(ft.Tag);
@ -216,13 +235,12 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
if (useAbsoluteHeight && t.Sector != null) {
if(((int)t.Position.z + t.Sector.FloorHeight).ToString() != posZ.Text) posZ.Text = "";
} else {
if(((int)t.Position.z).ToString() != posZ.Text) posZ.Text = "";
} else if(((int)t.Position.z).ToString() != posZ.Text){
posZ.Text = "";
}
// Action/tags
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(t.Args[0] != arg0.GetResult(-1)) arg0.ClearValue();
if(t.Args[1] != arg1.GetResult(-1)) arg1.ClearValue();
@ -230,9 +248,19 @@ namespace CodeImp.DoomBuilder.Windows
if(t.Args[3] != arg3.GetResult(-1)) arg3.ClearValue();
if(t.Args[4] != arg4.GetResult(-1)) arg4.ClearValue();
// Custom fields
t.Fields.BeforeFieldsChange(); //mxd
fieldslist.SetValues(t.Fields, false);
//mxd. Custom fields
if(General.Map.FormatInterface.HasCustomFields){
t.Fields.BeforeFieldsChange(); //mxd
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
thingProps.Add(new ThingProperties(t));
@ -247,52 +275,52 @@ namespace CodeImp.DoomBuilder.Windows
}
preventchanges = false;
updateScriptControls(); //mxd
//mxd. Set intial script-related values, if required
if(Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1) {
if(haveArg0Str) {
scriptNames.Text = arg0str;
arg0label.Text = "Script Name:";
} else {
int a0 = arg0.GetResult(0);
if(a0 > 0) {
for(int i = 0; i < General.Map.NumberedScripts.Count; i++) {
if(General.Map.NumberedScripts[i].Index == a0) {
scriptNumbers.SelectedIndex = i;
break;
}
}
if(scriptNumbers.SelectedIndex == -1) {
scriptNumbers.Items.Add(new ScriptItem(a0, "Script " + a0));
scriptNumbers.SelectedIndex = scriptNumbers.Items.Count - 1;
}
} else {
scriptNumbers.Text = arg0.Text;
}
}
} else {
scriptNumbers.Text = "0";
}
}
//mxd
private void setNumberedScripts(Thing t) {
arg0str.Items.Clear();
if (General.Map.NumberedScripts.Count > 0) {
foreach (ScriptItem si in General.Map.NumberedScripts) {
arg0str.Items.Add(si);
if (si.Index == t.Args[0])
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
//script number is not among known scripts...
if (arg0str.SelectedIndex == -1 && t.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(t.Args[0], "Script " + t.Args[0]));
arg0str.SelectedIndex = arg0str.Items.Count - 1;
}
} else if (t.Args[0] > 0) {
arg0str.Items.Add(new ScriptItem(t.Args[0], "Script " + t.Args[0]));
arg0str.SelectedIndex = 0;
}
}
//mxd
private void setNamedScripts(string selectedValue) {
arg0str.Items.Clear();
//update arg0str items
if (General.Map.NamedScripts.Count > 0) {
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;
}
}
} else {
arg0str.Text = selectedValue;
}
}
//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
@ -347,25 +375,7 @@ namespace CodeImp.DoomBuilder.Windows
arg4.SetDefaultValue();
}
//update arg0str
if (Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, showaction) != -1) {
arg0str.Visible = true;
if (General.Map.UDMF && fieldslist.GetValue("arg0str") != null) {
cbArgStr.Visible = true;
cbArgStr.Checked = true;
setNamedScripts((string)fieldslist.GetValue("arg0str"));
} else { //use script numbers
cbArgStr.Visible = General.Map.UDMF;
cbArgStr.Checked = false;
Thing t = General.GetByIndex(things, 0);
setNumberedScripts(t);
}
} else {
cbArgStr.Checked = false;
cbArgStr.Visible = false;
arg0str.Visible = false;
}
if(!preventchanges) updateScriptControls(); //mxd
}
// Browse Action clicked
@ -393,7 +403,6 @@ namespace CodeImp.DoomBuilder.Windows
{
List<string> defaultflags = new List<string>();
//mxd
// Verify the tag
if(General.Map.FormatInterface.HasThingTag) //mxd
{
@ -418,25 +427,19 @@ namespace CodeImp.DoomBuilder.Windows
return;
}
//mxd
bool hasAcs = Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1;
bool hasArg0str = General.Map.UDMF && !action.Empty && hasAcs && arg0str.Text.Length > 0;
bool hasAcs = !action.Empty && Array.IndexOf(GZBuilder.GZGeneral.ACS_SPECIALS, action.Value) != -1; //mxd
// Go for all the things
foreach(Thing t in things)
{
// Coordination
//mxd
if(cbRandomAngle.Checked) {
t.Rotate(General.Random(0, 359));
}
if(cbRandomAngle.Checked) t.Rotate(General.Random(0, 359)); //mxd
//mxd. Check position
float px = General.Clamp(t.Position.x, General.Map.Config.LeftBoundary, General.Map.Config.RightBoundary);
float py = General.Clamp(t.Position.y, General.Map.Config.BottomBoundary, General.Map.Config.TopBoundary);
if(t.Position.x != px || t.Position.y != py)
t.Move(new Vector2D(px, py));
// Apply all flags
foreach(CheckBox c in flags.Checkboxes)
@ -447,34 +450,44 @@ namespace CodeImp.DoomBuilder.Windows
// Action/tags
t.Tag = tagSelector.GetTag(t.Tag); //mxd
if(!action.Empty) t.Action = action.Value;
if (!action.Empty) {
t.Action = action.Value;
//mxd. Script name/number handling
if(hasAcs) {
if(!cbArgStr.Checked) { //apply script number
if(!string.IsNullOrEmpty(scriptNumbers.Text)) {
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;
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{
t.Args[0] = arg0.GetResult(t.Args[0]);
}
//mxd
if (hasAcs && !cbArgStr.Checked) {
if(arg0str.SelectedItem != null)
t.Args[0] = ((ScriptItem)arg0str.SelectedItem).Index;
else if(!int.TryParse(arg0str.Text.Trim(), out t.Args[0]))
t.Args[0] = 0;
} else {
t.Args[0] = arg0.GetResult(t.Args[0]);
}
t.Args[1] = arg1.GetResult(t.Args[1]);
t.Args[2] = arg2.GetResult(t.Args[2]);
t.Args[3] = arg3.GetResult(t.Args[3]);
t.Args[4] = arg4.GetResult(t.Args[4]);
// Custom fields
fieldslist.Apply(t.Fields);
//mxd. apply arg0str
if (hasArg0str && cbArgStr.Checked) {
if (t.Fields.ContainsKey("arg0str"))
t.Fields["arg0str"].Value = arg0str.Text;
else
t.Fields.Add("arg0str", new UniValue(2, arg0str.Text));
} else if (t.Fields.ContainsKey("arg0str")) {
t.Fields.Remove("arg0str");
}
//mxd. Custom fields
if(General.Map.FormatInterface.HasCustomFields){
fieldslist.Apply(t.Fields);
if(!string.IsNullOrEmpty(conversationID.Text))
UDMFTools.SetInteger(t.Fields, "conversation", conversationID.GetResult(t.Fields.GetValue("conversation", 0)), 0, false);
}
// Update settings
t.UpdateConfiguration();
@ -507,26 +520,10 @@ namespace CodeImp.DoomBuilder.Windows
//mxd
private void cbArgStr_CheckedChanged(object sender, EventArgs e) {
arg0str.Text = "";
if (cbArgStr.Checked){
setNamedScripts((string)fieldslist.GetValue("arg0str"));
} else if (!cbArgStr.Checked) {
setNumberedScripts(General.GetByIndex(things, 0));
}
arg0label.Text = cbArgStr.Checked ? "Script name:" : "Script number:";
}
//mxd
private void arg0str_Leave(object sender, EventArgs e) {
if(cbArgStr.Checked) fieldslist.SetValue("arg0str", arg0str.Text, CodeImp.DoomBuilder.Types.UniversalType.String);
}
//mxd
private void fieldslist_OnFieldValueChanged(string fieldname) {
if (cbArgStr.Checked && fieldname == "arg0str")
arg0str.Text = (string)fieldslist.GetValue(fieldname);
if(!cbArgStr.Visible) return;
scriptNames.Visible = cbArgStr.Checked;
scriptNumbers.Visible = !cbArgStr.Checked;
arg0label.Text = cbArgStr.Checked ? "Script Name:" : "Script Number:";
}
//mxd

View file

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

View file

@ -35,6 +35,8 @@ namespace CodeImp.DoomBuilder.Windows
System.Windows.Forms.Label label6;
this.groupposition = new System.Windows.Forms.GroupBox();
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.zfloor = 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.cancel = 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();
label2 = 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.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
//
this.zceiling.AllowDecimal = false;
this.zceiling.AllowNegative = true;
this.zceiling.AllowRelative = true;
this.zceiling.ButtonStep = 1;
this.zceiling.ButtonStepFloat = 1F;
this.zceiling.Location = new System.Drawing.Point(188, 0);
this.zceiling.Name = "zceiling";
this.zceiling.Size = new System.Drawing.Size(120, 24);
@ -119,6 +140,7 @@ namespace CodeImp.DoomBuilder.Windows
this.zfloor.AllowNegative = true;
this.zfloor.AllowRelative = true;
this.zfloor.ButtonStep = 1;
this.zfloor.ButtonStepFloat = 1F;
this.zfloor.Location = new System.Drawing.Point(188, 32);
this.zfloor.Name = "zfloor";
this.zfloor.Size = new System.Drawing.Size(120, 24);
@ -150,6 +172,7 @@ namespace CodeImp.DoomBuilder.Windows
this.positiony.AllowNegative = true;
this.positiony.AllowRelative = true;
this.positiony.ButtonStep = 1;
this.positiony.ButtonStepFloat = 1F;
this.positiony.Location = new System.Drawing.Point(236, 34);
this.positiony.Name = "positiony";
this.positiony.Size = new System.Drawing.Size(120, 24);
@ -163,6 +186,7 @@ namespace CodeImp.DoomBuilder.Windows
this.positionx.AllowNegative = true;
this.positionx.AllowRelative = true;
this.positionx.ButtonStep = 1;
this.positionx.ButtonStepFloat = 1F;
this.positionx.Location = new System.Drawing.Point(68, 34);
this.positionx.Name = "positionx";
this.positionx.Size = new System.Drawing.Size(120, 24);
@ -236,7 +260,6 @@ namespace CodeImp.DoomBuilder.Windows
this.fieldslist.TypeColumnVisible = true;
this.fieldslist.TypeColumnWidth = 100;
this.fieldslist.ValueColumnVisible = true;
this.fieldslist.OnFieldValueChanged += new CodeImp.DoomBuilder.Controls.FieldsEditorControl.SingleFieldNameEvent(this.fieldslist_OnFieldValueChanged);
//
// cancel
//
@ -261,26 +284,6 @@ namespace CodeImp.DoomBuilder.Windows
this.apply.UseVisualStyleBackColor = true;
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
//
this.AcceptButton = this.apply;

View file

@ -71,12 +71,16 @@ namespace CodeImp.DoomBuilder.Windows
{
InitializeComponent();
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.VertexFields);
if(General.Map.FormatInterface.HasCustomFields) { //mxd
// Initialize custom fields editor
fieldslist.Setup("vertex");
// Custom fields?
if(!General.Map.FormatInterface.HasCustomFields)
// Fill universal fields list
fieldslist.ListFixedFields(General.Map.Config.VertexFields);
} else {
tabs.TabPages.Remove(tabcustom);
panelHeightControls.Visible = false;
}
// Decimals allowed?
if(General.Map.FormatInterface.VertexDecimals > 0)
@ -88,11 +92,6 @@ namespace CodeImp.DoomBuilder.Windows
zceiling.AllowDecimal = true;
zfloor.AllowDecimal = true;
}
if(!General.Map.UDMF) panelHeightControls.Visible = false;
// Initialize custom fields editor
fieldslist.Setup("vertex");
}
#endregion
@ -130,7 +129,8 @@ namespace CodeImp.DoomBuilder.Windows
positiony.Enabled = allowPositionChange;
// Custom fields
fieldslist.SetValues(vc.Fields, true);
if(General.Map.FormatInterface.HasCustomFields) //mxd
fieldslist.SetValues(vc.Fields, true);
////////////////////////////////////////////////////////////////////////
// Now go for all sectors and change the options when a setting is different
@ -144,8 +144,10 @@ namespace CodeImp.DoomBuilder.Windows
if(positiony.Text != v.Position.y.ToString()) positiony.Text = "";
// Custom fields
v.Fields.BeforeFieldsChange();//mxd
fieldslist.SetValues(v.Fields, false);
if(General.Map.FormatInterface.HasCustomFields) { //mxd
v.Fields.BeforeFieldsChange();//mxd
fieldslist.SetValues(v.Fields, false);
}
//mxd. Store initial properties
vertexProps.Add(new VertexProperties(v));
@ -278,16 +280,6 @@ namespace CodeImp.DoomBuilder.Windows
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
private void clearZFloor_Click(object sender, EventArgs e) {
zfloor.Text = CLEAR_VALUE;
@ -305,6 +297,11 @@ namespace CodeImp.DoomBuilder.Windows
// OK clicked
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;
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">
<value>True</value>
</metadata>
<metadata name="fieldslist.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="cancel.Locked" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>

View file

@ -1077,6 +1077,18 @@ rotatethingsccw
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
gzdbvisualmode
{
@ -1087,7 +1099,7 @@ gzdbvisualmode
allowmouse = true;
allowscroll = true;
disregardshift = true;
default = 81; //Q
default = 81; //Q
}
//mxd.

View file

@ -2647,6 +2647,102 @@ namespace CodeImp.DoomBuilder.BuilderModes
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
[BeginAction("toggleslope")]
public void ToggleSlope() {