예제 #1
0
 public Shape(TreeNode node)
 {
     _node = node;
     _node.Tag = this;
     _width = 32;
     _height = 32;
     _hBound = 4;
     _vBound = 4;
     _type = TypesOfShape.Movement;
     _zones = new Zones();
     _sid = 0;
     _pixels = new Pixels(this);
     _pixels.CreatePixels(_width, _height);
 }
예제 #2
0
        private void CompileKFile(BinaryWriter stream, TreeNodeCollection nodes, TypesOfShape type)
        {
            Shape shape;
            int speedShapes;
            int accelShapes;
            Shape cShape;

            foreach(TreeNode node in nodes)
            {

                if(!(node.Tag is Shape))
                    continue;

                shape = (Shape)node.Tag;
                speedShapes = 0;
                accelShapes = 0;

                // If type is movement, any type will export
                //	otherwise, only export if the type specified
                //	is the type being tested now
                if(type != TypesOfShape.Movement)
                    if(type != shape.Type)
                        continue;

                foreach(TreeNode cnode in node.Nodes)
                    if(cnode.Tag is Shape)
                    {	cShape = (Shape)cnode.Tag;
                        if(cShape.Type == TypesOfShape.Speed)
                            speedShapes++;
                        else
                        if(cShape.Type == TypesOfShape.Acceleration)
                            accelShapes++;
                    }

                stream.Write((uint)shape.Type);
                stream.Write(shape.UseSID);
                stream.Write(shape.Width);
                stream.Write(shape.Width * shape.Height);
                stream.Write(shape.HBound);
                stream.Write(shape.VBound);
                stream.Write(shape.Zones.Count);
                stream.Write(speedShapes);
                stream.Write(accelShapes);
                stream.Write(shape.ZoneAnyStart);
                stream.Write(shape.ZoneReverse);
                stream.Write((byte)0);
                stream.Write((byte)0);

                CompileKFile(stream, shape.Zones);
                CompileKFile(stream, shape);

                // Export only speed shapes, followed by accel shapes
                //	(don't allow them to be interleaved)
                CompileKFile(stream, node.Nodes, TypesOfShape.Speed);
                CompileKFile(stream, node.Nodes, TypesOfShape.Acceleration);

            }
        }