Exemple #1
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.U = binaryReader.ReadVector3();
     this.V = binaryReader.ReadVector3();
     return(pointerQueue);
 }
Exemple #2
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name              = binaryReader.ReadStringID();
     this.Material          = binaryReader.ReadShortBlockIndex1();
     this.BoxesFlags        = ((Flags)(binaryReader.ReadInt16()));
     this.RelativeMassScale = binaryReader.ReadSingle();
     this.Friction          = binaryReader.ReadSingle();
     this.Restitution       = binaryReader.ReadSingle();
     this.Volume            = binaryReader.ReadSingle();
     this.Mass              = binaryReader.ReadSingle();
     this.fieldskip         = binaryReader.ReadBytes(2);
     this.Phantom           = binaryReader.ReadShortBlockIndex1();
     this.fieldskip0        = binaryReader.ReadBytes(4);
     this.Size              = binaryReader.ReadInt16();
     this.Count             = binaryReader.ReadInt16();
     this.fieldskip1        = binaryReader.ReadBytes(4);
     this.Radius            = binaryReader.ReadSingle();
     this.HalfExtents       = binaryReader.ReadVector3();
     this.fieldskip2        = binaryReader.ReadBytes(4);
     this.fieldskip3        = binaryReader.ReadBytes(4);
     this.Size0             = binaryReader.ReadInt16();
     this.Count0            = binaryReader.ReadInt16();
     this.fieldskip4        = binaryReader.ReadBytes(4);
     this.fieldskip5        = binaryReader.ReadBytes(4);
     this.RotationI         = binaryReader.ReadVector3();
     this.fieldskip6        = binaryReader.ReadBytes(4);
     this.RotationJ         = binaryReader.ReadVector3();
     this.fieldskip7        = binaryReader.ReadBytes(4);
     this.RotationK         = binaryReader.ReadVector3();
     this.fieldskip8        = binaryReader.ReadBytes(4);
     this.Translation       = binaryReader.ReadVector3();
     this.fieldskip9        = binaryReader.ReadBytes(4);
     return(pointerQueue);
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.WindTilingScale = binaryReader.ReadSingle();
     this.WindPrimaryHeadingpitchstrength = binaryReader.ReadVector3();
     this.PrimaryRateOfChange             = binaryReader.ReadSingle();
     this.PrimaryMinStrength = binaryReader.ReadSingle();
     this.fieldpad           = binaryReader.ReadBytes(4);
     this.fieldpad0          = binaryReader.ReadBytes(4);
     this.fieldpad1          = binaryReader.ReadBytes(12);
     this.WindGustingHeadingpitchstrength = binaryReader.ReadVector3();
     this.GustDiretionalRateOfChange      = binaryReader.ReadSingle();
     this.GustStrengthRateOfChange        = binaryReader.ReadSingle();
     this.GustConeAngle          = binaryReader.ReadSingle();
     this.fieldpad2              = binaryReader.ReadBytes(4);
     this.fieldpad3              = binaryReader.ReadBytes(4);
     this.fieldpad4              = binaryReader.ReadBytes(12);
     this.fieldpad5              = binaryReader.ReadBytes(12);
     this.fieldpad6              = binaryReader.ReadBytes(12);
     this.fieldpad7              = binaryReader.ReadBytes(12);
     this.TurbulanceRateOfChange = binaryReader.ReadSingle();
     this.TurbulenceScaleXYZ     = binaryReader.ReadVector3();
     this.GravityConstant        = binaryReader.ReadSingle();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24));
     this.fieldpad8 = binaryReader.ReadBytes(4);
     return(pointerQueue);
 }
        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);
        }
Exemple #5
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");
     }
 }
		public RoRsmMeshTransMatrix(BinaryReader bin, GenericFileFormatVersion version)
			: base(bin, version) {
			Matrix = bin.ReadMatrix();
			Position = bin.ReadVector3();
			RotationAngle = bin.ReadSingle();
			RotationAxis = bin.ReadVector3();
			Scale = bin.ReadVector3();
		}
Exemple #7
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Point          = binaryReader.ReadVector3();
     this.ReferenceFrame = binaryReader.ReadInt16();
     this.fieldpad       = binaryReader.ReadBytes(2);
     this.Vector         = binaryReader.ReadVector3();
     return(pointerQueue);
 }
Exemple #8
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Position = binaryReader.ReadVector3();
     this.Offset   = binaryReader.ReadVector3();
     this.Axis     = binaryReader.ReadVector3();
     this.Texcoord = binaryReader.ReadVector2();
     this.Color    = binaryReader.ReadColourR1G1B1();
     return(pointerQueue);
 }
