Example #1
0
        public static Mesh Deserialize(BinaryReader reader)
        {
            Action<bool> assert = (b) => { if (!b) throw new InvalidDataException(); };
            assert(reader.ReadString() == "MESH");
            assert(reader.ReadByte() == 1);
            assert(reader.ReadByte() == 0);
            int texture = reader.ReadInt32();
            int vertexCount = reader.ReadInt32();
            int indexCount = reader.ReadInt32();

            var vertices = new BlockVertex[vertexCount];
            for (int i = 0; i < vertexCount; i++)
            {
                var vertex = new BlockVertex();

                vertex.position = reader.ReadVector3();
                vertex.normal = reader.ReadVector3();
                vertex.color = reader.ReadVector3();
                vertex.uv = reader.ReadVector3();

                vertices[i] = vertex;
            }

            var indices = new int[indexCount];
            for (int i = 0; i < indexCount; i++)
            {
                indices[i] = reader.ReadInt32();
            }

            return new Mesh(indices, vertices, texture);
        }
Example #2
0
 public reaParser(Stream stream)
 {
     try
     {
         using (BinaryReader reader = new BinaryReader(stream))
         {
             byte[] type = reader.ReadBytes(4);
             Trace.Assert(remParser.TypeCheck(reaANICsection.ClassType, type));
             int anicLength = reader.ReadInt32();
             int unk1 = reader.ReadInt32();
             float unk2 = reader.ReadSingle();
             int count = reader.ReadInt32();
             ANIC = new reaANICsection(count);
             ANIC.unk1 = unk1;
             ANIC.unk2 = unk2;
             for (int i = 0; i < count; i++)
             {
                 reaAnimationTrack track = new reaAnimationTrack();
                 type = reader.ReadBytes(4);
                 Trace.Assert(remParser.TypeCheck(reaAnimationTrack.ClassType, type));
                 int anioLength = reader.ReadInt32();
                 byte[] name = reader.ReadBytes(256);
                 track.boneFrame = remParser.GetIdentifier(name, 0, 256);
                 int numScalings = reader.ReadInt32();
                 track.scalings = new reaIndexVector[numScalings];
                 int numRotations = reader.ReadInt32();
                 track.rotations = new reaIndexQuaternion[numRotations];
                 int numTranslations = reader.ReadInt32();
                 track.translations = new reaIndexVector[numTranslations];
                 for (int j = 0; j < numScalings; j++)
                 {
                     reaIndexVector ivec = new reaIndexVector();
                     ivec.index = reader.ReadInt32();
                     ivec.value = reader.ReadVector3();
                     track.scalings[j] = ivec;
                 }
                 for (int j = 0; j < numRotations; j++)
                 {
                     reaIndexQuaternion iq = new reaIndexQuaternion();
                     iq.index = reader.ReadInt32();
                     iq.value = reader.ReadQuaternion();
                     track.rotations[j] = iq;
                 }
                 for (int j = 0; j < numTranslations; j++)
                 {
                     reaIndexVector ivec = new reaIndexVector();
                     ivec.index = reader.ReadInt32();
                     ivec.value = reader.ReadVector3();
                     track.translations[j] = ivec;
                 }
                 ANIC.AddChild(track);
             }
         }
     }
     catch (FileNotFoundException)
     {
         Report.ReportLog("file not found");
     }
 }
Example #3
0
		public RoRsmMeshTransMatrix(BinaryReader bin, GenericFileFormatVersion version)
			: base(bin, version) {
			Matrix = bin.ReadMatrix();
			Position = bin.ReadVector3();
			RotationAngle = bin.ReadSingle();
			RotationAxis = bin.ReadVector3();
			Scale = bin.ReadVector3();
		}
Example #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Particle"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public Particle(NiFile file, BinaryReader reader)
		{
			this.Velocity = reader.ReadVector3();
			this.UnkownVector = reader.ReadVector3();
			this.Lifetime = reader.ReadSingle();
			this.Lifespan = reader.ReadSingle();
			this.Timestamp = reader.ReadSingle();
			this.UnkownShort = reader.ReadUInt16();
			this.VertexID = reader.ReadUInt16();
		}
