Пример #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
        }