示例#1
0
        public AnimationData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            AnimationID = reader.ReadUInt16();
            FirstNodeID = reader.ReadUInt16();
        }
示例#2
0
        public PaletteReferenceData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            OffsetOrSize = reader.ReadUInt32();
            ColorCount   = reader.ReadUInt32();
        }
示例#3
0
        public TransformData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            BaseOffset        = new Point(reader.ReadInt16(), reader.ReadInt16());
            Unknown0x04       = reader.ReadUInt16();
            TransformOffsetID = reader.ReadUInt16();
            Scale             = new Point(reader.ReadInt16(), reader.ReadInt16());
            RotationAngle     = reader.ReadInt32();
        }
示例#4
0
        public SpriteData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            ImageNumber   = reader.ReadUInt16();
            PaletteNumber = reader.ReadUInt16();
            Unknown0x04   = reader.ReadUInt16();
            Unknown0x06   = reader.ReadUInt16();
            Rectangle     = new Rectangle(reader.ReadInt16(), reader.ReadInt16(), reader.ReadInt16(), reader.ReadInt16());
        }
示例#5
0
        public ImageReferenceData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            OffsetOrSize = reader.ReadUInt32();
            Width        = reader.ReadUInt16();
            Height       = reader.ReadUInt16();
            Unknown0x08  = reader.ReadUInt16();
            Unknown0x0A  = reader.ReadUInt16();
        }
示例#6
0
        public AnimationFrameData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            FrameTime   = reader.ReadUInt16();
            Unknown0x02 = reader.ReadByte();
            Unknown0x03 = reader.ReadByte();
            SpriteID    = reader.ReadUInt16();
            TransformID = reader.ReadUInt16();
            Unknown0x08 = reader.ReadUInt16();
            Unknown0x0A = reader.ReadUInt16();
        }
示例#7
0
        public AnimationNodeData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            Unknown0x00           = reader.ReadUInt32();
            Unknown0x04           = reader.ReadUInt16();
            Unknown0x06           = reader.ReadUInt16();
            FirstAnimationFrameID = reader.ReadInt16();
            NumAnimationFrames    = reader.ReadUInt16();
            SiblingNodeID         = reader.ReadInt16();
            ChildNodeID           = reader.ReadInt16();
        }
示例#8
0
        public ColorSetData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            byte r, g, b, a;

            r      = reader.ReadByte();
            g      = reader.ReadByte();
            b      = reader.ReadByte();
            a      = reader.ReadByte();
            Color1 = Color.FromArgb(a, r, g, b);

            r      = reader.ReadByte();
            g      = reader.ReadByte();
            b      = reader.ReadByte();
            a      = reader.ReadByte();
            Color2 = Color.FromArgb(a, r, g, b);

            r      = reader.ReadByte();
            g      = reader.ReadByte();
            b      = reader.ReadByte();
            a      = reader.ReadByte();
            Color3 = Color.FromArgb(a, r, g, b);

            r      = reader.ReadByte();
            g      = reader.ReadByte();
            b      = reader.ReadByte();
            a      = reader.ReadByte();
            Color4 = Color.FromArgb(a, r, g, b);

            r      = reader.ReadByte();
            g      = reader.ReadByte();
            b      = reader.ReadByte();
            a      = reader.ReadByte();
            Color5 = Color.FromArgb(a, r, g, b);
        }
示例#9
0
        public AnmDat(string filePath)
            : base(filePath)
        {
            using (EndianBinaryReader reader = new EndianBinaryReader(File.Open(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), Endian.BigEndian))
            {
                InfoBlockSize         = reader.ReadUInt32();
                ImageDataSize         = reader.ReadUInt32();
                NumPixelDataHeaders   = reader.ReadUInt32();
                NumPaletteDataHeaders = reader.ReadUInt32();
                NumInfoBlocks         = reader.ReadUInt32();
                Unknown0x14           = reader.ReadUInt32();
                Unknown0x18           = reader.ReadUInt32();
                Unknown0x1C           = reader.ReadUInt32();

                InfoBlocks = new InfoBlockData[NumInfoBlocks];
                for (int i = 0; i < InfoBlocks.Length; i++)
                {
                    long offset = reader.BaseStream.Position;
                    InfoBlocks[i] = new InfoBlockData(this, reader);

                    reader.BaseStream.Seek(offset + InfoBlocks[i].InfoEntrySize, SeekOrigin.Begin);
                }

                TxfData = new Txf(reader, (int)ImageDataSize, (int)NumPixelDataHeaders, (int)NumPaletteDataHeaders);

                foreach (InfoBlockData infoBlock in InfoBlocks)
                {
                    /* Post-processing */
                    foreach (AnimationData animation in infoBlock.Animations.Where(x => x != null))
                    {
                        animation.FirstNode = infoBlock.AnimationNodes[animation.FirstNodeID];
                    }

                    foreach (AnimationFrameData animationFrame in infoBlock.AnimationFrames.Where(x => x != null))
                    {
                        animationFrame.Sprite    = infoBlock.Sprites[animationFrame.SpriteID];
                        animationFrame.Transform = infoBlock.Transforms[animationFrame.TransformID];
                    }

                    foreach (SpriteData sprite in infoBlock.Sprites.Where(x => x != null))
                    {
                        sprite.GenerateBitmap(TxfData);
                    }

                    foreach (TransformData transform in infoBlock.Transforms.Where(x => x != null))
                    {
                        transform.TransformOffset = infoBlock.TransformOffsets[transform.TransformOffsetID];
                    }

                    foreach (AnimationNodeData animationNode in infoBlock.AnimationNodes.Where(x => x != null))
                    {
                        if (animationNode.FirstAnimationFrameID != -1)
                        {
                            animationNode.AnimationFrames = new AnimationFrameData[animationNode.NumAnimationFrames];
                            for (int i = 0; i < animationNode.AnimationFrames.Length; i++)
                            {
                                animationNode.AnimationFrames[i] = infoBlock.AnimationFrames[animationNode.FirstAnimationFrameID + i];
                            }
                        }

                        if (animationNode.SiblingNodeID != -1)
                        {
                            animationNode.SiblingNode = infoBlock.AnimationNodes[animationNode.SiblingNodeID];
                        }

                        if (animationNode.ChildNodeID != -1)
                        {
                            animationNode.ChildNode = infoBlock.AnimationNodes[animationNode.ChildNodeID];
                        }
                    }
                }
            }
        }
示例#10
0
        public UnknownSignedIntData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            Unknown0x00 = reader.ReadInt32();
        }
示例#11
0
        public TransformOffsetData(InfoBlockData parent, EndianBinaryReader reader)
        {
            ParentInfoBlock = parent;

            Offset = new Point(reader.ReadInt16(), reader.ReadInt16());
        }