示例#1
0
        // Segment changes
        private void segindex_ValueChanged(object sender, EventArgs e)
        {
            Seg     sg = mode.Segs[(int)segindex.Value];
            Linedef ld = null;             //mxd

            if (sg.lineindex != -1)
            {
                ld = General.Map.Map.GetLinedefByIndex(sg.lineindex);                                //mxd
            }
            lineindex.Text   = sg.lineindex.ToString();
            startvertex.Text = sg.startvertex + "  (" + mode.Vertices[sg.startvertex].x + ", " + mode.Vertices[sg.startvertex].y + ")";
            endvertex.Text   = sg.endvertex + "  (" + mode.Vertices[sg.endvertex].x + ", " + mode.Vertices[sg.endvertex].y + ")";
            segside.Text     = sg.leftside ? "Back" : "Front";
            segangle.Text    = Angle2D.RealToDoom(sg.angle) + "\u00B0";
            segoffset.Text   = sg.offset + " mp";

            if (ld != null)            //mxd
            {
                sideindex.Text   = sg.leftside ? ld.Back.Index.ToString() : ld.Front.Index.ToString();
                sectorindex.Text = sg.leftside ? ld.Back.Sector.Index.ToString() : ld.Front.Sector.Index.ToString();
            }
            else
            {
                sideindex.Text   = "None";
                sectorindex.Text = "None";
            }

            General.Interface.RedrawDisplay();
        }
示例#2
0
        // This writes the THINGS to WAD file
        private void WriteThings(MapSet map, int position, IDictionary maplumps)
        {
            MemoryStream mem;
            BinaryWriter writer;
            Lump         lump;
            int          insertpos;
            int          flags;

            // Create memory to write to
            mem    = new MemoryStream();
            writer = new BinaryWriter(mem, WAD.ENCODING);

            // Go for all things
            foreach (Thing t in map.Things)
            {
                // Convert flags
                flags = 0;
                foreach (KeyValuePair <string, bool> f in t.Flags)
                {
                    int fnum;
                    if (f.Value && int.TryParse(f.Key, out fnum))
                    {
                        flags |= fnum;
                    }
                }

                // Write properties to stream
                // Write properties to stream
                writer.Write((UInt16)t.Tag);
                writer.Write((Int16)t.Position.x);
                writer.Write((Int16)t.Position.y);
                writer.Write((Int16)t.Position.z);
                writer.Write((Int16)Angle2D.RealToDoom(t.Angle));
                writer.Write((UInt16)t.Type);
                writer.Write((UInt16)flags);
                writer.Write((Byte)t.Action);
                writer.Write((Byte)t.Args[0]);
                writer.Write((Byte)t.Args[1]);
                writer.Write((Byte)t.Args[2]);
                writer.Write((Byte)t.Args[3]);
                writer.Write((Byte)t.Args[4]);
            }

            // Find insert position and remove old lump
            insertpos = MapManager.RemoveSpecificLump(wad, "THINGS", position, MapManager.TEMP_MAP_HEADER, maplumps);
            if (insertpos == -1)
            {
                insertpos = position + 1;
            }
            if (insertpos > wad.Lumps.Count)
            {
                insertpos = wad.Lumps.Count;
            }

            // Create the lump from memory
            lump = wad.Insert("THINGS", insertpos, (int)mem.Length);
            lump.Stream.Seek(0, SeekOrigin.Begin);
            mem.WriteTo(lump.Stream);
        }
示例#3
0
        // This rotates the thing
        public void Rotate(double newangle)
        {
            BeforePropsChange();

            // Change angle
            this.anglerad  = newangle;
            this.angledoom = Angle2D.RealToDoom(newangle);

            if (type != General.Map.Config.Start3DModeThingType)
            {
                General.Map.IsChanged = true;
            }
        }
        // This is called to perform a search (and replace)
        // Returns a list of items to show in the results list
        // replacewith is null when not replacing
        public override FindReplaceObject[] Find(string value, bool withinselection, bool replace, string replacewith, bool keepselection)
        {
            List <FindReplaceObject> objs = new List <FindReplaceObject>();

            // Interpret the replacement
            int replaceangle = 0;

            if (replace)
            {
                // If it cannot be interpreted, set replacewith to null (not replacing at all)
                if (!int.TryParse(replacewith, out replaceangle))
                {
                    replacewith = null;
                }
                if (replacewith == null)
                {
                    MessageBox.Show("Invalid replace value for this search type!", "Find and Replace", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(objs.ToArray());
                }
            }

            // Interpret the number given
            int angle;

            if (int.TryParse(value, out angle))
            {
                // Where to search?
                ICollection <Thing> list = withinselection ? General.Map.Map.GetSelectedThings(true) : General.Map.Map.Things;

                // Go for all things
                foreach (Thing t in list)
                {
                    // Match?
                    if (Angle2D.RealToDoom(t.Angle) == angle)
                    {
                        // Replace
                        if (replace)
                        {
                            t.Rotate(Angle2D.DoomToReal(replaceangle));
                        }

                        // Add to list
                        ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);
                        objs.Add(new FindReplaceObject(t, "Thing " + t.Index + " (" + ti.Title + ")"));
                    }
                }
            }

            return(objs.ToArray());
        }
