예제 #1
0
        private void rectangleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            GeneralRect g = new GeneralRect()
            {
                name = "RECT_00_NEW", subname = "00_NEW"
            };

            Runtime.TargetLVD.generalShapes.Add(g);
            lvdList.fillList();
        }
예제 #2
0
        private void rectValueChanged(object sender, EventArgs e)
        {
            GeneralRect r = currentGeneralRect;

            if (sender == rectUpperX)
            {
                r.x2 = (float)rectUpperX.Value;
            }
            if (sender == rectUpperY)
            {
                r.y2 = (float)rectUpperY.Value;
            }
            if (sender == rectLowerX)
            {
                r.x1 = (float)rectLowerX.Value;
            }
            if (sender == rectLowerY)
            {
                r.y1 = (float)rectLowerY.Value;
            }
        }
예제 #3
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;
 }
예제 #4
0
 public void open(LVDEntry entry, TreeNode entryTree)
 {
     currentTreeNode              = entryTree;
     currentEntry                 = entry;
     collisionGroup.Visible       = false;
     pointGroup.Visible           = false;
     boundGroup.Visible           = false;
     itemSpawnerGroup.Visible     = false;
     generalPointShapeBox.Visible = false;
     rectangleGroup.Visible       = false;
     pathGroup.Visible            = false;
     meleeCollisionGroup.Visible  = false;
     name.Text    = currentEntry.name;
     subname.Text = currentEntry.subname;
     if (entry is Collision)
     {
         Collision col = (Collision)entry;
         collisionGroup.Visible = true;
         xStart.Value           = (decimal)col.startPos[0];
         yStart.Value           = (decimal)col.startPos[1];
         zStart.Value           = (decimal)col.startPos[2];
         flag1.Checked          = col.useStartPos;
         flag2.Checked          = col.flag2;
         flag3.Checked          = col.flag3;
         flag4.Checked          = col.flag4;
         vertices.Nodes.Clear();
         string boneNameRigging = "";
         foreach (char b in col.unk4)
         {
             if (b != (char)0)
             {
                 boneNameRigging += b;
             }
         }
         if (boneNameRigging.Length == 0)
         {
             boneNameRigging = "None";
         }
         button3.Text = boneNameRigging;
         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 Point)
     {
         pointGroup.Visible = true;
         currentPoint       = (Point)entry;
         xPoint.Value       = (decimal)((Point)entry).x;
         yPoint.Value       = (decimal)((Point)entry).y;
     }
     else if (entry is Bounds)
     {
         boundGroup.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 (Section section in spawner.sections)
         {
             treeView1.Nodes.Add(new TreeNode($"Section {i++}")
             {
                 Tag = section
             });
         }
     }
     else if (entry is GeneralPoint)
     {
         generalPointShapeBox.Visible = true;
         GeneralPoint p = (GeneralPoint)entry;
         currentGeneralPoint = p;
         pointShapeX.Value   = (Decimal)p.x;
         pointShapeX.Value   = (Decimal)p.y;
     }
     else if (entry is GeneralRect)
     {
         rectangleGroup.Visible = true;
         GeneralRect r = (GeneralRect)entry;
         currentGeneralRect = r;
         rectUpperX.Value   = (Decimal)r.x2;
         rectUpperY.Value   = (Decimal)r.y2;
         rectLowerX.Value   = (Decimal)r.x1;
         rectLowerY.Value   = (Decimal)r.y1;
     }
     else if (entry is GeneralPath)
     {
         pathGroup.Visible = true;
         GeneralPath p = (GeneralPath)entry;
         currentGeneralPath = p;
         treeViewPath.Nodes.Clear();
         int j = 0;
         foreach (Vector2D v in p.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 (Vector2D 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
             });
         }
     }
 }
