Ejemplo n.º 1
0
        /// <summary>
        /// Reads direct information from track
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="flags"></param>
        /// <returns></returns>
        private object ReadDirect(SsbhParser reader, uint flags)
        {
            if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Transform))
            {
                var transform = new AnimTrackTransform()
                {
                    Sx = reader.ReadSingle(),
                    Sy = reader.ReadSingle(),
                    Sz = reader.ReadSingle(),
                    Rx = reader.ReadSingle(),
                    Ry = reader.ReadSingle(),
                    Rz = reader.ReadSingle(),
                    Rw = reader.ReadSingle(),
                    X  = reader.ReadSingle(),
                    Y  = reader.ReadSingle(),
                    Z  = reader.ReadSingle(),
                    CompensateScale = reader.ReadInt32()
                };

                return(transform);
            }

            if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Texture))
            {
                return(new AnimTrackTexture()
                {
                    UnkFloat1 = reader.ReadSingle(),
                    UnkFloat2 = reader.ReadSingle(),
                    UnkFloat3 = reader.ReadSingle(),
                    UnkFloat4 = reader.ReadSingle(),
                    Unknown = reader.ReadInt32()
                });
            }

            if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Float))
            {
                return(reader.ReadSingle());
            }

            if (CheckFlag(flags, 0x00FF, AnimTrackFlags.PatternIndex))
            {
                return(reader.ReadInt32());
            }

            if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Boolean))
            {
                return(reader.ReadByte() == 1);
            }

            if (CheckFlag(flags, 0x00FF, AnimTrackFlags.Vector4))
            {
                return(new AnimTrackCustomVector4(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle()));
            }

            return(null);
        }