예제 #1
0
        private unsafe int PatchLand(TileMatrix matrix, string dataPath, string indexPath)
        {
            using (FileStream fileStream1 = new FileStream(dataPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using (FileStream fileStream2 = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    BinaryReader binaryReader = new BinaryReader((Stream)fileStream2);
                    int          num1         = (int)(binaryReader.BaseStream.Length / 4L);
                    for (int index = 0; index < num1; ++index)
                    {
                        int num2 = binaryReader.ReadInt32();
                        int x    = num2 / matrix.BlockHeight;
                        int y    = num2 % matrix.BlockHeight;
                        fileStream1.Seek(4L, SeekOrigin.Current);
                        Tile[] tileArray = new Tile[64];

                        fixed(Tile *tilePtr = &tileArray[0])
                        TileMatrixPatch._lread(fileStream1.Handle, (void *)tilePtr, 192);

                        matrix.SetLandBlock(x, y, tileArray);
                    }
                    return(num1);
                }
            }
        }
예제 #2
0
        public TileMatrix(int fileIndex, int mapID, int width, int height)
        {
            m_Width       = width;
            m_Height      = height;
            m_BlockWidth  = width >> 3;
            m_BlockHeight = height >> 3;

            if (fileIndex != 0x7F)
            {
                string mapPath = Client.GetFilePath("map{0}.mul", fileIndex);

                if (mapPath != null && File.Exists(mapPath))
                {
                    m_Map = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                }

                string indexPath = Client.GetFilePath("staidx{0}.mul", fileIndex);

                if (indexPath != null && File.Exists(indexPath))
                {
                    m_Index       = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                    m_IndexReader = new BinaryReader(m_Index);
                }

                string staticsPath = Client.GetFilePath("statics{0}.mul", fileIndex);

                if (staticsPath != null && File.Exists(staticsPath))
                {
                    m_Statics = new FileStream(staticsPath, FileMode.Open, FileAccess.Read, FileShare.Read);
                }
            }

            m_EmptyStaticBlock = new HuedTile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                m_EmptyStaticBlock[i] = new HuedTile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    m_EmptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            m_InvalidLandBlock = new Tile[196];

            m_LandTiles   = new Tile[m_BlockWidth][][];
            m_StaticTiles = new HuedTile[m_BlockWidth][][][][];

            m_Patch = new TileMatrixPatch(this, mapID);

            /*for ( int i = 0; i < m_BlockWidth; ++i )
             * {
             *      m_LandTiles[i] = new Tile[m_BlockHeight][];
             *      m_StaticTiles[i] = new Tile[m_BlockHeight][][][];
             * }*/
        }
 public TileMatrix(int fileIndex, int mapID, int width, int height)
 {
     this.m_Width = width;
     this.m_Height = height;
     this.m_BlockWidth = width >> 3;
     this.m_BlockHeight = height >> 3;
     if (fileIndex != 127)
     {
         object[] objArray = new object[] { fileIndex };
         string filePath = Client.GetFilePath("map{0}.mul", objArray);
         if (filePath != null)
         {
             this.m_Map = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
         }
         objArray = new object[] { fileIndex };
         string str = Client.GetFilePath("staidx{0}.mul", objArray);
         if (str != null)
         {
             this.m_Index = new FileStream(str, FileMode.Open, FileAccess.Read, FileShare.Read);
             this.m_IndexReader = new BinaryReader(this.m_Index);
         }
         objArray = new object[] { fileIndex };
         string filePath1 = Client.GetFilePath("statics{0}.mul", objArray);
         if (filePath1 != null)
         {
             this.m_Statics = new FileStream(filePath1, FileMode.Open, FileAccess.Read, FileShare.Read);
         }
     }
     this.m_EmptyStaticBlock = new HuedTile[8][][];
     for (int i = 0; i < 8; i++)
     {
         this.m_EmptyStaticBlock[i] = new HuedTile[8][];
         for (int j = 0; j < 8; j++)
         {
             this.m_EmptyStaticBlock[i][j] = new HuedTile[0];
         }
     }
     this.m_InvalidLandBlock = new Tile[196];
     this.m_LandTiles = new Tile[this.m_BlockWidth][][];
     this.m_StaticTiles = new HuedTile[this.m_BlockWidth][][][][];
     this.m_Patch = new TileMatrixPatch(this, mapID);
 }
예제 #4
0
 public TileMatrix(int fileIndex, int mapID, int width, int height)
 {
     this.m_Width       = width;
     this.m_Height      = height;
     this.m_BlockWidth  = width >> 3;
     this.m_BlockHeight = height >> 3;
     if (fileIndex != 127)
     {
         object[] objArray = new object[] { fileIndex };
         string   filePath = Client.GetFilePath("map{0}.mul", objArray);
         if (filePath != null)
         {
             this.m_Map = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
         }
         objArray = new object[] { fileIndex };
         string str = Client.GetFilePath("staidx{0}.mul", objArray);
         if (str != null)
         {
             this.m_Index       = new FileStream(str, FileMode.Open, FileAccess.Read, FileShare.Read);
             this.m_IndexReader = new BinaryReader(this.m_Index);
         }
         objArray = new object[] { fileIndex };
         string filePath1 = Client.GetFilePath("statics{0}.mul", objArray);
         if (filePath1 != null)
         {
             this.m_Statics = new FileStream(filePath1, FileMode.Open, FileAccess.Read, FileShare.Read);
         }
     }
     this.m_EmptyStaticBlock = new HuedTile[8][][];
     for (int i = 0; i < 8; i++)
     {
         this.m_EmptyStaticBlock[i] = new HuedTile[8][];
         for (int j = 0; j < 8; j++)
         {
             this.m_EmptyStaticBlock[i][j] = new HuedTile[0];
         }
     }
     this.m_InvalidLandBlock = new Tile[196];
     this.m_LandTiles        = new Tile[this.m_BlockWidth][][];
     this.m_StaticTiles      = new HuedTile[this.m_BlockWidth][][][][];
     this.m_Patch            = new TileMatrixPatch(this, mapID);
 }
예제 #5
0
 public TileMatrix(int fileIndex, int mapID, int width, int height)
 {
     this.m_Width       = width;
     this.m_Height      = height;
     this.m_BlockWidth  = width >> 3;
     this.m_BlockHeight = height >> 3;
     if (fileIndex != (int)sbyte.MaxValue)
     {
         string filePath1 = Client.GetFilePath("map{0}.mul", (object)fileIndex);
         if (filePath1 != null)
         {
             this.m_Map = new FileStream(filePath1, FileMode.Open, FileAccess.Read, FileShare.Read);
         }
         string filePath2 = Client.GetFilePath("staidx{0}.mul", (object)fileIndex);
         if (filePath2 != null)
         {
             this.m_Index       = new FileStream(filePath2, FileMode.Open, FileAccess.Read, FileShare.Read);
             this.m_IndexReader = new BinaryReader((Stream)this.m_Index);
         }
         string filePath3 = Client.GetFilePath("statics{0}.mul", (object)fileIndex);
         if (filePath3 != null)
         {
             this.m_Statics = new FileStream(filePath3, FileMode.Open, FileAccess.Read, FileShare.Read);
         }
     }
     this.m_EmptyStaticBlock = new HuedTile[8][][];
     for (int index1 = 0; index1 < 8; ++index1)
     {
         this.m_EmptyStaticBlock[index1] = new HuedTile[8][];
         for (int index2 = 0; index2 < 8; ++index2)
         {
             this.m_EmptyStaticBlock[index1][index2] = new HuedTile[0];
         }
     }
     this.m_InvalidLandBlock = new Tile[196];
     this.m_LandTiles        = new Tile[this.m_BlockWidth][][];
     this.m_StaticTiles      = new HuedTile[this.m_BlockWidth][][][][];
     this.m_Patch            = new TileMatrixPatch(this, mapID);
 }
예제 #6
0
 private int PatchLand(TileMatrix matrix, string dataPath, string indexPath)
 {
     unsafe
     {
         int num;
         using (FileStream fileStream = new FileStream(dataPath, FileMode.Open, FileAccess.Read, FileShare.Read))
         {
             using (FileStream fileStream1 = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read))
             {
                 BinaryReader binaryReader = new BinaryReader(fileStream1);
                 int          length       = (int)(binaryReader.BaseStream.Length / (long)4);
                 for (int i = 0; i < length; i++)
                 {
                     int num1         = binaryReader.ReadInt32();
                     int blockHeight  = num1 / matrix.BlockHeight;
                     int blockHeight1 = num1 % matrix.BlockHeight;
                     fileStream.Seek((long)4, SeekOrigin.Current);
                     Tile[] tileArray = new Tile[64];
                     try
                     {
                         fixed(Tile *tilePointer = &tileArray[0])
                         {
                             TileMatrixPatch._lread(fileStream.Handle, tilePointer, 192);
                         }
                     }
                     finally
                     {
                         tilePointer = null;
                     }
                     matrix.SetLandBlock(blockHeight, blockHeight1, tileArray);
                 }
                 num = length;
             }
         }
         return(num);
     }
 }