예제 #5
0
파일: LVD.cs 프로젝트: struz/Smash-Forge
        /*type 1  - collisions
         * type 2  - spawns
         * type 3  - respawns
         * type 4  - camera bounds
         * type 5  - death boundaries
         * type 6  - ???
         * type 7  - ITEMPT_transform
         * type 8  - enemyGenerator
         * type 9  - ITEMPT
         * type 10 - fsAreaCam (and other fsArea's ? )
         * type 11 - fsCamLimit
         * type 12 - damageShapes (damage sphere and damage capsule are the only ones I've seen, type 2 and 3 respectively)
         * type 13 - item spawners
         * type 14 - general shapes (general rect, general path, etc.)
         * type 15 - general points
         * type 16 - ???
         * type 17 - FsStartPoint
         * type 18 - ???
         * type 19 - ???*/

        public override void Read(string filename)
        {
            FileData f = new FileData(filename);

            f.seek(0xB);//It's magic
            int collisionCount = f.readInt();

            for (int i = 0; i < collisionCount; i++)
            {
                Collision temp = new Collision();
                temp.read(f);
                collisions.Add(temp);
            }
            f.skip(1); //Seperation char

            int spawnCount = f.readInt();

            for (int i = 0; i < spawnCount; i++)
            {
                Point temp = new Point();
                f.skip(0xD);
                temp.name = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                temp.subname = f.readString(f.pos(), 0x40);
                f.skip(0xA6);
                temp.x = f.readFloat();
                temp.y = f.readFloat();
                spawns.Add(temp);
            }
            f.skip(1);//Seperation char

            int respawnCount = f.readInt();

            for (int i = 0; i < respawnCount; i++)
            {
                Point temp = new Point();
                f.skip(0xD);
                temp.name = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                temp.subname = f.readString(f.pos(), 0x40);
                f.skip(0xA6);
                temp.x = f.readFloat();
                temp.y = f.readFloat();
                respawns.Add(temp);
            }
            f.skip(1);//Seperation char

            int cameraCount = f.readInt();

            for (int i = 0; i < cameraCount; i++)
            {
                Bounds temp = new Bounds();
                f.skip(0xD);
                temp.name = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                temp.subname = f.readString(f.pos(), 0x40);
                f.skip(0xA6);
                temp.left   = f.readFloat();
                temp.right  = f.readFloat();
                temp.top    = f.readFloat();
                temp.bottom = f.readFloat();
                cameraBounds.Add(temp);
            }
            f.skip(1);//Seperation char

            int blastzoneCount = f.readInt();

            for (int i = 0; i < blastzoneCount; i++)
            {
                Bounds temp = new Bounds();
                f.skip(0xD);
                temp.name = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                temp.subname = f.readString(f.pos(), 0x40);
                f.skip(0xA6);
                temp.left   = f.readFloat();
                temp.right  = f.readFloat();
                temp.top    = f.readFloat();
                temp.bottom = f.readFloat();
                blastzones.Add(temp);
            }
            f.skip(1);            //Seperation char

            if (f.readInt() != 0) //1
            {
                return;
            }
            f.skip(1);            //Seperation char

            if (f.readInt() != 0) //2
            {
                return;
            }
            f.skip(1);//Seperation char

            int enemyGeneratorCount = f.readInt();

            if (enemyGeneratorCount != 0)
            {
                return;
            }
            f.skip(1);            //Seperation char

            if (f.readInt() != 0) //4
            {
                return;
            }
            f.skip(1);//Seperation char

            int fsAreaCamCount = f.readInt();

            if (fsAreaCamCount != 0)
            {
                return;
            }
            f.skip(1);//Seperation char

            int fsCamLimitCount = f.readInt();

            if (fsCamLimitCount != 0)
            {
                return;
            }
            f.skip(1);//Seperation char

            int damageShapeCount = f.readInt();

            for (int i = 0; i < damageShapeCount; i++)
            {
                f.skip(0xD);

                string tempName = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                string tempSubname = f.readString(f.pos(), 0x40);
                f.skip(0xA6);
                int shapeType = f.readInt();
                if (shapeType == 2)
                {
                    Sphere temp = new Sphere();
                    temp.name    = tempName;
                    temp.subname = tempSubname;
                    temp.x       = f.readFloat();
                    temp.y       = f.readFloat();
                    temp.z       = f.readFloat();
                    temp.radius  = f.readFloat();
                    f.skip(0x11);
                    damageSpheres.Add(temp);
                }
                else if (shapeType == 3)
                {
                    Capsule temp = new Capsule();
                    temp.name    = tempName;
                    temp.subname = tempSubname;
                    temp.x       = f.readFloat();
                    temp.y       = f.readFloat();
                    temp.z       = f.readFloat();
                    temp.dx      = f.readFloat();
                    temp.dy      = f.readFloat();
                    temp.dz      = f.readFloat();
                    temp.r       = f.readFloat();
                    temp.unk     = f.readFloat();
                    f.skip(1);
                    damageCapsules.Add(temp);
                }
                else
                {
                    throw new NotImplementedException();
                }
            }
            f.skip(1);//Seperation char

            int itemCount = f.readInt();

            for (int i = 0; i < itemCount; i++)
            {
                ItemSpawner temp = new ItemSpawner();
                temp.read(f);
                items.Add(temp);
            }
            f.skip(1);//Seperation char

            int generalShapeCount = f.readInt();

            for (int i = 0; i < generalShapeCount; i++)
            {
                f.skip(0xD);

                string tempName = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                string tempSubname = f.readString(f.pos(), 0x40);
                f.skip(0xAB);
                int             shapeType = f.readInt();
                LVDGeneralShape p;
                if (shapeType == 1)
                {
                    p = new GeneralPoint();
                }
                else if (shapeType == 3)
                {
                    p = new GeneralRect();
                }
                else if (shapeType == 4)
                {
                    p = new GeneralPath();
                }
                else
                {
                    throw new Exception($"Unknown shape type {shapeType} at offset {f.pos() - 4}");
                }
                p.name    = tempName;
                p.subname = tempSubname;
                p.Read(f);
                generalShapes.Add(p);
            }
            f.skip(1);

            int generalPointCount = f.readInt();

            for (int i = 0; i < generalPointCount; i++)
            {
                Point temp = new Point();
                f.skip(0xD);
                temp.name = f.readString(f.pos(), 0x38);
                f.skip(0x38);
                f.skip(1);//Seperation char
                temp.subname = f.readString(f.pos(), 0x40);
                f.skip(0xAF);
                temp.x = f.readFloat();
                temp.y = f.readFloat();
                f.skip(0x14);
                generalPoints.Add(temp);
            }

            if (f.readInt() != 0) //8
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);

            if (f.readInt() != 0) //8
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);

            if (f.readInt() != 0) //8
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);

            if (f.readInt() != 0) //8
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);

            if (f.readInt() != 0) //8
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);

            if (f.readInt() != 0) //8
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);

            //LVD doesn't end here and neither does my confusion, will update this part later
        }