コード例 #1
0
ファイル: Node.cs プロジェクト: SlOneRPC/RPF-Converter
        public void WriteXml(StringBuilder sb, int indent, byte[] allHeightmapData)
        {
            Vector2 p = new Vector2();

            p.X = PositionX / 4.0f;
            p.Y = PositionY / 4.0f;
            float minz = MinZ / 32.0f;
            float maxz = MaxZ / 32.0f;

            YndXml.SelfClosingTag(sb, indent, "Position " + FloatUtil.GetVector2XmlString(p));
            YndXml.ValueTag(sb, indent, "MinZ", FloatUtil.ToString(minz));
            YndXml.ValueTag(sb, indent, "MaxZ", FloatUtil.ToString(maxz));
            YndXml.ValueTag(sb, indent, "SizeX", HeightmapDimX.ToString());
            YndXml.ValueTag(sb, indent, "SizeY", HeightmapDimY.ToString());

            byte[] hmdata   = null;
            int    hmbcount = HeightmapDimX * HeightmapDimY;

            if (hmbcount > 0)
            {
                hmdata = new byte[hmbcount];
                Buffer.BlockCopy(allHeightmapData, HeightmapPtr, hmdata, 0, hmbcount);
            }
            YndXml.WriteRawArray(sb, hmdata, indent, "Heightmap", "", RelXml.FormatHexByte, Math.Max(HeightmapDimX, (byte)1));
        }
コード例 #2
0
ファイル: Node.cs プロジェクト: SlOneRPC/RPF-Converter
        public void WriteXml(StringBuilder sb, int indent, NodeLink[] allLinks)
        {
            Vector3 p = new Vector3();

            p.X = PositionX / 4.0f;
            p.Y = PositionY / 4.0f;
            p.Z = PositionZ / 32.0f;
            int linkCount    = LinkCountFlags.Value >> 3;
            int linkCountUnk = LinkCountFlags.Value & 7;

            YndXml.ValueTag(sb, indent, "AreaID", AreaID.ToString());
            YndXml.ValueTag(sb, indent, "NodeID", NodeID.ToString());
            YndXml.StringTag(sb, indent, "StreetName", YndXml.HashString(StreetName));
            YndXml.SelfClosingTag(sb, indent, "Position " + FloatUtil.GetVector3XmlString(p));
            YndXml.ValueTag(sb, indent, "Flags0", Flags0.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags1", Flags1.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags2", Flags2.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags3", Flags3.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags4", Flags4.Value.ToString());
            YndXml.ValueTag(sb, indent, "Flags5", linkCountUnk.ToString());

            NodeLink[] links = null;
            if (linkCount > 0)
            {
                links = new NodeLink[linkCount];
                for (int i = 0; i < linkCount; i++)
                {
                    links[i] = allLinks[LinkID + i];
                }
            }
            YndXml.WriteItemArray(sb, links, indent, "Links");
        }