示例#5
0
        public void ThingRotateRight()
        {
            // Make list of selected things
            List <Thing> selected = new List <Thing>(General.Map.Map.GetSelectedThings(true));

            if ((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed)
            {
                selected.Add(highlighted);
            }

            // Anything to do?
            if (selected.Count > 0)
            {
                // Make undo
                if (selected.Count > 1)
                {
                    General.Map.UndoRedo.CreateUndo("Rotate " + selected.Count + " things");
                    General.Interface.DisplayStatus(StatusType.Action, "Rotated " + selected.Count + " things.");
                }
                else
                {
                    General.Map.UndoRedo.CreateUndo("Rotate thing");
                    General.Interface.DisplayStatus(StatusType.Action, "Rotated a thing.");
                }

                foreach (Thing t in selected)
                {
                    int angle;

                    angle  = Angle2D.RealToDoom(t.Angle);
                    angle -= 45;

                    t.Rotate(Angle2D.DoomToReal(angle));
                }

                General.Map.IsChanged = true;
                General.Map.ThingsFilter.Update();
                General.Interface.RefreshInfo();
                General.Interface.RedrawDisplay();
            }
        }
示例#6
0
        /// <summary>
        /// This updates the list of things.
        /// </summary>
        public virtual void Update()
        {
            AdjustForMapFormat();

            // Make new list
            visiblethings      = new List <Thing>(General.Map.Map.Things.Count);
            hiddenthings       = new List <Thing>(General.Map.Map.Things.Count);
            thingsvisiblestate = new Dictionary <Thing, bool>(General.Map.Map.Things.Count);
            foreach (Thing t in General.Map.Map.Things)
            {
                bool qualifies = true;

                // Get thing info
                ThingTypeInfo ti = General.Map.Data.GetThingInfo(t.Type);

                // Check against simple properties
                qualifies &= (thingtype == -1) || (t.Type == thingtype);
                qualifies &= (thingangle == -1) || (Angle2D.RealToDoom(t.Angle) == thingangle);
                qualifies &= (thingzheight == int.MinValue) || ((int)(t.Position.z) == thingzheight);
                qualifies &= (thingaction == -1) || (t.Action == thingaction);
                qualifies &= (thingtag == -1) || (t.Tag == thingtag);
                for (int i = 0; i < Thing.NUM_ARGS; i++)
                {
                    qualifies &= (thingargs[i] == -1) || (t.Args[i] == thingargs[i]);
                }

                // Still qualifies?
                if (qualifies)
                {
                    // Check thing category
                    if (ti.Category == null)
                    {
                        qualifies = (categoryname.Length == 0);
                    }
                    else
                    {
                        qualifies = ((ti.Category.Name == categoryname) || (categoryname.Length == 0));
                    }
                }

                // Still qualifies?
                if (qualifies)
                {
                    // Go for all required fields
                    foreach (string s in requiredfields)
                    {
                        if (t.Flags.ContainsKey(s))
                        {
                            if (t.Flags[s] == false)
                            {
                                qualifies = false;
                                break;
                            }
                        }
                        else
                        {
                            qualifies = false;
                            break;
                        }
                    }
                }

                // Still qualifies?
                if (qualifies)
                {
                    // Go for all forbidden fields
                    foreach (string s in forbiddenfields)
                    {
                        if (t.Flags.ContainsKey(s))
                        {
                            if (t.Flags[s])
                            {
                                qualifies = false;
                                break;
                            }
                        }
                    }
                }

                // Still qualifies?
                if (qualifies)
                {
                    // Go for all required custom fields
                    foreach (KeyValuePair <string, UniValue> kv in customfields)
                    {
                        if (t.Fields.ContainsKey(kv.Key))
                        {
                            if (!((t.Fields[kv.Key].Type == kv.Value.Type) && (t.Fields[kv.Key].Value.Equals(kv.Value.Value))))
                            {
                                qualifies = false;
                                break;
                            }
                        }
                        else
                        {
                            qualifies = false;
                            break;
                        }
                    }
                }

                //mxd. Apply inversion
                qualifies ^= invert;

                // Put the thing in the lists. mxd: visiblethings and hiddenthings are only used from classic modes, IsThingVisible() is only used from visual mode.
                if (qualifies || displaymode == ThingsFilterDisplayMode.VISUAL_MODES_ONLY)
                {
                    visiblethings.Add(t);
                }
                else
                {
                    hiddenthings.Add(t);
                }
                thingsvisiblestate.Add(t, qualifies || (displaymode == ThingsFilterDisplayMode.CLASSIC_MODES_ONLY));
            }
        }
示例#7
0
 public override void Browse(IWin32Window parent)
 {
     value = Angle2D.DoomToReal(AngleForm.ShowDialog(parent, Angle2D.RealToDoom(value)));
 }
示例#8
0
        // This adds things
        private void WriteThings(ICollection <Thing> things, UniversalParser textmap)
        {
            // Go for all things
            foreach (Thing t in things)
            {
                // Make collection
                UniversalCollection coll = new UniversalCollection();
                if (t.Tag != 0)
                {
                    coll.Add("id", t.Tag);
                }
                coll.Add("x", t.Position.x);
                coll.Add("y", t.Position.y);
                if (t.Position.z != 0.0f)
                {
                    coll.Add("height", (float)t.Position.z);
                }
                coll.Add("angle", Angle2D.RealToDoom(t.Angle));
                coll.Add("type", t.Type);
                if (t.Action != 0)
                {
                    coll.Add("special", t.Action);
                }
                if (t.Args[0] != 0)
                {
                    coll.Add("arg0", t.Args[0]);
                }
                if (t.Args[1] != 0)
                {
                    coll.Add("arg1", t.Args[1]);
                }
                if (t.Args[2] != 0)
                {
                    coll.Add("arg2", t.Args[2]);
                }
                if (t.Args[3] != 0)
                {
                    coll.Add("arg3", t.Args[3]);
                }
                if (t.Args[4] != 0)
                {
                    coll.Add("arg4", t.Args[4]);
                }
                coll.Comment = t.Index.ToString();

                // Flags
                foreach (KeyValuePair <string, bool> flag in t.Flags)
                {
                    if (flag.Value)
                    {
                        coll.Add(flag.Key, flag.Value);
                    }
                }

                // Add custom fields
                AddCustomFields(t, "thing", coll);

                // Store
                textmap.Root.Add("thing", coll);
            }
        }
示例#9
0
        // This shows the info
        public void ShowInfo(Thing t)
        {
            ThingTypeInfo     ti;
            LinedefActionInfo act = null;
            TypeHandler       th;
            string            actioninfo = "";
            string            zinfo;
            float             zvalue;

            // Show/hide stuff depending on format
            if (!General.Map.FormatInterface.HasActionArgs)
            {
                arglbl1.Visible = false;
                arglbl2.Visible = false;
                arglbl3.Visible = false;
                arglbl4.Visible = false;
                arglbl5.Visible = false;
                arg1.Visible    = false;
                arg2.Visible    = false;
                arg3.Visible    = false;
                arg4.Visible    = false;
                arg5.Visible    = false;
                infopanel.Width = doomformatwidth;
            }
            else
            {
                arglbl1.Visible = true;
                arglbl2.Visible = true;
                arglbl3.Visible = true;
                arglbl4.Visible = true;
                arglbl5.Visible = true;
                arg1.Visible    = true;
                arg2.Visible    = true;
                arg3.Visible    = true;
                arg4.Visible    = true;
                arg5.Visible    = true;
                infopanel.Width = hexenformatwidth;
            }

            // Move panel
            spritepanel.Left = infopanel.Left + infopanel.Width + infopanel.Margin.Right + spritepanel.Margin.Left;

            // Lookup thing info
            ti = General.Map.Data.GetThingInfo(t.Type);

            // Get thing action information
            if (General.Map.Config.LinedefActions.ContainsKey(t.Action))
            {
                act        = General.Map.Config.LinedefActions[t.Action];
                actioninfo = act.ToString();
            }
            else if (t.Action == 0)
            {
                actioninfo = t.Action.ToString() + " - None";
            }
            else
            {
                actioninfo = t.Action.ToString() + " - Unknown";
            }

            // Determine z info to show
            t.DetermineSector();
            if (ti.AbsoluteZ)
            {
                zvalue = t.Position.z;
                zinfo  = zvalue.ToString();
            }
            else
            {
                if (t.Sector != null)
                {
                    // Hangs from ceiling?
                    if (ti.Hangs)
                    {
                        zvalue = (float)t.Sector.CeilHeight + t.Position.z;
                        zinfo  = zvalue.ToString();
                    }
                    else
                    {
                        zvalue = (float)t.Sector.FloorHeight + t.Position.z;
                        zinfo  = zvalue.ToString();
                    }
                }
                else
                {
                    zvalue = t.Position.z;
                    if (zvalue >= 0.0f)
                    {
                        zinfo = "+" + zvalue.ToString();
                    }
                    else
                    {
                        zinfo = zvalue.ToString();
                    }
                }
            }

            // Thing info
            infopanel.Text = " Thing " + t.Index + " ";
            type.Text      = t.Type + " - " + ti.Title;
            action.Text    = actioninfo;
            position.Text  = t.Position.x.ToString() + ", " + t.Position.y.ToString() + ", " + zinfo;
            tag.Text       = t.Tag.ToString();
            angle.Text     = Angle2D.RealToDoom(t.Angle).ToString() + "\u00B0";

            // Sprite
            if (ti.Title == "Camera") // villsa
            {
                General.DisplayZoomedImage(spritetex, General.Map.Data.ThingCamera.GetBitmap());
                spritename.Text = "";
            }
            else if (ti.Title == "Trigger") // villsa 9/11/11
            {
                General.DisplayZoomedImage(spritetex, General.Map.Data.ThingTrigger.GetBitmap());
                spritename.Text = "";
            }
            else if (ti.Sprite.ToLowerInvariant().StartsWith(DataManager.INTERNAL_PREFIX) && (ti.Sprite.Length > DataManager.INTERNAL_PREFIX.Length))
            {
                spritename.Text = "";
                General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(ti.Sprite).GetBitmap());
            }
            else if ((ti.Sprite.Length <= 8) && (ti.Sprite.Length > 0))
            {
                spritename.Text = ti.Sprite;
                General.DisplayZoomedImage(spritetex, General.Map.Data.GetSpriteImage(ti.Sprite).GetPreview());
            }
            else
            {
                spritename.Text           = "";
                spritetex.BackgroundImage = null;
            }

            // Arguments
            if (act != null)
            {
                arglbl1.Text    = act.Args[0].Title + ":";
                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;
                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       = "-";
            }

            // Show the whole thing
            this.Show();
            this.Update();
        }