Example #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiGravity" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiGravity(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (this.File.Header.Version >= eNifVersion.VER_4_0_0_2)
			{
				this.UnkownFloat1 = reader.ReadSingle();
			}
			this.Force = reader.ReadSingle();
			this.Type = reader.ReadUInt32();
			this.Position = reader.ReadVector3();
			this.Direction = reader.ReadVector3();
		}
Example #6
0
File: MDDF.cs Project: aeo24/WoWMap
 public static MDDFEntry Read(BinaryReader br)
 {
     return new MDDFEntry
     {
         MMIDEntryIndex = br.ReadUInt32(),
         UniqueId = br.ReadUInt32(),
         Position = br.ReadVector3(),
         Rotation = br.ReadVector3(),
         Scale = br.ReadUInt16(),
         Flags = (MDDFFlags)br.ReadUInt16(),
     };
 }
Example #7
0
        public int MeshFlags; // 60 is normal, 124 is decal

        public static int Deserialise(BinaryReader reader, GameObject parent)
        {
            GameObject go = new GameObject("Mesh Part");
            MeshPart part = go.AddComponent<MeshPart>();
            part.transform.SetParent(parent.transform);

            long offset = reader.BaseStream.Position;

            int NextOffset = reader.ReadInt32();
            reader.SkipInt32(64);
            reader.SkipInt32();//Length 
            reader.SkipInt32(0);

            int VertexCount = reader.ReadInt32();
            part.ObjectType = reader.ReadInt32(); //1 = static, 2 = can be or not there, 3 = can move
            int val = reader.ReadInt32();
            part.OcclusionGroup = "0x" + val.ToString("X") + " 0b" + Convert.ToString(val, 2);
            part.MeshFlags = reader.ReadInt32();

            reader.SkipBytes(32, 0);

            go.isStatic = part.ObjectType != 3;

            Matrix4x4 matrix = part.GetComponentInParent<Scene>().GetSH3ToUnityMatrix();

            List<Vector3> _verts = new List<Vector3>();
            List<Vector3> _norms = new List<Vector3>();
            List<Vector2> _uvs = new List<Vector2>();
            List<Color32> _colors = new List<Color32>();
            for (int i = 0; i != VertexCount; i++)
            {
                Vector3 temp = reader.ReadVector3();
                temp.y = -temp.y;
                _verts.Add(matrix.MultiplyPoint(temp));

                temp = reader.ReadVector3();
                temp.x = -temp.x;
                temp.z = -temp.z;
                _norms.Add(temp);

                _uvs.Add(reader.ReadVector2());
                _colors.Add(reader.ReadBGRA());
            }

            Mesh mesh = MeshUtils.MakeStripped(_verts, _norms, _uvs, _colors);

            mesh.name = "mesh_" + offset;
            go.AddComponent<MeshFilter>().sharedMesh = mesh;
            go.AddComponent<MeshRenderer>().shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;

            return NextOffset;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NiScreenLODData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiScreenLODData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.BoundCenter = reader.ReadVector3();
			this.BoundRadius = reader.ReadSingle();
			this.WorldCenter = reader.ReadVector3();
			this.WorldRadius = reader.ReadSingle();
			uint num = reader.ReadUInt32();
			this.ProportionLevels = new float[num];
			int num2 = 0;
			while ((long)num2 < (long)((ulong)num))
			{
				this.ProportionLevels[num2] = reader.ReadSingle();
				num2++;
			}
		}
Example #9
0
File: MODF.cs Project: aeo24/WoWMap
 public static MODFEntry Read(BinaryReader br)
 {
     return new MODFEntry
     {
         MWIDEntryIndex = br.ReadUInt32(),
         UniqueId = br.ReadUInt32(),
         Position = br.ReadVector3(),
         Rotation = br.ReadVector3(),
         LowerBounds = br.ReadVector3(),
         UpperBounds = br.ReadVector3(),
         Flags = (MODFFlags)br.ReadUInt16(),
         DoodadSet = br.ReadUInt16(),
         NameSet = br.ReadUInt16(),
         padding = br.ReadUInt16(),
     };
 }
