refactor(Tools): restyle tools with astyle (#3705)
This commit is contained in:
@@ -98,7 +98,7 @@ static const char* const langs[] = {"enGB", "enUS", "deDE", "esES", "frFR", "koK
|
|||||||
|
|
||||||
void CreateDir( const std::string& Path )
|
void CreateDir( const std::string& Path )
|
||||||
{
|
{
|
||||||
if(chdir(Path.c_str()) == 0)
|
if (chdir(Path.c_str()) == 0)
|
||||||
{
|
{
|
||||||
int ret = chdir("../");
|
int ret = chdir("../");
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
@@ -124,7 +124,7 @@ void CreateDir( const std::string& Path )
|
|||||||
bool FileExists( const char* FileName )
|
bool FileExists( const char* FileName )
|
||||||
{
|
{
|
||||||
int fp = _open(FileName, OPEN_FLAGS);
|
int fp = _open(FileName, OPEN_FLAGS);
|
||||||
if(fp != -1)
|
if (fp != -1)
|
||||||
{
|
{
|
||||||
_close(fp);
|
_close(fp);
|
||||||
return true;
|
return true;
|
||||||
@@ -148,41 +148,41 @@ void Usage(char* prg)
|
|||||||
|
|
||||||
void HandleArgs(int argc, char* arg[])
|
void HandleArgs(int argc, char* arg[])
|
||||||
{
|
{
|
||||||
for(int c = 1; c < argc; ++c)
|
for (int c = 1; c < argc; ++c)
|
||||||
{
|
{
|
||||||
// i - input path
|
// i - input path
|
||||||
// o - output path
|
// o - output path
|
||||||
// e - extract only MAP(1)/DBC(2) - standard both(3)
|
// e - extract only MAP(1)/DBC(2) - standard both(3)
|
||||||
// f - use float to int conversion
|
// f - use float to int conversion
|
||||||
// h - limit minimum height
|
// h - limit minimum height
|
||||||
if(arg[c][0] != '-')
|
if (arg[c][0] != '-')
|
||||||
Usage(arg[0]);
|
Usage(arg[0]);
|
||||||
|
|
||||||
switch(arg[c][1])
|
switch (arg[c][1])
|
||||||
{
|
{
|
||||||
case 'i':
|
case 'i':
|
||||||
if(c + 1 < argc) // all ok
|
if (c + 1 < argc) // all ok
|
||||||
strcpy(input_path, arg[(c++) + 1]);
|
strcpy(input_path, arg[(c++) + 1]);
|
||||||
else
|
else
|
||||||
Usage(arg[0]);
|
Usage(arg[0]);
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
if(c + 1 < argc) // all ok
|
if (c + 1 < argc) // all ok
|
||||||
strcpy(output_path, arg[(c++) + 1]);
|
strcpy(output_path, arg[(c++) + 1]);
|
||||||
else
|
else
|
||||||
Usage(arg[0]);
|
Usage(arg[0]);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
if(c + 1 < argc) // all ok
|
if (c + 1 < argc) // all ok
|
||||||
CONF_allow_float_to_int = atoi(arg[(c++) + 1]) != 0;
|
CONF_allow_float_to_int = atoi(arg[(c++) + 1]) != 0;
|
||||||
else
|
else
|
||||||
Usage(arg[0]);
|
Usage(arg[0]);
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
if(c + 1 < argc) // all ok
|
if (c + 1 < argc) // all ok
|
||||||
{
|
{
|
||||||
CONF_extract = atoi(arg[(c++) + 1]);
|
CONF_extract = atoi(arg[(c++) + 1]);
|
||||||
if(!(CONF_extract > 0 && CONF_extract < 4))
|
if (!(CONF_extract > 0 && CONF_extract < 4))
|
||||||
Usage(arg[0]);
|
Usage(arg[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -199,7 +199,7 @@ uint32 ReadBuild(int locale)
|
|||||||
//printf("Read %s file... ", filename.c_str());
|
//printf("Read %s file... ", filename.c_str());
|
||||||
|
|
||||||
MPQFile m(filename.c_str());
|
MPQFile m(filename.c_str());
|
||||||
if(m.isEof())
|
if (m.isEof())
|
||||||
{
|
{
|
||||||
printf("Fatal error: Not found %s file!\n", filename.c_str());
|
printf("Fatal error: Not found %s file!\n", filename.c_str());
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -234,7 +234,7 @@ uint32 ReadMapDBC()
|
|||||||
printf("Read Map.dbc file... ");
|
printf("Read Map.dbc file... ");
|
||||||
DBCFile dbc("DBFilesClient\\Map.dbc");
|
DBCFile dbc("DBFilesClient\\Map.dbc");
|
||||||
|
|
||||||
if(!dbc.open())
|
if (!dbc.open())
|
||||||
{
|
{
|
||||||
printf("Fatal error: Invalid Map.dbc file format!\n");
|
printf("Fatal error: Invalid Map.dbc file format!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -242,7 +242,7 @@ uint32 ReadMapDBC()
|
|||||||
|
|
||||||
size_t map_count = dbc.getRecordCount();
|
size_t map_count = dbc.getRecordCount();
|
||||||
map_ids = new map_id[map_count];
|
map_ids = new map_id[map_count];
|
||||||
for(uint32 x = 0; x < map_count; ++x)
|
for (uint32 x = 0; x < map_count; ++x)
|
||||||
{
|
{
|
||||||
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
map_ids[x].id = dbc.getRecord(x).getUInt(0);
|
||||||
strcpy(map_ids[x].name, dbc.getRecord(x).getString(1));
|
strcpy(map_ids[x].name, dbc.getRecord(x).getString(1));
|
||||||
@@ -255,7 +255,7 @@ void ReadLiquidTypeTableDBC()
|
|||||||
{
|
{
|
||||||
printf("Read LiquidType.dbc file...");
|
printf("Read LiquidType.dbc file...");
|
||||||
DBCFile dbc("DBFilesClient\\LiquidType.dbc");
|
DBCFile dbc("DBFilesClient\\LiquidType.dbc");
|
||||||
if(!dbc.open())
|
if (!dbc.open())
|
||||||
{
|
{
|
||||||
printf("Fatal error: Invalid LiquidType.dbc file format!\n");
|
printf("Fatal error: Invalid LiquidType.dbc file format!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -266,7 +266,7 @@ void ReadLiquidTypeTableDBC()
|
|||||||
LiqType = new uint16[liqTypeMaxId + 1];
|
LiqType = new uint16[liqTypeMaxId + 1];
|
||||||
memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16));
|
memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16));
|
||||||
|
|
||||||
for(uint32 x = 0; x < liqTypeCount; ++x)
|
for (uint32 x = 0; x < liqTypeCount; ++x)
|
||||||
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||||
|
|
||||||
printf("Done! (%u LiqTypes loaded)\n", (uint32)liqTypeCount);
|
printf("Done! (%u LiqTypes loaded)\n", (uint32)liqTypeCount);
|
||||||
@@ -522,7 +522,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
|||||||
}
|
}
|
||||||
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
for (int y = 0; y <= ADT_GRID_SIZE; y++)
|
||||||
{
|
{
|
||||||
for(int x = 0; x <= ADT_GRID_SIZE; x++)
|
for (int x = 0; x <= ADT_GRID_SIZE; x++)
|
||||||
{
|
{
|
||||||
float h = V9[y][x];
|
float h = V9[y][x];
|
||||||
if (maxHeight < h) maxHeight = h;
|
if (maxHeight < h) maxHeight = h;
|
||||||
@@ -690,7 +690,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
for (int i = 0; i < ADT_CELLS_PER_GRID; i++)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
for (int j = 0; j < ADT_CELLS_PER_GRID; j++)
|
||||||
{
|
{
|
||||||
adt_liquid_header* h = h2o->getLiquidData(i, j);
|
adt_liquid_header* h = h2o->getLiquidData(i, j);
|
||||||
if (!h)
|
if (!h)
|
||||||
@@ -768,7 +768,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
|||||||
bool fullType = false;
|
bool fullType = false;
|
||||||
for (int y = 0; y < ADT_CELLS_PER_GRID; y++)
|
for (int y = 0; y < ADT_CELLS_PER_GRID; y++)
|
||||||
{
|
{
|
||||||
for(int x = 0; x < ADT_CELLS_PER_GRID; x++)
|
for (int x = 0; x < ADT_CELLS_PER_GRID; x++)
|
||||||
{
|
{
|
||||||
if (liquid_flags[y][x] != type)
|
if (liquid_flags[y][x] != type)
|
||||||
{
|
{
|
||||||
@@ -796,7 +796,7 @@ bool ConvertADT(std::string const& inputPath, std::string const& outputPath, int
|
|||||||
minHeight = 20000;
|
minHeight = 20000;
|
||||||
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
for (int y = 0; y < ADT_GRID_SIZE; y++)
|
||||||
{
|
{
|
||||||
for(int x = 0; x < ADT_GRID_SIZE; x++)
|
for (int x = 0; x < ADT_GRID_SIZE; x++)
|
||||||
{
|
{
|
||||||
if (liquid_show[y][x])
|
if (liquid_show[y][x])
|
||||||
{
|
{
|
||||||
@@ -953,7 +953,7 @@ void ExtractMapsFromMpq(uint32 build)
|
|||||||
CreateDir(path);
|
CreateDir(path);
|
||||||
|
|
||||||
printf("Convert map files\n");
|
printf("Convert map files\n");
|
||||||
for(uint32 z = 0; z < map_count; ++z)
|
for (uint32 z = 0; z < map_count; ++z)
|
||||||
{
|
{
|
||||||
printf("Extract %s (%d/%u) \n", map_ids[z].name, z + 1, map_count);
|
printf("Extract %s (%d/%u) \n", map_ids[z].name, z + 1, map_count);
|
||||||
// Loadup map grid data
|
// Loadup map grid data
|
||||||
@@ -965,9 +965,9 @@ void ExtractMapsFromMpq(uint32 build)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint32 y = 0; y < WDT_MAP_SIZE; ++y)
|
for (uint32 y = 0; y < WDT_MAP_SIZE; ++y)
|
||||||
{
|
{
|
||||||
for(uint32 x = 0; x < WDT_MAP_SIZE; ++x)
|
for (uint32 x = 0; x < WDT_MAP_SIZE; ++x)
|
||||||
{
|
{
|
||||||
if (!wdt.main->adt_list[y][x].exist)
|
if (!wdt.main->adt_list[y][x].exist)
|
||||||
continue;
|
continue;
|
||||||
@@ -986,13 +986,13 @@ void ExtractMapsFromMpq(uint32 build)
|
|||||||
bool ExtractFile( char const* mpq_name, std::string const& filename )
|
bool ExtractFile( char const* mpq_name, std::string const& filename )
|
||||||
{
|
{
|
||||||
FILE* output = fopen(filename.c_str(), "wb");
|
FILE* output = fopen(filename.c_str(), "wb");
|
||||||
if(!output)
|
if (!output)
|
||||||
{
|
{
|
||||||
printf("Can't create the output file '%s'\n", filename.c_str());
|
printf("Can't create the output file '%s'\n", filename.c_str());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MPQFile m(mpq_name);
|
MPQFile m(mpq_name);
|
||||||
if(!m.isEof())
|
if (!m.isEof())
|
||||||
fwrite(m.getPointer(), 1, m.getSize(), output);
|
fwrite(m.getPointer(), 1, m.getSize(), output);
|
||||||
|
|
||||||
fclose(output);
|
fclose(output);
|
||||||
@@ -1006,7 +1006,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
|||||||
std::set<std::string> dbcfiles;
|
std::set<std::string> dbcfiles;
|
||||||
|
|
||||||
// get DBC file list
|
// get DBC file list
|
||||||
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
for (ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
||||||
{
|
{
|
||||||
vector<string> files;
|
vector<string> files;
|
||||||
(*i)->GetFileListTo(files);
|
(*i)->GetFileListTo(files);
|
||||||
@@ -1018,7 +1018,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
|||||||
std::string path = output_path;
|
std::string path = output_path;
|
||||||
path += "/dbc/";
|
path += "/dbc/";
|
||||||
CreateDir(path);
|
CreateDir(path);
|
||||||
if(!basicLocale)
|
if (!basicLocale)
|
||||||
{
|
{
|
||||||
path += langs[locale];
|
path += langs[locale];
|
||||||
path += "/";
|
path += "/";
|
||||||
@@ -1040,7 +1040,7 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
|||||||
string filename = path;
|
string filename = path;
|
||||||
filename += (iter->c_str() + strlen("DBFilesClient\\"));
|
filename += (iter->c_str() + strlen("DBFilesClient\\"));
|
||||||
|
|
||||||
if(FileExists(filename.c_str()))
|
if (FileExists(filename.c_str()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ExtractFile(iter->c_str(), filename))
|
if (ExtractFile(iter->c_str(), filename))
|
||||||
@@ -1056,14 +1056,14 @@ void LoadLocaleMPQFiles(int const locale)
|
|||||||
sprintf(filename, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);
|
sprintf(filename, "%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]);
|
||||||
new MPQArchive(filename);
|
new MPQArchive(filename);
|
||||||
|
|
||||||
for(int i = 1; i < 5; ++i)
|
for (int i = 1; i < 5; ++i)
|
||||||
{
|
{
|
||||||
char ext[3] = "";
|
char ext[3] = "";
|
||||||
if(i > 1)
|
if (i > 1)
|
||||||
sprintf(ext, "-%i", i);
|
sprintf(ext, "-%i", i);
|
||||||
|
|
||||||
sprintf(filename, "%s/Data/%s/patch-%s%s.MPQ", input_path, langs[locale], langs[locale], ext);
|
sprintf(filename, "%s/Data/%s/patch-%s%s.MPQ", input_path, langs[locale], langs[locale], ext);
|
||||||
if(FileExists(filename))
|
if (FileExists(filename))
|
||||||
new MPQArchive(filename);
|
new MPQArchive(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1072,17 +1072,17 @@ void LoadCommonMPQFiles()
|
|||||||
{
|
{
|
||||||
char filename[512];
|
char filename[512];
|
||||||
int count = sizeof(CONF_mpq_list) / sizeof(char*);
|
int count = sizeof(CONF_mpq_list) / sizeof(char*);
|
||||||
for(int i = 0; i < count; ++i)
|
for (int i = 0; i < count; ++i)
|
||||||
{
|
{
|
||||||
sprintf(filename, "%s/Data/%s", input_path, CONF_mpq_list[i]);
|
sprintf(filename, "%s/Data/%s", input_path, CONF_mpq_list[i]);
|
||||||
if(FileExists(filename))
|
if (FileExists(filename))
|
||||||
new MPQArchive(filename);
|
new MPQArchive(filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void CloseMPQFiles()
|
inline void CloseMPQFiles()
|
||||||
{
|
{
|
||||||
for(ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end(); ++j) (*j)->close();
|
for (ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end(); ++j) (*j)->close();
|
||||||
gOpenArchives.clear();
|
gOpenArchives.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,7 +1107,7 @@ int main(int argc, char* arg[])
|
|||||||
//Open MPQs
|
//Open MPQs
|
||||||
LoadLocaleMPQFiles(i);
|
LoadLocaleMPQFiles(i);
|
||||||
|
|
||||||
if((CONF_extract & EXTRACT_DBC) == 0)
|
if ((CONF_extract & EXTRACT_DBC) == 0)
|
||||||
{
|
{
|
||||||
FirstLocale = i;
|
FirstLocale = i;
|
||||||
build = ReadBuild(FirstLocale);
|
build = ReadBuild(FirstLocale);
|
||||||
@@ -1116,7 +1116,7 @@ int main(int argc, char* arg[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Extract DBC files
|
//Extract DBC files
|
||||||
if(FirstLocale < 0)
|
if (FirstLocale < 0)
|
||||||
{
|
{
|
||||||
FirstLocale = i;
|
FirstLocale = i;
|
||||||
build = ReadBuild(FirstLocale);
|
build = ReadBuild(FirstLocale);
|
||||||
@@ -1131,7 +1131,7 @@ int main(int argc, char* arg[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FirstLocale < 0)
|
if (FirstLocale < 0)
|
||||||
{
|
{
|
||||||
printf("No locales detected\n");
|
printf("No locales detected\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ bool isHole(int holes, int i, int j)
|
|||||||
{
|
{
|
||||||
int testi = i / 2;
|
int testi = i / 2;
|
||||||
int testj = j / 4;
|
int testj = j / 4;
|
||||||
if(testi > 3) testi = 3;
|
if (testi > 3) testi = 3;
|
||||||
if(testj > 3) testj = 3;
|
if (testj > 3) testj = 3;
|
||||||
return (holes & holetab_h[testi] & holetab_v[testj]) != 0;
|
return (holes & holetab_h[testi] & holetab_v[testj]) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,33 +21,33 @@ bool DBCFile::open()
|
|||||||
char header[4];
|
char header[4];
|
||||||
unsigned int na, nb, es, ss;
|
unsigned int na, nb, es, ss;
|
||||||
|
|
||||||
if(f.read(header, 4) != 4) // Number of records
|
if (f.read(header, 4) != 4) // Number of records
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(header[0] != 'W' || header[1] != 'D' || header[2] != 'B' || header[3] != 'C')
|
if (header[0] != 'W' || header[1] != 'D' || header[2] != 'B' || header[3] != 'C')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(f.read(&na, 4) != 4) // Number of records
|
if (f.read(&na, 4) != 4) // Number of records
|
||||||
return false;
|
return false;
|
||||||
if(f.read(&nb, 4) != 4) // Number of fields
|
if (f.read(&nb, 4) != 4) // Number of fields
|
||||||
return false;
|
return false;
|
||||||
if(f.read(&es, 4) != 4) // Size of a record
|
if (f.read(&es, 4) != 4) // Size of a record
|
||||||
return false;
|
return false;
|
||||||
if(f.read(&ss, 4) != 4) // String size
|
if (f.read(&ss, 4) != 4) // String size
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
recordSize = es;
|
recordSize = es;
|
||||||
recordCount = na;
|
recordCount = na;
|
||||||
fieldCount = nb;
|
fieldCount = nb;
|
||||||
stringSize = ss;
|
stringSize = ss;
|
||||||
if(fieldCount * 4 != recordSize)
|
if (fieldCount * 4 != recordSize)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
data = new unsigned char[recordSize * recordCount + stringSize];
|
data = new unsigned char[recordSize * recordCount + stringSize];
|
||||||
stringTable = data + recordSize * recordCount;
|
stringTable = data + recordSize * recordCount;
|
||||||
|
|
||||||
size_t data_size = recordSize * recordCount + stringSize;
|
size_t data_size = recordSize * recordCount + stringSize;
|
||||||
if(f.read(data, data_size) != data_size)
|
if (f.read(data, data_size) != data_size)
|
||||||
return false;
|
return false;
|
||||||
f.close();
|
f.close();
|
||||||
return true;
|
return true;
|
||||||
@@ -68,9 +68,9 @@ size_t DBCFile::getMaxId()
|
|||||||
assert(data);
|
assert(data);
|
||||||
|
|
||||||
size_t maxId = 0;
|
size_t maxId = 0;
|
||||||
for(size_t i = 0; i < getRecordCount(); ++i)
|
for (size_t i = 0; i < getRecordCount(); ++i)
|
||||||
{
|
{
|
||||||
if(maxId < getRecord(i).getUInt(0))
|
if (maxId < getRecord(i).getUInt(0))
|
||||||
maxId = getRecord(i).getUInt(0);
|
maxId = getRecord(i).getUInt(0);
|
||||||
}
|
}
|
||||||
return maxId;
|
return maxId;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ bool FileLoader::loadFile(std::string const& fileName, bool log)
|
|||||||
{
|
{
|
||||||
free();
|
free();
|
||||||
MPQFile mf(fileName.c_str());
|
MPQFile mf(fileName.c_str());
|
||||||
if(mf.isEof())
|
if (mf.isEof())
|
||||||
{
|
{
|
||||||
if (log)
|
if (log)
|
||||||
printf("No such file %s\n", fileName.c_str());
|
printf("No such file %s\n", fileName.c_str());
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ MPQArchive::MPQArchive(const char* filename)
|
|||||||
{
|
{
|
||||||
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
||||||
printf("Opening %s\n", filename);
|
printf("Opening %s\n", filename);
|
||||||
if(result)
|
if (result)
|
||||||
{
|
{
|
||||||
switch(result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case LIBMPQ_ERROR_OPEN :
|
case LIBMPQ_ERROR_OPEN :
|
||||||
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
||||||
@@ -54,12 +54,12 @@ MPQFile::MPQFile(const char* filename):
|
|||||||
pointer(0),
|
pointer(0),
|
||||||
size(0)
|
size(0)
|
||||||
{
|
{
|
||||||
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
for (ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
||||||
{
|
{
|
||||||
mpq_archive* mpq_a = (*i)->mpq_a;
|
mpq_archive* mpq_a = (*i)->mpq_a;
|
||||||
|
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, filename, &filenum)) continue;
|
if (libmpq__file_number(mpq_a, filename, &filenum)) continue;
|
||||||
libmpq__off_t transferred;
|
libmpq__off_t transferred;
|
||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
void GetFileListTo(vector<string>& filelist)
|
void GetFileListTo(vector<string>& filelist)
|
||||||
{
|
{
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
if (libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
||||||
libmpq__off_t size, transferred;
|
libmpq__off_t size, transferred;
|
||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ void DoodadHandler::InsertModelGeometry(const DoodadDefinition& def, Model* mode
|
|||||||
for (std::vector<Vector3>::iterator itr = model->Vertices.begin(); itr != model->Vertices.end(); ++itr)
|
for (std::vector<Vector3>::iterator itr = model->Vertices.begin(); itr != model->Vertices.end(); ++itr)
|
||||||
Vertices.push_back(Utils::TransformDoodadVertex(def, *itr)); // Vertices have to be converted based on the information from the DoodadDefinition struct
|
Vertices.push_back(Utils::TransformDoodadVertex(def, *itr)); // Vertices have to be converted based on the information from the DoodadDefinition struct
|
||||||
|
|
||||||
for (std::vector<Triangle<uint16> >::iterator itr = model->Triangles.begin(); itr != model->Triangles.end(); ++itr)
|
for (std::vector<Triangle<uint16>>::iterator itr = model->Triangles.begin(); itr != model->Triangles.end(); ++itr)
|
||||||
Triangles.push_back(Triangle<uint32>(Constants::TRIANGLE_TYPE_DOODAD, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset));
|
Triangles.push_back(Triangle<uint32>(Constants::TRIANGLE_TYPE_DOODAD, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
~DoodadHandler();
|
~DoodadHandler();
|
||||||
|
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Triangle<uint32> > Triangles;
|
std::vector<Triangle<uint32>> Triangles;
|
||||||
bool IsSane() { return _definitions && _paths; }
|
bool IsSane() { return _definitions && _paths; }
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,13 +70,13 @@ void Geometry::CalculateMinMaxHeight( float& min, float& max )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Geometry::AddData( std::vector<Vector3>& verts, std::vector<Triangle<uint32> >& tris )
|
void Geometry::AddData( std::vector<Vector3>& verts, std::vector<Triangle<uint32>>& tris )
|
||||||
{
|
{
|
||||||
uint32 vertOffset = Vertices.size();
|
uint32 vertOffset = Vertices.size();
|
||||||
for (std::vector<Vector3>::iterator itr = verts.begin(); itr != verts.end(); ++itr)
|
for (std::vector<Vector3>::iterator itr = verts.begin(); itr != verts.end(); ++itr)
|
||||||
Vertices.push_back(Transform ? Utils::ToRecast(*itr) : *itr);
|
Vertices.push_back(Transform ? Utils::ToRecast(*itr) : *itr);
|
||||||
|
|
||||||
for (std::vector<Triangle<uint32> >::iterator itr = tris.begin(); itr != tris.end(); ++itr)
|
for (std::vector<Triangle<uint32>>::iterator itr = tris.begin(); itr != tris.end(); ++itr)
|
||||||
Triangles.push_back(Triangle<uint32>(itr->Type, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset));
|
Triangles.push_back(Triangle<uint32>(itr->Type, itr->V0 + vertOffset, itr->V1 + vertOffset, itr->V2 + vertOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,9 +119,9 @@ void Geometry::AddAdt( ADT* adt )
|
|||||||
{
|
{
|
||||||
for (std::vector<MapChunk*>::iterator itr = adt->MapChunks.begin(); itr != adt->MapChunks.end(); ++itr)
|
for (std::vector<MapChunk*>::iterator itr = adt->MapChunks.begin(); itr != adt->MapChunks.end(); ++itr)
|
||||||
{
|
{
|
||||||
std::vector<Triangle<uint32> > tmp;
|
std::vector<Triangle<uint32>> tmp;
|
||||||
tmp.reserve((*itr)->Triangles.size());
|
tmp.reserve((*itr)->Triangles.size());
|
||||||
for (std::vector<Triangle<uint8> >::iterator itr2 = (*itr)->Triangles.begin(); itr2 != (*itr)->Triangles.end(); ++itr2)
|
for (std::vector<Triangle<uint8>>::iterator itr2 = (*itr)->Triangles.begin(); itr2 != (*itr)->Triangles.end(); ++itr2)
|
||||||
tmp.push_back(Triangle<uint32>(itr2->Type, itr2->V0, itr2->V1, itr2->V2));
|
tmp.push_back(Triangle<uint32>(itr2->Type, itr2->V0, itr2->V1, itr2->V2));
|
||||||
AddData((*itr)->Vertices, tmp);
|
AddData((*itr)->Vertices, tmp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,12 +18,12 @@ public:
|
|||||||
|
|
||||||
void CalculateBoundingBox(float*& min, float*& max);
|
void CalculateBoundingBox(float*& min, float*& max);
|
||||||
void CalculateMinMaxHeight(float& min, float& max);
|
void CalculateMinMaxHeight(float& min, float& max);
|
||||||
void AddData(std::vector<Vector3>& verts, std::vector<Triangle<uint32> >& tris);
|
void AddData(std::vector<Vector3>& verts, std::vector<Triangle<uint32>>& tris);
|
||||||
void AddAdt(ADT* adt);
|
void AddAdt(ADT* adt);
|
||||||
void GetRawData(float*& verts, int*& tris, uint8*& areas);
|
void GetRawData(float*& verts, int*& tris, uint8*& areas);
|
||||||
|
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Triangle<uint32> > Triangles;
|
std::vector<Triangle<uint32>> Triangles;
|
||||||
bool Transform;
|
bool Transform;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
|
|
||||||
ADT* Source;
|
ADT* Source;
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Triangle<uint32> > Triangles;
|
std::vector<Triangle<uint32>> Triangles;
|
||||||
std::vector<MCNKLiquidData> MCNKData;
|
std::vector<MCNKLiquidData> MCNKData;
|
||||||
private:
|
private:
|
||||||
void HandleNewLiquid();
|
void HandleNewLiquid();
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ MPQFile::MPQFile(const char* filename):
|
|||||||
mpq_archive* mpq_a = (*i)->mpq_a;
|
mpq_archive* mpq_a = (*i)->mpq_a;
|
||||||
|
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, filename, &filenum))
|
if (libmpq__file_number(mpq_a, filename, &filenum))
|
||||||
continue;
|
continue;
|
||||||
libmpq__off_t transferred;
|
libmpq__off_t transferred;
|
||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public:
|
|||||||
void GetFileListTo(std::vector<std::string>& filelist)
|
void GetFileListTo(std::vector<std::string>& filelist)
|
||||||
{
|
{
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
if (libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
||||||
libmpq__off_t size, transferred;
|
libmpq__off_t size, transferred;
|
||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ FILE* MPQManager::GetFileFrom(const std::string& path, MPQArchive* file )
|
|||||||
mpq_archive* mpq_a = file->mpq_a;
|
mpq_archive* mpq_a = file->mpq_a;
|
||||||
|
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, path.c_str(), &filenum))
|
if (libmpq__file_number(mpq_a, path.c_str(), &filenum))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
libmpq__off_t transferred;
|
libmpq__off_t transferred;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
Chunk* Source;
|
Chunk* Source;
|
||||||
MapChunkHeader Header;
|
MapChunkHeader Header;
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Triangle<uint8> > Triangles;
|
std::vector<Triangle<uint8>> Triangles;
|
||||||
int32 Index;
|
int32 Index;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@@ -157,7 +157,7 @@ void ExtractGameobjectModels()
|
|||||||
if (numTris > 0)
|
if (numTris > 0)
|
||||||
{
|
{
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
for (std::vector<Triangle<uint16> >::iterator itr2 = model.Triangles.begin(); itr2 != model.Triangles.end(); ++itr2, ++i)
|
for (std::vector<Triangle<uint16>>::iterator itr2 = model.Triangles.begin(); itr2 != model.Triangles.end(); ++itr2, ++i)
|
||||||
{
|
{
|
||||||
indices[i * 3 + 0] = itr2->V0;
|
indices[i * 3 + 0] = itr2->V0;
|
||||||
indices[i * 3 + 1] = itr2->V1;
|
indices[i * 3 + 1] = itr2->V1;
|
||||||
@@ -229,7 +229,7 @@ void ExtractGameobjectModels()
|
|||||||
uint32 mobaBatch = itr2->MOBALength / 12;
|
uint32 mobaBatch = itr2->MOBALength / 12;
|
||||||
uint32* MobaEx = new uint32[mobaBatch * 4];
|
uint32* MobaEx = new uint32[mobaBatch * 4];
|
||||||
|
|
||||||
for(uint32 i = 8; i < itr2->MOBALength; i += 12)
|
for (uint32 i = 8; i < itr2->MOBALength; i += 12)
|
||||||
MobaEx[k++] = itr2->MOBA[i];
|
MobaEx[k++] = itr2->MOBA[i];
|
||||||
|
|
||||||
int mobaSizeGrp = mobaBatch * 4 + 4;
|
int mobaSizeGrp = mobaBatch * 4 + 4;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
ModelHeader Header;
|
ModelHeader Header;
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Vector3> Normals;
|
std::vector<Vector3> Normals;
|
||||||
std::vector<Triangle<uint16> > Triangles;
|
std::vector<Triangle<uint16>> Triangles;
|
||||||
bool IsCollidable;
|
bool IsCollidable;
|
||||||
FILE* Stream;
|
FILE* Stream;
|
||||||
bool IsBad;
|
bool IsBad;
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ float Utils::Distance( float x, float y )
|
|||||||
std::string Utils::Replace( std::string str, const std::string& oldStr, const std::string& newStr )
|
std::string Utils::Replace( std::string str, const std::string& oldStr, const std::string& newStr )
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
while((pos = str.find(oldStr, pos)) != std::string::npos)
|
while ((pos = str.find(oldStr, pos)) != std::string::npos)
|
||||||
{
|
{
|
||||||
str.replace(pos, oldStr.length(), newStr);
|
str.replace(pos, oldStr.length(), newStr);
|
||||||
pos += newStr.length();
|
pos += newStr.length();
|
||||||
@@ -223,7 +223,7 @@ std::string Utils::GetExtension( std::string path )
|
|||||||
std::string::size_type idx = path.rfind('.');
|
std::string::size_type idx = path.rfind('.');
|
||||||
std::string extension = "";
|
std::string extension = "";
|
||||||
|
|
||||||
if(idx != std::string::npos)
|
if (idx != std::string::npos)
|
||||||
extension = path.substr(idx + 1);
|
extension = path.substr(idx + 1);
|
||||||
return extension;
|
return extension;
|
||||||
}
|
}
|
||||||
@@ -525,7 +525,7 @@ char* Utils::GetPlainName(const char* FileName)
|
|||||||
{
|
{
|
||||||
char* temp;
|
char* temp;
|
||||||
|
|
||||||
if((temp = (char*)strrchr(FileName, '\\')) != nullptr)
|
if ((temp = (char*)strrchr(FileName, '\\')) != nullptr)
|
||||||
FileName = temp + 1;
|
FileName = temp + 1;
|
||||||
return (char*)FileName;
|
return (char*)FileName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
|
|
||||||
std::vector<uint8> TriangleFlags;
|
std::vector<uint8> TriangleFlags;
|
||||||
std::vector<uint8> TriangleMaterials;
|
std::vector<uint8> TriangleMaterials;
|
||||||
std::vector<Triangle<uint16> > Triangles;
|
std::vector<Triangle<uint16>> Triangles;
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Vector3> Normals;
|
std::vector<Vector3> Normals;
|
||||||
// @ToDo: Research.
|
// @ToDo: Research.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void WorldModelHandler::ProcessInternal( MapChunk* mcnk )
|
|||||||
fseek(stream, mcnk->Source->Offset, SEEK_SET);
|
fseek(stream, mcnk->Source->Offset, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldModelHandler::InsertModelGeometry( std::vector<Vector3>& verts, std::vector<Triangle<uint32> >& tris, const WorldModelDefinition& def, WorldModelRoot* root, bool translate )
|
void WorldModelHandler::InsertModelGeometry( std::vector<Vector3>& verts, std::vector<Triangle<uint32>>& tris, const WorldModelDefinition& def, WorldModelRoot* root, bool translate )
|
||||||
{
|
{
|
||||||
for (std::vector<WorldModelGroup>::iterator group = root->Groups.begin(); group != root->Groups.end(); ++group)
|
for (std::vector<WorldModelGroup>::iterator group = root->Groups.begin(); group != root->Groups.end(); ++group)
|
||||||
{
|
{
|
||||||
@@ -136,7 +136,7 @@ void WorldModelHandler::InsertModelGeometry( std::vector<Vector3>& verts, std::v
|
|||||||
Vector3 v = Utils::TransformDoodadVertex(def, Utils::TransformWmoDoodad(*instance, def, *itr2, false), translate);
|
Vector3 v = Utils::TransformDoodadVertex(def, Utils::TransformWmoDoodad(*instance, def, *itr2, false), translate);
|
||||||
verts.push_back(translate ? v : Utils::ToRecast(v));
|
verts.push_back(translate ? v : Utils::ToRecast(v));
|
||||||
}
|
}
|
||||||
for (std::vector<Triangle<uint16> >::iterator itr2 = model->Triangles.begin(); itr2 != model->Triangles.end(); ++itr2)
|
for (std::vector<Triangle<uint16>>::iterator itr2 = model->Triangles.begin(); itr2 != model->Triangles.end(); ++itr2)
|
||||||
tris.push_back(Triangle<uint32>(Constants::TRIANGLE_TYPE_WMO, itr2->V0 + vertOffset, itr2->V1 + vertOffset, itr2->V2 + vertOffset));
|
tris.push_back(Triangle<uint32>(Constants::TRIANGLE_TYPE_WMO, itr2->V0 + vertOffset, itr2->V1 + vertOffset, itr2->V2 + vertOffset));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@ public:
|
|||||||
~WorldModelHandler();
|
~WorldModelHandler();
|
||||||
|
|
||||||
std::vector<Vector3> Vertices;
|
std::vector<Vector3> Vertices;
|
||||||
std::vector<Triangle<uint32> > Triangles;
|
std::vector<Triangle<uint32>> Triangles;
|
||||||
bool IsSane() { return _definitions && _paths; }
|
bool IsSane() { return _definitions && _paths; }
|
||||||
static void InsertModelGeometry(std::vector<Vector3>& verts, std::vector<Triangle<uint32> >& tris, const WorldModelDefinition& def, WorldModelRoot* root, bool translate = true);
|
static void InsertModelGeometry(std::vector<Vector3>& verts, std::vector<Triangle<uint32>>& tris, const WorldModelDefinition& def, WorldModelRoot* root, bool translate = true);
|
||||||
protected:
|
protected:
|
||||||
void ProcessInternal(MapChunk* data);
|
void ProcessInternal(MapChunk* data);
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -421,7 +421,7 @@ namespace MMAP
|
|||||||
{
|
{
|
||||||
float quadHeight = 0;
|
float quadHeight = 0;
|
||||||
uint32 validCount = 0;
|
uint32 validCount = 0;
|
||||||
for(uint32 idx = 0; idx < 3; idx++)
|
for (uint32 idx = 0; idx < 3; idx++)
|
||||||
{
|
{
|
||||||
float h = lverts_copy[ltris[idx] * 3 + 1];
|
float h = lverts_copy[ltris[idx] * 3 + 1];
|
||||||
if (h != INVALID_MAP_LIQ_HEIGHT && h < INVALID_MAP_LIQ_HEIGHT_MAX)
|
if (h != INVALID_MAP_LIQ_HEIGHT && h < INVALID_MAP_LIQ_HEIGHT_MAX)
|
||||||
@@ -435,7 +435,7 @@ namespace MMAP
|
|||||||
if (validCount > 0 && validCount < 3)
|
if (validCount > 0 && validCount < 3)
|
||||||
{
|
{
|
||||||
quadHeight /= validCount;
|
quadHeight /= validCount;
|
||||||
for(uint32 idx = 0; idx < 3; idx++)
|
for (uint32 idx = 0; idx < 3; idx++)
|
||||||
{
|
{
|
||||||
float h = lverts[ltris[idx] * 3 + 1];
|
float h = lverts[ltris[idx] * 3 + 1];
|
||||||
if (h == INVALID_MAP_LIQ_HEIGHT || h > INVALID_MAP_LIQ_HEIGHT_MAX)
|
if (h == INVALID_MAP_LIQ_HEIGHT || h > INVALID_MAP_LIQ_HEIGHT_MAX)
|
||||||
@@ -457,7 +457,7 @@ namespace MMAP
|
|||||||
{
|
{
|
||||||
float minLLevel = INVALID_MAP_LIQ_HEIGHT_MAX;
|
float minLLevel = INVALID_MAP_LIQ_HEIGHT_MAX;
|
||||||
float maxLLevel = INVALID_MAP_LIQ_HEIGHT;
|
float maxLLevel = INVALID_MAP_LIQ_HEIGHT;
|
||||||
for(uint32 x = 0; x < 3; x++)
|
for (uint32 x = 0; x < 3; x++)
|
||||||
{
|
{
|
||||||
float h = lverts[ltris[x] * 3 + 1];
|
float h = lverts[ltris[x] * 3 + 1];
|
||||||
if (minLLevel > h)
|
if (minLLevel > h)
|
||||||
@@ -469,7 +469,7 @@ namespace MMAP
|
|||||||
|
|
||||||
float maxTLevel = INVALID_MAP_LIQ_HEIGHT;
|
float maxTLevel = INVALID_MAP_LIQ_HEIGHT;
|
||||||
float minTLevel = INVALID_MAP_LIQ_HEIGHT_MAX;
|
float minTLevel = INVALID_MAP_LIQ_HEIGHT_MAX;
|
||||||
for(uint32 x = 0; x < 6; x++)
|
for (uint32 x = 0; x < 6; x++)
|
||||||
{
|
{
|
||||||
float h = tverts[ttris[x] * 3 + 1];
|
float h = tverts[ttris[x] * 3 + 1];
|
||||||
if (maxTLevel < h)
|
if (maxTLevel < h)
|
||||||
@@ -579,21 +579,21 @@ namespace MMAP
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
0-----1 .... 128
|
0-----1 .... 128
|
||||||
|\ |
|
|\ |
|
||||||
| \ T |
|
| \ T |
|
||||||
| \ |
|
| \ |
|
||||||
| B \ |
|
| B \ |
|
||||||
| \|
|
| \|
|
||||||
129---130 ... 386
|
129---130 ... 386
|
||||||
|\ |
|
|\ |
|
||||||
| \ |
|
| \ |
|
||||||
| \ |
|
| \ |
|
||||||
| \ |
|
| \ |
|
||||||
| \|
|
| \|
|
||||||
258---259 ... 515
|
258---259 ... 515
|
||||||
*/
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -914,7 +914,7 @@ namespace MMAP
|
|||||||
// pretty silly thing, as we parse entire file and load only the tile we need
|
// pretty silly thing, as we parse entire file and load only the tile we need
|
||||||
// but we don't expect this file to be too large
|
// but we don't expect this file to be too large
|
||||||
char* buf = new char[512];
|
char* buf = new char[512];
|
||||||
while(fgets(buf, 512, fp))
|
while (fgets(buf, 512, fp))
|
||||||
{
|
{
|
||||||
float p0[3], p1[3];
|
float p0[3], p1[3];
|
||||||
uint32 mid, tx, ty;
|
uint32 mid, tx, ty;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ char const* GetPlainName(char const* FileName)
|
|||||||
{
|
{
|
||||||
const char* szTemp;
|
const char* szTemp;
|
||||||
|
|
||||||
if((szTemp = strrchr(FileName, '\\')) != nullptr)
|
if ((szTemp = strrchr(FileName, '\\')) != nullptr)
|
||||||
FileName = szTemp + 1;
|
FileName = szTemp + 1;
|
||||||
return FileName;
|
return FileName;
|
||||||
}
|
}
|
||||||
@@ -27,7 +27,7 @@ char* GetPlainName(char* FileName)
|
|||||||
{
|
{
|
||||||
char* szTemp;
|
char* szTemp;
|
||||||
|
|
||||||
if((szTemp = strrchr(FileName, '\\')) != nullptr)
|
if ((szTemp = strrchr(FileName, '\\')) != nullptr)
|
||||||
FileName = szTemp + 1;
|
FileName = szTemp + 1;
|
||||||
return FileName;
|
return FileName;
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ void fixname2(char* name, size_t len)
|
|||||||
{
|
{
|
||||||
for (size_t i = 0; i < len - 3; i++)
|
for (size_t i = 0; i < len - 3; i++)
|
||||||
{
|
{
|
||||||
if(name[i] == ' ')
|
if (name[i] == ' ')
|
||||||
name[i] = '_';
|
name[i] = '_';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ ADTFile::ADTFile(char* filename): ADT(filename), nWMO(0), nMDX(0), WmoInstansNam
|
|||||||
|
|
||||||
bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||||
{
|
{
|
||||||
if(ADT.isEof ())
|
if (ADT.isEof ())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 size;
|
uint32 size;
|
||||||
@@ -92,7 +92,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
|||||||
std::string dirname = std::string(szWorkDirWmo) + "/dir_bin";
|
std::string dirname = std::string(szWorkDirWmo) + "/dir_bin";
|
||||||
FILE* dirfile;
|
FILE* dirfile;
|
||||||
dirfile = fopen(dirname.c_str(), "ab");
|
dirfile = fopen(dirname.c_str(), "ab");
|
||||||
if(!dirfile)
|
if (!dirfile)
|
||||||
{
|
{
|
||||||
printf("Can't open dirfile!'%s'\n", dirname.c_str());
|
printf("Can't open dirfile!'%s'\n", dirname.c_str());
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void ExtractGameobjectModels()
|
|||||||
{
|
{
|
||||||
printf("Extracting GameObject models...");
|
printf("Extracting GameObject models...");
|
||||||
DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc");
|
DBCFile dbc("DBFilesClient\\GameObjectDisplayInfo.dbc");
|
||||||
if(!dbc.open())
|
if (!dbc.open())
|
||||||
{
|
{
|
||||||
printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
|
printf("Fatal error: Invalid GameObjectDisplayInfo.dbc file format!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ bool Model::open()
|
|||||||
_unload();
|
_unload();
|
||||||
|
|
||||||
memcpy(&header, f.getBuffer(), sizeof(ModelHeader));
|
memcpy(&header, f.getBuffer(), sizeof(ModelHeader));
|
||||||
if(header.nBoundingTriangles > 0)
|
if (header.nBoundingTriangles > 0)
|
||||||
{
|
{
|
||||||
f.seek(0);
|
f.seek(0);
|
||||||
f.seekRelative(header.ofsBoundingVertices);
|
f.seekRelative(header.ofsBoundingVertices);
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ MPQArchive::MPQArchive(const char* filename)
|
|||||||
{
|
{
|
||||||
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
int result = libmpq__archive_open(&mpq_a, filename, -1);
|
||||||
printf("Opening %s\n", filename);
|
printf("Opening %s\n", filename);
|
||||||
if(result)
|
if (result)
|
||||||
{
|
{
|
||||||
switch(result)
|
switch (result)
|
||||||
{
|
{
|
||||||
case LIBMPQ_ERROR_OPEN :
|
case LIBMPQ_ERROR_OPEN :
|
||||||
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
printf("Error opening archive '%s': Does file really exist?\n", filename);
|
||||||
@@ -54,12 +54,12 @@ MPQFile::MPQFile(const char* filename):
|
|||||||
pointer(0),
|
pointer(0),
|
||||||
size(0)
|
size(0)
|
||||||
{
|
{
|
||||||
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
for (ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end(); ++i)
|
||||||
{
|
{
|
||||||
mpq_archive* mpq_a = (*i)->mpq_a;
|
mpq_archive* mpq_a = (*i)->mpq_a;
|
||||||
|
|
||||||
uint32 filenum;
|
uint32 filenum;
|
||||||
if(libmpq__file_number(mpq_a, filename, &filenum)) continue;
|
if (libmpq__file_number(mpq_a, filename, &filenum)) continue;
|
||||||
libmpq__off_t transferred;
|
libmpq__off_t transferred;
|
||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public:
|
|||||||
void GetFileListTo(vector<string>& filelist)
|
void GetFileListTo(vector<string>& filelist)
|
||||||
{
|
{
|
||||||
uint32_t filenum;
|
uint32_t filenum;
|
||||||
if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
if (libmpq__file_number(mpq_a, "(listfile)", &filenum)) return;
|
||||||
libmpq__off_t size, transferred;
|
libmpq__off_t size, transferred;
|
||||||
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
libmpq__file_unpacked_size(mpq_a, filenum, &size);
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ bool FileExists(const char* file)
|
|||||||
|
|
||||||
void strToLower(char* str)
|
void strToLower(char* str)
|
||||||
{
|
{
|
||||||
while(*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
*str = tolower(*str);
|
*str = tolower(*str);
|
||||||
++str;
|
++str;
|
||||||
@@ -92,7 +92,7 @@ void ReadLiquidTypeTableDBC()
|
|||||||
{
|
{
|
||||||
printf("Read LiquidType.dbc file...");
|
printf("Read LiquidType.dbc file...");
|
||||||
DBCFile dbc("DBFilesClient\\LiquidType.dbc");
|
DBCFile dbc("DBFilesClient\\LiquidType.dbc");
|
||||||
if(!dbc.open())
|
if (!dbc.open())
|
||||||
{
|
{
|
||||||
printf("Fatal error: Invalid LiquidType.dbc file format!\n");
|
printf("Fatal error: Invalid LiquidType.dbc file format!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
@@ -103,7 +103,7 @@ void ReadLiquidTypeTableDBC()
|
|||||||
LiqType = new uint16[LiqType_maxid + 1];
|
LiqType = new uint16[LiqType_maxid + 1];
|
||||||
memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16));
|
memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16));
|
||||||
|
|
||||||
for(uint32 x = 0; x < LiqType_count; ++x)
|
for (uint32 x = 0; x < LiqType_count; ++x)
|
||||||
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3);
|
||||||
|
|
||||||
printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count);
|
printf("Done! (%u LiqTypes loaded)\n", (unsigned int)LiqType_count);
|
||||||
@@ -166,13 +166,13 @@ bool ExtractSingleWmo(std::string& fname)
|
|||||||
bool file_ok = true;
|
bool file_ok = true;
|
||||||
std::cout << "Extracting " << fname << std::endl;
|
std::cout << "Extracting " << fname << std::endl;
|
||||||
WMORoot froot(fname);
|
WMORoot froot(fname);
|
||||||
if(!froot.open())
|
if (!froot.open())
|
||||||
{
|
{
|
||||||
printf("Couldn't open RootWmo!!!\n");
|
printf("Couldn't open RootWmo!!!\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
FILE* output = fopen(szLocalFile, "wb");
|
FILE* output = fopen(szLocalFile, "wb");
|
||||||
if(!output)
|
if (!output)
|
||||||
{
|
{
|
||||||
printf("couldn't open %s for writing!\n", szLocalFile);
|
printf("couldn't open %s for writing!\n", szLocalFile);
|
||||||
return false;
|
return false;
|
||||||
@@ -198,7 +198,7 @@ bool ExtractSingleWmo(std::string& fname)
|
|||||||
|
|
||||||
string s = groupFileName;
|
string s = groupFileName;
|
||||||
WMOGroup fgroup(s);
|
WMOGroup fgroup(s);
|
||||||
if(!fgroup.open())
|
if (!fgroup.open())
|
||||||
{
|
{
|
||||||
printf("Could not open all Group file for: %s\n", plain_name);
|
printf("Could not open all Group file for: %s\n", plain_name);
|
||||||
file_ok = false;
|
file_ok = false;
|
||||||
@@ -229,7 +229,7 @@ void ParsMapFiles()
|
|||||||
sprintf(id, "%03u", map_ids[i].id);
|
sprintf(id, "%03u", map_ids[i].id);
|
||||||
sprintf(fn, "World\\Maps\\%s\\%s.wdt", map_ids[i].name, map_ids[i].name);
|
sprintf(fn, "World\\Maps\\%s\\%s.wdt", map_ids[i].name, map_ids[i].name);
|
||||||
WDTFile WDT(fn, map_ids[i].name);
|
WDTFile WDT(fn, map_ids[i].name);
|
||||||
if(WDT.init(id, map_ids[i].id))
|
if (WDT.init(id, map_ids[i].id))
|
||||||
{
|
{
|
||||||
printf("Processing Map %u\n[", map_ids[i].id);
|
printf("Processing Map %u\n[", map_ids[i].id);
|
||||||
for (int x = 0; x < 64; ++x)
|
for (int x = 0; x < 64; ++x)
|
||||||
@@ -276,9 +276,9 @@ bool scan_patches(char* scanmatch, std::vector<std::string>& pArchiveNames)
|
|||||||
sprintf(path, "%s.MPQ", scanmatch);
|
sprintf(path, "%s.MPQ", scanmatch);
|
||||||
}
|
}
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
if(FILE* h = fopen64(path, "rb"))
|
if (FILE* h = fopen64(path, "rb"))
|
||||||
#else
|
#else
|
||||||
if(FILE* h = fopen(path, "rb"))
|
if (FILE* h = fopen(path, "rb"))
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
fclose(h);
|
fclose(h);
|
||||||
@@ -287,12 +287,12 @@ bool scan_patches(char* scanmatch, std::vector<std::string>& pArchiveNames)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return(true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
|
bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
|
||||||
{
|
{
|
||||||
if(!hasInputPathParam)
|
if (!hasInputPathParam)
|
||||||
getGamePath();
|
getGamePath();
|
||||||
|
|
||||||
printf("\nGame path: %s\n", input_path);
|
printf("\nGame path: %s\n", input_path);
|
||||||
@@ -352,7 +352,7 @@ bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!scan_patches(path, pArchiveNames))
|
if (!scan_patches(path, pArchiveNames))
|
||||||
return(false);
|
return (false);
|
||||||
|
|
||||||
// now, scan for the patch levels in locale dirs
|
// now, scan for the patch levels in locale dirs
|
||||||
printf("Scanning patch levels from locale directories.\n");
|
printf("Scanning patch levels from locale directories.\n");
|
||||||
@@ -366,13 +366,13 @@ bool fillArchiveNameVector(std::vector<std::string>& pArchiveNames)
|
|||||||
printf("Error when formatting string");
|
printf("Error when formatting string");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(scan_patches(path, pArchiveNames))
|
if (scan_patches(path, pArchiveNames))
|
||||||
foundOne = true;
|
foundOne = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if(!foundOne)
|
if (!foundOne)
|
||||||
{
|
{
|
||||||
printf("no locale found\n");
|
printf("no locale found\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -387,15 +387,15 @@ bool processArgv(int argc, char** argv, const char* versionString)
|
|||||||
hasInputPathParam = false;
|
hasInputPathParam = false;
|
||||||
preciseVectorData = false;
|
preciseVectorData = false;
|
||||||
|
|
||||||
for(int i = 1; i < argc; ++i)
|
for (int i = 1; i < argc; ++i)
|
||||||
{
|
{
|
||||||
if(strcmp("-s", argv[i]) == 0)
|
if (strcmp("-s", argv[i]) == 0)
|
||||||
{
|
{
|
||||||
preciseVectorData = false;
|
preciseVectorData = false;
|
||||||
}
|
}
|
||||||
else if(strcmp("-d", argv[i]) == 0)
|
else if (strcmp("-d", argv[i]) == 0)
|
||||||
{
|
{
|
||||||
if((i + 1) < argc)
|
if ((i + 1) < argc)
|
||||||
{
|
{
|
||||||
hasInputPathParam = true;
|
hasInputPathParam = true;
|
||||||
strcpy(input_path, argv[i + 1]);
|
strcpy(input_path, argv[i + 1]);
|
||||||
@@ -408,11 +408,11 @@ bool processArgv(int argc, char** argv, const char* versionString)
|
|||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(strcmp("-?", argv[1]) == 0)
|
else if (strcmp("-?", argv[1]) == 0)
|
||||||
{
|
{
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
else if(strcmp("-l", argv[i]) == 0)
|
else if (strcmp("-l", argv[i]) == 0)
|
||||||
{
|
{
|
||||||
preciseVectorData = true;
|
preciseVectorData = true;
|
||||||
}
|
}
|
||||||
@@ -422,7 +422,7 @@ bool processArgv(int argc, char** argv, const char* versionString)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
printf("Extract %s.\n", versionString);
|
printf("Extract %s.\n", versionString);
|
||||||
printf("%s [-?][-s][-l][-d <path>]\n", argv[0]);
|
printf("%s [-?][-s][-l][-d <path>]\n", argv[0]);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ char* wdtGetPlainName(char* FileName)
|
|||||||
{
|
{
|
||||||
char* szTemp;
|
char* szTemp;
|
||||||
|
|
||||||
if((szTemp = strrchr(FileName, '\\')) != nullptr)
|
if ((szTemp = strrchr(FileName, '\\')) != nullptr)
|
||||||
FileName = szTemp + 1;
|
FileName = szTemp + 1;
|
||||||
return FileName;
|
return FileName;
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,7 @@ bool WDTFile::init(char* /*map_id*/, unsigned int mapID)
|
|||||||
std::string dirname = std::string(szWorkDirWmo) + "/dir_bin";
|
std::string dirname = std::string(szWorkDirWmo) + "/dir_bin";
|
||||||
FILE* dirfile;
|
FILE* dirfile;
|
||||||
dirfile = fopen(dirname.c_str(), "ab");
|
dirfile = fopen(dirname.c_str(), "ab");
|
||||||
if(!dirfile)
|
if (!dirfile)
|
||||||
{
|
{
|
||||||
printf("Can't open dirfile!'%s'\n", dirname.c_str());
|
printf("Can't open dirfile!'%s'\n", dirname.c_str());
|
||||||
return false;
|
return false;
|
||||||
@@ -108,7 +108,7 @@ WDTFile::~WDTFile(void)
|
|||||||
|
|
||||||
ADTFile* WDTFile::GetMap(int x, int z)
|
ADTFile* WDTFile::GetMap(int x, int z)
|
||||||
{
|
{
|
||||||
if(!(x >= 0 && z >= 0 && x < 64 && z < 64))
|
if (!(x >= 0 && z >= 0 && x < 64 && z < 64))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
char name[512];
|
char name[512];
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ WMORoot::WMORoot(std::string& filename)
|
|||||||
bool WMORoot::open()
|
bool WMORoot::open()
|
||||||
{
|
{
|
||||||
MPQFile f(filename.c_str());
|
MPQFile f(filename.c_str());
|
||||||
if(f.isEof ())
|
if (f.isEof ())
|
||||||
{
|
{
|
||||||
printf("No such file.\n");
|
printf("No such file.\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -138,7 +138,7 @@ WMOGroup::WMOGroup(const std::string& filename) :
|
|||||||
bool WMOGroup::open()
|
bool WMOGroup::open()
|
||||||
{
|
{
|
||||||
MPQFile f(filename.c_str());
|
MPQFile f(filename.c_str());
|
||||||
if(f.isEof ())
|
if (f.isEof ())
|
||||||
{
|
{
|
||||||
printf("No such file.\n");
|
printf("No such file.\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -248,7 +248,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool precise
|
|||||||
int k = 0;
|
int k = 0;
|
||||||
int moba_batch = moba_size / 12;
|
int moba_batch = moba_size / 12;
|
||||||
MobaEx = new int[moba_batch * 4];
|
MobaEx = new int[moba_batch * 4];
|
||||||
for(int i = 8; i < moba_size; i += 12)
|
for (int i = 8; i < moba_size; i += 12)
|
||||||
{
|
{
|
||||||
MobaEx[k++] = MOBA[i];
|
MobaEx[k++] = MOBA[i];
|
||||||
}
|
}
|
||||||
@@ -260,50 +260,50 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool precise
|
|||||||
|
|
||||||
uint32 nIdexes = nTriangles * 3;
|
uint32 nIdexes = nTriangles * 3;
|
||||||
|
|
||||||
if(fwrite("INDX", 4, 1, output) != 1)
|
if (fwrite("INDX", 4, 1, output) != 1)
|
||||||
{
|
{
|
||||||
printf("Error while writing file nbraches ID");
|
printf("Error while writing file nbraches ID");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes;
|
int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes;
|
||||||
if(fwrite(&wsize, sizeof(int), 1, output) != 1)
|
if (fwrite(&wsize, sizeof(int), 1, output) != 1)
|
||||||
{
|
{
|
||||||
printf("Error while writing file wsize");
|
printf("Error while writing file wsize");
|
||||||
// no need to exit?
|
// no need to exit?
|
||||||
}
|
}
|
||||||
if(fwrite(&nIdexes, sizeof(uint32), 1, output) != 1)
|
if (fwrite(&nIdexes, sizeof(uint32), 1, output) != 1)
|
||||||
{
|
{
|
||||||
printf("Error while writing file nIndexes");
|
printf("Error while writing file nIndexes");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if(nIdexes > 0)
|
if (nIdexes > 0)
|
||||||
{
|
{
|
||||||
if(fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes)
|
if (fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes)
|
||||||
{
|
{
|
||||||
printf("Error while writing file indexarray");
|
printf("Error while writing file indexarray");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fwrite("VERT", 4, 1, output) != 1)
|
if (fwrite("VERT", 4, 1, output) != 1)
|
||||||
{
|
{
|
||||||
printf("Error while writing file nbraches ID");
|
printf("Error while writing file nbraches ID");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
|
wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
|
||||||
if(fwrite(&wsize, sizeof(int), 1, output) != 1)
|
if (fwrite(&wsize, sizeof(int), 1, output) != 1)
|
||||||
{
|
{
|
||||||
printf("Error while writing file wsize");
|
printf("Error while writing file wsize");
|
||||||
// no need to exit?
|
// no need to exit?
|
||||||
}
|
}
|
||||||
if(fwrite(&nVertices, sizeof(int), 1, output) != 1)
|
if (fwrite(&nVertices, sizeof(int), 1, output) != 1)
|
||||||
{
|
{
|
||||||
printf("Error while writing file nVertices");
|
printf("Error while writing file nVertices");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
if(nVertices > 0)
|
if (nVertices > 0)
|
||||||
{
|
{
|
||||||
if(fwrite(MOVT, sizeof(float) * 3, nVertices, output) != nVertices)
|
if (fwrite(MOVT, sizeof(float) * 3, nVertices, output) != nVertices)
|
||||||
{
|
{
|
||||||
printf("Error while writing file vectors");
|
printf("Error while writing file vectors");
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -319,7 +319,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool precise
|
|||||||
int k = 0;
|
int k = 0;
|
||||||
int moba_batch = moba_size / 12;
|
int moba_batch = moba_size / 12;
|
||||||
MobaEx = new int[moba_batch * 4];
|
MobaEx = new int[moba_batch * 4];
|
||||||
for(int i = 8; i < moba_size; i += 12)
|
for (int i = 8; i < moba_size; i += 12)
|
||||||
{
|
{
|
||||||
MobaEx[k++] = MOBA[i];
|
MobaEx[k++] = MOBA[i];
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool precise
|
|||||||
int check = 3 * nColVertices;
|
int check = 3 * nColVertices;
|
||||||
fwrite(VERT, 4, 3, output);
|
fwrite(VERT, 4, 3, output);
|
||||||
for (uint32 i = 0; i < nVertices; ++i)
|
for (uint32 i = 0; i < nVertices; ++i)
|
||||||
if(IndexRenum[i] >= 0)
|
if (IndexRenum[i] >= 0)
|
||||||
check -= fwrite(MOVT + 3 * i, sizeof(float), 3, output);
|
check -= fwrite(MOVT + 3 * i, sizeof(float), 3, output);
|
||||||
|
|
||||||
assert(check == 0);
|
assert(check == 0);
|
||||||
@@ -498,7 +498,7 @@ WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint
|
|||||||
FILE* input;
|
FILE* input;
|
||||||
input = fopen(tempname, "r+b");
|
input = fopen(tempname, "r+b");
|
||||||
|
|
||||||
if(!input)
|
if (!input)
|
||||||
{
|
{
|
||||||
printf("WMOInstance::WMOInstance: couldn't open %s\n", tempname);
|
printf("WMOInstance::WMOInstance: couldn't open %s\n", tempname);
|
||||||
return;
|
return;
|
||||||
@@ -515,7 +515,7 @@ WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint
|
|||||||
float x, z;
|
float x, z;
|
||||||
x = pos.x;
|
x = pos.x;
|
||||||
z = pos.z;
|
z = pos.z;
|
||||||
if(x == 0 && z == 0)
|
if (x == 0 && z == 0)
|
||||||
{
|
{
|
||||||
pos.x = 533.33333f * 32;
|
pos.x = 533.33333f * 32;
|
||||||
pos.z = 533.33333f * 32;
|
pos.z = 533.33333f * 32;
|
||||||
@@ -526,7 +526,7 @@ WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint
|
|||||||
|
|
||||||
float scale = 1.0f;
|
float scale = 1.0f;
|
||||||
uint32 flags = MOD_HAS_BOUND;
|
uint32 flags = MOD_HAS_BOUND;
|
||||||
if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
|
if (tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN;
|
||||||
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
|
//write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
|
||||||
fwrite(&mapID, sizeof(uint32), 1, pDirfile);
|
fwrite(&mapID, sizeof(uint32), 1, pDirfile);
|
||||||
fwrite(&tileX, sizeof(uint32), 1, pDirfile);
|
fwrite(&tileX, sizeof(uint32), 1, pDirfile);
|
||||||
|
|||||||
Reference in New Issue
Block a user