Tools/VMaps Extractor: reduce difference between branches
This commit is contained in:
1 parent
cd7eef7945
commit
1528eda26e
3 files changed
+18
-25
No files matched your search
@@ -34,6 +34,8 @@ bool ExtractSingleModel(std::string& fname)
|
||||
fname.erase(fname.length() - 2, 2);
|
||||
fname.append("2");
|
||||
}
|
||||
// >= 3.1.0 ADT MMDX section store filename.m2 filenames for corresponded .m2 file
|
||||
// nothing do
|
||||
|
||||
std::string originalName = fname;
|
||||
|
||||
@@ -59,7 +61,7 @@ extern HANDLE LocaleMpq;
|
||||
|
||||
void ExtractGameobjectModels()
|
||||
{
|
||||
printf("Extracting GameObject models...");
|
||||
printf("Extracting GameObject models...\n");
|
||||
DBCFile dbc(LocaleMpq, "DBFilesClient\\GameObjectDisplayInfo.dbc");
|
||||
if (!dbc.open())
|
||||
{
|
||||
@@ -89,13 +91,15 @@ void ExtractGameobjectModels()
|
||||
continue;
|
||||
|
||||
FixNameCase((char*)path.c_str(), path.size());
|
||||
char * name = GetPlainName((char*)path.c_str());
|
||||
char* name = GetPlainName((char*)path.c_str());
|
||||
FixNameSpaces(name, strlen(name));
|
||||
|
||||
char * ch_ext = GetExtension(name);
|
||||
char* ch_ext = GetExtension(name);
|
||||
if (!ch_ext)
|
||||
continue;
|
||||
|
||||
strToLower(ch_ext);
|
||||
|
||||
bool result = false;
|
||||
uint8 isWmo = 0;
|
||||
if (!strcmp(ch_ext, ".wmo"))
|
||||
@@ -103,8 +107,11 @@ void ExtractGameobjectModels()
|
||||
isWmo = 1;
|
||||
result = ExtractSingleWmo(path);
|
||||
}
|
||||
else if (!strcmp(ch_ext, ".mdl")) // TODO: extract .mdl files, if needed
|
||||
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);
|
||||
|
||||
|
||||
@@ -260,30 +260,13 @@ bool FileExists(char const* file)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ExtractWmo()
|
||||
void strToLower(char* str)
|
||||
{
|
||||
bool success = false;
|
||||
|
||||
//char const* ParsArchiveNames[] = {"patch-2.MPQ", "patch.MPQ", "common.MPQ", "expansion.MPQ"};
|
||||
|
||||
SFILE_FIND_DATA data;
|
||||
HANDLE find = SFileFindFirstFile(WorldMpq, "*.wmo", &data, nullptr);
|
||||
if (find != nullptr)
|
||||
while (*str)
|
||||
{
|
||||
do
|
||||
{
|
||||
std::string str = data.cFileName;
|
||||
//printf("Extracting wmo %s\n", str.c_str());
|
||||
success |= ExtractSingleWmo(str);
|
||||
}
|
||||
while (SFileFindNextFile(find, &data));
|
||||
*str = tolower(*str);
|
||||
++str;
|
||||
}
|
||||
SFileFindClose(find);
|
||||
|
||||
if (success)
|
||||
printf("\nExtract wmo complete (No (fatal) errors)\n");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ExtractSingleWmo(std::string& fname)
|
||||
@@ -344,6 +327,7 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
char temp[1024];
|
||||
strncpy(temp, fname.c_str(), 1024);
|
||||
temp[fname.length()-4] = 0;
|
||||
|
||||
char groupFileName[1024];
|
||||
sprintf(groupFileName, "%s_%03u.wmo", temp, i);
|
||||
//printf("Trying to open groupfile %s\n",groupFileName);
|
||||
@@ -378,6 +362,7 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
|
||||
fseek(output, 8, SEEK_SET); // store the correct no of vertices
|
||||
fwrite(&Wmo_nVertices, sizeof(int), 1, output);
|
||||
// store the correct no of groups
|
||||
fwrite(&groupCount, sizeof(uint32), 1, output);
|
||||
fclose(output);
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ extern std::unordered_map<std::string, WMODoodadData> WmoDoodads;
|
||||
uint32 GenerateUniqueObjectId(uint32 clientId, uint16 clientDoodadId);
|
||||
|
||||
bool FileExists(const char * file);
|
||||
void strToLower(char* str);
|
||||
|
||||
bool ExtractSingleWmo(std::string& fname);
|
||||
bool ExtractSingleModel(std::string& fname);
|
||||
|
||||
Reference in new issue
Block a user