Exemple #9
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Position = binaryReader.ReadVector3();
     this.Normal   = binaryReader.ReadVector3();
     this.Tangent  = binaryReader.ReadVector3();
     this.Binormal = binaryReader.ReadVector3();
     this.Texcoord = binaryReader.ReadVector2();
     return(pointerQueue);
 }
 void IBinary.Read(System.IO.BinaryReader reader)
 {
     this.isNormalBullet         = reader.ReadBoolean();
     this.id                     = reader.ReadInt32();
     this.timeStamp              = reader.ReadInt32();
     this.speed                  = reader.ReadUInt32();
     this.bulletLocalPosition    = reader.ReadVector3();
     this.bulletLocalEulerAngles = reader.ReadVector3();
     this.barrelLocalEulerAngles = reader.ReadVector3();
 }
Exemple #11
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();
		}
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(1));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     this.fieldpad      = binaryReader.ReadBytes(4);
     this.MoppBoundsMin = binaryReader.ReadVector3();
     this.MoppBoundsMax = binaryReader.ReadVector3();
     return(pointerQueue);
 }
Exemple #13
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.FourVectorsX = binaryReader.ReadVector3();
     this.fieldskip    = binaryReader.ReadBytes(4);
     this.FourVectorsY = binaryReader.ReadVector3();
     this.fieldskip0   = binaryReader.ReadBytes(4);
     this.FourVectorsZ = binaryReader.ReadVector3();
     this.fieldskip1   = binaryReader.ReadBytes(4);
     return(pointerQueue);
 }
Exemple #14
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.NodeName           = binaryReader.ReadStringID();
     this.DefaultRotation    = binaryReader.ReadQuaternion();
     this.DefaultTranslation = binaryReader.ReadVector3();
     this.DefaultScale       = binaryReader.ReadSingle();
     this.MinBounds          = binaryReader.ReadVector3();
     this.MaxBounds          = binaryReader.ReadVector3();
     return(pointerQueue);
 }
Exemple #15
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.ScenarioCutsceneCameraPointFlags = ((Flags)(binaryReader.ReadInt16()));
     this.Type        = ((TypeEnum)(binaryReader.ReadInt16()));
     this.Name        = binaryReader.ReadString32();
     this.Position    = binaryReader.ReadVector3();
     this.Orientation = binaryReader.ReadVector3();
     this.Unused      = binaryReader.ReadSingle();
     return(pointerQueue);
 }
Exemple #16
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();
		}
Exemple #17
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Type     = ((TypeEnum)(binaryReader.ReadInt16()));
     this.Code     = binaryReader.ReadInt16();
     this.PadThai  = binaryReader.ReadInt16();
     this.fieldpad = binaryReader.ReadBytes(2);
     this.Point0   = binaryReader.ReadVector3();
     this.Point1   = binaryReader.ReadVector3();
     return(pointerQueue);
 }
Exemple #18
0
 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(),
     };
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.UserHintLineSegmentFlags = ((Flags)(binaryReader.ReadInt32()));
     this.Point0          = binaryReader.ReadVector3();
     this.ReferenceFrame  = binaryReader.ReadInt16();
     this.fieldpad        = binaryReader.ReadBytes(2);
     this.Point1          = binaryReader.ReadVector3();
     this.ReferenceFrame0 = binaryReader.ReadInt16();
     this.fieldpad0       = binaryReader.ReadBytes(2);
     return(pointerQueue);
 }
Exemple #20
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;
        }
Exemple #21
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.CenterOfMass   = binaryReader.ReadVector3();
     this.fieldskip      = binaryReader.ReadBytes(4);
     this.InertiaTensorI = binaryReader.ReadVector3();
     this.fieldskip0     = binaryReader.ReadBytes(4);
     this.InertiaTensorJ = binaryReader.ReadVector3();
     this.fieldskip1     = binaryReader.ReadBytes(4);
     this.InertiaTensorK = binaryReader.ReadVector3();
     this.fieldskip2     = binaryReader.ReadBytes(4);
     return(pointerQueue);
 }
