The bitmask.
Inheritance: BaseField
示例#1
0
        /// <summary>
        /// The load ent controls.
        /// </summary>
        /// <param name="reflexive">
        /// The reflexive.
        /// </param>
        /// <param name="entArray">
        /// The ent array.
        /// </param>
        /// <param name="clearControls">
        /// The clear controls.
        /// </param>
        /// <param name="layer">
        /// The layer.
        /// </param>
        /// <param name="tabIndex">
        /// The tab index.
        /// </param>
        /// <param name="customPluginPath">
        /// The custom plugin path.
        /// </param>
        public void LoadENTControls(
            IFPIO.Reflexive reflexive, 
            object[] entArray, 
            bool clearControls, 
            int layer, 
            ref int tabIndex, 
            string customPluginPath)
        {
            // add padding, offset label vertically, Change button sizes
            // int over = 10;
            if (clearControls)
            {
                foreach (Control c in this.bottomPanel.Controls)
                {
                    c.Dispose();
                }

                this.bottomPanel.Controls.Clear();
            }

            this.reflexiveItems = entArray;
            this.reflexiveLabel = reflexive.label;
            this.AutoSize = true;
            this.BackColor = Color.DarkGray;
            this.BorderStyle = BorderStyle.FixedSingle;
            this.Dock = DockStyle.Top;

            // this.ForeColor = System.Drawing.Color.DarkGray;
            this.Padding = new Padding(10, 0, 0, 0);
            this.offsetInMeta = reflexive.offset;
            this.chunkSize = reflexive.chunkSize;
            int tempCBindex = this.Controls.Count;
            this.tempComboBox.Tag = reflexive.name;
            this.tempLabel.Text = reflexive.name;
            ToolTip1.SetToolTip(this.tempLabel, "offset: " + customPluginPath);

            int colorSpaceCount = 3;

            foreach (object o in entArray)
            {
                IFPIO.BaseObject tempbase = (IFPIO.BaseObject)o;
                if (tempbase.visible == false)
                {
                    if (MetaEditor.ShowInvisibles == false)
                    {
                        continue;
                    }
                }

                bool skipEmptyReflex = false;
                //if (MetaEditor.ra.isOpen &&
                //    MetaEditor.ra.getValue(customPluginPath + "\\" + tempbase.offset) == bool.FalseString)
                //{
                //    if (tempbase.ObjectType == IFPIO.ObjectEnum.Struct)
                //    {
                //        skipEmptyReflex = true;
                //    }
                //    else
                //    {
                //        continue;
                //    }
                //}

                // ComboBox for changing types
                ComboBox cbox = new ComboBox();
                cbox.Anchor = AnchorStyles.Right | AnchorStyles.Top;
                cbox.BackColor = Color.LightGray;
                cbox.DropDownStyle = ComboBoxStyle.DropDownList;
                cbox.Width = 95;
                cbox.Items.AddRange(Enum.GetNames(typeof(IFPIO.ObjectEnum)));
                cbox.Items.RemoveAt(0); // Remove reflexive listing
                cbox.SelectionChangeCommitted += fieldTypeChanged; // Remove reflexive listing

                switch (tempbase.ObjectType)
                {
                    case IFPIO.ObjectEnum.Struct:
                        {
                            if (MetaEditor.ShowReflexives == false)
                            {
                                continue;
                            }

                            Label tempLabel1 = new Label();
                            tempLabel1.AutoSize = true;
                            tempLabel1.Location = new Point(0, 0);
                            tempLabel1.Name = "label1";
                            tempLabel1.Dock = DockStyle.Top;
                            tempLabel1.Size = new Size(35, 13);
                            tempLabel1.TabIndex = 1;
                            ReflexiveControl tempReflexive = new ReflexiveControl(
                                map, translatedOffset, ((IFPIO.Reflexive)tempbase).HasCount, tempbase.lineNumber);
                            tempReflexive.Name = "reflexive";
                            tempReflexive.LoadENTControls(
                                (IFPIO.Reflexive)tempbase,
                                ((IFPIO.Reflexive)tempbase).items,
                                true,
                                layer + 1,
                                ref tabIndex,
                                customPluginPath + "\\" + tempbase.offset);

                            // Label, Combobox & Button are always added ( = 3)
                            if (!(tempReflexive.Controls.Count <= 2 && skipEmptyReflex))
                            {
                                bottomPanel.Controls.Add(tempLabel1);
                                tempLabel1.BringToFront();
                                bottomPanel.Controls.Add(tempReflexive);
                                tempReflexive.BringToFront();
                            }

                            break;
                        }

                    case IFPIO.ObjectEnum.Block:
                        {
                            if (MetaEditor.ShowIdents == false)
                            {
                                continue;
                            }

                            TagBlock tempBlock = new TagBlock(
                                tempbase.name, map, tempbase.offset, tempbase.lineNumber);
                            tempBlock.Name = "tagblock";
                            tempBlock.Controls[1].ContextMenuStrip = identContext;
                            bottomPanel.Controls.Add(tempBlock);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Ident:
                        {
                            if (MetaEditor.ShowIdents == false)
                            {
                                continue;
                            }

                            Ident tempident = new Ident(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.Ident)tempbase).hasTagType,
                                tempbase.lineNumber);
                            tempident.Name = "ident";
                            tempident.Controls[1].ContextMenuStrip = identContext;
                            tempident.Controls[2].ContextMenuStrip = identContext;
                            bottomPanel.Controls.Add(tempident);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.StringID:
                        {
                            if (MetaEditor.ShowSIDs == false)
                            {
                                continue;
                            }

                            SID tempSID = new SID(tempbase.name, map, tempbase.offset, tempbase.lineNumber);
                            tempSID.Name = "sid";
                            bottomPanel.Controls.Add(tempSID);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Float:
                        {
                            if (MetaEditor.ShowFloats == false)
                            {
                                continue;
                            }

                            DataValues tempFloat = new DataValues(
                                tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Float, tempbase.lineNumber);

                            // Float tempFloat = new Float(tempbase.name, map, tempbase.offset);
                            tempFloat.Name = "float";
                            bottomPanel.Controls.Add(tempFloat);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.String32:
                        {
                            if (MetaEditor.ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String32)
                            {
                                continue;
                            }

                            EntStrings tempstring = new EntStrings(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.IFPString)tempbase).size,
                                ((IFPIO.IFPString)tempbase).type,
                                tempbase.lineNumber);
                            tempstring.Name = "string";
                            tempstring.TabIndex = tabIndex;
                            bottomPanel.Controls.Add(tempstring);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.UnicodeString256:
                        {
                            if (MetaEditor.ShowUnicodeString256s == false)
                            {
                                continue;
                            }

                            goto case IFPIO.ObjectEnum.String32;
                        }

                    case IFPIO.ObjectEnum.UnicodeString64:
                        {
                            if (MetaEditor.ShowUnicodeString64s == false)
                            {
                                continue;
                            }

                            goto case IFPIO.ObjectEnum.String32;
                        }

                    case IFPIO.ObjectEnum.String256:
                        {
                            if (MetaEditor.ShowString256s == false)
                            {
                                continue;
                            }

                            goto case IFPIO.ObjectEnum.String32;
                        }

                    case IFPIO.ObjectEnum.String:
                        {
                            if (MetaEditor.ShowString32s == false && tempbase.ObjectType == IFPIO.ObjectEnum.String)
                            {
                                continue;
                            }

                            goto case IFPIO.ObjectEnum.String32;
                        }

                    case IFPIO.ObjectEnum.Int:
                        {
                            if (((IFPIO.IFPInt)tempbase).entIndex.nulled)
                            {
                                if ((MetaEditor.ShowInts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Int) ||
                                    (MetaEditor.ShowShorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.Short) ||
                                    (MetaEditor.ShowUshorts == false && tempbase.ObjectType == IFPIO.ObjectEnum.UShort) ||
                                    (MetaEditor.ShowUints == false && tempbase.ObjectType == IFPIO.ObjectEnum.UInt))
                                {
                                    continue;
                                }

                                DataValues tempdatavalues = new DataValues(
                                    tempbase.name, map, tempbase.offset, tempbase.ObjectType, tempbase.lineNumber);
                                bottomPanel.Controls.Add(tempdatavalues);
                                bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            }
                            else
                            {
                                if ((MetaEditor.ShowBlockIndex32s == false &&
                                     (tempbase.ObjectType == IFPIO.ObjectEnum.Int |
                                      tempbase.ObjectType == IFPIO.ObjectEnum.UInt)) ||
                                    (MetaEditor.ShowBlockIndex16s == false &&
                                     (tempbase.ObjectType == IFPIO.ObjectEnum.Short |
                                      tempbase.ObjectType == IFPIO.ObjectEnum.UShort)) ||
                                    (MetaEditor.ShowBlockIndex8s == false &&
                                     tempbase.ObjectType == IFPIO.ObjectEnum.Byte))
                                {
                                    continue;
                                }

                                Indices tempdatavalues = new Indices(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    tempbase.ObjectType,
                                    ((IFPIO.IFPInt)tempbase).entIndex);
                                bottomPanel.Controls.Add(tempdatavalues);
                                bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            }

                            break;
                        }

                    case IFPIO.ObjectEnum.Short:
                        {
                            goto case IFPIO.ObjectEnum.Int;
                        }

                    case IFPIO.ObjectEnum.UShort:
                        {
                            goto case IFPIO.ObjectEnum.Int;
                        }

                    case IFPIO.ObjectEnum.UInt:
                        {
                            goto case IFPIO.ObjectEnum.Int;
                        }

                    case IFPIO.ObjectEnum.Unknown:
                        {
                            if (MetaEditor.ShowUndefineds == false)
                            {
                                continue;
                            }

                            DataValues tempUndefined = new DataValues(
                                tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unknown, tempbase.lineNumber);

                            // Float tempFloat = new Float(tempbase.name, map, tempbase.offset);
                            tempUndefined.Name = "tempUndefined";
                            bottomPanel.Controls.Add(tempUndefined);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Byte_Flags:
                        {
                            if (MetaEditor.ShowBitmask8s == false && ((IFPIO.Bitmask)tempbase).bitmaskSize == 8)
                            {
                                continue;
                            }

                            Bitmask tempbitmask = new Bitmask(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.Bitmask)tempbase).bitmaskSize,
                                ((IFPIO.Bitmask)tempbase).options,
                                tempbase.lineNumber);
                            bottomPanel.Controls.Add(tempbitmask);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Word_Flags:
                        {
                            if (MetaEditor.ShowBitmask16s == false && ((IFPIO.Bitmask)tempbase).bitmaskSize == 16)
                            {
                                continue;
                            }

                            Bitmask tempbitmask = new Bitmask(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.Bitmask)tempbase).bitmaskSize,
                                ((IFPIO.Bitmask)tempbase).options,
                                tempbase.lineNumber);
                            bottomPanel.Controls.Add(tempbitmask);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Long_Flags:
                        {
                            if (MetaEditor.ShowBitmask32s == false && ((IFPIO.Bitmask)tempbase).bitmaskSize == 32)
                            {
                                continue;
                            }

                            Bitmask tempbitmask = new Bitmask(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.Bitmask)tempbase).bitmaskSize,
                                ((IFPIO.Bitmask)tempbase).options,
                                tempbase.lineNumber);
                            bottomPanel.Controls.Add(tempbitmask);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Byte:
                        {
                            if (((IFPIO.IFPByte)tempbase).entIndex.nulled)
                            {
                                if (MetaEditor.ShowBytes == false)
                                {
                                    continue;
                                }

                                DataValues tempByte = new DataValues(
                                    tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Byte, tempbase.lineNumber);
                                bottomPanel.Controls.Add(tempByte);
                                bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            }
                            else
                            {
                                if (MetaEditor.ShowBlockIndex8s == false)
                                {
                                    continue;
                                }

                                Indices tempdatavalues = new Indices(
                                    tempbase.name,
                                    map,
                                    tempbase.offset,
                                    tempbase.ObjectType,
                                    ((IFPIO.IFPByte)tempbase).entIndex);
                                bottomPanel.Controls.Add(tempdatavalues);
                                bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            }

                            break;
                        }

                    case IFPIO.ObjectEnum.Char_Enum:
                        {
                            if (MetaEditor.ShowEnum8s == false)
                            {
                                continue;
                            }

                            Enums tempenum = new Enums(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.IFPEnum)tempbase).enumSize,
                                ((IFPIO.IFPEnum)tempbase).options,
                                tempbase.lineNumber);
                            bottomPanel.Controls.Add(tempenum);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Enum:
                        {
                            if (MetaEditor.ShowEnum16s == false)
                            {
                                continue;
                            }

                            Enums tempenum = new Enums(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.IFPEnum)tempbase).enumSize,
                                ((IFPIO.IFPEnum)tempbase).options,
                                tempbase.lineNumber);
                            bottomPanel.Controls.Add(tempenum);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Long_Enum:
                        {
                            if (MetaEditor.ShowEnum32s == false)
                            {
                                continue;
                            }

                            Enums tempenum = new Enums(
                                tempbase.name,
                                map,
                                tempbase.offset,
                                ((IFPIO.IFPEnum)tempbase).enumSize,
                                ((IFPIO.IFPEnum)tempbase).options,
                                tempbase.lineNumber);
                            bottomPanel.Controls.Add(tempenum);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.Unused:
                        {
                            DataValues tempUnused = new DataValues(
                                tempbase.name, map, tempbase.offset, IFPIO.ObjectEnum.Unused, tempbase.lineNumber);
                            tempUnused.TabIndex = tabIndex;
                            tempUnused.Populate(map.SelectedMeta.offset);
                            bottomPanel.Controls.Add(tempUnused);
                            bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();
                            break;
                        }

                    case IFPIO.ObjectEnum.TagType:
                        continue;
                }

                if (!(tempbase is IFPIO.Reflexive))
                {
                    bottomPanel.Controls[0].ContextMenuStrip = identContext;
                    bottomPanel.Controls[0].Controls[1].ContextMenuStrip = identContext;
                    ToolTip1.SetToolTip(
                        this.bottomPanel.Controls[0].Controls[0], "offset: " + customPluginPath + "\\" + tempbase.offset);

                    // cbox.Location = new Point(this.bottomPanel.Controls[0].Width - 100, 4);
                    // cbox.SelectedIndex = cbox.Items.IndexOf(tempbase.ObjectType.ToString());
                    // this.bottomPanel.Controls[0].Controls.RemoveAt(this.bottomPanel.Controls[0].Controls.Count - 1);
                    this.bottomPanel.Controls[0].Controls[this.bottomPanel.Controls[0].Controls.Count - 1].Click +=
                        fieldTypeChanged;

                    // this.bottomPanel.Controls[0].Controls.Add(cbox);
                }

                if (bottomPanel.Controls.Count > 0 && bottomPanel.Controls[0] is DataValues)
                {
                    // if (((tempbase.name.ToLower().Contains(" a") & tempbase.name[tempbase.name.ToLower().IndexOf(" a")]) ||
                    // tempbase.name.ToLower().Contains("alpha"))& alphaControl == null)
                    if (ColorWheel.checkForColor(tempbase.name, alphaControl, " a", "alpha"))
                    {
                        alphaControl = (DataValues)bottomPanel.Controls[0];
                        colorSpaceCount = 0;
                    }

                        // if (tempbase.name.ToLower().Contains(" r") & redControl == null)
                    else if (ColorWheel.checkForColor(tempbase.name, redControl, " r", "red"))
                    {
                        redControl = (DataValues)bottomPanel.Controls[0];
                        colorSpaceCount = 0;
                    }

                        // if (tempbase.name.ToLower().Contains(" g") & greenControl == null)
                    else if (ColorWheel.checkForColor(tempbase.name, greenControl, " g", "green"))
                    {
                        greenControl = (DataValues)bottomPanel.Controls[0];
                        colorSpaceCount = 0;
                    }

                        // if (tempbase.name.ToLower().Contains(" b") & blueControl == null)
                    else if (ColorWheel.checkForColor(tempbase.name, blueControl, " b", "blue"))
                    {
                        blueControl = (DataValues)bottomPanel.Controls[0];
                        colorSpaceCount = 0;
                    }
                    else
                    {
                        colorSpaceCount++;
                        if (colorSpaceCount == 1)
                        {
                            alphaControl = null;
                            redControl = null;
                            greenControl = null;
                            blueControl = null;
                        }
                    }

                    if (redControl != null & greenControl != null & blueControl != null)
                    {
                        // Create the new ColorWheel class, indicating
                        // the locations of the color wheel itself, the
                        // brightness area, and the position of the selected color.
                        ColorWheel cw = new ColorWheel();

                        if (alphaControl != null)
                        {
                            cw.setTextBox(alphaControl.textBox1, Color.White);
                        }

                        cw.setTextBox(redControl.textBox1, Color.Red);
                        cw.setTextBox(greenControl.textBox1, Color.Green);
                        cw.setTextBox(blueControl.textBox1, Color.Blue);

                        // p.I.AddRange(new Rectangle[] { SelectedColorRectangle });
                        cw.Dock = DockStyle.Top;
                        bottomPanel.Controls.Add(cw);
                        bottomPanel.Controls[bottomPanel.Controls.Count - 1].BringToFront();

                        // Reset for next batch
                        colorSpaceCount++;
                        alphaControl = null;
                        redControl = null;
                        greenControl = null;
                        blueControl = null;
                    }
                }
                else
                {
                    colorSpaceCount++;
                }
            }

            // used for customPlugin variables
            this.Size = this.PreferredSize;
            this.AutoScroll = false;
            this.AutoSize = false;
        }
