コード例 #1
0
 void writeTexts(OutputBuffer o)
 {
     foreach (var text in texts)
     {
         text.Write(o);
     }
 }
コード例 #2
0
            public void Write(OutputBuffer o)
            {
                OutputBuffer chunk = new OutputBuffer();

                chunk.writeInt(atlasId);
                chunk.writeShort(unk1);
                chunk.writeShort((short)verts.Length);
                chunk.writeInt(indices.Length);

                foreach (var vert in verts)
                {
                    chunk.writeFloat(vert.x);
                    chunk.writeFloat(vert.y);
                    chunk.writeFloat(vert.u);
                    chunk.writeFloat(vert.v);
                }

                foreach (var index in indices)
                {
                    chunk.writeShort(index);
                }

                if ((indices.Length % 2) != 0)
                {
                    chunk.writeShort(0);
                }

                o.writeInt((int)TagType.Graphic);
                o.writeInt(chunk.Size / 4);
                o.write(chunk);
            }
コード例 #3
0
                public void Write(OutputBuffer o)
                {
                    o.writeInt((int)TagType.PlaceObject);
                    o.writeInt(12);

                    o.writeInt(objectId);
                    o.writeInt(placementId);
                    o.writeInt(unk1);
                    o.writeInt(nameId);
                    o.writeShort(unk2);
                    o.writeShort(unk3);
                    o.writeShort(mcObjectId);
                    o.writeShort(unk4);
                    o.writeShort(transformFlags);
                    o.writeShort(transformId);
                    o.writeShort((short)positionFlags);
                    o.writeShort(positionId);
                    o.writeInt(colorId1);
                    o.writeInt(colorId2);

                    o.writeInt((colorMatrix != null) ? 1 : 0);
                    o.writeInt((unkF014 != null) ? 1 : 0);

                    if (colorMatrix != null)
                    {
                        colorMatrix.Write(o);
                    }

                    if (unkF014 != null)
                    {
                        unkF014.Write(o);
                    }
                }
コード例 #4
0
            public void Write(OutputBuffer o)
            {
                o.writeInt((int)TagType.DefineSprite);
                o.writeInt(7);
                o.writeInt(id);
                o.writeInt(unk1);
                o.writeInt(unk2);
                o.writeInt(labels.Length);
                o.writeInt(frames.Count);
                o.writeInt(keyframes.Count);
                o.writeInt(unk3);

                foreach (var label in labels)
                {
                    label.Write(o);
                }

                foreach (var frame in frames)
                {
                    o.writeInt((int)TagType.ShowFrame);
                    o.writeInt(2);
                    frame.Write(o);
                }

                foreach (var frame in keyframes)
                {
                    o.writeInt((int)TagType.Keyframe);
                    o.writeInt(2);
                    frame.Write(o);
                }
            }
コード例 #5
0
 void writeMovieClips(OutputBuffer o)
 {
     foreach (var mc in sprites)
     {
         mc.Write(o);
     }
 }
コード例 #6
0
 public void Write(OutputBuffer o)
 {
     o.writeInt((int)TagType.DoAction);
     o.writeInt(2);
     o.writeInt(actionId);
     o.writeInt(unk1);
 }
コード例 #7
0
 public void Write(OutputBuffer o)
 {
     o.writeInt((int)TagType.RemoveObject);
     o.writeInt(2);
     o.writeInt(unk1);
     o.writeShort(mcObjectId);
     o.writeShort(unk2);
 }
コード例 #8
0
 public void Write(OutputBuffer o)
 {
     /*o.writeInt((int)TagType.FrameLabel);
      * o.writeInt(3);
      * o.writeInt(nameId);
      * o.writeInt(startFrame);
      * o.writeInt(unk1);*/
 }
コード例 #9
0
 void writeShapes(OutputBuffer o)
 {
     foreach (var shape in shapes)
     {
         shape.Write(o);
     }
     {
     }
 }
コード例 #10
0
            public void Write(OutputBuffer o)
            {
                o.writeInt((int)TagType.Metadata);
                o.writeInt(2);

                o.writeShort(VersionMajor);
                o.writeShort(VersionMinor);
                o.writeShort(VersionPatch);
                o.writeShort(VersionFlag);
            }
コード例 #11
0
        void writePositions(OutputBuffer o)
        {
            o.writeInt((int)TagType.Positions);
            o.writeInt(positions.Count * 2 + 1);
            o.writeInt(positions.Count);

            foreach (var position in positions)
            {
                o.writeFloat(position.X);
                o.writeFloat(position.Y);
            }
        }
コード例 #12
0
        void writeColors(OutputBuffer o)
        {
            o.writeInt((int)TagType.Colors);
            o.writeInt(colors.Count * 2 + 1);
            o.writeInt(colors.Count);

            foreach (var color in colors)
            {
                o.writeShort((short)(color.r * 255));
                o.writeShort((short)(color.g * 255));
                o.writeShort((short)(color.b * 255));
                o.writeShort((short)(color.a * 255));
            }
        }
コード例 #13
0
        void writeAtlases(OutputBuffer o)
        {
            o.writeInt((int)TagType.TextureAtlases);
            o.writeInt(textureAtlases.Count * 4 + 1);
            o.writeInt(textureAtlases.Count);

            foreach (var atlas in textureAtlases)
            {
                o.writeInt(atlas.id);
                o.writeInt(atlas.unk);
                o.writeFloat(atlas.width);
                o.writeFloat(atlas.height);
            }
        }
