示例#1
0
文件: Map.cs 项目: msx752/ClassicUO
        public static unsafe RadarMapBlock?GetRadarMapBlock(int map, int blockX, int blockY)
        {
            IndexMap indexMap = GetIndex(map, blockX, blockY);

            if (indexMap.MapAddress == 0)
            {
                return(null);
            }
            MapBlock *mp    = (MapBlock *)indexMap.MapAddress;
            MapCells *cells = (MapCells *)&mp->Cells;

            RadarMapBlock mb = new RadarMapBlock
            {
                Cells = new RadarMapcells[8, 8]
            };

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    ref MapCells      cell    = ref cells[y * 8 + x];
                    ref RadarMapcells outcell = ref mb.Cells[x, y];
                    outcell.Graphic = cell.TileID;
                    outcell.Z       = cell.Z;
                    outcell.IsLand  = true;
                }
示例#2
0
文件: Map.cs 项目: broem/ClassicUO
        public static unsafe RadarMapBlock?GetRadarMapBlock(int map, int blockX, int blockY)
        {
            IndexMap indexMap = GetIndex(map, blockX, blockY);

            if (indexMap == null || indexMap.MapAddress == 0)
            {
                return(null);
            }
            MapBlock      block = Marshal.PtrToStructure <MapBlock>((IntPtr)indexMap.MapAddress);
            RadarMapBlock mb    = new RadarMapBlock();

            mb.Cells = new RadarMapcells[8, 8];

            for (int x = 0; x < 8; x++)
            {
                for (int y = 0; y < 8; y++)
                {
                    ref MapCells      cell    = ref block.Cells[y * 8 + x];
                    ref RadarMapcells outcell = ref mb.Cells[x, y];
                    outcell.Graphic = cell.TileID;
                    outcell.Z       = cell.Z;
                    outcell.IsLand  = true;
                }