示例#1
0
        public void Load(TileMatrixClient tileData, Map map)
        {
            // get data from the tile Matrix
            byte[] groundData = tileData.GetLandBlock(BlockX, BlockY);
            int staticLength;
            byte[] staticsData = tileData.GetStaticBlock(BlockX, BlockY, out staticLength);

            // load the ground data into the tiles.
            int groundDataIndex = 0;
            for (int i = 0; i < 64; i++)
            {
                int iTileID = groundData[groundDataIndex++] + (groundData[groundDataIndex++] << 8);
                int iTileZ = (sbyte)groundData[groundDataIndex++];

                Ground ground = new Ground(iTileID, map);
                ground.Position.Set((int)BlockX * 8 + i % 8, (int)BlockY * 8 + (i / 8), iTileZ);
            }

            // load the statics data into the tiles
            int countStatics = staticLength / 7;
            int staticDataIndex = 0;
            for (int i = 0; i < countStatics; i++)
            {
                int iTileID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
                int iX = staticsData[staticDataIndex++];
                int iY = staticsData[staticDataIndex++];
                int iTileZ = (sbyte)staticsData[staticDataIndex++];
                int hue = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256);

                StaticItem item = new StaticItem(iTileID, hue, i, map);
                item.Position.Set((int)BlockX * 8 + iX, (int)BlockY * 8 + iY, iTileZ);
            }
        }
示例#2
0
        private static sbyte[] m_Zs = new sbyte[64]; // shared between all instances of MiniMapBlock.

        #endregion Fields

        #region Constructors

        public MiniMapBlock(uint x, uint y, TileMatrixClient tileData)
        {
            X = x;
            Y = y;
            Colors = new uint[64];

            // get data from the tile Matrix
            byte[] groundData = tileData.GetLandBlock(x, y);
            int staticLength;
            byte[] staticsData = tileData.GetStaticBlock(x, y, out staticLength);

            // get the ground colors
            int groundDataIndex = 0;
            for (int i = 0; i < 64; i++)
            {
                Colors[i] = IO.RadarColorData.Colors[groundData[groundDataIndex++] + (groundData[groundDataIndex++] << 8)];
                m_Zs[i]= (sbyte)groundData[groundDataIndex++];
            }

            // get the static colors
            int countStatics = staticLength / 7;
            int staticDataIndex = 0;
            for (int i = 0; i < countStatics; i++)
            {
                int itemID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
                int tile = staticsData[staticDataIndex++] + staticsData[staticDataIndex++] * 8;
                sbyte z = (sbyte)staticsData[staticDataIndex++];
                int hue = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256); // is this used?

                ItemData data = TileData.ItemData[itemID];
                int iz = z + data.Height + (data.IsRoof || data.IsSurface ? 1 : 0);

                if ((x * 8 + (tile % 8) == 1480) && (y * 8 + (tile / 8) == 1608))
                {
                    if (iz > m_Zs[tile])
                    {
                        Colors[tile] = IO.RadarColorData.Colors[itemID + 0x4000];
                        m_Zs[tile] = (sbyte)iz;
                    }
                }

                if (iz > m_Zs[tile])
                {
                    Colors[tile] = IO.RadarColorData.Colors[itemID + 0x4000];
                    m_Zs[tile] = (sbyte)iz;
                }
            }
        }
示例#3
0
        private void ParseMapBlock(TileMatrixClient tileData, uint x, uint y)
        {
            byte[] groundData = tileData.GetLandBlock(x, y);
            int staticLength;
            byte[] staticsData = tileData.GetStaticBlock(x, y, out staticLength);

            // load the statics data
            int countStatics = staticLength / 7;
            int staticDataIndex = 0;
            for (int i = 0; i < countStatics; i++)
            {
                int iTileID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
                int iX = staticsData[staticDataIndex++];
                int iY = staticsData[staticDataIndex++];
                int iTileZ = (sbyte)staticsData[staticDataIndex++];
                int hue = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256);

                if (m_StaticCounts.ContainsKey(iTileID))
                    m_StaticCounts[iTileID]++;
                else
                    m_StaticCounts.Add(iTileID, 1);
            }
        }