示例#1
0
        public void Load(TileMatrixRaw tileData, Map map)
        {
            // get data from the tile Matrix
            byte[] groundData  = tileData.GetLandBlock(X, Y);
            byte[] staticsData = tileData.GetStaticBlock(X, Y);

            // 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(X * 8 + i % 8, Y * 8 + (i / 8), iTileZ);
            }

            // load the statics data into the tiles
            int countStatics    = staticsData.Length / 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(X * 8 + iX, Y * 8 + iY, iTileZ);
            }
        }
示例#2
0
        public Map(int index)
        {
            Index = index;

            m_MapData = new TileMatrixRaw(Index, Index);
            Height    = m_MapData.Height;
            Width     = m_MapData.Width;

            m_Blocks = new MapBlock[c_CellsInMemorySpan * c_CellsInMemorySpan];
        }