Exemplo n.º 1
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (treeView1.SelectedNode.Index > -1)
            {
                Runtime.ParamManager.UnselectHurtboxes();
                hurtboxData = new DataTable();
                dataGridView1.DataSource = hurtboxData;

                Hurtbox hurtbox = Runtime.ParamManager.Hurtboxes[treeView1.SelectedNode.Index];

                hurtboxData.Columns.Add(new DataColumn("Name")
                {
                    ReadOnly = true
                });
                hurtboxData.Columns.Add("Value");
                hurtboxData.Rows.Add("Bone", hurtbox.Bone);
                hurtboxData.Rows.Add("Size", hurtbox.Size);
                hurtboxData.Rows.Add("X Pos", hurtbox.X);
                hurtboxData.Rows.Add("Y Pos", hurtbox.Y);
                hurtboxData.Rows.Add("Z Pos", hurtbox.Z);
                hurtboxData.Rows.Add("X Stretch", hurtbox.X2);
                hurtboxData.Rows.Add("Y Stretch", hurtbox.Y2);
                hurtboxData.Rows.Add("Z Stretch", hurtbox.Z2);
                hurtboxData.Rows.Add("Zone", hurtbox.Zone == Hurtbox.LW_ZONE ? "Low" : hurtbox.Zone == Hurtbox.HI_ZONE ? "High" : "Mid");

                Runtime.SelectedHurtboxID = hurtbox.ID;
            }
        }
Exemplo n.º 2
0
        private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (treeView1.SelectedNode.Index > -1)
            {
                Hurtbox hurtbox = Runtime.ParamManager.Hurtboxes[treeView1.SelectedNode.Index];

                int    bone = hurtbox.Bone;
                float  X = hurtbox.X, Y = hurtbox.Y, Z = hurtbox.Z, X2 = hurtbox.X2, Y2 = hurtbox.Y2, Z2 = hurtbox.Z2, Size = hurtbox.Size;
                string Zone = hurtbox.Zone == Hurtbox.LW_ZONE ? "Low" : hurtbox.Zone == Hurtbox.HI_ZONE ? "High" : "Mid";

                int.TryParse(hurtboxData.Rows[0][1].ToString(), out bone);

                float.TryParse(hurtboxData.Rows[1][1].ToString(), out Size);
                float.TryParse(hurtboxData.Rows[2][1].ToString(), out X);
                float.TryParse(hurtboxData.Rows[3][1].ToString(), out Y);
                float.TryParse(hurtboxData.Rows[4][1].ToString(), out Z);
                float.TryParse(hurtboxData.Rows[5][1].ToString(), out X2);
                float.TryParse(hurtboxData.Rows[6][1].ToString(), out Y2);
                float.TryParse(hurtboxData.Rows[7][1].ToString(), out Z2);

                Zone = hurtboxData.Rows[8][1].ToString();

                hurtbox.Bone = bone;
                hurtbox.Size = Size;
                hurtbox.X    = X;
                hurtbox.Y    = Y;
                hurtbox.Z    = Z;
                hurtbox.X2   = X2;
                hurtbox.Y2   = Y2;
                hurtbox.Z2   = Z2;

                if (Zone == "Low")
                {
                    hurtbox.Zone = Hurtbox.LW_ZONE;
                }
                else if (Zone == "Mid")
                {
                    hurtbox.Zone = Hurtbox.N_ZONE;
                }
                else if (Zone == "High")
                {
                    hurtbox.Zone = Hurtbox.HI_ZONE;
                }

                if (hurtbox.X == hurtbox.X2 && hurtbox.Y == hurtbox.Y2 && hurtbox.Z == hurtbox.Z2)
                {
                    hurtbox.isSphere = true;
                }

                Runtime.ParamManager.SaveHurtboxes();
            }
        }