Exemple #22
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.DecoratorSet         = binaryReader.ReadByteBlockIndex1();
     this.DecoratorClass       = binaryReader.ReadByte();
     this.DecoratorPermutation = binaryReader.ReadByte();
     this.SpriteIndex          = binaryReader.ReadByte();
     this.Position             = binaryReader.ReadVector3();
     this.Left             = binaryReader.ReadVector3();
     this.Up               = binaryReader.ReadVector3();
     this.Extents          = binaryReader.ReadVector3();
     this.PreviousPosition = binaryReader.ReadVector3();
     return(pointerQueue);
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.ScenarioObjectDatumStructPlacementFlags = ((PlacementFlags)(binaryReader.ReadInt32()));
     this.Position = binaryReader.ReadVector3();
     this.Rotation = binaryReader.ReadVector3();
     this.Scale    = binaryReader.ReadSingle();
     this.ScenarioObjectDatumStructTransformFlags = ((TransformFlags)(binaryReader.ReadInt16()));
     this.ManualBSPFlags = binaryReader.ReadBlockFlags16();
     pointerQueue        = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.ObjectID.ReadFields(binaryReader)));
     this.BSPPolicy      = ((BSPPolicyEnum)(binaryReader.ReadByte()));
     this.fieldpad       = binaryReader.ReadBytes(1);
     this.EditorFolder   = binaryReader.ReadShortBlockIndex1();
     return(pointerQueue);
 }
    void IBinary.Read(System.IO.BinaryReader reader)
    {
        this.elapsedTime = reader.ReadSingle();
        this.hp          = reader.ReadInt32();

        this.rotationTimeCount = reader.ReadSingle();
        this.localPosition     = reader.ReadVector3();
        this.forward           = reader.ReadVector3();

        this.remainRouteCount  = reader.ReadInt32();
        this.hasTargetPosition = reader.ReadBoolean();

        this.conditionDto = new FishConditionDto();
        (this.conditionDto as IBinary).Read(reader);
    }
        /// <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++;
			}
		}
Exemple #26
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Ambient                 = binaryReader.ReadColorR8G8B8();
     this.ShadowDirection         = binaryReader.ReadVector3();
     this.LightingAccuracy        = binaryReader.ReadSingle();
     this.ShadowOpacity           = binaryReader.ReadSingle();
     this.PrimaryDirectionColor   = binaryReader.ReadColorR8G8B8();
     this.PrimaryDirection        = binaryReader.ReadVector3();
     this.SecondaryDirectionColor = binaryReader.ReadColorR8G8B8();
     this.SecondaryDirection      = binaryReader.ReadVector3();
     this.ShIndex                 = binaryReader.ReadInt16();
     this.fieldpad                = binaryReader.ReadBytes(2);
     return(pointerQueue);
 }
Exemple #27
0
 public EscortData(System.IO.BinaryReader reader)
 {
     position = reader.ReadVector3();
     duration = reader.ReadInt16();
     id       = reader.ReadString(32);
     unknown  = reader.ReadInt16();
 }
Exemple #28
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;
        }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Sprites                  = binaryReader.ReadTagReference();
     this.ViewBoxWidth             = binaryReader.ReadSingle();
     this.ViewBoxHeight            = binaryReader.ReadSingle();
     this.ViewBoxDepth             = binaryReader.ReadSingle();
     this.ExclusionRadius          = binaryReader.ReadSingle();
     this.MaxVelocity              = binaryReader.ReadSingle();
     this.MinMass                  = binaryReader.ReadSingle();
     this.MaxMass                  = binaryReader.ReadSingle();
     this.MinSize                  = binaryReader.ReadSingle();
     this.MaxSize                  = binaryReader.ReadSingle();
     this.MaximumNumberOfParticles = binaryReader.ReadInt32();
     this.InitialVelocity          = binaryReader.ReadVector3();
     this.BitmapAnimationSpeed     = binaryReader.ReadSingle();
     pointerQueue                  = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.GeometryBlockInfo.ReadFields(binaryReader)));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(48));
     this.Type            = ((TypeEnum)(binaryReader.ReadInt16()));
     this.fieldpad        = binaryReader.ReadBytes(2);
     this.MininumOpacity  = binaryReader.ReadSingle();
     this.MaxinumOpacity  = binaryReader.ReadSingle();
     this.RainStreakScale = binaryReader.ReadSingle();
     this.RainLineWidth   = binaryReader.ReadSingle();
     this.fieldpad0       = binaryReader.ReadBytes(4);
     this.fieldpad1       = binaryReader.ReadBytes(4);
     this.fieldpad2       = binaryReader.ReadBytes(4);
     return(pointerQueue);
 }