示例#2
0
        /// <summary>
        /// The field type changed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void fieldTypeChanged(object sender, EventArgs e)
        {
            // Get original data
            Control c = ((Control)sender).Parent;
            int origPlacement = c.Parent.Controls.IndexOf(c);
            Control origParent = c.Parent;

            ControlSwapper cs = new ControlSwapper(c);
            cs.ShowDialog();
            string name = string.Empty;
            int offset = -1;
            int chunkoffset = -1;
            int lineNum = -1;
            int sizeCount = 0;

            //////
            c.Enabled = true;
            origParent.Controls.Add(c);
            origParent.Controls.SetChildIndex(c, origPlacement);
            return;

            /////

            switch (c.ToString())
            {
                case "Entity.MetaEditor.Bitmask":
                    Bitmask bt = (Bitmask)c;
                    name = bt.EntName;
                    offset = bt.offsetInMap;
                    chunkoffset = bt.chunkOffset;
                    lineNum = bt.LineNumber;
                    sizeCount = bt.bitCount >> 3;
                    break;
                case "Entity.MetaEditor.DataValues":
                    DataValues dv = (DataValues)c;
                    name = dv.EntName;
                    offset = dv.offsetInMap;
                    chunkoffset = dv.chunkOffset;
                    lineNum = dv.LineNumber;
                    switch (dv.ValueType)
                    {
                        case IFPIO.ObjectEnum.Byte:
                            // case DataValues.ENTType.ub:
                            sizeCount = 1;
                            break;
                        case IFPIO.ObjectEnum.Short:
                        case IFPIO.ObjectEnum.UShort:
                            sizeCount = 2;
                            break;
                        case IFPIO.ObjectEnum.Float:
                        case IFPIO.ObjectEnum.Int:
                        case IFPIO.ObjectEnum.UInt:
                            sizeCount = 4;
                            break;
                    }

                    break;
            }

            Control c2 = null;
            switch (((string)((ComboBox)sender).SelectedItem).ToLower())
            {
                case "byte":
                    if (sizeCount < 1)
                    {
                        break;
                    }

                    DataValues dv = new DataValues(name, map, chunkoffset, IFPIO.ObjectEnum.Byte, lineNum);
                    dv.Controls.RemoveAt(dv.Controls.Count - 1);
                    c2 = dv;
                    sizeCount -= 1;
                    break;
                case "short":
                    if (sizeCount < 2)
                    {
                        break;
                    }

                    dv = new DataValues(name, map, chunkoffset, IFPIO.ObjectEnum.Short, lineNum);
                    dv.Controls.RemoveAt(dv.Controls.Count - 1);
                    c2 = dv;
                    sizeCount -= 2;
                    break;
                case "int":
                    if (sizeCount < 4)
                    {
                        break;
                    }

                    dv = new DataValues(name, map, chunkoffset, IFPIO.ObjectEnum.Int, lineNum);
                    dv.Controls.RemoveAt(dv.Controls.Count - 1);
                    c2 = dv;
                    sizeCount -= 4;
                    break;
                case "float":
                    if (sizeCount < 4)
                    {
                        break;
                    }

                    dv = new DataValues(name, map, chunkoffset, IFPIO.ObjectEnum.Float, lineNum);
                    dv.Controls.RemoveAt(dv.Controls.Count - 1);
                    c2 = dv;
                    sizeCount -= 4;
                    break;
                case "byte_flags":
                    if (sizeCount < 1)
                    {
                        break;
                    }

                    IFPIO.Option[] options = new IFPIO.Option[8];
                    for (int x = 0; x < 8; x++)
                    {
                        options[x] = new IFPIO.Option("bit " + x, x.ToString(), lineNum);
                    }

                    Bitmask bt = new Bitmask(name, map, chunkoffset, 8, options, lineNum);
                    bt.Controls.RemoveAt(bt.Controls.Count - 1);
                    c2 = bt;
                    sizeCount -= 1;
                    break;
                case "word_flags":
                    if (sizeCount < 2)
                    {
                        break;
                    }

                    options = new IFPIO.Option[16];
                    for (int x = 0; x < 16; x++)
                    {
                        options[x] = new IFPIO.Option("bit " + x, x.ToString(), lineNum);
                    }

                    bt = new Bitmask(name, map, chunkoffset, 16, options, lineNum);
                    bt.Controls.RemoveAt(bt.Controls.Count - 1);
                    c2 = bt;
                    sizeCount -= 2;
                    break;
                case "long_flags":
                    if (sizeCount < 4)
                    {
                        break;
                    }

                    options = new IFPIO.Option[32];
                    for (int x = 0; x < 32; x++)
                    {
                        options[x] = new IFPIO.Option("bit " + x, x.ToString(), lineNum);
                    }

                    bt = new Bitmask(name, map, chunkoffset, 32, options, lineNum);
                    bt.Controls.RemoveAt(bt.Controls.Count - 1);
                    c2 = bt;
                    sizeCount -= 4;
                    break;
            }

            if (c2 != null && sizeCount == 0)
            {
                c2.TabIndex = c.TabIndex;
                c2.Location = c.Location;
                c.Parent.Controls.Add(c2);
                c.Parent.Controls.SetChildIndex(c2, c.Parent.Controls.GetChildIndex(c));
                c2.Controls.Add((ComboBox)sender);
                c.Parent.Controls.Remove(c);
                c = c2.Parent;
                while (!(c is MetaEditor))
                {
                    c = c.Parent;
                }

                ((MetaEditor)c).ReloadMetaForSameTagType(true);
            }
        }