示例#1
0
        private void OpenLvdEntry(LVDEntry entry, TreeNode entryTree)
        {
            lvdEntryGroup.Visible = true;
            currentEntry          = entry;
            currentTreeNode       = entryTree;

            nameTB.Text           = currentEntry.name;
            subnameTB.Text        = currentEntry.subname;
            xStartPosUpDown.Value = (decimal)currentEntry.startPos[0];
            yStartPosUpDown.Value = (decimal)currentEntry.startPos[1];
            zStartPosUpDown.Value = (decimal)currentEntry.startPos[2];
            useStartPosCB.Checked = currentEntry.useStartPos;
            string boneNameRigging = currentEntry.boneName;

            if (boneNameRigging.Length == 0)
            {
                boneNameRigging = "None";
            }
            boneRigSelectButton.Text = boneNameRigging;

            if (entry is Collision)
            {
                Collision col = (Collision)entry;
                OpenCollision(col);
            }
            else if (entry is CollisionCliff)
            {
                CollisionCliff cliff = (CollisionCliff)entry;
                OpenCliff(cliff);
            }
            else if (entry is Spawn)
            {
                OpenSpawn(entry);
            }
            else if (entry is Bounds)
            {
                OpenBounds(entry);
            }
            else if (entry is ItemSpawner)
            {
                OpenItemSpawner(entry);
            }
            else if (entry is GeneralPoint)
            {
                GeneralPoint generalPoint = (GeneralPoint)entry;
                OpenGeneralPoint(generalPoint);
            }
            else if (entry is GeneralShape)
            {
                GeneralShape s = (GeneralShape)entry;
                OpenGeneralShape(s);
            }
            else if (entry is DAT.COLL_DATA)
            {
                OpenDatCollData(entry);
            }
        }
示例#2
0
        private void OpenCliff(CollisionCliff cliff)
        {
            cliffGroup.Visible = true;

            cliffPosXUpDown.Value        = (decimal)cliff.pos.X;
            cliffPosYUpDown.Value        = (decimal)cliff.pos.Y;
            cliffAngleUpDown.Value       = (decimal)cliff.angle;
            cliffLineIndexUpDown.Maximum = ((Collision)currentTreeNode.Parent.Tag).materials.Count;
            cliffLineIndexUpDown.Value   = cliff.lineIndex + 1;
        }
示例#3
0
        public void read(FileData f)
        {
            base.read(f);

            flag1 = Convert.ToBoolean(f.readByte());
            flag2 = Convert.ToBoolean(f.readByte());
            flag3 = Convert.ToBoolean(f.readByte());
            flag4 = Convert.ToBoolean(f.readByte());

            f.skip(1);
            int vertCount = f.readInt();

            for (int i = 0; i < vertCount; i++)
            {
                f.skip(1);
                Vector2D temp = new Vector2D();
                temp.x = f.readFloat();
                temp.y = f.readFloat();
                verts.Add(temp);
            }

            f.skip(1);
            int normalCount = f.readInt();

            for (int i = 0; i < normalCount; i++)
            {
                f.skip(1);
                Vector2D temp = new Vector2D();
                temp.x = f.readFloat();
                temp.y = f.readFloat();
                normals.Add(temp);
            }

            f.skip(1);
            int cliffCount = f.readInt();

            for (int i = 0; i < cliffCount; i++)
            {
                CollisionCliff temp = new CollisionCliff();
                temp.read(f);
                cliffs.Add(temp);
            }

            f.skip(1);
            int materialCount = f.readInt();

            for (int i = 0; i < materialCount; i++)
            {
                f.skip(1);
                CollisionMat temp = new CollisionMat();
                temp.material = f.read(0xC);//Temporary, will work on fleshing out material more later

                materials.Add(temp);
            }
        }
示例#4
0
        private void cliff_ValueChanged(object sender, EventArgs e)
        {
            CollisionCliff cliff = (CollisionCliff)currentEntry;

            if (sender == cliffPosXUpDown)
            {
                cliff.pos.X = (float)cliffPosXUpDown.Value;
            }
            if (sender == cliffPosYUpDown)
            {
                cliff.pos.Y = (float)cliffPosYUpDown.Value;
            }
            if (sender == cliffAngleUpDown)
            {
                cliff.angle = (float)cliffAngleUpDown.Value;
            }
            if (sender == cliffLineIndexUpDown)
            {
                cliff.lineIndex = (int)cliffLineIndexUpDown.Value - 1;
            }
        }
