Ejemplo n.º 1
0
        public TileMatrixData(uint index)
        {
            FileStream staticIndexStream;

            m_MapDataStream    = FileManager.GetFile("map{0}.mul", index);
            staticIndexStream  = FileManager.GetFile("staidx{0}.mul", index);
            m_StaticDataStream = FileManager.GetFile("statics{0}.mul", index);

            if (m_MapDataStream == null)
            {
                // the map we tried to load does not exist. Try alternate for felucca / trammel ?
                if (index == 1)
                {
                    uint trammel = 0;
                    m_MapDataStream    = FileManager.GetFile("map{0}.mul", trammel);
                    staticIndexStream  = FileManager.GetFile("staidx{0}.mul", trammel);
                    m_StaticDataStream = FileManager.GetFile("statics{0}.mul", trammel);
                }
                else
                {
                    Tracer.Critical("Unknown map index {0}", index);
                }
            }

            m_StaticIndexReader = new BinaryReader(staticIndexStream);

            ChunkHeight = m_MapChunkHeightList[index];
            ChunkWidth  = (uint)m_MapDataStream.Length / (ChunkHeight * m_SizeLandChunk);

            m_EmptyStaticsChunk       = new byte[0];
            m_InvalidLandChunk        = new byte[m_SizeLandChunkData];
            m_bufferedLandChunks_Keys = new uint[m_bufferedLandChunksMaxCount];
            m_bufferedLandChunks      = new byte[m_bufferedLandChunksMaxCount][];
            for (uint i = 0; i < m_bufferedLandChunksMaxCount; i++)
            {
                m_bufferedLandChunks[i] = new byte[m_SizeLandChunkData];
            }

            m_StaticTileLoadingBuffer = new byte[2048];

            m_Patch = new TileMatrixDataPatch(this, index);
        }
Ejemplo n.º 2
0
 public TileMatrixData(uint index)
 {
     MapIndex = index;
     // Map file fallback order: mapX.mul => mapXLegacyMUL.uop => (if trammel / map index 1) => map0.mul => mapXLegacyMUL.uop
     if (!LoadMapStream(MapIndex, out m_MapDataStream, out m_UOPIndex))
     {
         if (MapIndex == 1 && LoadMapStream(0, out m_MapDataStream, out m_UOPIndex))
         {
             Tracer.Debug("Map file for index 1 did not exist, successfully loaded index 0 instead.");
         }
         else
         {
             Tracer.Critical($"Unable to load map index {MapIndex}");
         }
     }
     ChunkHeight = MapChunkHeightList[MapIndex];
     ChunkWidth  = (uint)m_MapDataStream.Length / (ChunkHeight * SizeOfLandChunk);
     // load map patch and statics
     m_Patch = new TileMatrixDataPatch(this, MapIndex);
     if (!LoadStaticsStream(MapIndex, out m_StaticDataStream, out m_StaticIndexReader))
     {
         if (MapIndex == 1 && LoadStaticsStream(0, out m_StaticDataStream, out m_StaticIndexReader))
         {
             Tracer.Debug("Statics file for index 1 did not exist, successfully loaded index 0 instead.");
         }
         else
         {
             Tracer.Critical($"Unable to load static index {MapIndex}");
         }
     }
     // load buffers
     m_BufferedLandChunkKeys = new uint[CountBufferedLandChunk];
     m_BufferedLandChunks    = new byte[CountBufferedLandChunk][];
     for (uint i = 0; i < CountBufferedLandChunk; i++)
     {
         m_BufferedLandChunks[i] = new byte[SizeOfLandChunkData];
     }
     m_StaticTileLoadingBuffer = new byte[SizeOfInitialStaticTileLoadingBuffer];
 }
