Exemplo n.º 1
0
        public void open(Object obj, TreeNode entryTree)
        {
            lvdEntryGroup.Visible       = false;
            collisionGroup.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 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 (Section 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 (Vector2D 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 (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
                        });
                    }
                }
            }
            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;
            }
        }
Exemplo n.º 2
0
        /*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.skip(0xA);//It's magic

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

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

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

            for (int i = 0; i < spawnCount; i++)
            {
                Spawn temp = new Spawn();
                temp.read(f);
                spawns.Add(temp);
            }

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

            for (int i = 0; i < respawnCount; i++)
            {
                Spawn temp = new Spawn();
                temp.read(f);
                respawns.Add(temp);
            }

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

            for (int i = 0; i < cameraCount; i++)
            {
                Bounds temp = new Bounds();
                temp.read(f);
                cameraBounds.Add(temp);
            }

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

            for (int i = 0; i < blastzoneCount; i++)
            {
                Bounds temp = new Bounds();
                temp.read(f);
                blastzones.Add(temp);
            }

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

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

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

            if (enemyGeneratorCount != 0) //Can these be read in the same way as item spawners?
            {
                return;
            }

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

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

            if (fsAreaCamCount != 0)
            {
                return;
            }

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

            if (fsCamLimitCount != 0)
            {
                return;
            }

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

            for (int i = 0; i < damageShapeCount; i++)
            {
                DamageShape temp = new DamageShape();
                temp.read(f);
                damageShapes.Add(temp);
            }

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

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

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

            for (int i = 0; i < generalShapeCount; i++)
            {
                GeneralShape temp = new GeneralShape();
                temp.read(f);
                generalShapes.Add(temp);
            }

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

            for (int i = 0; i < generalPointCount; i++)
            {
                GeneralPoint temp = new GeneralPoint();
                temp.read(f);
                generalPoints.Add(temp);
            }

            f.skip(1);
            if (f.readInt() != 0) //16
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);
            if (f.readInt() != 0) //17
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);
            if (f.readInt() != 0) //18
            {
                return;           //no clue how to be consistent in reading these so...
            }
            f.skip(1);
            if (f.readInt() != 0) //19
            {
                return;           //no clue how to be consistent in reading these so...
            }
            //LVD doesn't end here and neither does my confusion, will update this part later
        }
Exemplo n.º 3
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
             });
         }
     }
 }
Exemplo n.º 4
0
        /*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
        }