コード例 #14
0
        void writeExtents(OutputBuffer o)
        {
            o.writeInt((int)TagType.Bounds);
            o.writeInt(bounds.Count * 4 + 1);
            o.writeInt(bounds.Count);

            foreach (var extent in bounds)
            {
                o.writeFloat(extent.left);
                o.writeFloat(extent.top);
                o.writeFloat(extent.right);
                o.writeFloat(extent.bottom);
            }
        }
コード例 #15
0
            public void Write(OutputBuffer o)
            {
                o.writeInt((int)TagType.Shape);
                o.writeInt(5);

                o.writeInt(id);
                o.writeInt(unk1);
                o.writeInt(boundingBoxID);
                o.writeInt(unk2);
                o.writeInt(graphics.Length);

                foreach (var graphic in graphics)
                {
                    graphic.Write(o);
                }
            }
コード例 #16
0
        void writeTransforms(OutputBuffer o)
        {
            o.writeInt((int)TagType.Transforms);
            o.writeInt(transforms.Count * 6 + 1);
            o.writeInt(transforms.Count);

            foreach (var transform in transforms)
            {
                o.writeFloat(transform.M11);
                o.writeFloat(transform.M12);
                o.writeFloat(transform.M21);
                o.writeFloat(transform.M22);
                o.writeFloat(transform.M31);
                o.writeFloat(transform.M32);
            }
        }
コード例 #17
0
 public void Write(OutputBuffer o)
 {
     o.writeInt(magic);
     o.writeInt(unk0);
     o.writeInt(unk1);
     o.writeInt(unk2);
     o.writeInt(unk3);
     o.writeInt(unk4);
     o.writeInt(unk5);
     o.writeInt(filesize);
     o.writeInt(unk6);
     o.writeInt(unk7);
     o.writeInt(unk8);
     o.writeInt(unk9);
     o.writeInt(unk10);
     o.writeInt(unk11);
     o.writeInt(unk12);
     o.writeInt(unk13);
 }
コード例 #18
0
                // NOTE: unlike other chunk write functions, this does not include the header
                // so it can be used for both frames and keyframes.
                public void Write(OutputBuffer o)
                {
                    o.writeInt(id);
                    o.writeInt(deletions.Count + actions.Count + placements.Count);

                    foreach (var deletion in deletions)
                    {
                        deletion.Write(o);
                    }

                    foreach (var action in actions)
                    {
                        action.Write(o);
                    }

                    foreach (var placement in placements)
                    {
                        placement.Write(o);
                    }
                }
コード例 #19
0
        public byte[] Rebuild()
        {
            OutputBuffer o = new OutputBuffer();

            // TODO: write correct filesize in header.
            // It isn't checked by the game, but what the hell, right?
            header.Write(o);

            writeSymbols(o);
            writeColors(o);
            writeTransforms(o);
            writePositions(o);
            writeExtents(o);
            actionscript.Write(o);
            writeAtlases(o);

            unkF008.Write(o);
            unkF009.Write(o);
            unkF00A.Write(o);
            unk000A.Write(o);
            unkF00B.Write(o);
            properties.Write(o);
            unkF00D.Write(o);

            writeShapes(o);
            writeMovieClips(o);
            writeTexts(o);
            //metadata.Write(o);

            o.writeInt((int)TagType.End);
            o.writeInt(0);

            int padSize = (4 - (o.Size % 4)) % 4;

            for (int i = 0; i < padSize; i++)
            {
                o.writeByte(0);
            }

            return(o.getBytes());
        }
コード例 #20
0
        void writeSymbols(OutputBuffer o)
        {
            OutputBuffer chunk = new OutputBuffer();

            chunk.writeInt(symbols.Count);

            foreach (var symbol in symbols)
            {
                chunk.writeInt(symbol.Length);
                chunk.writeString(symbol);

                int padSize = 4 - (chunk.Size % 4);
                for (int i = 0; i < padSize; i++)
                {
                    chunk.writeByte(0);
                }
            }

            o.writeInt((int)TagType.Symbols);
            o.writeInt(chunk.Size / 4);
            o.write(chunk);
        }
コード例 #21
0
            public void Write(OutputBuffer o)
            {
                o.writeInt((int)TagType.DefineEditText);
                o.writeInt(16);

                o.writeInt(id);
                o.writeInt(unk1);
                o.writeInt(placeholderTextId);
                o.writeInt(unk2);
                o.writeInt(colorId);
                o.writeInt(unk3);
                o.writeInt(unk4);
                o.writeInt(unk5);
                o.writeShort((short)alignment);
                o.writeShort(unk6);
                o.writeInt(unk7);
                o.writeInt(unk8);
                o.writeFloat(size);
                o.writeInt(unk9);
                o.writeInt(unk10);
                o.writeInt(unk11);
                o.writeInt(unk12);
            }
コード例 #22
0
 public void write(OutputBuffer d)
 {
     data.AddRange(d.data);
 }
コード例 #23
0
 public void Write(OutputBuffer o)
 {
     o.writeInt((int)type);
     o.writeInt(size);
     o.write(data);
 }