Ejemplo n.º 3
0
        public TileMatrixData(uint index)
        {
            FileStream staticIndexStream;

            var mapPath = FileManager.GetFilePath(String.Format("map{0}.mul", index));

            if (File.Exists(mapPath))
            {
                m_MapDataStream = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            }
            else
            {
                mapPath = FileManager.GetFilePath(String.Format("map{0}LegacyMUL.uop", index));

                if (File.Exists(mapPath))
                {
                    m_MapDataStream = new FileStream(mapPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    m_MapIndex      = new UOPIndex(m_MapDataStream);
                }
            }

            staticIndexStream  = FileManager.GetFile("staidx{0}.mul", index);
            m_StaticDataStream = FileManager.GetFile("statics{0}.mul", index);

            if (m_MapDataStream == null)
            {
                // the map we tried to load does not exist. Try alternate for felucca / trammel ?
                if (index == 1)
                {
                    uint trammel  = 0;
                    var  mapPath2 = FileManager.GetFilePath(String.Format("map{0}.mul", trammel));

                    if (File.Exists(mapPath2))
                    {
                        m_MapDataStream = new FileStream(mapPath2, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                    }
                    else
                    {
                        mapPath2 = FileManager.GetFilePath(String.Format("map{0}LegacyMUL.uop", trammel));

                        if (File.Exists(mapPath2))
                        {
                            m_MapDataStream = new FileStream(mapPath2, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
                            m_MapIndex      = new UOPIndex(m_MapDataStream);
                        }
                    }
                    staticIndexStream  = FileManager.GetFile("staidx{0}.mul", trammel);
                    m_StaticDataStream = FileManager.GetFile("statics{0}.mul", trammel);
                }
                else
                {
                    Tracer.Critical("Unknown map index {0}", index);
                }
            }

            m_StaticIndexReader = new BinaryReader(staticIndexStream);

            ChunkHeight = m_MapChunkHeightList[index];
            ChunkWidth  = (uint)m_MapDataStream.Length / (ChunkHeight * m_SizeLandChunk);

            m_EmptyStaticsChunk       = new byte[0];
            m_InvalidLandChunk        = new byte[m_SizeLandChunkData];
            m_bufferedLandChunks_Keys = new uint[m_bufferedLandChunksMaxCount];
            m_bufferedLandChunks      = new byte[m_bufferedLandChunksMaxCount][];
            for (uint i = 0; i < m_bufferedLandChunksMaxCount; i++)
            {
                m_bufferedLandChunks[i] = new byte[m_SizeLandChunkData];
            }

            m_StaticTileLoadingBuffer = new byte[2048];

            m_Patch = new TileMatrixDataPatch(this, index);
        }
Ejemplo n.º 4
0
        public TileMatrixData(uint index)
        {
            FileStream staticIndexStream;

            m_MapDataStream = FileManager.GetFile("map{0}.mul", index);
            staticIndexStream = FileManager.GetFile("staidx{0}.mul", index);
            m_StaticDataStream = FileManager.GetFile("statics{0}.mul", index);

            if (m_MapDataStream == null)
            {
                // the map we tried to load does not exist. Try alternate for felucca / trammel ?
                if (index == 1)
                {
                    uint trammel = 0;
                    m_MapDataStream = FileManager.GetFile("map{0}.mul", trammel);
                    staticIndexStream = FileManager.GetFile("staidx{0}.mul", trammel);
                    m_StaticDataStream = FileManager.GetFile("statics{0}.mul", trammel);
                }
                else
                {
                    Tracer.Critical("Unknown map index {0}", index);
                }
            }

            m_StaticIndexReader = new BinaryReader(staticIndexStream);

            ChunkHeight = m_MapChunkHeightList[index];
            ChunkWidth = (uint)m_MapDataStream.Length / (ChunkHeight * m_SizeLandChunk);

            m_EmptyStaticsChunk = new byte[0];
            m_InvalidLandChunk = new byte[m_SizeLandChunkData];
            m_bufferedLandChunks_Keys = new uint[m_bufferedLandChunksMaxCount];
            m_bufferedLandChunks = new byte[m_bufferedLandChunksMaxCount][];
            for (uint i = 0; i < m_bufferedLandChunksMaxCount; i++)
                m_bufferedLandChunks[i] = new byte[m_SizeLandChunkData];

            m_StaticTileLoadingBuffer = new byte[2048];

            m_Patch = new TileMatrixDataPatch(this, index);
        }