Exemplo n.º 1
0
 public void Clear()
 {
     currentEntry             = null;
     currentVert              = new Vector2(0);
     currentNormal            = new Vector2(0);
     currentMat               = null;
     currentTreeNode          = null;
     currentPoint             = null;
     currentBounds            = null;
     currentItemSection       = null;
     currentGeneralPoint      = null;
     currentGeneralRect       = null;
     currentGeneralPath       = null;
     name.Text                = "";
     subname.Text             = "";
     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;
 }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
 public void ResetUi()
 {
     currentEntry    = null;
     currentTreeNode = null;
     currentMat      = null;
     currentPoint    = null;
     currentBounds   = null;
     nameTB.Text     = "";
     subnameTB.Text  = "";
     HideAllGroupBoxes();
 }
Exemplo n.º 4
0
 private void lines_AfterSelect(object sender, TreeViewEventArgs e)
 {
     currentNormal          = (Vector2)((object[])e.Node.Tag)[0];
     LVD.LVDSelection       = currentNormal;
     currentMat             = (CollisionMat)((object[])e.Node.Tag)[1];
     leftLedge.Checked      = currentMat.getFlag(6);
     rightLedge.Checked     = currentMat.getFlag(7);
     noWallJump.Checked     = currentMat.getFlag(4);
     comboBox1.Text         = Enum.GetName(typeof(materialTypes), currentMat.physics);
     passthroughAngle.Value = (decimal)(Math.Atan2(currentNormal.Y, currentNormal.X) * 180.0 / Math.PI);
 }
Exemplo n.º 5
0
 private void lines_AfterSelect(object sender, TreeViewEventArgs e)
 {
     currentNormal        = (Vector2D)((object[])e.Node.Tag)[0];
     Runtime.LVDSelection = currentNormal;
     MainForm.Instance.viewports[0].timeSinceSelected.Restart();
     currentMat             = (CollisionMat)((object[])e.Node.Tag)[1];
     leftLedge.Checked      = currentMat.getFlag(6);
     rightLedge.Checked     = currentMat.getFlag(7);
     noWallJump.Checked     = currentMat.getFlag(4);
     comboBox1.Text         = Enum.GetName(typeof(materialTypes), currentMat.getPhysics());
     passthroughAngle.Value = (decimal)(Math.Atan2(currentNormal.y, currentNormal.x) * 180.0 / Math.PI);
 }
Exemplo n.º 6
0
        private void lines_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // Find the currently selected normal.
            int       selectedIndex = linesTreeView.SelectedNode.Index;
            Collision collision     = (Collision)currentEntry;

            if (selectedIndex >= collision.normals.Count)
            {
                return;
            }

            LVD.LVDSelection = collision.normals[selectedIndex];

            currentMat                      = (CollisionMat)((object[])e.Node.Tag)[1];
            leftLedgeCB.Checked             = currentMat.getFlag(6);
            rightLedgeCB.Checked            = currentMat.getFlag(7);
            noWallJumpCB.Checked            = currentMat.getFlag(4);
            physicsMatComboBox.SelectedItem = (CollisionMatType)currentMat.physics;

            passthroughAngleUpDown.Value = (decimal)(Math.Atan2(collision.normals[selectedIndex].Y, collision.normals[selectedIndex].X) * 180.0 / Math.PI);
        }
Exemplo n.º 7
0
 public void Clear()
 {
     currentEntry                 = null;
     currentVert                  = null;
     currentNormal                = null;
     currentMat                   = null;
     currentTreeNode              = null;
     currentPoint                 = null;
     currentBounds                = null;
     currentItemSection           = null;
     currentGeneralPoint          = null;
     currentGeneralRect           = null;
     currentGeneralPath           = null;
     name.Text                    = "";
     subname.Text                 = "";
     collisionGroup.Visible       = false;
     pointGroup.Visible           = false;
     boundGroup.Visible           = false;
     itemSpawnerGroup.Visible     = false;
     generalPointShapeBox.Visible = false;
     rectangleGroup.Visible       = false;
     pathGroup.Visible            = false;
 }