示例#5
0
        public void open(Object obj, TreeNode entryTree)
        {
            lvdEntryGroup.Visible       = false;
            collisionGroup.Visible      = false;
            cliffGroup.Visible          = false;
            point2dGroup.Visible        = false;
            boundsGroup.Visible         = false;
            itemSpawnerGroup.Visible    = false;
            point3dGroup.Visible        = false;
            rectangleGroup.Visible      = false;
            pathGroup.Visible           = false;
            meleeCollisionGroup.Visible = false;
            if (obj is LVDEntry)
            {
                LVDEntry entry = (LVDEntry)obj;
                lvdEntryGroup.Visible = true;
                currentTreeNode       = entryTree;
                currentEntry          = entry;

                name.Text           = currentEntry.name;
                subname.Text        = currentEntry.subname;
                xStart.Value        = (decimal)currentEntry.startPos[0];
                yStart.Value        = (decimal)currentEntry.startPos[1];
                zStart.Value        = (decimal)currentEntry.startPos[2];
                useStartPos.Checked = currentEntry.useStartPos;
                string boneNameRigging = currentEntry.boneName;
                if (boneNameRigging.Length == 0)
                {
                    boneNameRigging = "None";
                }
                button3.Text = boneNameRigging;

                if (entry is Collision)
                {
                    Collision col = (Collision)entry;
                    collisionGroup.Visible = true;
                    flag1.Checked          = col.flag1;
                    flag2.Checked          = col.flag2;
                    flag3.Checked          = col.flag3;
                    flag4.Checked          = col.flag4;
                    vertices.Nodes.Clear();
                    for (int i = 0; i < col.verts.Count; i++)
                    {
                        vertices.Nodes.Add(new TreeNode($"Vertex {i + 1} ({col.verts[i].X},{col.verts[i].Y})")
                        {
                            Tag = col.verts[i]
                        });
                    }
                    lines.Nodes.Clear();
                    for (int i = 0; i < col.normals.Count; i++)
                    {
                        object[] temp = { col.normals[i], col.materials[i] };
                        lines.Nodes.Add(new TreeNode($"Line {i + 1}")
                        {
                            Tag = temp
                        });
                    }
                }
                else if (entry is CollisionCliff)
                {
                    CollisionCliff cliff = (CollisionCliff)entry;
                    cliffGroup.Visible = true;

                    cliffPosX.Value        = (decimal)cliff.pos.X;
                    cliffPosY.Value        = (decimal)cliff.pos.Y;
                    cliffAngle.Value       = (decimal)cliff.angle;
                    cliffLineIndex.Maximum = ((Collision)currentTreeNode.Parent.Tag).materials.Count;
                    cliffLineIndex.Value   = cliff.lineIndex + 1;
                }
                else if (entry is Spawn)
                {
                    point2dGroup.Visible = true;
                    currentPoint         = (Spawn)entry;
                    xPoint.Value         = (decimal)((Spawn)entry).x;
                    yPoint.Value         = (decimal)((Spawn)entry).y;
                }
                else if (entry is Bounds)
                {
                    boundsGroup.Visible = true;
                    currentBounds       = (Bounds)entry;
                    topVal.Value        = (decimal)currentBounds.top;
                    rightVal.Value      = (decimal)currentBounds.right;
                    leftVal.Value       = (decimal)currentBounds.left;
                    bottomVal.Value     = (decimal)currentBounds.bottom;
                }
                else if (entry is ItemSpawner)
                {
                    itemSpawnerGroup.Visible = true;
                    ItemSpawner spawner = (ItemSpawner)entry;
                    treeView1.Nodes.Clear();
                    int i = 1;
                    foreach (LVDShape section in spawner.sections)
                    {
                        treeView1.Nodes.Add(new TreeNode($"Section {i++}")
                        {
                            Tag = section
                        });
                    }
                }
                else if (entry is GeneralPoint)
                {
                    point3dGroup.Visible = true;
                    GeneralPoint p = (GeneralPoint)entry;
                    currentGeneralPoint = p;
                    pointShapeX.Value   = (Decimal)p.x;
                    pointShapeY.Value   = (Decimal)p.y;
                    pointShapeZ.Value   = (Decimal)p.z;
                }
                else if (entry is GeneralShape)
                {
                    GeneralShape s = (GeneralShape)entry;
                    if (s.type == 1)
                    {
                        point2dGroup.Visible = true;
                        xPoint.Value         = (decimal)s.x1;
                        yPoint.Value         = (decimal)s.y1;
                    }
                    else if (s.type == 3)
                    {
                        rectangleGroup.Visible = true;
                        currentGeneralRect     = s;
                        rectUpperX.Value       = (Decimal)s.x2;
                        rectUpperY.Value       = (Decimal)s.y2;
                        rectLowerX.Value       = (Decimal)s.x1;
                        rectLowerY.Value       = (Decimal)s.y1;
                    }
                    else if (s.type == 4)
                    {
                        pathGroup.Visible  = true;
                        currentGeneralPath = s;
                        treeViewPath.Nodes.Clear();
                        int j = 0;
                        foreach (Vector2 v in s.points)
                        {
                            treeViewPath.Nodes.Add(new TreeNode($"Point {++j} ({v.X},{v.Y})")
                            {
                                Tag = v
                            });
                        }
                    }
                }
                else if (entry is DAT.COLL_DATA)
                {
                    meleeCollisionGroup.Visible = true;
                    meleeVerts.Nodes.Clear();
                    meleeLinks.Nodes.Clear();
                    meleePolygons.Nodes.Clear();
                    int i = 0;
                    foreach (Vector2 vert in ((DAT.COLL_DATA)entry).vertices)
                    {
                        meleeVerts.Nodes.Add(new TreeNode($"Vertex {i++}")
                        {
                            Tag = vert
                        });
                    }
                    i = 0;
                    foreach (DAT.COLL_DATA.Link link in ((DAT.COLL_DATA)entry).links)
                    {
                        meleeLinks.Nodes.Add(new TreeNode($"Link {i++}")
                        {
                            Tag = link
                        });
                    }
                    i = 0;
                    foreach (DAT.COLL_DATA.AreaTableEntry ate in ((DAT.COLL_DATA)entry).areaTable)
                    {
                        meleePolygons.Nodes.Add(new TreeNode($"Polygon {i++}")
                        {
                            Tag = ate
                        });
                    }
                }
            }
            else if (obj is DAT.JOBJ)
            {
                DAT.JOBJ jobj = (DAT.JOBJ)obj;
                currentJobj = jobj;
                jobjX.Value = (Decimal)jobj.pos.X;
                jobjY.Value = (Decimal)jobj.pos.Y;
                jobjZ.Value = (Decimal)jobj.pos.Z;
            }
        }