Exemplo n.º 3
0
        public CharacterParamManager(string file, string character = null)
        {
            Reset();

            try
            {
                param = new ParamFile(file);

                if (character != null)
                {
                    this.character = character;
                }
                else
                {
                    this.character = Path.GetFileNameWithoutExtension(file.Replace("fighter_param_vl_", ""));
                }

                //Move data (FAF, Intangibility)

                for (int id = 0; id < ((ParamGroup)param.Groups[0]).Chunks.Length; id++)
                {
                    MoveData m = new MoveData();
                    m.Index = id;
                    m.FAF   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][2].Value);
                    m.IntangibilityStart = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][3].Value);
                    m.IntangibilityEnd   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][4].Value);

                    MovesData.Add(id, m);
                }

                //ECB

                for (int id = 0; id < ((ParamGroup)param.Groups[3]).Chunks.Length; id++)
                {
                    ECB ecb = new ECB();
                    ecb.ID   = id;
                    ecb.Bone = Convert.ToInt32(((ParamGroup)param.Groups[3])[id][0].Value);
                    ecb.X    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][1].Value);
                    ecb.Y    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][2].Value);
                    ecb.Z    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][3].Value);

                    ECBs.Add(id, ecb);
                }

                //Hurtboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[4]).Chunks.Length; id++)
                {
                    Hurtbox hurtbox = new Hurtbox();
                    hurtbox.ID = id;
                    hurtbox.X  = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][0].Value);
                    hurtbox.Y  = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][1].Value);
                    hurtbox.Z  = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][2].Value);

                    hurtbox.X2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][3].Value);
                    hurtbox.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][4].Value);
                    hurtbox.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][5].Value);

                    hurtbox.Size = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][6].Value);
                    hurtbox.Bone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][7].Value);
                    hurtbox.Part = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][8].Value);
                    hurtbox.Zone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][9].Value);

                    if (hurtbox.X == hurtbox.X2 && hurtbox.Y == hurtbox.Y2 && hurtbox.Z == hurtbox.Z2)
                    {
                        // It can't be anything but a sphere. I think some part of the param might
                        // control this so this might be a crude detection method. This fixes Bowser Jr at least.
                        hurtbox.isSphere = true;
                    }

                    Hurtboxes.Add(id, hurtbox);
                }

                //Ledge grabboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[6]).Chunks.Length; id++)
                {
                    LedgeGrabbox l = new LedgeGrabbox();
                    l.ID = id;
                    l.Z1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][0].Value);
                    l.Y1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][1].Value);
                    l.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][2].Value);
                    l.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][3].Value);

                    LedgeGrabboxes.Add(id, l);
                }

                //Special Bubbles, these are used in certain moves as trigger/reflect/absorb bubbles and shields such as counters or reflectors

                //Read the data from the csv file that contains the param group, entry and values as well as the character and animation
                foreach (csvSpecialBubble sb in SpecialBubbleData)
                {
                    if (sb.Character == this.character)
                    {
                        try
                        {
                            SpecialBubbles.Add(sb.ID, new SpecialBubble()
                            {
                                Animations = sb.Animation.ToLower().Split('|').ToList(),
                                Type       = (SpecialBubble.BubbleType)sb.Type,
                                X          = sb.X != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.X].Value) : 0,
                                Y          = sb.Y != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Y].Value) : 0,
                                Z          = sb.Z != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Z].Value) : 0,
                                X2         = sb.X2 != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.X2].Value) : 0,
                                Y2         = sb.Y2 != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Y2].Value) : 0,
                                Z2         = sb.Z2 != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Z2].Value) : 0,
                                Size       = sb.Size != -1 ? Convert.ToSingle(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Size].Value) : 0,
                                Bone       = sb.SetBone ? sb.Bone :(sb.Bone != -1 ? Convert.ToInt32(((ParamGroup)param.Groups[sb.ParamGroup - 1])[sb.ParamEntry][sb.Bone].Value) : 0),
                                ID         = sb.ID,
                                StartFrame = sb.StartFrame,
                                EndFrame   = sb.EndFrame
                            });
                        }catch
                        {
                            //Probably wrong params, ignore it... also don't reset hurtboxes and other stuff if something goes wrong here
                        }
                    }
                }
            }
            catch
            {
                //Some error occurred (Invalid file probably)
                //Reset lists
                Reset();
            }
        }