Example #10
0
        public static Skybox Deserialise(BinaryReader reader, GameObject parent)
        {
            GameObject go = new GameObject("Skybox");
            Skybox sky = go.AddComponent<Skybox>();
            go.transform.SetParent(parent.transform);

            sky.NextSkyboxOffset = reader.ReadInt32();
            sky.HeaderLength = reader.ReadInt32();
            sky.SkyboxLength = reader.ReadInt32();
            sky.Unknown1 = reader.ReadInt32();

            sky.Unknown2 = reader.ReadInt32();
            sky.Unknown3 = reader.ReadInt32();
            sky.Unknown4 = reader.ReadInt32();
            sky.Unknown5 = reader.ReadInt32();

            sky.Matrix = reader.ReadMatrix4x4();

            List<Vector3> _verts = new List<Vector3>();
            for (int i = 0; i != 8; i++)
            {
                _verts.Add(reader.ReadVector3());
                reader.SkipInt32();
            }
            sky.Vertices = _verts.ToArray();

            return sky;
        }
Example #11
0
 public Polygon(BinaryReader reader)
 {
     int vertexCount = reader.ReadInt32();
     Vector3[] vertices = new Vector3[vertexCount];
     for (int x = 0; x < vertexCount; x++)
         vertices[x] = reader.ReadVector3();
     CalculateValues(vertices);
 }
Example #12
0
		public RoRswDataModel(BinaryReader reader, GenericFileFormatVersion version)
			: base(reader, version) {
			name = reader.ReadWord(40);
			if (version.IsCompatible(1, 3)) {
				unk1 = reader.ReadInt32();
				unk2 = reader.ReadSingle();
				unk3 = reader.ReadSingle();
			}
			filename = reader.ReadWord(40);
			reserved = reader.ReadWord(40);
			type = reader.ReadWord(20);
			sound = reader.ReadWord(20);
			todo1 = reader.ReadWord(40);
			pos = reader.ReadVector3();
			rot = reader.ReadVector3();
			scale = reader.ReadVector3();
		}
Example #13
0
 public Structure(Map map, BinaryReader reader)
 {
     position = reader.ReadVector3();
     collisionPolygon = new Polygon(reader);
     characterFile = reader.ReadString();
     teamID = reader.ReadInt32();
     info = new CharacterInfo(characterFile);
     health = info.maxHealth;
     this.map = map;
 }
Example #14
0
        public Bone(BinaryReader reader)
        {
            Name = reader.ReadString();
            parentName = reader.ReadString();

            InheritScale = reader.ReadBoolean();
            InheritRotation = reader.ReadBoolean();
            Position = reader.ReadVector3();
            RotationMatrix = reader.ReadMatrix3();
            Rotation = Quaternion.FromMatrix3(RotationMatrix);
        }
Example #15
0
 public Lane(BinaryReader reader)
 {
     teamID = reader.ReadInt32();
     int numWayPoints = reader.ReadInt32();
     waypoints = new Vector3[numWayPoints];
     for (int x = 0; x < numWayPoints; x++)
         waypoints[x] = reader.ReadVector3();
     totalLength = 0;
     for (int x = 0; x < waypoints.Length - 1; x++)
         totalLength += (waypoints[x + 1] - waypoints[x]).Length();
 }
Example #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiRangeLODData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiRangeLODData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.LODCenter = reader.ReadVector3();
			uint num = reader.ReadUInt32();
			this.LODLevels = new LODRange[num];
			int num2 = 0;
			while ((long)num2 < (long)((ulong)num))
			{
				this.LODLevels[num2] = new LODRange(file, reader);
				num2++;
			}
		}
Example #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="QuatKey"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="type">The type.</param>
        /// <exception cref="Exception">Invalid eKeyType</exception>
        public QuatKey(BinaryReader reader, eKeyType type)
		{
			this.Time = reader.ReadSingle();
			if (type < eKeyType.LINEAR_KEY || type > eKeyType.TBC_KEY)
			{
				throw new Exception("Invalid eKeyType");
			}
			this.Value = reader.ReadVector4();
			if (type == eKeyType.TBC_KEY)
			{
				this.TBC = reader.ReadVector3();
			}
		}