예제 #7
0
        public TileMatrix(int fileIndex, int mapID, int width, int height, string path)
        {
            Width       = width;
            Height      = height;
            BlockWidth  = width >> 3;
            BlockHeight = height >> 3;


            if (path == null)
            {
                mapPath = Files.GetFilePath("map{0}.mul", fileIndex);

                if (String.IsNullOrEmpty(mapPath) || !File.Exists(mapPath))
                {
                    mapPath = Files.GetFilePath("map{0}LegacyMUL.uop", fileIndex);
                }

                if (mapPath != null && mapPath.EndsWith(".uop"))
                {
                    IsUOPFormat = true;
                }

                // For shards that use Fel and Tram before the split
                if (String.IsNullOrEmpty(mapPath) || (!File.Exists(mapPath) && fileIndex == 1))
                {
                    fileIndex = 0;
                    mapPath   = Files.GetFilePath("map{0}.mul", fileIndex);
                }
            }
            else
            {
                mapPath = Path.Combine(path, String.Format("map{0}.mul", fileIndex));

                if (!File.Exists(mapPath))
                {
                    mapPath = Path.Combine(path, String.Format("map{0}LegacyMUL.uop", fileIndex));
                }

                if (!File.Exists(mapPath))
                {
                    mapPath = null;
                }
                else if (mapPath != null && mapPath.EndsWith(".uop"))
                {
                    IsUOPFormat = true;
                }
            }

            if (mapPath != null && fileIndex == 0)
            {
                FileInfo fi = new FileInfo(mapPath);
                if (fi.Length < 89915392)
                {
                    // Old map size.
                    Width = 6144;
                }
            }

            if (path == null)
            {
                indexPath = Files.GetFilePath("staidx{0}.mul", fileIndex);
            }
            else
            {
                indexPath = Path.Combine(path, String.Format("staidx{0}.mul", fileIndex));
                if (!File.Exists(indexPath))
                {
                    indexPath = null;
                }
            }

            if (path == null)
            {
                staticsPath = Files.GetFilePath("statics{0}.mul", fileIndex);
            }
            else
            {
                staticsPath = Path.Combine(path, String.Format("statics{0}.mul", fileIndex));
                if (!File.Exists(staticsPath))
                {
                    staticsPath = null;
                }
            }

            EmptyStaticBlock = new HuedTile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                EmptyStaticBlock[i] = new HuedTile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    EmptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            InvalidLandBlock = new Tile[196];

            m_LandTiles   = new Tile[BlockWidth][][];
            m_StaticTiles = new HuedTile[BlockWidth][][][][];

            Patch = new TileMatrixPatch(this, mapID, path);
        }
