Пример #1
0
    // Request TEX blocks //
    private static void RequestAvailableTEXs(string mapName)
    {
        int X = (int)(min.x + ((max.x - min.x) / 2));
        int Y = (int)(min.x + ((max.x - min.x) / 2));
        int x, y, dx, dy;

        x  = y = dx = 0;
        dy = -1;
        int t    = Mathf.Max((int)max.x + 1, (int)max.y) + 1;
        int maxI = t * t;

        for (int i = 0; i < maxI; i++)
        {
            //if (((x + X) > 0) && ((x + X) < 128) && ((y + Y) > 0) && ((y + Y) < 128))
            //if ((-X / 2 <= x) && (x <= X / 2) && (-Y / 2 <= y) && (y <= Y / 2))
            if (((x + X) > 0) && ((x + X) < maxI) && ((y + Y) > 0) && ((y + Y) < maxI))
            {
                if (minimapAvailability[x + X, y + Y])
                {
                    MinimapRequest minimapRequest = new MinimapRequest();
                    minimapRequest.mapName = mapName;
                    minimapRequest.coords  = new Vector2(x + X, y + Y);
                    RequestBlock(minimapRequest);
                }
            }
            if ((x == y) || ((x < 0) && (x == -y)) || ((x > 0) && (x == 1 - y)))
            {
                t  = dx;
                dx = -dy;
                dy = t;
            }
            x += dx;
            y += dy;
        }
    }
Пример #2
0
    // Request a minimap image from the parser //
    private static void RequestBlock(MinimapRequest minimapRequest)
    {
        string mapName  = minimapRequest.mapName;
        int    x        = (int)minimapRequest.coords.x;
        int    y        = (int)minimapRequest.coords.y;
        string fileName = mapName + "." + x.ToString("X").ToLower() + y.ToString("X").ToLower() + ".tex";
        string path     = @"AIDX\Map\" + mapName + @"\" + fileName;

        if (DataManager.fileList.ContainsKey(path))
        {
            TexFile          texFile   = new TexFile();
            byte[]           data      = texFile.Read(path);
            MinimapBlockData blockData = new MinimapBlockData();
            blockData.mapName         = mapName;
            blockData.coords          = minimapRequest.coords;
            blockData.textureInfo     = texFile.header2;
            blockData.minimapByteData = data;
            MinimapDataQueue.Enqueue(blockData);
        }
    }