Example #18
0
		public RoRsmMesh(BinaryReader bin, GenericFileFormatVersion version)
			: base(bin, version) {
			int count;

			Head = new RoRsmMeshHeader(bin, version);

			count = bin.ReadInt32();
			if ((bin.BaseStream.Length - bin.BaseStream.Position) < (4 * count)) {
				IsValid = false;
				return;
			}
			for (int i = 0; i < count; i++) {
				TextureIndexs.Add(bin.ReadInt32());
			}

			Matrix = new RoRsmMeshTransMatrix(bin, version);

			count = bin.ReadInt32();
			if ((bin.BaseStream.Length - bin.BaseStream.Position) < (9 * count)) {
				IsValid = false;
				return;
			}
			for (int i = 0; i < count; i++) {
				MainVectors.Add(bin.ReadVector3());
			}

			count = bin.ReadInt32();
			for (int i = 0; i < count; i++) {
				TextureVectors.Add(new RoRsmMeshTextureVertex(bin, version));
			}


			count = bin.ReadInt32();
			for (int i = 0; i < count; i++) {
				Surfaces.Add(new RoRsmMeshSurface(bin, version));
			}

			if (version.IsCompatible(1, 5)) {
				count = bin.ReadInt32();
				for (int i = 0; i < count; i++) {
					PositionFrames.Add(new RoRsmMeshPositionFrame(bin, version));
				}
			}

			count = bin.ReadInt32();
			for (int i = 0; i < count; i++) {
				RotationFrames.Add(new RoRsmMeshRotationFrame(bin, version));
			}

			IsValid = true;
		}
Example #19
0
        /// <summary>
        /// Initialize a <see cref="RWBoundingSphere"/> by reading the structure from a stream using the <see cref="BinaryReader"/>.
        /// </summary>
        /// <param name="reader">The <see cref="BinaryReader"/> used to read from the stream.</param>
        internal RWBoundingSphere(BinaryReader reader)
        {
            Center = reader.ReadVector3();
            Radius = reader.ReadSingle();
            int positionFlag = reader.ReadInt32();
            int normalFlag = reader.ReadInt32();

            /*
            if (positionFlag != POS_FLAG || normalFlag != NRM_FLAG) // maybe overzealous
            {
                throw new InvalidDataException("Position and normal flags are not set to 1");
            }
            */
        }
Example #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="VecKey"/> class.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="type">The type.</param>
        /// <exception cref="Exception">Invalid eKeyType!</exception>
        public VecKey(BinaryReader reader, eKeyType type) : base(reader, type)
		{
			this.Time = reader.ReadSingle();
			if (type < eKeyType.LINEAR_KEY || type > eKeyType.TBC_KEY)
			{
				throw new Exception("Invalid eKeyType!");
			}
			if (type == eKeyType.LINEAR_KEY)
			{
				this.Value = reader.ReadVector3();
			}
			if (type == eKeyType.QUADRATIC_KEY)
			{
				this.Value = reader.ReadVector3();
				this.Forward = reader.ReadVector3();
				this.Backward = reader.ReadVector3();
			}
			if (type == eKeyType.TBC_KEY)
			{
				this.Value = reader.ReadVector3();
				this.TBC = reader.ReadVector3();
			}
		}
Example #21
0
		public int[] unk3; // 2


		public RoRswDataEffect(BinaryReader reader, GenericFileFormatVersion version)
			: base(reader, version) {
			name = reader.ReadWord(40);
			unk1 = reader.ReadSingle();
			category = reader.ReadInt32();
			pos = reader.ReadVector3();
			type = reader.ReadInt32();
			loop = reader.ReadSingle();
			unk2 = new float[2] {
				reader.ReadSingle(),
				reader.ReadSingle()
			};
			unk3 = new int[2] {
				reader.ReadInt32(),
				reader.ReadInt32()
			};
		}
Example #22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NiLODNode" /> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiLODNode(NiFile file, BinaryReader reader) : base(file, reader)
		{
			if (base.Version >= eNifVersion.VER_4_0_0_2 && base.Version <= eNifVersion.VER_10_0_1_0)
			{
				this.LODCenter = reader.ReadVector3();
			}
			if (base.Version <= eNifVersion.VER_10_0_1_0)
			{
				uint num = reader.ReadUInt32();
				this.LODLevels = new LODRange[num];
				int num2 = 0;
				while ((long)num2 < (long)((ulong)num))
				{
					this.LODLevels[num2] = new LODRange(file, reader);
					num2++;
				}
			}
			if (base.Version >= eNifVersion.VER_10_0_1_0)
			{
				this.LODLevelData = new NiRef<NiLODData>(reader);
			}
		}
