Beispiel #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.LwZone ? "Low" : hurtbox.Zone == Hurtbox.HiZone ? "High" : "Mid");

                Runtime.SelectedHurtboxId = hurtbox.Id;
            }
        }
Beispiel #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.LwZone ? "Low" : hurtbox.Zone == Hurtbox.HiZone ? "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.LwZone;
                }
                else if (zone == "Mid")
                {
                    hurtbox.Zone = Hurtbox.NZone;
                }
                else if (zone == "High")
                {
                    hurtbox.Zone = Hurtbox.HiZone;
                }

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

                Runtime.ParamManager.SaveHurtboxes();
            }
        }
Beispiel #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();
            }
        }