示例#10
0
        // Apply clicked
        private void apply_Click(object sender, EventArgs e)
        {
            List <string> defaultflags = new List <string>();
            string        undodesc     = "thing";

            // Verify the tag
            if (General.Map.FormatInterface.HasThingTag && ((tag.GetResult(0) < General.Map.FormatInterface.MinTag) || (tag.GetResult(0) > General.Map.FormatInterface.MaxTag)))
            {
                General.ShowWarningMessage("Thing tag must be between " + General.Map.FormatInterface.MinTag + " and " + General.Map.FormatInterface.MaxTag + ".", MessageBoxButtons.OK);
                return;
            }

            // Verify the type
            if (((thingtype.GetResult(0) < General.Map.FormatInterface.MinThingType) || (thingtype.GetResult(0) > General.Map.FormatInterface.MaxThingType)))
            {
                General.ShowWarningMessage("Thing type must be between " + General.Map.FormatInterface.MinThingType + " and " + General.Map.FormatInterface.MaxThingType + ".", MessageBoxButtons.OK);
                return;
            }

            // Verify the action
            if (General.Map.FormatInterface.HasThingAction && ((action.Value < General.Map.FormatInterface.MinAction) || (action.Value > General.Map.FormatInterface.MaxAction)))
            {
                General.ShowWarningMessage("Thing action must be between " + General.Map.FormatInterface.MinAction + " and " + General.Map.FormatInterface.MaxAction + ".", MessageBoxButtons.OK);
                return;
            }

            // Make undo
            if (things.Count > 1)
            {
                undodesc = things.Count + " things";
            }
            General.Map.UndoRedo.CreateUndo("Edit " + undodesc);

            // Go for all the things
            foreach (Thing t in things)
            {
                // Thing type index
                t.Type = General.Clamp(thingtype.GetResult(t.Type), General.Map.FormatInterface.MinThingType, General.Map.FormatInterface.MaxThingType);

                // Coordination
                t.Rotate(Angle2D.DoomToReal(angle.GetResult(Angle2D.RealToDoom(t.Angle))));
                t.Move(t.Position.x, t.Position.y, (float)height.GetResult((int)t.Position.z));

                // Apply all flags
                foreach (CheckBox c in flags.Checkboxes)
                {
                    if (c.CheckState == CheckState.Checked)
                    {
                        t.SetFlag(c.Tag.ToString(), true);
                    }
                    else if (c.CheckState == CheckState.Unchecked)
                    {
                        t.SetFlag(c.Tag.ToString(), false);
                    }
                }

                // Action/tags
                t.Tag = tag.GetResult(t.Tag);
                if (!action.Empty)
                {
                    t.Action = action.Value;
                }
                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);

                // Update settings
                t.UpdateConfiguration();
            }

            // Set as defaults
            foreach (CheckBox c in flags.Checkboxes)
            {
                if (c.CheckState == CheckState.Checked)
                {
                    defaultflags.Add(c.Tag.ToString());
                }
            }
            General.Settings.DefaultThingType  = thingtype.GetResult(General.Settings.DefaultThingType);
            General.Settings.DefaultThingAngle = Angle2D.DegToRad((float)angle.GetResult((int)Angle2D.RadToDeg(General.Settings.DefaultThingAngle) - 90) + 90);
            General.Settings.SetDefaultThingFlags(defaultflags);

            // Done
            General.Map.IsChanged = true;
            this.DialogResult     = DialogResult.OK;
            this.Close();
        }
