Thing Info panel, Linedef info panel: tag labels are now displayed for action arguments.

This commit is contained in:
MaxED 2014-01-16 13:08:41 +00:00
parent e487a9c80a
commit 88a6f5a46c
6 changed files with 47 additions and 44 deletions

View file

@ -50,7 +50,6 @@ namespace CodeImp.DoomBuilder.Controls
// This shows the info
public void ShowInfo(Linedef l)
{
TypeHandler th;
bool upperunpegged, lowerunpegged;
string peggedness;
int defaultPanelWidth = 270; //mxd
@ -165,17 +164,12 @@ namespace CodeImp.DoomBuilder.Controls
if (hasArg0Str) {
arg1.Text = '"' + l.Fields["arg0str"].Value.ToString() + '"';
} else {
th = General.Types.GetArgumentHandler(act.Args[0]);
th.SetValue(l.Args[0]); arg1.Text = th.GetStringValue();
setArgumentText(act.Args[0], arg1, l.Args[0]);
}
th = General.Types.GetArgumentHandler(act.Args[1]);
th.SetValue(l.Args[1]); arg2.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[2]);
th.SetValue(l.Args[2]); arg3.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[3]);
th.SetValue(l.Args[3]); arg4.Text = th.GetStringValue();
th = General.Types.GetArgumentHandler(act.Args[4]);
th.SetValue(l.Args[4]); arg5.Text = th.GetStringValue();
setArgumentText(act.Args[1], arg2, l.Args[1]);
setArgumentText(act.Args[2], arg3, l.Args[2]);
setArgumentText(act.Args[3], arg4, l.Args[3]);
setArgumentText(act.Args[4], arg5, l.Args[4]);
// Front side available?
if(l.Front != null)
@ -458,12 +452,24 @@ namespace CodeImp.DoomBuilder.Controls
//mxd
private float getDefaultUDMFValue(string valueName) {
foreach (UniversalFieldInfo fi in fieldInfos) {
if (fi.Name == valueName)
return (float)fi.Default;
if (fi.Name == valueName) return (float)fi.Default;
}
return 0;
}
//mxd
private void setArgumentText(ArgumentInfo info, Label label, int value) {
TypeHandler th = General.Types.GetArgumentHandler(info);
th.SetValue(value);
label.Text = th.GetStringValue();
if(value < 1 || !General.Map.Options.TagLabels.ContainsKey(value)) return;
if(th is ThingTagHandler || th is LinedefTagHandler || th is SectorTagHandler) {
label.Text += " (" + General.Map.Options.TagLabels[value] + ")";
}
}
// When visible changed
protected override void OnVisibleChanged(EventArgs e)
{

View file

@ -50,7 +50,6 @@ namespace CodeImp.DoomBuilder.Controls
{
ThingTypeInfo ti;
LinedefActionInfo act = null;
TypeHandler th;
string actioninfo = "";
string zinfo;
float zvalue;
@ -106,12 +105,12 @@ namespace CodeImp.DoomBuilder.Controls
// Hangs from ceiling?
if(ti.Hangs)
{
zvalue = (float)t.Sector.CeilHeight - t.Position.z - ti.Height; //mxd
zvalue = t.Sector.CeilHeight - t.Position.z - ti.Height; //mxd
zinfo = zvalue.ToString();
}
else
{
zvalue = (float)t.Sector.FloorHeight + t.Position.z;
zvalue = t.Sector.FloorHeight + t.Position.z;
zinfo = zvalue.ToString();
}
}
@ -176,22 +175,12 @@ namespace CodeImp.DoomBuilder.Controls
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();
setArgumentText(arginfo[0], arg1, t.Args[0]);
}
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();
setArgumentText(arginfo[1], arg2, t.Args[1]);
setArgumentText(arginfo[2], arg3, t.Args[2]);
setArgumentText(arginfo[3], arg4, t.Args[3]);
setArgumentText(arginfo[4], arg5, t.Args[4]);
//mxd. Flags
flags.Items.Clear();
@ -217,6 +206,19 @@ namespace CodeImp.DoomBuilder.Controls
this.Update();
}
//mxd
private void setArgumentText(ArgumentInfo info, Label label, int value) {
TypeHandler th = General.Types.GetArgumentHandler(info);
th.SetValue(value);
label.Text = th.GetStringValue();
if(value < 1 || !General.Map.Options.TagLabels.ContainsKey(value)) return;
if (th is ThingTagHandler || th is LinedefTagHandler || th is SectorTagHandler) {
label.Text += " (" + General.Map.Options.TagLabels[value] + ")";
}
}
// When visible changed
protected override void OnVisibleChanged(EventArgs e)
{

View file

@ -34,7 +34,7 @@
//
// label
//
this.label.Location = new System.Drawing.Point(3, 6);
this.label.Location = new System.Drawing.Point(0, 6);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(86, 14);
this.label.TabIndex = 36;

View file

@ -33,7 +33,7 @@
//
// label
//
this.label.Location = new System.Drawing.Point(3, 6);
this.label.Location = new System.Drawing.Point(0, 6);
this.label.Name = "label";
this.label.Size = new System.Drawing.Size(87, 14);
this.label.TabIndex = 40;

View file

@ -52,8 +52,6 @@ namespace CodeImp.DoomBuilder.Types
public override void SetValue(object value)
{
int result;
// Null?
if(value == null)
{
@ -68,6 +66,7 @@ namespace CodeImp.DoomBuilder.Types
else
{
// Try parsing as string
int result;
if(int.TryParse(value.ToString(), NumberStyles.Integer, CultureInfo.CurrentCulture, out result))
{
this.value = result;

View file

@ -3219,10 +3219,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Wrap the value within the width of the texture (to prevent ridiculous values)
// NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels
if(texture.IsImageLoaded) {
if(alignx)
j.sidedef.OffsetX %= texture.Width;
if(aligny)
j.sidedef.OffsetY %= texture.Height;
if(alignx) j.sidedef.OffsetX %= texture.Width;
if(aligny) j.sidedef.OffsetY %= texture.Height;
}
// Add sidedefs forward (connected to the right vertex)
@ -3239,7 +3237,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Apply alignment
if(alignx)
j.sidedef.OffsetX = (int)j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex);
j.controlSide.OffsetX = (int)j.offsetx - (int)Math.Round(j.sidedef.Line.Length / scalex);
if(aligny)
j.sidedef.OffsetY = (int)Math.Round((first.controlSide.Sector.CeilHeight - j.controlSide.Sector.CeilHeight) / scaley) + ystartalign;
forwardoffset = (int)j.offsetx;
@ -3250,10 +3248,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
// Wrap the value within the width of the texture (to prevent ridiculous values)
// NOTE: We don't use ScaledWidth here because the texture offset is in pixels, not mappixels
if(texture.IsImageLoaded) {
if(alignx)
j.sidedef.OffsetX %= texture.Width;
if(aligny)
j.sidedef.OffsetY %= texture.Height;
if(alignx) j.sidedef.OffsetX %= texture.Width;
if(aligny) j.sidedef.OffsetY %= texture.Height;
}
// Add sidedefs backward (connected to the left vertex)