Exemplo n.º 4
0
        public CharacterParamManager(string file)
        {
            Reset();
            try
            {
                ParamFile param = new ParamFile(file);

                //Move data (FAF, Intangibility)

                for (int id = 0; id < ((ParamGroup)param.Groups[0]).Chunks.Length; id++)
                {
                    MoveData m = new MoveData();
                    m.Index = id;
                    m.FAF   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][2].Value);
                    m.IntangibilityStart = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][3].Value);
                    m.IntangibilityEnd   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][4].Value);

                    MovesData.Add(id, m);
                }

                //Hurtboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[4]).Chunks.Length; id++)
                {
                    Hurtbox hurtbox = new Hurtbox();
                    hurtbox.X = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][0].Value);
                    hurtbox.Y = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][1].Value);
                    hurtbox.Z = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][2].Value);

                    hurtbox.X2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][3].Value);
                    hurtbox.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][4].Value);
                    hurtbox.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][5].Value);

                    hurtbox.Size = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][6].Value);
                    hurtbox.Bone = (Convert.ToInt32(((ParamGroup)param.Groups[4])[id][7].Value) - 1).Clamp(0, int.MaxValue);
                    hurtbox.Part = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][8].Value);
                    hurtbox.Zone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][9].Value);

                    Hurtboxes.Add(id, hurtbox);
                }

                //Ledge grabboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[6]).Chunks.Length; id++)
                {
                    LedgeGrabbox l = new LedgeGrabbox();
                    l.ID = id;
                    l.X1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][0].Value);
                    l.Y1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][1].Value);
                    l.X2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][2].Value);
                    l.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][3].Value);

                    LedgeGrabboxes.Add(id, l);
                }
            }
            catch
            {
                //Some error occurred (Invalid file probably)
                //Reset lists
                Reset();
            }
        }
Exemplo n.º 5
0
        public CharacterParamManager(string file)
        {
            Reset();
            try
            {
                ParamFile param = new ParamFile(file);

                //Move data (FAF, Intangibility)

                for (int id = 0; id < ((ParamGroup)param.Groups[0]).Chunks.Length; id++)
                {
                    MoveData m = new MoveData();
                    m.Index = id;
                    m.FAF   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][2].Value);
                    m.IntangibilityStart = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][3].Value);
                    m.IntangibilityEnd   = Convert.ToInt32(((ParamGroup)param.Groups[0])[id][4].Value);

                    MovesData.Add(id, m);
                }

                //ECB

                for (int id = 0; id < ((ParamGroup)param.Groups[3]).Chunks.Length; id++)
                {
                    ECB ecb = new ECB();
                    ecb.ID   = id;
                    ecb.Bone = VBN.applyBoneThunk(Convert.ToInt32(((ParamGroup)param.Groups[3])[id][0].Value));
                    ecb.X    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][1].Value);
                    ecb.Y    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][2].Value);
                    ecb.Z    = Convert.ToSingle(((ParamGroup)param.Groups[3])[id][3].Value);

                    ECBs.Add(id, ecb);
                }

                //Hurtboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[4]).Chunks.Length; id++)
                {
                    Hurtbox hurtbox = new Hurtbox();
                    hurtbox.X = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][0].Value);
                    hurtbox.Y = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][1].Value);
                    hurtbox.Z = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][2].Value);

                    hurtbox.X2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][3].Value);
                    hurtbox.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][4].Value);
                    hurtbox.Z2 = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][5].Value);

                    hurtbox.Size = Convert.ToSingle(((ParamGroup)param.Groups[4])[id][6].Value);
                    hurtbox.Bone = VBN.applyBoneThunk(Convert.ToInt32(((ParamGroup)param.Groups[4])[id][7].Value));
                    hurtbox.Part = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][8].Value);
                    hurtbox.Zone = Convert.ToInt32(((ParamGroup)param.Groups[4])[id][9].Value);

                    if (hurtbox.X == hurtbox.X2 && hurtbox.Y == hurtbox.Y2 && hurtbox.Z == hurtbox.Z2)
                    {
                        // It can't be anything but a sphere. I think some part of the param might
                        // control this so this might be a crude detection method. This fixes Bowser Jr at least.
                        hurtbox.isSphere = true;
                    }

                    Hurtboxes.Add(id, hurtbox);
                }

                //Ledge grabboxes

                for (int id = 0; id < ((ParamGroup)param.Groups[6]).Chunks.Length; id++)
                {
                    LedgeGrabbox l = new LedgeGrabbox();
                    l.ID = id;
                    l.X1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][0].Value);
                    l.Y1 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][1].Value);
                    l.X2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][2].Value);
                    l.Y2 = Convert.ToSingle(((ParamGroup)param.Groups[6])[id][3].Value);

                    LedgeGrabboxes.Add(id, l);
                }
            }
            catch
            {
                //Some error occurred (Invalid file probably)
                //Reset lists
                Reset();
            }
        }