示例#11
0
        // This sets up the form to edit the given things
        public void Setup(ICollection <Thing> things)
        {
            Thing ft;

            // Keep this list
            this.things = things;
            if (things.Count > 1)
            {
                this.Text = "Edit Things (" + things.Count + ")";
            }

            ////////////////////////////////////////////////////////////////////////
            // Set all options to the first thing properties
            ////////////////////////////////////////////////////////////////////////

            ft = General.GetByIndex(things, 0);

            // Set type
            thingtype.SelectType(ft.Type);

            // Flags
            foreach (CheckBox c in flags.Checkboxes)
            {
                if (ft.Flags.ContainsKey(c.Tag.ToString()))
                {
                    c.Checked = ft.Flags[c.Tag.ToString()];
                }
            }

            // Coordination
            angle.Text  = Angle2D.RealToDoom(ft.Angle).ToString();
            height.Text = ((int)ft.Position.z).ToString();

            // Action/tags
            action.Value = ft.Action;
            tag.Text     = ft.Tag.ToString();
            arg0.SetValue(ft.Args[0]);
            arg1.SetValue(ft.Args[1]);
            arg2.SetValue(ft.Args[2]);
            arg3.SetValue(ft.Args[3]);
            arg4.SetValue(ft.Args[4]);

            // Custom fields
            fieldslist.SetValues(ft.Fields, true);

            ////////////////////////////////////////////////////////////////////////
            // Now go for all lines and change the options when a setting is different
            ////////////////////////////////////////////////////////////////////////

            // Go for all things
            foreach (Thing t in things)
            {
                // Type does not match?
                if ((thingtype.GetSelectedInfo() != null) &&
                    (thingtype.GetSelectedInfo().Index != t.Type))
                {
                    thingtype.ClearSelectedType();
                }

                // Flags
                foreach (CheckBox c in flags.Checkboxes)
                {
                    if (t.Flags.ContainsKey(c.Tag.ToString()))
                    {
                        if (t.Flags[c.Tag.ToString()] != c.Checked)
                        {
                            c.ThreeState = true;
                            c.CheckState = CheckState.Indeterminate;
                        }
                    }
                }

                // Coordination
                int angledeg = Angle2D.RealToDoom(t.Angle);
                if (angledeg.ToString() != angle.Text)
                {
                    angle.Text = "";
                }
                if (((int)t.Position.z).ToString() != height.Text)
                {
                    height.Text = "";
                }

                // Action/tags
                if (t.Action != action.Value)
                {
                    action.Empty = true;
                }
                if (t.Tag.ToString() != tag.Text)
                {
                    tag.Text = "";
                }
                if (t.Args[0] != arg0.GetResult(-1))
                {
                    arg0.ClearValue();
                }
                if (t.Args[1] != arg1.GetResult(-1))
                {
                    arg1.ClearValue();
                }
                if (t.Args[2] != arg2.GetResult(-1))
                {
                    arg2.ClearValue();
                }
                if (t.Args[3] != arg3.GetResult(-1))
                {
                    arg3.ClearValue();
                }
                if (t.Args[4] != arg4.GetResult(-1))
                {
                    arg4.ClearValue();
                }

                // Custom fields
                fieldslist.SetValues(t.Fields, false);
            }
        }