Example #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SkinData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        /// <param name="hasVertexWeights">if set to <c>true</c> [has vertex weights].</param>
        public SkinData(NiFile file, BinaryReader reader, bool hasVertexWeights)
		{
			this.Transform = new SkinTransform(file, reader);
			this.BoundingSphereOffset = reader.ReadVector3();
			this.BoundingSphereRadius = reader.ReadSingle();
			if (file.Version == eNifVersion.VER_20_3_0_9 && file.Header.UserVersion == 131072u)
			{
				this.Unkown13Shorts = new ushort[13];
				for (int i = 0; i < 13; i++)
				{
					this.Unkown13Shorts[i] = reader.ReadUInt16();
				}
			}
			this.NumVertices = reader.ReadUInt16();
			if (hasVertexWeights)
			{
				this.VertexWeights = new SkinWeight[(int)this.NumVertices];
				for (int j = 0; j < (int)this.NumVertices; j++)
				{
					this.VertexWeights[j] = new SkinWeight(file, reader);
				}
			}
		}
Example #24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SkinTransform"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public SkinTransform(NiFile file, BinaryReader reader)
		{
			this.Rotation = reader.ReadMatrix33();
			this.Translation = reader.ReadVector3();
			this.Scale = reader.ReadSingle();
		}
		public RoRsmMeshRotationFrame(BinaryReader bin, GenericFileFormatVersion version)
			: base(bin, version) {
			Frame = bin.ReadInt32();
			Rotation = bin.ReadVector3();
		}
Example #26
0
        /// <summary>
        /// Loads the file from the specified stream.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        public override void Load(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR"));

            int blockCount = reader.ReadInt32();

            for (int i = 0; i < blockCount; i++) {
                ZoneBlock type = (ZoneBlock)reader.ReadInt32();
                int offset = reader.ReadInt32();

                long nextBlock = stream.Position;
                stream.Seek(offset, SeekOrigin.Begin);

                switch (type) {
                    case ZoneBlock.Info:
                        Type = (ZoneType)reader.ReadInt32();
                        Width = reader.ReadInt32();
                        Height = reader.ReadInt32();
                        GridCount = reader.ReadInt32();
                        GridSize = reader.ReadSingle();
                        StartPosition = new IntVector2(reader.ReadInt32(), reader.ReadInt32());

                        for (int w = 0; w < Width; w++) {
                            for (int h = 0; h < Height; h++) {
                                Positions[w, h].IsUsed = reader.ReadBoolean();
                                Positions[w, h].Position = reader.ReadVector2();
                            }
                        }
                        break;
                    case ZoneBlock.SpawnPoints:
                        int spawnCount = reader.ReadInt32();

                        for (int j = 0; j < spawnCount; j++) {
                            SpawnPoint spawnPoint = new SpawnPoint();
                            spawnPoint.Position = reader.ReadVector3();
                            spawnPoint.Name = reader.ReadByteString();

                            SpawnPoints.Add(spawnPoint);
                        }
                        break;
                    case ZoneBlock.Textures:
                        int textureCount = reader.ReadInt32();

                        for (int j = 0; j < textureCount; j++) {
                            Textures.Add(reader.ReadByteString());
                        }
                        break;
                    case ZoneBlock.Tiles:
                        int tileCount = reader.ReadInt32();

                        for (int j = 0; j < tileCount; j++) {
                            ZoneTile tile = new ZoneTile();
                            tile.Layer1 = reader.ReadInt32();
                            tile.Layer2 = reader.ReadInt32();
                            tile.Offset1 = reader.ReadInt32();
                            tile.Offset2 = reader.ReadInt32();
                            tile.BlendingEnabled = reader.ReadInt32() != 0;
                            tile.Rotation = (TileRotation)reader.ReadInt32();
                            tile.TileType = reader.ReadInt32();

                            Tiles.Add(tile);
                        }
                        break;
                    case ZoneBlock.Economy:
                        Name = reader.ReadByteString();
                        IsUnderground = reader.ReadInt32() != 0;
                        BackgroundMusicFilePath = reader.ReadByteString();
                        SkyFilePath = reader.ReadByteString();
                        EconomyCheckRate = reader.ReadInt32();
                        PopulationBase = reader.ReadInt32();
                        PopulationGrowthRate = reader.ReadInt32();
                        MetalConsumption = reader.ReadInt32();
                        StoneConsumption = reader.ReadInt32();
                        WoodConsumption = reader.ReadInt32();
                        LeatherConsumption = reader.ReadInt32();
                        ClothConsumption = reader.ReadInt32();
                        AlchemyConsumption = reader.ReadInt32();
                        ChemicalConsumption = reader.ReadInt32();
                        IndustrialConsumption = reader.ReadInt32();
                        MedicineConsumption = reader.ReadInt32();
                        FoodConsumption = reader.ReadInt32();
                        break;
                }

                if (i < blockCount - 1) {
                    stream.Seek(nextBlock, SeekOrigin.Begin);
                }
            }
        }