Exemple #30
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.PrimaryLightmapColor             = binaryReader.ReadColorR8G8B8();
     this.PrimaryLightmapIncidentDirection = binaryReader.ReadVector3();
     return(pointerQueue);
 }
        public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
        {
            System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
            this.Position = binaryReader.ReadVector3();
            int i;

            for (i = 0; (i < 4); i = (i + 1))
            {
                this.NodeIndices00[i] = new NodeIndicesBlock();
                pointerQueue          = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeIndices00[i].ReadFields(binaryReader)));
            }
            for (i = 0; (i < 4); i = (i + 1))
            {
                this.NodeWeights00[i] = new NodeWeightsBlock();
                pointerQueue          = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeWeights00[i].ReadFields(binaryReader)));
            }
            for (i = 0; (i < 4); i = (i + 1))
            {
                this.NodeIndices20[i] = new NodeIndices1Block();
                pointerQueue          = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeIndices20[i].ReadFields(binaryReader)));
            }
            this.UseNewNodeIndices         = binaryReader.ReadInt32();
            this.AdjustedCompoundNodeIndex = binaryReader.ReadInt32();
            return(pointerQueue);
        }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(592));
     this.fieldpad = binaryReader.ReadBytes(4);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(20));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(64));
     this.VehicleFloor   = binaryReader.ReadSingle();
     this.VehicleCeiling = binaryReader.ReadSingle();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(6));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     this.WorldBoundsX = binaryReader.ReadRange();
     this.WorldBoundsY = binaryReader.ReadRange();
     this.WorldBoundsZ = binaryReader.ReadRange();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(1));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(36));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24));
     this.fieldpad0 = binaryReader.ReadBytes(24);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(136));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(36));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(176));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(32));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(2));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(116));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(1));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(100));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(72));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(1));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(60));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(20));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(104));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8));
     this.fieldpad1 = binaryReader.ReadBytes(4);
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(676));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(48));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(200));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(88));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(20));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(20));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(20));
     this.fieldpad2 = binaryReader.ReadBytes(96);
     this.VehicleSpericalLimitRadius = binaryReader.ReadSingle();
     this.VehicleSpericalLimitCenter = binaryReader.ReadVector3();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(88));
     this.Decorators = binaryReader.ReadTagReference();
     pointerQueue    = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.StructurePhysics.ReadFields(binaryReader)));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(172));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(52));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(92));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(48));
     return(pointerQueue);
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Radius             = binaryReader.ReadSingle();
     this.MomentScale        = binaryReader.ReadSingle();
     this.Mass               = binaryReader.ReadSingle();
     this.CenterOfMass       = binaryReader.ReadVector3();
     this.Density            = binaryReader.ReadSingle();
     this.GravityScale       = binaryReader.ReadSingle();
     this.GroundFriction     = binaryReader.ReadSingle();
     this.GroundDepth        = binaryReader.ReadSingle();
     this.GroundDampFraction = binaryReader.ReadSingle();
     this.GroundNormalK1     = binaryReader.ReadSingle();
     this.GroundNormalK0     = binaryReader.ReadSingle();
     this.fieldpad           = binaryReader.ReadBytes(4);
     this.WaterFriction      = binaryReader.ReadSingle();
     this.WaterDepth         = binaryReader.ReadSingle();
     this.WaterDensity       = binaryReader.ReadSingle();
     this.fieldpad0          = binaryReader.ReadBytes(4);
     this.AirFriction        = binaryReader.ReadSingle();
     this.fieldpad1          = binaryReader.ReadBytes(4);
     this.XxMoment           = binaryReader.ReadSingle();
     this.YyMoment           = binaryReader.ReadSingle();
     this.ZzMoment           = binaryReader.ReadSingle();
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(36));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(128));
     pointerQueue.Enqueue(binaryReader.ReadBlamPointer(128));
     return(pointerQueue);
 }
