Exemple #1
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
        }
Exemple #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.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
        }