Exemple #1
0
                // Constructors
                public MotionData(BINAReader reader)
                {
                    MotionName = reader.GetString();
                    reader.JumpAhead(12);

                    SyncFrame    = reader.ReadBoolean();
                    StopEndFrame = reader.ReadBoolean();
                    reader.JumpAhead(6);
                }
Exemple #2
0
 // Constructors
 public EffectData(BINAReader reader)
 {
     EffectName = reader.GetString();
     reader.JumpAhead(12);
     LinkMotionStop = reader.ReadBoolean();
     reader.JumpAhead(7);
 }
Exemple #3
0
        // Methods
        public override void Load(Stream fileStream)
        {
            // BINA Header
            var reader = new BINAReader(fileStream);

            Header = reader.ReadHeader();

            string sig = reader.ReadSignature(4);

            if (sig != Signature)
            {
                throw new InvalidSignatureException(Signature, sig);
            }
            var unknown1 = reader.ReadUInt32(); //Might be part of the Header according to Skyth's spec?

            if (unknown1 != 1)
            {
                Console.WriteLine($"Unknown1 does not equal 1 in this file! It's actually set to {unknown1}");
            }
            var shapeCount = reader.ReadInt64();
            var unknown2   = reader.ReadUInt64();

            if (unknown2 != 24)
            {
                Console.WriteLine($"Unknown1 does not equal 24 in this file! It's actually set to {unknown1}");
            }
            Console.WriteLine(unknown2);

            for (int i = 0; i < shapeCount; i++)
            {
                SvShape shape           = new SvShape();
                var     shapeNameOffset = reader.ReadInt64();
                long    pos             = reader.BaseStream.Position;
                reader.JumpTo(shapeNameOffset, false);
                shape.Name = reader.ReadNullTerminatedString();
                reader.JumpTo(pos, true);

                shape.Unknown1            = reader.ReadUInt32();
                shape.Size                = reader.ReadVector3();
                shape.Position            = reader.ReadVector3();
                shape.Rotation            = reader.ReadQuaternion();
                shape.BoundingBox.Minimum = reader.ReadVector3();
                shape.BoundingBox.Maximum = reader.ReadVector3();
                shape.Unknown2            = reader.ReadUInt32();

                var sectorCount      = reader.ReadInt64();
                var sectorListOffset = reader.ReadInt64();
                pos = reader.BaseStream.Position;
                reader.JumpTo(sectorListOffset, false);
                for (int s = 0; s < sectorCount; s++)
                {
                    SvSector sector = new SvSector();
                    sector.SectorIndex = reader.Read();
                    sector.Visible     = reader.ReadBoolean();
                    shape.Sectors.Add(sector);
                }
                reader.JumpTo(pos, true);
                SvShapes.Add(shape);
            }
        }
Exemple #4
0
        // Methods
        public override void Load(Stream fileStream)
        {
            var reader = new BINAReader(fileStream);

            Header      = reader.ReadHeader();
            IsBigEndian = reader.IsBigEndian;

            System.Console.WriteLine(reader.BaseStream.Position);
            RangeIn       = reader.ReadSingle(); // Unused
            RangeDistance = reader.ReadSingle(); // Unused

            ModelName = reader.GetString();
            reader.JumpAhead(12);

            SkeletonName = reader.GetString();
            reader.JumpAhead(12);

            BoundingShape = (BoundingShapes)reader.ReadUInt32();

            BoundingSize = reader.ReadVector3();

            MeshName = reader.GetString();
            reader.JumpAhead(20);

            ShapeOffset = reader.ReadVector3();
            reader.JumpAhead(4);
            ShapeSizeOffset = reader.ReadSingle();

            RigidBodyType     = (RigidBodyTypes)reader.ReadByte();
            RigidBodyMaterial = (RigidBodyMaterials)reader.ReadByte();
            reader.JumpAhead(2);

            _PhysicsParam = new PhysicsParam(reader);

            ContactDamageType = (ContactDamageTypes)reader.ReadByte();
            RideOnDamage      = reader.ReadBoolean();
            AerialBounce      = reader.ReadBoolean();

            reader.JumpAhead(9);

            // ReactionData
            for (uint i = 0; i < ReactionDataCount; i++)
            {
                _ReactionData[i] = new ReactionData(reader);
            }
        }
Exemple #5
0
            public void Read(BINAReader reader, bool readChildIndices = true)
            {
                long nameOffset            = reader.ReadInt64();
                long dataOffset            = reader.ReadInt64();
                long childIndexTableOffset = reader.ReadInt64();

                ParentIndex = reader.ReadInt32();
                Index       = reader.ReadInt32();
                DataIndex   = reader.ReadInt32();

                ushort childCount   = reader.ReadUInt16();
                bool   hasData      = reader.ReadBoolean();
                byte   fullPathSize = reader.ReadByte(); // Not counting this node in

                // Read name
                if (nameOffset != 0)
                {
                    Name = reader.GetString((uint)nameOffset);
                }

                // (MINOR HACK) Store data offset in Data
                // to be read later, avoiding some Seeks
                if (hasData && dataOffset != 0)
                {
                    Data = dataOffset;
                }

                // Read Child Indices
                if (!readChildIndices)
                {
                    return;
                }

                long curPos = reader.BaseStream.Position;

                reader.JumpTo(childIndexTableOffset);
                ChildIndices.Capacity = childCount;

                for (int i = 0; i < childCount; ++i)
                {
                    ChildIndices.Add(reader.ReadInt32());
                }

                reader.JumpTo(curPos);
            }