Пример #1
0
void ExtractMapsFromMpq(uint32 build, const int locale)
{
    char mpq_filename[1024];
    char output_filename[1024];
    char mpq_map_name[1024];

    printf("\nExtracting maps...\n");
    if (build==17520)
	{
		build = 18273;
	}

    uint32 map_count = ReadMapDBC(locale);

    ReadAreaTableDBC(locale);
    ReadLiquidTypeTableDBC(locale);

    std::string path = output_path;
    path += "/maps/";
    CreateDir(path);

    printf("Convert map files\n");
    for (uint32 z = 0; z < map_count; ++z)
    {
        printf("Extract %s (%d/%d)                  \n", map_ids[z].name, z + 1, map_count);
        // Loadup map grid data
        sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
        WDT_file wdt;
        if (!wdt.loadFile(mpq_map_name, false))
            continue;

        for (uint32 y = 0; y < WDT_MAP_SIZE; ++y)
        {
            for (uint32 x = 0; x < WDT_MAP_SIZE; ++x)
            {
                if (!wdt.main->adt_list[y][x].exist)
                    continue;

                sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
                sprintf(output_filename, "%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
                ConvertADT(mpq_filename, output_filename, y, x, build);
            }
            // draw progress bar
            printf("Processing........................%d%%\r", (100 * (y + 1)) / WDT_MAP_SIZE);
        }
    }
    delete [] areas;
    delete [] map_ids;
}
Пример #2
0
void ExtractMapsFromMpq(uint32 build)
{
    std::string mpqFileName;
    std::string outputFileName;
    std::string mpqMapName;

    printf("Extracting maps...\n");

    uint32 map_count = ReadMapDBC();

    ReadLiquidTypeTableDBC();

    std::string path = output_path;
    path += "/maps/";
    CreateDir(path);

    printf("Convert map files\n");
    for(uint32 z = 0; z < map_count; ++z)
    {
        printf("Extract %s (%d/%u)                  \n", map_ids[z].name, z+1, map_count);
        // Loadup map grid data

        mpqMapName = Trinity::StringFormat("World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
        WDT_file wdt;
        if (!wdt.loadFile(mpqMapName, false))
        {
//            printf("Error loading %s map wdt data\n", map_ids[z].name);
            continue;
        }

        for(uint32 y = 0; y < WDT_MAP_SIZE; ++y)
        {
            for(uint32 x = 0; x < WDT_MAP_SIZE; ++x)
            {
                if (!wdt.main->adt_list[y][x].exist)
                    continue;

                mpqFileName = Trinity::StringFormat("World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
                outputFileName = Trinity::StringFormat("%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
                ConvertADT(mpqFileName, outputFileName, y, x, build);
            }
            // draw progress bar
            printf("Processing........................%d%%\r", (100 * (y+1)) / WDT_MAP_SIZE);
        }
    }
    printf("\n");
    delete[] map_ids;
}
Пример #3
0
void ExtractMapsFromMpq()
{
    char mpq_filename[1024];
    char output_filename[1024];

    printf("Extracting maps...\n");

    uint32 map_count = ReadMapDBC();

    ReadAreaTableDBC();
    ReadLiquidTypeTableDBC();

    unsigned int total = map_count * ADT_RES * ADT_RES;
    unsigned int done = 0;

    std::string path = output_path;
    path += "/maps/";
    CreateDir(path);

    for(uint32 x = 0; x < ADT_RES; ++x)
    {
        for(uint32 y = 0; y < ADT_RES; ++y)
        {
            for(uint32 z = 0; z < map_count; ++z)
            {
                sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
                sprintf(output_filename, "%s/maps/%03u%02u%02u.map", output_path, map_ids[z].id, y, x);
                ConvertADT(mpq_filename, output_filename);
                done++;
            }
            // draw progress bar
            printf("Processing........................%d%%\r", (100 * done) / total);
        }
    }

    delete [] areas;
    delete [] map_ids;
}
Пример #4
0
void ExtractMapsFromMpq(uint32 build)
{
    char mpq_filename[1024];
    char output_filename[1024];
    char mpq_map_name[1024];

    printf("Extracting maps...\n");

    LoadMapMPQFiles();

    uint32 map_count = ReadMapDBC();

    ReadAreaTableDBC();
    ReadLiquidTypeTableDBC();

    std::string path = ".";
    path += "/maps/";
    CreateDir(path);

    std::vector<std::string> not_found;

    printf("Convert map files\n");
    HANDLE actualMPQ = WorldMPQ;
    for(uint32 z = 0; z < map_count; ++z)
    {
        // Loadup map grid data
        sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
        WDT_file wdt(mpq_map_name, actualMPQ);
        if (wdt.isEof())
        {
            if (actualMPQ == WorldMPQ)
            {
                z--;
                actualMPQ = ExpansionsMPQ[0];
                continue;
            }
            if (actualMPQ == ExpansionsMPQ[0])
            {
                z--;
                actualMPQ = ExpansionsMPQ[1];
                continue;
            }
            if (actualMPQ == ExpansionsMPQ[1])
            {
                z--;
                actualMPQ = ExpansionsMPQ[2];
                continue;
            }
            actualMPQ = WorldMPQ;
            not_found.push_back(map_ids[z].name);
            printf("Extract %s (%d/%d) -- not found\n", map_ids[z].name, z+1, map_count);
            continue;
        }
        if (actualMPQ == WorldMPQ)
            printf("Extract %s (%d/%d) -- World.MPQ\n", map_ids[z].name, z+1, map_count);
        if (actualMPQ == ExpansionsMPQ[0])
            printf("Extract %s (%d/%d) -- expansion1.MPQ\n", map_ids[z].name, z+1, map_count);
        if (actualMPQ == ExpansionsMPQ[1])
            printf("Extract %s (%d/%d) -- expansion2.MPQ\n", map_ids[z].name, z+1, map_count);
        if (actualMPQ == ExpansionsMPQ[2])
            printf("Extract %s (%d/%d) -- expansion3.MPQ\n", map_ids[z].name, z+1, map_count);
        actualMPQ = WorldMPQ;

        wdt.prepareLoadedData();

        for(uint32 y = 0; y < WDT_MAP_SIZE; ++y)
        {
            for(uint32 x = 0; x < WDT_MAP_SIZE; ++x)
            {
                if (!wdt.main->adt_list[y][x].exist)
                    continue;
                sprintf(mpq_filename, "World\\Maps\\%s\\%s_%u_%u.adt", map_ids[z].name, map_ids[z].name, x, y);
                sprintf(output_filename, "./maps/%03u%02u%02u.map", map_ids[z].id, y, x);
                ConvertADT(mpq_filename, output_filename, y, x, build, WorldMPQ);
            }
            // draw progress bar
            //printf("Processing........................%d%%\r", (100 * (y+1)) / WDT_MAP_SIZE);
        }
    }
    printf("\n");
    delete [] areas;
    delete [] map_ids;
    //printf("Map not extracted : %u\n", not_found.size());
    //for(int i = 0; i < not_found.size(); i++)
    //    printf("    %s\n", not_found[i].c_str());
}