Ejemplo n.º 1
0
Skies::Skies( int mapid )
{
	gLog( "Skies::Skies( %i );\n", mapid );

	numSkies = 0;
	cs = -1;
	stars = 0;

	for( DBCFile::Iterator i = gLightDB.begin(); i != gLightDB.end(); ++i )
	{
		if( mapid == i->getUInt( LightDB::Map ) )
		{
			Sky s( i );
			skies.push_back( s );
			numSkies++;
		}
	}

	// sort skies from smallest to largest; global last.
	// smaller skies will have precedence when calculating weights to achieve smooth transitions etc.
	std::sort( skies.begin( ), skies.end( ) );

	stars = new Model( "Environments\\Stars\\Stars.mdx", true );

}
Ejemplo n.º 2
0
void ExtractGameobjectModels()
{
    printf("Extracting GameObject models...");
    DBCFile dbc(LocaleMpq, "DBFilesClient\\GameObjectDisplayInfo.dbc");
    if(!dbc.open())
    {
        printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
        exit(1);
    }

    std::string basepath = szWorkDirWmo;
    basepath += "/";
    std::string path;

    FILE * model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");

    for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
    {
        path = it->getString(1);

        if (path.length() < 4)
            continue;

        FixNameCase((char*)path.c_str(), path.size());
        char * name = GetPlainName((char*)path.c_str());
        FixNameSpaces(name, strlen(name));

        char * ch_ext = GetExtension(name);
        if (!ch_ext)
            continue;

        strToLower(ch_ext);

        bool result = false;
        if (!strcmp(ch_ext, ".wmo"))
            result = ExtractSingleWmo(path);
        else if (!strcmp(ch_ext, ".mdl"))   // TODO: extract .mdl files, if needed
            continue;
        else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2"))
            result = ExtractSingleModel(path);

        if (result)
        {
            uint32 displayId = it->getUInt(0);
            uint32 path_length = strlen(name);
            fwrite(&displayId, sizeof(uint32), 1, model_list);
            fwrite(&path_length, sizeof(uint32), 1, model_list);
            fwrite(name, sizeof(char), path_length, model_list);
        }
    }

    fclose(model_list);

    printf("Done!\n");
}
Ejemplo n.º 3
0
Skies::Skies(unsigned int mapid)
{
    numSkies = 0;
    cs = -1;
    stars = 0;

    for (DBCFile::Iterator i = gLightDB.begin(); i != gLightDB.end(); ++i)
    {
        if (mapid == i->getUInt(LightDB::Map))
        {
            Sky s(i);
            skies.push_back(s);
            numSkies++;
        }
    }

    if (numSkies == 0)
    {
        for (DBCFile::Iterator i = gLightDB.begin(); i != gLightDB.end(); ++i)
        {
            if (0 == i->getUInt(LightDB::Map))
            {
                Sky s(i);
                skies.push_back(s);
                numSkies++;
                break;
            }
        }
    }



    // sort skies from smallest to largest; global last.
    // smaller skies will have precedence when calculating weights to achieve smooth transitions etc.
    std::sort(skies.begin(), skies.end());

    stars = ModelManager::add("Environments\\Stars\\Stars.mdx");
}
Ejemplo n.º 4
0
void Menu::createMapList()
{
	for (DBCFile::Iterator i = gMapDB.begin(); i != gMapDB.end(); ++i)
	{
		MapEntry e;
		e.mapID = i->getInt(MapDB::MapID);
		e.name = i->getLocalizedString(MapDB::Name);
		e.areaType = i->getUInt(MapDB::AreaType);
		if (e.areaType == 3) e.name = i->getString(MapDB::InternalName);

		if (e.areaType < 0 || e.areaType > 3 || !World::IsEditableWorld(e.mapID))
			continue;

		mMaps.push_back(e);
	}
}
Ejemplo n.º 5
0
void ExtractGameobjectModels()
{
    printf("\n");
    printf("Extracting GameObject models...\n");
    DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc");
    if (!dbc.open())
    {
        printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
        exit(1);
    }

    std::string basepath = szWorkDirWmo;
    basepath += "/";
    std::string path;
    StringSet failedPaths;

    FILE* model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");

    for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
    {
        path = it->getString(1);

        if (path.length() < 4)
            continue;

        fixnamen((char*)path.c_str(), path.size());
        char* name = GetPlainName((char*)path.c_str());
        fixname2(name, strlen(name));

        char* ch_ext = GetExtension(name);
        if (!ch_ext)
            continue;

        strToLower(ch_ext);

        bool result = false;
        if (!strcmp(ch_ext, ".wmo"))
        {
            result = ExtractSingleWmo(path);
        }
        else if (!strcmp(ch_ext, ".mdl"))
        {
            // TODO: extract .mdl files, if needed
            continue;
        }
        else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2"))
        {
            result = ExtractSingleModel(path, failedPaths);
        }

        if (result)
        {
            uint32 displayId = it->getUInt(0);
            uint32 path_length = strlen(name);
            fwrite(&displayId, sizeof(uint32), 1, model_list);
            fwrite(&path_length, sizeof(uint32), 1, model_list);
            fwrite(name, sizeof(char), path_length, model_list);
        }
    }

    fclose(model_list);

    if (!failedPaths.empty())
    {
        printf("Warning: Some models could not be extracted, see below\n");
        for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
            printf("Could not find file of model %s\n", itr->c_str());
        printf("A few of these warnings are expected to happen, so be not alarmed!\n");
    }

    printf("Done!\n");
}
Ejemplo n.º 6
0
void ExtractGameobjectModels(int iCoreNumber, const void *szRawVMAPMagic)
{
    printf("\n");
    printf("Extracting GameObject models...\n");
    DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc");
    if (!dbc.open())
    {
        printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
        exit(1);
    }

    std::string basepath = szWorkDirWmo;
    basepath += "/";
    std::string path;
    StringSet failedPaths;

    FILE* model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");

    for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
    {
        path = it->getString(1);

        if (path.length() < 4)
            { continue; }

        string name;

        string ch_ext = GetExtension(path);
        if (ch_ext.empty())
            { continue; }

        bool result = false;
        if (ch_ext == "wmo")
        {
            name = GetUniformName(path);
            result = ExtractSingleWmo(path, iCoreNumber, szRawVMAPMagic);
        }
        else
        {
            result = ExtractSingleModel(path, name, failedPaths, iCoreNumber, szRawVMAPMagic);
        }

        if (result && FileExists((basepath + name).c_str()))
        {
            uint32 displayId = it->getUInt(0);
            uint32 path_length = name.length();
            fwrite(&displayId, sizeof(uint32), 1, model_list);
            fwrite(&path_length, sizeof(uint32), 1, model_list);
            fwrite(name.c_str(), sizeof(char), path_length, model_list);
        }
    }

    fclose(model_list);

    if (!failedPaths.empty())
    {
        printf("\n Warning: Some models could not be extracted, see below\n");
        for (StringSet::const_iterator itr = failedPaths.begin(); itr != failedPaths.end(); ++itr)
            { printf(" Could not find file of model %s\n", itr->c_str()); }
        printf("\n A few of these warnings are expected to happen, so be not alarmed!\n");
    }

    printf("\n Asset Extraction Complete !\n");
}
Ejemplo n.º 7
0
void ExtractGameobjectModels(char* input_path)
{
    HANDLE localeFile;
    char localMPQ[512];

    sprintf(localMPQ, "%smisc.MPQ", input_path);
    if (FileExists(localMPQ)==false)
    {   // Use misc.mpq
        printf(localMPQ, "%s/Data/%s/locale-%s.MPQ", input_path);
    }
        
    if (!SFileOpenArchive(localMPQ, 0, MPQ_OPEN_READ_ONLY, &localeFile))
    {
        exit(1);
    }

    printf("Extracting GameObject models...");
    DBCFile dbc(localeFile, "DBFilesClient\\GameObjectDisplayInfo.dbc");
    if(!dbc.open())
    {
        printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
        exit(1);
    }

    std::string basepath = szWorkDirWmo;
    basepath += "/";
    std::string path;

    FILE * model_list = fopen((basepath + "temp_gameobject_models").c_str(), "wb");

    for (DBCFile::Iterator it = dbc.begin(); it != dbc.end(); ++it)
    {
        path = it->getString(1);

        if (path.length() < 4)
            continue;

        FixNameCase((char*)path.c_str(), path.size());
        char * name = GetPlainName((char*)path.c_str());
        FixNameSpaces(name, strlen(name));

        char * ch_ext = GetExtension(name);
        if (!ch_ext)
            continue;

        strToLower(ch_ext);

        bool result = false;
        if (!strcmp(ch_ext, ".wmo"))
            result = ExtractSingleWmo(path);
        else if (!strcmp(ch_ext, ".mdl"))   // TODO: extract .mdl files, if needed
            continue;
        else //if (!strcmp(ch_ext, ".mdx") || !strcmp(ch_ext, ".m2"))
            result = ExtractSingleModel(path);

        if (result)
        {
            uint32 displayId = it->getUInt(0);
            uint32 path_length = strlen(name);
            fwrite(&displayId, sizeof(uint32), 1, model_list);
            fwrite(&path_length, sizeof(uint32), 1, model_list);
            fwrite(name, sizeof(char), path_length, model_list);
        }
    }

    fclose(model_list);

    printf("Done!\n");
}