Exemplo n.º 8
0
        private void addVert(object sender, EventArgs e)
        {
            if (vertices.SelectedNode == null || (vertices.SelectedNode != null && vertices.SelectedNode.Index == vertices.Nodes.Count - 1))
            {
                Vector2D newVert;
                if (vertices.SelectedNode != null)
                {
                    newVert = new Vector2D()
                    {
                        x = currentVert.x, y = currentVert.y
                    }
                }
                ;
                else
                {
                    newVert = new Vector2D();
                }
                ((Collision)currentEntry).verts.Add(newVert);
                TreeNode newNode = new TreeNode("New Vertex")
                {
                    Tag = newVert
                };
                vertices.Nodes.Add(newNode);
                vertices.SelectedNode = newNode;
                if (((Collision)currentEntry).verts.Count > ((Collision)currentEntry).normals.Count + 1)
                {
                    CollisionMat newMat = new CollisionMat();
                    object[]     t      = { new Vector2D()
                                            {
                                                x = 1, y = 0
                                            }, new CollisionMat() };
                    ((Collision)currentEntry).materials.Add((CollisionMat)t[1]);
                    ((Collision)currentEntry).normals.Add((Vector2D)t[0]);
                    lines.Nodes.Add(new TreeNode("New line")
                    {
                        Tag = t
                    });
                }
            }
            else
            {
                Vector2D newVert = new Vector2D()
                {
                    x = currentVert.x, y = currentVert.y
                };
                ((Collision)currentEntry).verts.Insert(vertices.SelectedNode.Index, newVert);
                vertices.Nodes.Insert(vertices.SelectedNode.Index, new TreeNode("New Vertex")
                {
                    Tag = newVert
                });

                if (((Collision)currentEntry).verts.Count > ((Collision)currentEntry).normals.Count + 1)
                {
                    object[] t = { new Vector2D()
                                   {
                                       x = 1, y = 0
                                   }, new CollisionMat() };
                    ((Collision)currentEntry).materials.Insert(vertices.SelectedNode.Index, (CollisionMat)t[1]);
                    ((Collision)currentEntry).normals.Insert(vertices.SelectedNode.Index, (Vector2D)t[0]);
                    lines.Nodes.Insert(vertices.SelectedNode.Index, new TreeNode("New line")
                    {
                        Tag = t
                    });
                }
            }

            renumber();
        }
Exemplo n.º 9
0
        public void read(FileData f)
        {
            f.skip(0xD);
            name = f.readString(f.pos(), 0x38);
            f.skip(0x38);
            f.skip(1);//Seperation char
            subname = f.readString(f.pos(), 0x40);
            f.skip(0x40);
            f.skip(1);//Seperation char
            startPos[0] = f.readFloat();
            startPos[1] = f.readFloat();
            startPos[2] = f.readFloat();
            useStartPos = (f.readByte() != 0);
            f.skip(1);//Seperation char
            unk2 = f.readInt();
            f.skip(1);
            unk3 = f.read(0xC);
            f.skip(4); //FF FF FF FF
            f.skip(1); //Seperation char
            unk4 = new char[0x40];
            for (int i = 0; i < 0x40; i++)
            {
                unk4[i] = (char)f.readByte();
            }

            flag1 = Convert.ToBoolean(f.readByte());
            flag2 = Convert.ToBoolean(f.readByte());
            flag3 = Convert.ToBoolean(f.readByte());
            flag4 = Convert.ToBoolean(f.readByte());
            f.skip(1);//Seperation char
            //f.skip(0xAA);
            //Console.WriteLine(f.pos());
            int vertCount = f.readInt();

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

            int normalCount = f.readInt();

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

            int cliffCount = f.readInt(); //CLIFFS tend to be useless

            f.skip(0xFC * cliffCount);    //Standard CLIFFS are 0xFC in length, just skip em all
            f.skip(1);                    //Seperation char

            int materialCount = f.readInt();

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

                materials.Add(temp);
            }
        }