예제 #8
0
        public TileMatrix(int fileIndex, int mapID, int width, int height, string path)
        {
            Width       = width;
            Height      = height;
            BlockWidth  = width >> 3;
            BlockHeight = height >> 3;

            if (path == null)
            {
                mapPath = Files.GetFilePath("map{0}.mul", fileIndex);
                if (String.IsNullOrEmpty(mapPath) || !File.Exists(mapPath))
                {
                    mapPath = Files.GetFilePath("map{0}LegacyMUL.uop", fileIndex);
                }

                if (mapPath != null && mapPath.EndsWith(".uop"))
                {
                    IsUOPFormat = true;
                }
            }
            else
            {
                mapPath = Path.Combine(path, String.Format("map{0}.mul", fileIndex));
                if (!File.Exists(mapPath))
                {
                    mapPath = Path.Combine(path, String.Format("map{0}LegacyMUL.uop", fileIndex));
                }
                if (!File.Exists(mapPath))
                {
                    mapPath = null;
                }
                else if (mapPath != null && mapPath.EndsWith(".uop"))
                {
                    IsUOPFormat = true;
                }
            }

            if (path == null)
            {
                indexPath = Files.GetFilePath("staidx{0}.mul", fileIndex);
            }
            else
            {
                indexPath = Path.Combine(path, String.Format("staidx{0}.mul", fileIndex));
                if (!File.Exists(indexPath))
                {
                    indexPath = null;
                }
            }

            if (path == null)
            {
                staticsPath = Files.GetFilePath("statics{0}.mul", fileIndex);
            }
            else
            {
                staticsPath = Path.Combine(path, String.Format("statics{0}.mul", fileIndex));
                if (!File.Exists(staticsPath))
                {
                    staticsPath = null;
                }
            }

            EmptyStaticBlock = new HuedTile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                EmptyStaticBlock[i] = new HuedTile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    EmptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            InvalidLandBlock = new Tile[196];

            m_LandTiles   = new Tile[BlockWidth][][];
            m_StaticTiles = new HuedTile[BlockWidth][][][][];

            Patch = new TileMatrixPatch(this, mapID, path);
        }