Example #27
0
        static void ReadBoundingNormals(BinaryReader br, M2Model model)
        {
            var bnInfo = model.Header.BoundingVertices;

            model.BoundingNormals = new Vector3[bnInfo.Count];
            br.BaseStream.Position = bnInfo.Offset;

            for (var i = 0; i < bnInfo.Count; i++)
            {
                model.BoundingNormals[i] = br.ReadVector3();
            }
        }
Example #28
0
        static void ReadVertices(BinaryReader br, M2Model model)
        {
            var vertInfo = model.Header.Vertices;

            model.Vertices = new ModelVertices[vertInfo.Count];

            br.BaseStream.Position = vertInfo.Offset;
            for (int i = 0; i < vertInfo.Count; i++)
            {
                var mv = new ModelVertices
                             {
                                 Position = br.ReadVector3(),
                                 BoneWeight = br.ReadBytes(4),
                                 BoneIndices = br.ReadBytes(4),
                                 Normal = br.ReadVector3(),
                                 TextureCoordinates = br.ReadVector2(),
                                 Float_1 = br.ReadSingle(),
                                 Float_2 = br.ReadSingle()
                             };

                model.Vertices[i] = mv;
            }
        }
 public static RTSBuildingData Deserialize(BinaryReader s, GameState state, int index)
 {
     RTSBuildingData data = new RTSBuildingData(index);
     data.FriendlyName = s.ReadString();
     data.InfoFile = s.ReadString();
     data.Health = s.ReadInt32();
     data.CapitalCost = s.ReadInt32();
     data.PopCapChange = s.ReadInt32();
     data.MaxCount = s.ReadInt32();
     data.IsResource = s.ReadBoolean();
     data.Impact = s.ReadInt32();
     data.BuildAmount = s.ReadInt32();
     data.Depositable = s.ReadBoolean();
     data.SightRadius = s.ReadInt32();
     data.GridSize = s.ReadPoint();
     CollisionType ct = (CollisionType)s.ReadInt32();
     Vector2 cc = s.ReadVector2();
     bool cs = s.ReadBoolean();
     switch(ct) {
         case CollisionType.Circle:
             float cr = s.ReadSingle();
             data.ICollidableShape = new CollisionCircle(cr, cc, cs);
             break;
         case CollisionType.Rectangle:
             float cw = s.ReadSingle();
             float cd = s.ReadSingle();
             data.ICollidableShape = new CollisionRect(cw, cd, cc, cs);
             break;
         default:
             throw new Exception("Nonexistent Collision Type");
     }
     data.BBox.Min = s.ReadVector3();
     data.BBox.Max = s.ReadVector3();
     data.DefaultActionController = state.Scripts[s.ReadString()];
     return data;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="NiVectorExtraData"/> class.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <param name="reader">The reader.</param>
        public NiVectorExtraData(NiFile file, BinaryReader reader) : base(file, reader)
		{
			this.Data = reader.ReadVector3();
			this.UnkownFloat = reader.ReadSingle();
		}