Beispiel #1
0
        void Parse(Stream s)
        {
            var br = new BinaryReader(s);

            this.version        = br.ReadUInt32();
            this.unknown1       = br.ReadUInt32();
            this.duration       = br.ReadSingle();
            this.unknown_floats = new float[8];
            for (int i = 0; i < this.unknown_floats.Length; i++)
            {
                this.unknown_floats[i] = br.ReadSingle();
            }
            this.unknown_hashes = new uint[3];

            for (int i = 0; i < this.unknown_hashes.Length; i++)
            {
                this.unknown_hashes[i] = br.ReadUInt32();
            }
            this.clip_name  = br.ReadString32();
            this.actor_name = br.ReadString32();
            var extra_actor_count = br.ReadInt32();
            var extra_actors      = new string[extra_actor_count];

            for (int i = 0; i < extra_actor_count; i++)
            {
                extra_actors[i] = br.ReadString32();
            }
            this.actor_list = string.Join(",", extra_actors);
            var ik_target_count = br.ReadInt32();

            this.IKChainCount = br.ReadInt32();
            var ik_targets = new IKTarget[ik_target_count];

            for (int i = 0; i < ik_target_count; i++)
            {
                ik_targets[i] = new IKTarget(RecommendedApiVersion, this.OnResourceChanged, s);
            }
            this.ik_targets = new IKTargetList(this.OnResourceChanged, ik_targets);
            UInt32 next   = br.ReadUInt32();
            bool   end    = false;
            var    events = new List <ClipEvent>();

            while (stream.Position + next != stream.Length)
            {
                var evt = ClipEvent.Create(next, this.OnResourceChanged, next);

                var evt_end = br.ReadInt32() + br.BaseStream.Position;
                evt.Parse(s);
                events.Add(evt);
                if (Settings.Settings.Checking && br.BaseStream.Position != evt_end)
                {
                    throw new InvalidDataException();
                }

                next = br.ReadUInt32();
            }
            this.clip_events = new ClipEventList(this.OnResourceChanged, events);
            this.s3clip      = new byte[next];
            s.Read(this.s3clip, 0, this.s3clip.Length);
        }
 protected override bool isEqual(ClipEvent other)
 {
     if (other is ClipEventSound)
     {
         ClipEventSound f = other as ClipEventSound;
         return(String.Compare(this.sound_name, f.sound_name) == 0);
     }
     else
     {
         return(false);
     }
 }
 protected override bool isEqual(ClipEvent other)
 {
     if (other is ClipEventUnknown)
     {
         ClipEventUnknown f = other as ClipEventUnknown;
         return(Enumerable.SequenceEqual(this.data, f.data));
     }
     else
     {
         return(false);
     }
 }
 protected override bool isEqual(ClipEvent other)
 {
     if (other is ClipEventCensor)
     {
         ClipEventCensor f = other as ClipEventCensor;
         return(this.unknown_3 == f.unknown_3);
     }
     else
     {
         return(false);
     }
 }
        void Parse(Stream s)
        {
            var br = new BinaryReader(s);

            this.version        = br.ReadUInt32();
            this.flags          = br.ReadUInt32();
            this.duration       = br.ReadSingle();
            this.initialOffsetQ = new Quaternion(RecommendedApiVersion, OnResourceChanged, s);
            this.initialOffsetT = new Vector3(RecommendedApiVersion, OnResourceChanged, s);
            if (version >= 5)
            {
                this.referenceNamespaceHash = br.ReadUInt32();
            }
            if (version >= 10)
            {
                this.surfaceNamespaceHash = br.ReadUInt32();
                this.surfaceJointNameHash = br.ReadUInt32();
            }

            if (version >= 11)
            {
                this.surfacechildNamespaceHash = br.ReadUInt32();
            }
            if (version >= 7)
            {
                this.clip_name = br.ReadString32();
            }
            this.rigNameSpace = br.ReadString32();
            if (version >= 4)
            {
                explicitNamespaces = new ExplicitNameSpaceList(OnResourceChanged, s);
            }
            this.slot_assignments = new IkConfiguration(OnResourceChanged, s);
            uint clipEventLength = br.ReadUInt32();
            var  events          = new List <ClipEvent>();

            for (int i = 0; i < clipEventLength; i++)
            {
                ClipEventType clipType = (ClipEventType)br.ReadUInt32();
                uint          size     = br.ReadUInt32();
                ClipEvent     evt      = ClipEvent.Create(clipType, this.OnResourceChanged, size);
                evt.Parse(s);
                events.Add(evt);
            }
            this.clip_events = new ClipEventList(this.OnResourceChanged, events);
            uint codecDataLength = br.ReadUInt32();

            if (codecDataLength > 0)
            {
                this.codecData = new S3CLIP(RecommendedApiVersion, OnResourceChanged, s);
            }
        }
 protected override bool isEqual(ClipEvent other)
 {
     if (other is ClipEventDoubleModifierSound)
     {
         ClipEventDoubleModifierSound f = other as ClipEventDoubleModifierSound;
         return(String.Compare(this.unknown_3, f.unknown_3) == 0 &&
                this.actor_name == f.actor_name && this.slot_name == f.slot_name);
     }
     else
     {
         return(false);
     }
 }
 protected override bool isEqual(ClipEvent other)
 {
     if (other is ClipEventEffect)
     {
         ClipEventEffect f = other as ClipEventEffect;
         return(String.Compare(this.slot_name, f.slot_name) == 0 && String.Compare(this.effect_name, f.effect_name) == 0 &&
                this.actor_name_hash == f.actor_name_hash && this.slot_name_hash == f.slot_name_hash &&
                Enumerable.SequenceEqual(this.unknown, f.unknown));
     }
     else
     {
         return(false);
     }
 }