예제 #9
0
		public TileMatrix(int fileIndex, int mapID, int width, int height, string path)
		{
			Width = width;
			Height = height;
			BlockWidth = width >> 3;
			BlockHeight = height >> 3;

			if (path == null)
			{
				mapPath = Files.GetFilePath("map{0}.mul", fileIndex);

				if (String.IsNullOrEmpty(mapPath) || !File.Exists(mapPath))
				{
					mapPath = Files.GetFilePath("map{0}LegacyMUL.uop", fileIndex);
				}

				if (mapPath != null && mapPath.EndsWith(".uop"))
				{
					IsUOPFormat = true;
				}
			}
			else
			{
				mapPath = Path.Combine(path, String.Format("map{0}.mul", fileIndex));

				if (!File.Exists(mapPath))
				{
					mapPath = Path.Combine(path, String.Format("map{0}LegacyMUL.uop", fileIndex));
				}

				if (!File.Exists(mapPath))
				{
					mapPath = null;
				}
				else if (mapPath != null && mapPath.EndsWith(".uop"))
				{
					IsUOPFormat = true;
				}
			}

			if (path == null)
			{
				indexPath = Files.GetFilePath("staidx{0}.mul", fileIndex);
			}
			else
			{
				indexPath = Path.Combine(path, String.Format("staidx{0}.mul", fileIndex));
				if (!File.Exists(indexPath))
				{
					indexPath = null;
				}
			}

			if (path == null)
			{
				staticsPath = Files.GetFilePath("statics{0}.mul", fileIndex);
			}
			else
			{
				staticsPath = Path.Combine(path, String.Format("statics{0}.mul", fileIndex));
				if (!File.Exists(staticsPath))
				{
					staticsPath = null;
				}
			}

			EmptyStaticBlock = new HuedTile[8][][];

			for (int i = 0; i < 8; ++i)
			{
				EmptyStaticBlock[i] = new HuedTile[8][];

				for (int j = 0; j < 8; ++j)
				{
					EmptyStaticBlock[i][j] = new HuedTile[0];
				}
			}

			InvalidLandBlock = new Tile[196];

			m_LandTiles = new Tile[BlockWidth][][];
			m_StaticTiles = new HuedTile[BlockWidth][][][][];

			Patch = new TileMatrixPatch(this, mapID, path);
		}
