コード例 #1
0
ファイル: vmapexport.cpp プロジェクト: FirstCore/Battle_2.4.3
int main(int argc, char ** argv)
{
    bool success=true;
    const char *versionString = "V3.00 2010_07";

    // Use command line arguments, when some
    if (!processArgv(argc, argv, versionString))
        return 1;

    // some simple check if working dir is dirty
    else
    {
        std::string sdir = std::string(szWorkDirWmo) + "/dir";
        std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin";
        struct stat status;
        if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status))
        {
            printf("Your output directory seems to be polluted, please use an empty directory!\n");
            printf("<press return to exit>");
            char garbage[2];
            return scanf("%c", garbage);
        }
    }

    printf("Extract %s. Beginning work ....\n",versionString);
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // Create the working directory
    if (mkdir(szWorkDirWmo
#ifdef __linux__
                    , 0711
#endif
                    ))
            success = (errno == EEXIST);

    // prepare archive name list
    std::vector<std::string> archiveNames;
    fillArchiveNameVector(archiveNames);
    for (size_t i = 0; i < archiveNames.size(); ++i)
    {
        MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());
        if (!gOpenArchives.size() || gOpenArchives.front() != archive)
            delete archive;
    }

    if (gOpenArchives.empty())
    {
        printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
        return 1;
    }

    // extract data
    if (success)
        success = ExtractWmo();

    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    //map.dbc
    if (success)
    {
        DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
        if (!dbc->open())
        {
            delete dbc;
            printf("FATAL ERROR: Map.dbc not found in data file.\n");
            return 1;
        }
        map_count=dbc->getRecordCount ();
        map_ids=new map_id[map_count];
        for (unsigned int x = 0; x < map_count; ++x)
        {
            map_ids[x].id=dbc->getRecord (x).getUInt(0);
            strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
            printf("Map - %s\n",map_ids[x].name);
        }


        delete dbc;
        ParsMapFiles();
        delete[] map_ids;
        //nError = ERROR_SUCCESS;
    }

    printf("\n");
    if (!success)
    {
        printf("ERROR: Extract %s. Work NOT complete.\n   Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
        getchar();
    }

    printf("Extract %s. Work complete. No errors.\n",versionString);
    return 0;
}
コード例 #2
0
ファイル: vmapexport.cpp プロジェクト: AwkwardDev/Summit
int main(int argc, char ** argv)
{
    //char tmp[512];
//    FILE* pDatei;
//    char tmp[512];
//    char tmp1[512];
    //char tmp2[512];
//    char tmp3[512];
//    char tmp4[512];
//    char szMpqName[MAX_PATH] = "";
//    char szListFile[MAX_PATH] = "";
    int nError = ERROR_SUCCESS;
    char *versionString = "V2.4 2007_07_12";

    // Use command line arguments, when some
    if(!processArgv(argc, argv, versionString)) 
        return 1;
 
    printf("Extract %s. Beginning work ....\n",versionString);
    // Set the lowest priority to allow running in the background
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // Create the working directory
    if(nError == ERROR_SUCCESS)
    {
        //if(!CreateDirectory(szWorkDirMaps, NULL))
        // nError = GetLastError();
        if(!CreateDirectory(szWorkDirWmo, NULL))
            nError = GetLastError();
        if(nError == ERROR_ALREADY_EXISTS)
            nError = ERROR_SUCCESS;
    } 
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // patch goes first -> fake priority handling
    std::vector<MPQArchive*> archives;

    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    std::vector<std::string> archiveNames;

    fillArchiveNameVector(archiveNames);
    for (size_t i=0; i<archiveNames.size(); i++) {
        archives.push_back(new MPQArchive(archiveNames[i].c_str()));
    }
    ExtractWmo(archiveNames);

     //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    //map.dbc
    if(nError == ERROR_SUCCESS)
    {
        DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
        dbc->open();
        map_count=dbc->getRecordCount ();
        map_ids=new map_id[map_count];
        for(unsigned int x=0;x<map_count;x++)
        {
            map_ids[x].id=dbc->getRecord (x).getUInt(0);
            strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
            printf("Map - %s\n",map_ids[x].name);		 
        }

        delete dbc;
        ParsMapFiles();
        delete [] map_ids;
        nError = ERROR_SUCCESS;
    }

    clreol();
    if(nError != ERROR_SUCCESS) {
        printf("ERROR: Extract %s. Work NOT complete.\n   Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
        _getch();
    }
    printf("Extract %s. Work complete. No errors.",versionString);
}
コード例 #3
0
int main(int argc, char* argv[])
{
	srand((unsigned int)time(0));

	int xres = 1024;
	int yres = 768;

	bool usePatch = true;

	for(int i = 1; i < argc; ++i)
	{
		if(!strcmp(argv[i], "-f")) 
			fullscreen = 1;
		else if(!strcmp(argv[i], "-w")) 
			fullscreen = 0;
		else if(!strcmp(argv[i], "-1024") || !strcmp(argv[i], "-1024x768"))
		{
			xres = 1024;
			yres = 768;
		}
		else if(!strcmp(argv[i], "-1280") || !strcmp(argv[i], "-1280x1024"))
		{
			xres = 1280;
			yres = 1024;
		}
		else if(!strcmp(argv[i], "-1280x960"))
		{
			xres = 1280;
			yres = 960;
		}
		else if(!strcmp(argv[i], "-1400") || !strcmp(argv[i], "-1400x1050"))
		{
			xres = 1400;
			yres = 1050;
		}
		else if(!strcmp(argv[i], "-1280x800"))
		{
			xres = 1280;
			yres = 800;
		}
		else if(!strcmp(argv[i], "-1600") || !strcmp(argv[i], "-1600x1200"))
		{
			xres = 1600;
			yres = 1200;
		}
		else if(!strcmp(argv[i], "-1920") || !strcmp(argv[i], "-1920x1200"))
		{
			xres = 1920;
			yres = 1200;
		}
		else if(!strcmp(argv[i], "-2048") || !strcmp(argv[i], "-2048x1536"))
		{
			xres = 2048;
			yres = 1536;
		}
		
		else if(!strcmp(argv[i], "-p"))
			usePatch = true;
		else if(!strcmp(argv[i], "-np"))
			usePatch = false;
	}

	checkConfig();

	/*if(!loadPath())
	{
		getGamePath();
	}
	else
	{
		getGamePath() = loadPath();
	}*/

	getGamePath();
	CreateStrips();

	gLog("[World of Warcraft Studio - Editor] - " APP_TITLE " : " APP_VERSION "\n[World of Warcraft Studio - Editor] - Game path: %s\n[World of Warcraft Studio - Editor] - Game Version: %d\n", gamepath, loadGameVersion());
	GraphicCard(); // Send to Log info about Graphic Card

	checkConfig2();

	vector<string> archiveNames;
	fillArchiveNameVector(archiveNames);
	for(size_t i = 0; i < archiveNames.size(); ++i)
		MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());

	if(gOpenArchives.empty())
	{
		gLog("[World of Warcraft Studio - Editor] - ERROR: No one archive found");
		return 1;
	}

	gAreaDB.open();

	video.init(xres, yres, fullscreen != 0);

	gLog("[World of Warcraft Studio - Editor] - Initializing Ground Effects\n");
	InitGroundEffects();
	gLog("[World of Warcraft Studio - Editor] - Initializing Fonts\n");
	InitFonts();
	gLog("[World of Warcraft Studio - Editor] - Main Initializing complete\n");

	float ftime;
	uint32 t, last_t, frames = 0, time = 0, fcount = 0, ft = 0;
	AppState* as;
	gFPS = 0;

	gLog("[World of Warcraft Studio - Editor] - Creating Menu\n");
	Menu* m = new Menu();
	as = m;

	gStates.push_back(as);

	if(glExtGetGLProcs_VertexProgram_1_0_ARB() == 0)
	{
		gLog("[World of Warcraft Studio - Editor] - Unable to load ARB Vertex Program Code\n");
		return 0;
	}
	loadWaterShader();

	bool done = false;
	t = SDL_GetTicks();
	gLog("[World of Warcraft Studio - Editor] - Entering Main Loop\n");
	while(gStates.size() > 0 && !done)
	{
		last_t = t;
		t = SDL_GetTicks();
		Uint32 dt = t - last_t;
		time += dt;
		ftime = time / 1000.0f;

		as = gStates[gStates.size()-1];

		SDL_Event event;
		while(SDL_PollEvent(&event))
		{
			if(event.type == SDL_QUIT)
				done = true;
			else if(event.type == SDL_MOUSEMOTION)
			{
				if(SDL_GetAppState()&SDL_APPMOUSEFOCUS)
					as->mousemove(&event.motion);
			}
			else if((event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP) && (SDL_GetAppState()&SDL_APPINPUTFOCUS))
			{	
				if(event.button.type == SDL_MOUSEBUTTONUP)
					as->mouseclick(&event.button);
				else if(SDL_GetAppState()&SDL_APPMOUSEFOCUS)
					as->mouseclick(&event.button);
			}
			else if(event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)
			{
				if(SDL_GetAppState()&SDL_APPINPUTFOCUS)
					as->keypressed(&event.key);
			}
			else if(event.type == SDL_VIDEORESIZE)
				video.resize(event.resize.w, event.resize.h);
		}

		if(SDL_GetAppState()&SDL_APPACTIVE)
		{
			as->tick(ftime, dt / 1000.0f);
			as->display(ftime, dt / 1000.0f);
		}

		if(gPop) 
		{
			gPop = false;
			gStates.pop_back();
			delete as;
		}

		frames++;
		fcount++;
		ft += dt;
		
		if(ft >= 1000)
		{
            float fps = (float)fcount / (float)ft * 1000.0f;
			gFPS = fps;
			char buf[32];
			sprintf_s(buf, APP_TITLE " - %.2f fps", fps);
			SDL_WM_SetCaption(buf, NULL);
            ft = 0;
			fcount = 0;
		}

		video.flip();
	}
	gLog("[World of Warcraft Studio - Editor] - Exited Main Loop\n");

	deleteFonts();
	
	video.close();

	for(deque<MPQArchive*>::iterator it = archives.begin(); it != archives.end(); ++it)
        (*it)->close();
		
	archives.clear();

	gLog("\n[World of Warcraft Studio - Editor] - Exiting.\n");

	return 0;
}
コード例 #4
0
ファイル: vmapexport.cpp プロジェクト: Corenex/mangoszero
int main(int argc, char ** argv)
{
    //char tmp[512];
//    FILE* pDatei;
//    char tmp[512];
//    char tmp1[512];
    //char tmp2[512];
//    char tmp3[512];
//    char tmp4[512];
//    char szMpqName[MAX_PATH] = "";
//    char szListFile[MAX_PATH] = "";
    int nError = ERROR_SUCCESS;
    char *versionString = "V2.4 2007_07_12";

    // Use command line arguments, when some
    if(!processArgv(argc, argv, versionString))
        return 1;

    printf("Extract %s. Beginning work ....\n",versionString);
    // Set the lowest priority to allow running in the background
    SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // Create the working directory
    if(nError == ERROR_SUCCESS)
    {
        //if(!CreateDirectory(szWorkDirMaps, NULL))
        // nError = GetLastError();
        if(!CreateDirectory(szWorkDirWmo, NULL))
            nError = GetLastError();
        if(nError == ERROR_ALREADY_EXISTS)
            nError = ERROR_SUCCESS;
    }

    // prepare archive name list
    std::vector<std::string> archiveNames;
    fillArchiveNameVector(archiveNames);
    if(!gOpenArchives.Open(archiveNames))
    {
        printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
        return 1;
    }

    // extract data
    ExtractWmo();

    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    //map.dbc
    if(nError == ERROR_SUCCESS)
    {
        DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
        if(!dbc->open())
        {
            delete dbc;
            printf("FATAL ERROR: Map.dbc not found in data file.\n");
            return 1;
        }
        map_count=dbc->getRecordCount ();
        map_ids=new map_id[map_count];
        for(unsigned int x=0;x<map_count;++x)
        {
            map_ids[x].id=dbc->getRecord (x).getUInt(0);
            strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
            printf("Map - %s\n",map_ids[x].name);
        }

        delete dbc;
        ParsMapFiles();
        delete [] map_ids;
        nError = ERROR_SUCCESS;
    }

    clreol();
    if(nError != ERROR_SUCCESS)
    {
        printf("ERROR: Extract %s. Work NOT complete.\n   Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
        _getch();
    }
    printf("Extract %s. Work complete. No errors.",versionString);
}
コード例 #5
0
ファイル: vmapexport.cpp プロジェクト: Aincent/server
int main(int argc, char** argv)
{
    printf("mangos-zero vmap (version %s) extractor\n\n", szRawVMAPMagic);

    bool success = true;

    // Use command line arguments, when some
    if (!processArgv(argc, argv))
        { return 1; }

    // some simple check if working dir is dirty
    else
    {
        std::string sdir = std::string(szWorkDirWmo) + "/dir";
        std::string sdir_bin = std::string(szWorkDirWmo) + "/dir_bin";
        struct stat status;
        if (!stat(sdir.c_str(), &status) || !stat(sdir_bin.c_str(), &status))
        {
            printf("Your output directory seems to be polluted, please use an empty directory!\n");
            printf("<press return to exit>");
            char garbage[2];
            int ret = scanf("%c", garbage);
            return 1;
        }
    }

    printf("Beginning work ....\n");
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // Create the working directory
    if (mkdir(szWorkDirWmo
#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__)
              , 0711
#endif
             ))
        { success = (errno == EEXIST); }

    // prepare archive name list
    std::vector<std::string> archiveNames;
    fillArchiveNameVector(archiveNames);
    for (size_t i = 0; i < archiveNames.size(); ++i)
    {
        MPQArchive* archive = new MPQArchive(archiveNames[i].c_str());
        if (!gOpenArchives.size() || gOpenArchives.front() != archive)
            { delete archive; }
    }

    if (gOpenArchives.empty())
    {
        printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n", input_path);
        return 1;
    }
    ReadLiquidTypeTableDBC();

    // extract data
    if (success)
        { success = ExtractWmo(); }

    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    //map.dbc
    if (success)
    {
        DBCFile* dbc = new DBCFile("DBFilesClient\\Map.dbc");
        if (!dbc->open())
        {
            delete dbc;
            printf("FATAL ERROR: Map.dbc not found in data file.\n");
            return 1;
        }
        map_count = dbc->getRecordCount();
        map_ids = new map_id[map_count];
        for (unsigned int x = 0; x < map_count; ++x)
        {
            map_ids[x].id = dbc->getRecord(x).getUInt(0);
            strcpy(map_ids[x].name, dbc->getRecord(x).getString(1));
            printf("Map - %s\n", map_ids[x].name);
        }


        delete dbc;
        ParsMapFiles();
        delete [] map_ids;
        //nError = ERROR_SUCCESS;
        // Extract models, listed in DameObjectDisplayInfo.dbc
        ExtractGameobjectModels();
    }

    printf("\n");
    if (!success)
    {
        printf("ERROR: Work NOT complete.\n   Precise vector data=%d.\nPress any key.\n", preciseVectorData);
        getchar();
    }

    printf("Work complete. No errors.\n");
    delete [] LiqType;
    return 0;
}
コード例 #6
0
ファイル: vmapexport.cpp プロジェクト: Ankso/mangos
int main(int argc, char ** argv)
{
    bool success=true;
    const char *versionString = "V2.90 2010_05";

    // Use command line arguments, when some
    if(!processArgv(argc, argv, versionString))
        return 1;

    printf("Extract %s. Beginning work ....\n",versionString);
    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    // Create the working directory
    if(mkdir(szWorkDirWmo
#ifdef __linux__
                    , 0711
#endif
                    ))
            success = (errno == EEXIST);

    // prepare archive name list
    std::vector<std::string> archiveNames;
    fillArchiveNameVector(archiveNames);
    for (size_t i=0; i < archiveNames.size(); ++i)
    {
        MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());
        if(!gOpenArchives.size() || gOpenArchives.front() != archive)
            delete archive;
    }

    if(gOpenArchives.empty())
    {
        printf("FATAL ERROR: None MPQ archive found by path '%s'. Use -d option with proper path.\n",input_path);
        return 1;
    }
    ReadLiquidTypeTableDBC();

    // extract data
    if(success)
        success = ExtractWmo();

    //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    //map.dbc
    if(success)
    {
        DBCFile * dbc = new DBCFile("DBFilesClient\\Map.dbc");
        if(!dbc->open())
        {
            delete dbc;
            printf("FATAL ERROR: Map.dbc not found in data file.\n");
            return 1;
        }
        map_count=dbc->getRecordCount ();
        map_ids=new map_id[map_count];
        for(unsigned int x=0;x<map_count;++x)
        {
            map_ids[x].id=dbc->getRecord (x).getUInt(0);
            strcpy(map_ids[x].name,dbc->getRecord(x).getString(1));
            printf("Map - %s\n",map_ids[x].name);
        }


        delete dbc;
        ParsMapFiles();
        delete [] map_ids;
        //nError = ERROR_SUCCESS;
    }

    clreol();
    if(!success)
    {
        printf("ERROR: Extract %s. Work NOT complete.\n   Precise vector data=%d.\nPress any key.\n",versionString, preciseVectorData);
        getchar();
    }

    printf("Extract %s. Work complete. No errors.\n",versionString);
    delete [] LiqType;
    return 0;
}