Exemple #34
0
 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(),
     };
 }
        public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
        {
            System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
            this.Type = ((TypeEnum)(binaryReader.ReadInt16()));
            this.GlobalGeometryPartNewFlags = ((Flags)(binaryReader.ReadInt16()));
            this.Material                      = binaryReader.ReadShortBlockIndex1();
            this.StripStartIndex               = binaryReader.ReadInt16();
            this.StripLength                   = binaryReader.ReadInt16();
            this.FirstSubpartIndex             = binaryReader.ReadInt16();
            this.SubpartCount                  = binaryReader.ReadInt16();
            this.MaxNodesVertex                = binaryReader.ReadByte();
            this.ContributingCompoundNodeCount = binaryReader.ReadByte();
            this.Position                      = binaryReader.ReadVector3();
            int i;

            for (i = 0; (i < 4); i = (i + 1))
            {
                this.NodeIndices00[i] = new NodeIndicesBlock();
                pointerQueue          = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeIndices00[i].ReadFields(binaryReader)));
            }
            for (i = 0; (i < 3); i = (i + 1))
            {
                this.NodeWeights00[i] = new NodeWeightsBlock();
                pointerQueue          = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeWeights00[i].ReadFields(binaryReader)));
            }
            this.LodMipmapMagicNumber = binaryReader.ReadSingle();
            this.fieldskip            = binaryReader.ReadBytes(24);
            return(pointerQueue);
        }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name           = binaryReader.ReadStringID();
     this.Position       = binaryReader.ReadVector3();
     this.ReferenceFrame = binaryReader.ReadInt16();
     this.fieldpad       = binaryReader.ReadBytes(2);
     this.Facing         = binaryReader.ReadVector2();
     this.ActorStartingLocationsFlags = ((Flags)(binaryReader.ReadInt32()));
     this.CharacterType          = binaryReader.ReadShortBlockIndex1();
     this.InitialWeapon          = binaryReader.ReadShortBlockIndex1();
     this.InitialSecondaryWeapon = binaryReader.ReadShortBlockIndex1();
     this.fieldpad0               = binaryReader.ReadBytes(2);
     this.VehicleType             = binaryReader.ReadShortBlockIndex1();
     this.SeatType                = ((SeatTypeEnum)(binaryReader.ReadInt16()));
     this.GrenadeType             = ((GrenadeTypeEnum)(binaryReader.ReadInt16()));
     this.SwarmCount              = binaryReader.ReadInt16();
     this.ActorVariantName        = binaryReader.ReadStringID();
     this.VehicleVariantName      = binaryReader.ReadStringID();
     this.InitialMovementDistance = binaryReader.ReadSingle();
     this.EmitterVehicle          = binaryReader.ReadShortBlockIndex1();
     this.InitialMovementMode     = ((InitialMovementModeEnum)(binaryReader.ReadInt16()));
     this.PlacementScript         = binaryReader.ReadString32();
     this.fieldskip               = binaryReader.ReadBytes(2);
     this.fieldpad1               = binaryReader.ReadBytes(2);
     return(pointerQueue);
 }
Exemple #37
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();
		}
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name     = binaryReader.ReadString32();
     this.Rotation = binaryReader.ReadQuaternion();
     this.Position = binaryReader.ReadVector3();
     return(pointerQueue);
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.fieldpad = binaryReader.ReadBytes(4);
     this.Alpha    = binaryReader.ReadSingle();
     this.Position = binaryReader.ReadVector3();
     return(pointerQueue);
 }
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.AccelerationRange = binaryReader.ReadVector3();
     this.AccelActionScale  = binaryReader.ReadSingle();
     this.AccelAttachScale  = binaryReader.ReadSingle();
     return(pointerQueue);
 }
Exemple #41
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);
 }
Exemple #42
0
 public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader)
 {
     System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader));
     this.Name                   = binaryReader.ReadStringID();
     this.ParentNode             = binaryReader.ReadShortBlockIndex1();
     this.FirstChildNode         = binaryReader.ReadShortBlockIndex1();
     this.NextSiblingNode        = binaryReader.ReadShortBlockIndex1();
     this.fieldpad               = binaryReader.ReadBytes(2);
     this.DefaultTranslation     = binaryReader.ReadVector3();
     this.DefaultRotation        = binaryReader.ReadQuaternion();
     this.DefaultInverseScale    = binaryReader.ReadSingle();
     this.DefaultInverseForward  = binaryReader.ReadVector3();
     this.DefaultInverseLeft     = binaryReader.ReadVector3();
     this.DefaultInverseUp       = binaryReader.ReadVector3();
     this.DefaultInversePosition = binaryReader.ReadVector3();
     return(pointerQueue);
 }
Exemple #43
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;
 }
Exemple #44
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);
        }
Exemple #45
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();
 }
        /// <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++;
			}
		}
Exemple #47
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();
			}
		}
Exemple #48
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;
		}
Exemple #49
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");
            }
            */
        }
Exemple #50
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();
			}
		}
Exemple #51
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()
			};
		}
Exemple #52
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);
			}
		}
Exemple #53
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);
				}
			}
		}
        /// <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();
		}
Exemple #56
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);
                }
            }
        }
Exemple #57
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();
            }
        }
Exemple #58
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();
		}