예제 #10
0
        private unsafe int PatchStatics(TileMatrix matrix, string dataPath, string indexPath, string lookupPath)
        {
            int num;

            using (FileStream fileStream = new FileStream(dataPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using (FileStream fileStream1 = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    using (FileStream fileStream2 = new FileStream(lookupPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        BinaryReader     binaryReader  = new BinaryReader(fileStream1);
                        BinaryReader     binaryReader1 = new BinaryReader(fileStream2);
                        int              length        = (int)(binaryReader.BaseStream.Length / (long)4);
                        HuedTileList[][] huedTileList  = new HuedTileList[8][];
                        for (int i = 0; i < 8; i++)
                        {
                            huedTileList[i] = new HuedTileList[8];
                            for (int j = 0; j < 8; j++)
                            {
                                huedTileList[i][j] = new HuedTileList();
                            }
                        }
                        for (int k = 0; k < length; k++)
                        {
                            int num1         = binaryReader.ReadInt32();
                            int blockHeight  = num1 / matrix.BlockHeight;
                            int blockHeight1 = num1 % matrix.BlockHeight;
                            int num2         = binaryReader1.ReadInt32();
                            int num3         = binaryReader1.ReadInt32();
                            binaryReader1.ReadInt32();
                            if (num2 < 0 || num3 <= 0)
                            {
                                matrix.SetStaticBlock(blockHeight, blockHeight1, matrix.EmptyStaticBlock);
                            }
                            else
                            {
                                fileStream.Seek((long)num2, SeekOrigin.Begin);
                                int          num4            = num3 / 7;
                                StaticTile[] staticTileArray = new StaticTile[num4];
                                try
                                {
                                    fixed(StaticTile *staticTilePointer = &staticTileArray[0])
                                    {
                                        TileMatrixPatch._lread(fileStream.Handle, staticTilePointer, num3);
                                        StaticTile *staticTilePointer1 = staticTilePointer;
                                        StaticTile *staticTilePointer2 = staticTilePointer + num4 * sizeof(StaticTile);

                                        while (staticTilePointer1 < staticTilePointer2)
                                        {
                                            huedTileList[(*staticTilePointer1).m_X & 7][(*staticTilePointer1).m_Y & 7].Add((short)(((*staticTilePointer1).m_ID & 16383) + 16384), (*staticTilePointer1).m_Hue, (*staticTilePointer1).m_Z);
                                            staticTilePointer1 = staticTilePointer1 + sizeof(StaticTile);
                                        }
                                        HuedTile[][][] array = new HuedTile[8][][];
                                        for (int l = 0; l < 8; l++)
                                        {
                                            array[l] = new HuedTile[8][];
                                            for (int m = 0; m < 8; m++)
                                            {
                                                array[l][m] = huedTileList[l][m].ToArray();
                                            }
                                        }
                                        matrix.SetStaticBlock(blockHeight, blockHeight1, array);
                                    }
                                }
                                finally
                                {
                                    staticTilePointer = null;
                                }
                            }
                        }
                        num = length;
                    }
                }
            }
            return(num);
        }
예제 #11
0
        public TileMatrix(int fileIndex, int mapID, int width, int height, string path)
        {
            Width = width;
            Height = height;
            BlockWidth = width >> 3;
            BlockHeight = height >> 3;

            if (path == null)
                mapPath = Files.GetFilePath("map{0}.mul", fileIndex);
            else
            {
                mapPath = Path.Combine(path, String.Format("map{0}.mul", fileIndex));
                if (!File.Exists(mapPath))
                    mapPath = null;
            }

            if (path == null)
                indexPath = Files.GetFilePath("staidx{0}.mul", fileIndex);
            else
            {
                indexPath = Path.Combine(path, String.Format("staidx{0}.mul", fileIndex));
                if (!File.Exists(indexPath))
                    indexPath = null;
            }

            if (path == null)
                staticsPath = Files.GetFilePath("statics{0}.mul", fileIndex);
            else
            {
                staticsPath = Path.Combine(path, String.Format("statics{0}.mul", fileIndex));
                if (!File.Exists(staticsPath))
                    staticsPath = null;
            }

            EmptyStaticBlock = new HuedTile[8][][];

            for (int i = 0; i < 8; ++i)
            {
                EmptyStaticBlock[i] = new HuedTile[8][];

                for (int j = 0; j < 8; ++j)
                {
                    EmptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            InvalidLandBlock = new Tile[196];

            m_LandTiles = new Tile[BlockWidth][][];
            m_StaticTiles = new HuedTile[BlockWidth][][][][];

            Patch = new TileMatrixPatch(this, mapID, path);
        }
예제 #12
0
        private unsafe int PatchStatics(TileMatrix matrix, string dataPath, string indexPath, string lookupPath)
        {
            using (FileStream fileStream1 = new FileStream(dataPath, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using (FileStream fileStream2 = new FileStream(indexPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                {
                    using (FileStream fileStream3 = new FileStream(lookupPath, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        BinaryReader     binaryReader1     = new BinaryReader((Stream)fileStream2);
                        BinaryReader     binaryReader2     = new BinaryReader((Stream)fileStream3);
                        int              num1              = (int)(binaryReader1.BaseStream.Length / 4L);
                        HuedTileList[][] huedTileListArray = new HuedTileList[8][];
                        for (int index1 = 0; index1 < 8; ++index1)
                        {
                            huedTileListArray[index1] = new HuedTileList[8];
                            for (int index2 = 0; index2 < 8; ++index2)
                            {
                                huedTileListArray[index1][index2] = new HuedTileList();
                            }
                        }
                        for (int index1 = 0; index1 < num1; ++index1)
                        {
                            int num2   = binaryReader1.ReadInt32();
                            int x      = num2 / matrix.BlockHeight;
                            int y      = num2 % matrix.BlockHeight;
                            int num3   = binaryReader2.ReadInt32();
                            int wBytes = binaryReader2.ReadInt32();
                            binaryReader2.ReadInt32();
                            if (num3 < 0 || wBytes <= 0)
                            {
                                matrix.SetStaticBlock(x, y, matrix.EmptyStaticBlock);
                            }
                            else
                            {
                                fileStream1.Seek((long)num3, SeekOrigin.Begin);
                                int          length          = wBytes / 7;
                                StaticTile[] staticTileArray = new StaticTile[length];
                                fixed(StaticTile *staticTilePtr1 = &staticTileArray[0])
                                {
                                    TileMatrixPatch._lread(fileStream1.Handle, (void *)staticTilePtr1, wBytes);
                                    StaticTile *staticTilePtr2 = staticTilePtr1;

                                    for (StaticTile *staticTilePtr3 = staticTilePtr1 + length; staticTilePtr2 < staticTilePtr3; ++staticTilePtr2)
                                    {
                                        huedTileListArray[(int)staticTilePtr2->m_X & 7][(int)staticTilePtr2->m_Y & 7].Add((short)(((int)staticTilePtr2->m_ID & 16383) + 16384), staticTilePtr2->m_Hue, staticTilePtr2->m_Z);
                                    }
                                    HuedTile[][][] huedTileArray = new HuedTile[8][][];
                                    for (int index2 = 0; index2 < 8; ++index2)
                                    {
                                        huedTileArray[index2] = new HuedTile[8][];
                                        for (int index3 = 0; index3 < 8; ++index3)
                                        {
                                            huedTileArray[index2][index3] = huedTileListArray[index2][index3].ToArray();
                                        }
                                    }
                                    matrix.SetStaticBlock(x, y, huedTileArray);
                                }
                            }
                        }
                        return(num1);
                    }
                }
            }
        }
예제 #13
0
        public TileMatrix( int fileIndex, int mapID, int width, int height )
        {
            m_Width = width;
            m_Height = height;
            m_BlockWidth = width >> 3;
            m_BlockHeight = height >> 3;

            if ( fileIndex != 0x7F )
            {
                string mapPath = Client.GetFilePath( "map{0}.mul", fileIndex );

                if ( mapPath != null && File.Exists( mapPath ) )
                    m_Map = new FileStream( mapPath, FileMode.Open, FileAccess.Read, FileShare.Read );

                string indexPath = Client.GetFilePath( "staidx{0}.mul", fileIndex );

                if ( indexPath != null && File.Exists( indexPath ) )
                {
                    m_Index = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.Read );
                    m_IndexReader = new BinaryReader( m_Index );
                }

                string staticsPath = Client.GetFilePath( "statics{0}.mul", fileIndex );

                if ( staticsPath != null && File.Exists( staticsPath ) )
                    m_Statics = new FileStream( staticsPath, FileMode.Open, FileAccess.Read, FileShare.Read );
            }

            m_EmptyStaticBlock = new HuedTile[8][][];

            for ( int i = 0; i < 8; ++i )
            {
                m_EmptyStaticBlock[i] = new HuedTile[8][];

                for ( int j = 0; j < 8; ++j )
                {
                    m_EmptyStaticBlock[i][j] = new HuedTile[0];
                }
            }

            m_InvalidLandBlock = new Tile[196];

            m_LandTiles = new Tile[m_BlockWidth][][];
            m_StaticTiles = new HuedTile[m_BlockWidth][][][][];

            m_Patch = new TileMatrixPatch( this, mapID );

            /*for ( int i = 0; i < m_BlockWidth; ++i )
            {
                m_LandTiles[i] = new Tile[m_BlockHeight][];
                m_StaticTiles[i] = new Tile[m_BlockHeight][][][];
            }*/
        }