mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
--HG-- branch : trunk rename : contrib/vmap_assembler/CMakeLists.txt => contrib/vmap3_assembler/CMakeLists.txt rename : contrib/vmap_assembler/VC90/vmap_assembler.vcproj => contrib/vmap3_assembler/VC90/vmap_assembler.vcproj rename : contrib/vmap_assembler/splitConfig.txt => contrib/vmap3_assembler/splitConfig.txt rename : contrib/vmap_assembler/vmap_assembler.cpp => contrib/vmap3_assembler/vmap_assembler.cpp rename : contrib/vmap_assembler/vmap_assemblerVC90.sln => contrib/vmap3_assembler/vmap_assemblerVC90.sln rename : contrib/vmap_extractor_v2/CMakeLists.txt => contrib/vmap3_extractor/CMakeLists.txt rename : contrib/vmap_extractor_v2/vmapextract/CMakeLists.txt => contrib/vmap3_extractor/vmapextract/CMakeLists.txt rename : contrib/vmap_extractor_v2/vmapextract/adtfile.cpp => contrib/vmap3_extractor/vmapextract/adtfile.cpp rename : contrib/vmap_extractor_v2/vmapextract/adtfile.h => contrib/vmap3_extractor/vmapextract/adtfile.h rename : contrib/vmap_extractor_v2/vmapextract/dbcfile.cpp => contrib/vmap3_extractor/vmapextract/dbcfile.cpp rename : contrib/vmap_extractor_v2/vmapextract/dbcfile.h => contrib/vmap3_extractor/vmapextract/dbcfile.h rename : contrib/vmap_extractor_v2/vmapextract/loadlib/loadlib.h => contrib/vmap3_extractor/vmapextract/loadlib/loadlib.h rename : contrib/vmap_extractor_v2/vmapextract/model.cpp => contrib/vmap3_extractor/vmapextract/model.cpp rename : contrib/vmap_extractor_v2/vmapextract/model.h => contrib/vmap3_extractor/vmapextract/model.h rename : contrib/vmap_extractor_v2/vmapextract/modelheaders.h => contrib/vmap3_extractor/vmapextract/modelheaders.h rename : contrib/vmap_extractor_v2/vmapextract/mpq_libmpq.cpp => contrib/vmap3_extractor/vmapextract/mpq_libmpq.cpp rename : contrib/vmap_extractor_v2/vmapextract/mpq_libmpq04.h => contrib/vmap3_extractor/vmapextract/mpq_libmpq04.h rename : contrib/vmap_extractor_v2/vmapextract/vec3d.h => contrib/vmap3_extractor/vmapextract/vec3d.h rename : contrib/vmap_extractor_v2/vmapextract/vmapexport.cpp => contrib/vmap3_extractor/vmapextract/vmapexport.cpp rename : contrib/vmap_extractor_v2/vmapextract/vmapexport.h => contrib/vmap3_extractor/vmapextract/vmapexport.h rename : contrib/vmap_extractor_v2/vmapextract/wdtfile.cpp => contrib/vmap3_extractor/vmapextract/wdtfile.cpp rename : contrib/vmap_extractor_v2/vmapextract/wdtfile.h => contrib/vmap3_extractor/vmapextract/wdtfile.h rename : contrib/vmap_extractor_v2/vmapextract/wmo.cpp => contrib/vmap3_extractor/vmapextract/wmo.cpp rename : contrib/vmap_extractor_v2/vmapextract/wmo.h => contrib/vmap3_extractor/vmapextract/wmo.h rename : contrib/vmap_extractor_v2/win/vmapExtractor3_VC90.sln => contrib/vmap3_extractor/win/vmapExtractor3_VC90.sln
121 lines
3.1 KiB
C++
121 lines
3.1 KiB
C++
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string>
|
|
|
|
#include "TileAssembler.h"
|
|
|
|
//=======================================================
|
|
// remove last return or LF and tailing SPACE
|
|
// remove all char after a #
|
|
|
|
void chompAndTrim(std::string& str)
|
|
{
|
|
for(unsigned int i=0;i<str.length(); ++i) {
|
|
char lc = str[i];
|
|
if(lc == '#') {
|
|
str = str.substr(0,i);
|
|
break;
|
|
}
|
|
}
|
|
|
|
while(str.length() >0) {
|
|
char lc = str[str.length()-1];
|
|
if(lc == '\r' || lc == '\n' || lc == ' ') {
|
|
str = str.substr(0,str.length()-1);
|
|
} else {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
//=======================================================
|
|
/**
|
|
This callback method is called for each model found in the dir file.
|
|
return true if it should be included in the vmap
|
|
*/
|
|
bool modelNameFilter(char *pName)
|
|
{
|
|
#if 0
|
|
bool result;
|
|
result = !Wildcard::wildcardfit("*bush[0-9]*", pName);
|
|
if(result) result = !Wildcard::wildcardfit("*shrub[0-9]*", pName);
|
|
if(result) result = !Wildcard::wildcardfit("*_Bushes_*", pName);
|
|
if(result) result = !Wildcard::wildcardfit("*_Bush_*", pName);
|
|
if(!result) {
|
|
printf("%s",pName);
|
|
}
|
|
#endif
|
|
return true;
|
|
}
|
|
|
|
//=======================================================
|
|
/**
|
|
File contains map names that should be split into tiles
|
|
A '#' at the beginning of a line defines a comment
|
|
*/
|
|
|
|
/* bool readConfigFile(char *pConffile, VMAP::TileAssembler* pTa)
|
|
{
|
|
bool result = false;
|
|
char buffer[501];
|
|
FILE *cf = fopen(pConffile, "rb");
|
|
if(cf) {
|
|
while(fgets(buffer, 500, cf)) {
|
|
std::string name = std::string(buffer);
|
|
size_t pos = name.find_first_not_of(' ');
|
|
name = name.substr(pos);
|
|
chompAndTrim(name); // just to be sure
|
|
if(name[0] != '#' && name.size() >0) { // comment?
|
|
unsigned int mapId = atoi(name.c_str());
|
|
pTa->addWorldAreaMapId(mapId);
|
|
}
|
|
}
|
|
fclose(cf);
|
|
result = true;
|
|
}
|
|
return(result);
|
|
} */
|
|
//=======================================================
|
|
int main(int argc, char* argv[])
|
|
{
|
|
if(argc != 3 && argc != 4)
|
|
{
|
|
printf("\nusage: %s <raw data dir> <vmap dest dir> [config file name]\n", argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
char *src = argv[1];
|
|
char *dest = argv[2];
|
|
char *conffile = NULL;
|
|
if(argc >= 4)
|
|
conffile = argv[3];
|
|
|
|
VMAP::TileAssembler* ta = new VMAP::TileAssembler(std::string(src), std::string(dest));
|
|
ta->setModelNameFilterMethod(modelNameFilter);
|
|
|
|
/*
|
|
All the names in the list are considered to be world maps or huge instances.
|
|
These maps will be spilt into tiles in the vmap assemble process
|
|
*/
|
|
/* if(conffile != NULL)
|
|
{
|
|
if(!readConfigFile(conffile, ta))
|
|
{
|
|
printf("Can not open file config file: %s\n", conffile);
|
|
delete ta;
|
|
return 1;
|
|
}
|
|
} */
|
|
|
|
if(!ta->convertWorld2())
|
|
{
|
|
printf("exit with errors\n");
|
|
delete ta;
|
|
return 1;
|
|
}
|
|
|
|
delete ta;
|
|
printf("Ok, all done\n");
|
|
return 0;
|
|
}
|