Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps
This commit is contained in:
commit
554e88dd63
74 files changed
+476
-464
No files matched your search
@@ -936,7 +936,7 @@ void ExtractMapsFromMpq(uint32 build)
|
||||
printf("Convert map files\n");
|
||||
for(uint32 z = 0; z < map_count; ++z)
|
||||
{
|
||||
printf("Extract %s (%d/%d) \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
|
||||
sprintf(mpq_map_name, "World\\Maps\\%s\\%s.wdt", map_ids[z].name, map_ids[z].name);
|
||||
WDT_file wdt;
|
||||
@@ -1016,13 +1016,13 @@ void ExtractDBCFiles(int locale, bool basicLocale)
|
||||
}
|
||||
|
||||
// extract DBCs
|
||||
int count = 0;
|
||||
uint32 count = 0;
|
||||
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
|
||||
{
|
||||
string filename = path;
|
||||
filename += (iter->c_str() + strlen("DBFilesClient\\"));
|
||||
|
||||
if(ExtractFile(iter->c_str(), filename))
|
||||
if (ExtractFile(iter->c_str(), filename))
|
||||
++count;
|
||||
}
|
||||
printf("Extracted %u DBC files\n\n", count);
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "dbcfile.h"
|
||||
#include "mpq_libmpq04.h"
|
||||
|
||||
DBCFile::DBCFile(const std::string &filename):
|
||||
filename(filename),
|
||||
data(0)
|
||||
DBCFile::DBCFile(const std::string& filename):
|
||||
filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool DBCFile::open()
|
||||
{
|
||||
MPQFile f(filename.c_str());
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
const char * GetPlainName(const char * FileName)
|
||||
char const* GetPlainName(char const* FileName)
|
||||
{
|
||||
const char * szTemp;
|
||||
|
||||
@@ -35,7 +35,7 @@ const char * GetPlainName(const char * FileName)
|
||||
return FileName;
|
||||
}
|
||||
|
||||
char * GetPlainName(char * FileName)
|
||||
char* GetPlainName(char* FileName)
|
||||
{
|
||||
char * szTemp;
|
||||
|
||||
@@ -44,24 +44,21 @@ char * GetPlainName(char * FileName)
|
||||
return FileName;
|
||||
}
|
||||
|
||||
void fixnamen(char *name, size_t len)
|
||||
void fixnamen(char* name, size_t len)
|
||||
{
|
||||
for (size_t i=0; i<len-3; i++)
|
||||
for (size_t i = 0; i < len-3; i++)
|
||||
{
|
||||
if (i>0 && name[i]>='A' && name[i]<='Z' && isalpha(name[i-1]))
|
||||
{
|
||||
if (i > 0 && name[i] >= 'A' && name[i] <= 'Z' && isalpha(name[i-1]))
|
||||
name[i] |= 0x20;
|
||||
} else if ((i==0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
|
||||
{
|
||||
else if ((i == 0 || !isalpha(name[i-1])) && name[i]>='a' && name[i]<='z')
|
||||
name[i] &= ~0x20;
|
||||
}
|
||||
}
|
||||
//extension in lowercase
|
||||
for(size_t i=len-3; i<len; i++)
|
||||
for (size_t i = len - 3; i < len; i++)
|
||||
name[i] |= 0x20;
|
||||
}
|
||||
|
||||
void fixname2(char *name, size_t len)
|
||||
void fixname2(char* name, size_t len)
|
||||
{
|
||||
for (size_t i=0; i<len-3; i++)
|
||||
{
|
||||
@@ -70,15 +67,15 @@ void fixname2(char *name, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
char * GetExtension(char * FileName)
|
||||
char* GetExtension(char* FileName)
|
||||
{
|
||||
char * szTemp;
|
||||
if((szTemp = strrchr(FileName, '.')) != NULL)
|
||||
char* szTemp;
|
||||
if (szTemp = strrchr(FileName, '.'))
|
||||
return szTemp;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ADTFile::ADTFile(char* filename): ADT(filename)
|
||||
ADTFile::ADTFile(char* filename): ADT(filename), nWMO(0), nMDX(0), WmoInstansName(NULL), ModelInstansName(NULL)
|
||||
{
|
||||
Adtfilename.append(filename);
|
||||
}
|
||||
@@ -99,7 +96,7 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
xMap = TempMapNumber.substr(TempMapNumber.find("_")+1,(TempMapNumber.find_last_of("_")-1) - (TempMapNumber.find("_")));
|
||||
yMap = TempMapNumber.substr(TempMapNumber.find_last_of("_")+1,(TempMapNumber.length()) - (TempMapNumber.find_last_of("_")));
|
||||
Adtfilename.erase((Adtfilename.length()-xMap.length()-yMap.length()-2), (xMap.length()+yMap.length()+2));
|
||||
string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
|
||||
//string AdtMapNumber = xMap + ' ' + yMap + ' ' + GetPlainName((char*)Adtfilename.c_str());
|
||||
//printf("Processing map %s...\n", AdtMapNumber.c_str());
|
||||
//printf("MapNumber = %s\n", TempMapNumber.c_str());
|
||||
//printf("xMap = %s\n", xMap.c_str());
|
||||
@@ -159,18 +156,17 @@ bool ADTFile::init(uint32 map_num, uint32 tileX, uint32 tileY)
|
||||
{
|
||||
if (size)
|
||||
{
|
||||
char *buf = new char[size];
|
||||
char* buf = new char[size];
|
||||
ADT.read(buf, size);
|
||||
char *p=buf;
|
||||
char* p=buf;
|
||||
int q = 0;
|
||||
WmoInstansName = new string[size];
|
||||
while (p<buf+size)
|
||||
{
|
||||
string path(p);
|
||||
char* s=GetPlainName(p);
|
||||
fixnamen(s,strlen(s));
|
||||
fixname2(s,strlen(s));
|
||||
p=p+strlen(p)+1;
|
||||
char* s = GetPlainName(p);
|
||||
fixnamen(s, strlen(s));
|
||||
fixname2(s, strlen(s));
|
||||
p += strlen(p) + 1;
|
||||
WmoInstansName[q++] = s;
|
||||
}
|
||||
delete[] buf;
|
||||
|
||||
@@ -23,9 +23,10 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
DBCFile::DBCFile(const std::string &filename) : filename(filename)
|
||||
DBCFile::DBCFile(const std::string& filename):
|
||||
filename(filename), recordSize(0), recordCount(0), fieldCount(0), stringSize(0), data(NULL), stringTable(NULL)
|
||||
{
|
||||
data = NULL;
|
||||
|
||||
}
|
||||
|
||||
bool DBCFile::open()
|
||||
|
||||
@@ -26,15 +26,14 @@
|
||||
|
||||
Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0)
|
||||
{
|
||||
memset(&header, 0, sizeof(header));
|
||||
}
|
||||
|
||||
bool Model::open()
|
||||
{
|
||||
MPQFile f(filename.c_str());
|
||||
|
||||
ok = !f.isEof();
|
||||
|
||||
if (!ok)
|
||||
if (f.isEof())
|
||||
{
|
||||
f.close();
|
||||
// Do not show this error on console to avoid confusion, the extractor can continue working even if some models fail to load
|
||||
@@ -52,9 +51,7 @@ bool Model::open()
|
||||
vertices = new Vec3D[header.nBoundingVertices];
|
||||
f.read(vertices,header.nBoundingVertices*12);
|
||||
for (uint32 i=0; i<header.nBoundingVertices; i++)
|
||||
{
|
||||
vertices[i] = fixCoordSystem(vertices[i]);
|
||||
}
|
||||
f.seek(0);
|
||||
f.seekRelative(header.ofsBoundingTriangles);
|
||||
indices = new uint16[header.nBoundingTriangles];
|
||||
@@ -73,13 +70,13 @@ bool Model::open()
|
||||
bool Model::ConvertToVMAPModel(const char * outfilename)
|
||||
{
|
||||
int N[12] = {0,0,0,0,0,0,0,0,0,0,0,0};
|
||||
FILE * output=fopen(outfilename,"wb");
|
||||
if(!output)
|
||||
FILE* output=fopen(outfilename, "wb");
|
||||
if (!output)
|
||||
{
|
||||
printf("Can't create the output file '%s'\n",outfilename);
|
||||
return false;
|
||||
}
|
||||
fwrite(szRawVMAPMagic,8,1,output);
|
||||
fwrite(szRawVMAPMagic, 8, 1, output);
|
||||
uint32 nVertices = 0;
|
||||
nVertices = header.nBoundingVertices;
|
||||
fwrite(&nVertices, sizeof(int), 1, output);
|
||||
@@ -101,20 +98,18 @@ bool Model::ConvertToVMAPModel(const char * outfilename)
|
||||
wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes;
|
||||
fwrite(&wsize, sizeof(int), 1, output);
|
||||
fwrite(&nIndexes, sizeof(uint32), 1, output);
|
||||
if(nIndexes >0)
|
||||
{
|
||||
if (nIndexes >0)
|
||||
fwrite(indices, sizeof(unsigned short), nIndexes, output);
|
||||
}
|
||||
fwrite("VERT",4, 1, output);
|
||||
|
||||
fwrite("VERT", 4, 1, output);
|
||||
wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
|
||||
fwrite(&wsize, sizeof(int), 1, output);
|
||||
fwrite(&nVertices, sizeof(int), 1, output);
|
||||
if(nVertices >0)
|
||||
if (nVertices >0)
|
||||
{
|
||||
for(uint32 vpos=0; vpos <nVertices; ++vpos)
|
||||
{
|
||||
std::swap(vertices[vpos].y, vertices[vpos].z);
|
||||
}
|
||||
|
||||
fwrite(vertices, sizeof(float)*3, nVertices, output);
|
||||
}
|
||||
|
||||
@@ -134,24 +129,24 @@ Vec3D fixCoordSystem2(Vec3D v)
|
||||
return Vec3D(v.x, v.z, v.y);
|
||||
}
|
||||
|
||||
ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
|
||||
ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
|
||||
: model(NULL), d1(0), w(0.0f)
|
||||
{
|
||||
float ff[3];
|
||||
f.read(&id, 4);
|
||||
f.read(ff,12);
|
||||
pos = fixCoords(Vec3D(ff[0],ff[1],ff[2]));
|
||||
f.read(ff,12);
|
||||
rot = Vec3D(ff[0],ff[1],ff[2]);
|
||||
f.read(&scale,4);
|
||||
f.read(ff, 12);
|
||||
pos = fixCoords(Vec3D(ff[0], ff[1], ff[2]));
|
||||
f.read(ff, 12);
|
||||
rot = Vec3D(ff[0], ff[1], ff[2]);
|
||||
f.read(&scale, 4);
|
||||
// scale factor - divide by 1024. blizzard devs must be on crack, why not just use a float?
|
||||
sc = scale / 1024.0f;
|
||||
|
||||
char tempname[512];
|
||||
sprintf(tempname, "%s/%s", szWorkDirWmo, ModelInstName);
|
||||
FILE *input;
|
||||
input = fopen(tempname, "r+b");
|
||||
FILE* input = fopen(tempname, "r+b");
|
||||
|
||||
if(!input)
|
||||
if (!input)
|
||||
{
|
||||
//printf("ModelInstance::ModelInstance couldn't open %s\n", tempname);
|
||||
return;
|
||||
@@ -167,7 +162,9 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID,
|
||||
|
||||
uint16 adtId = 0;// not used for models
|
||||
uint32 flags = MOD_M2;
|
||||
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, name
|
||||
fwrite(&mapID, sizeof(uint32), 1, pDirfile);
|
||||
fwrite(&tileX, sizeof(uint32), 1, pDirfile);
|
||||
|
||||
@@ -21,12 +21,9 @@
|
||||
|
||||
#include "loadlib/loadlib.h"
|
||||
#include "vec3d.h"
|
||||
//#include "mpq.h"
|
||||
#include "modelheaders.h"
|
||||
#include <vector>
|
||||
|
||||
class Model;
|
||||
class WMOInstance;
|
||||
class MPQFile;
|
||||
|
||||
Vec3D fixCoordSystem(Vec3D v);
|
||||
@@ -35,18 +32,14 @@ class Model
|
||||
{
|
||||
public:
|
||||
ModelHeader header;
|
||||
uint32 offsBB_vertices, offsBB_indices;
|
||||
Vec3D *BB_vertices, *vertices;
|
||||
uint16 *BB_indices, *indices;
|
||||
size_t nIndices;
|
||||
Vec3D* vertices;
|
||||
uint16* indices;
|
||||
|
||||
bool open();
|
||||
bool ConvertToVMAPModel(const char * outfilename);
|
||||
bool ConvertToVMAPModel(char const* outfilename);
|
||||
|
||||
bool ok;
|
||||
|
||||
Model(std::string &filename);
|
||||
~Model() {_unload();}
|
||||
Model(std::string& filename);
|
||||
~Model() { _unload(); }
|
||||
|
||||
private:
|
||||
void _unload()
|
||||
@@ -56,22 +49,22 @@ private:
|
||||
vertices = NULL;
|
||||
indices = NULL;
|
||||
}
|
||||
|
||||
std::string filename;
|
||||
char outfilename;
|
||||
};
|
||||
|
||||
class ModelInstance
|
||||
{
|
||||
public:
|
||||
Model *model;
|
||||
Model* model;
|
||||
|
||||
uint32 id;
|
||||
Vec3D pos, rot;
|
||||
unsigned int d1, scale;
|
||||
float w,sc;
|
||||
float w, sc;
|
||||
|
||||
ModelInstance() {}
|
||||
ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
|
||||
ModelInstance() : model(NULL), d1(0), scale(0), w(0.0f), sc(0.0f), id(0) {}
|
||||
ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -159,12 +159,12 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
|
||||
int p = 0;
|
||||
//Select root wmo files
|
||||
const char * rchr = strrchr(plain_name, '_');
|
||||
char const* rchr = strrchr(plain_name, '_');
|
||||
if(rchr != NULL)
|
||||
{
|
||||
char cpy[4];
|
||||
strncpy((char*)cpy,rchr,4);
|
||||
for (int i=0;i < 4; ++i)
|
||||
strncpy((char*)cpy, rchr, 4);
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
int m = cpy[i];
|
||||
if(isdigit(m))
|
||||
@@ -200,7 +200,7 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
strcpy(temp, fname.c_str());
|
||||
temp[fname.length()-4] = 0;
|
||||
char groupFileName[1024];
|
||||
sprintf(groupFileName,"%s_%03d.wmo",temp, i);
|
||||
sprintf(groupFileName, "%s_%03u.wmo", temp, i);
|
||||
//printf("Trying to open groupfile %s\n",groupFileName);
|
||||
|
||||
string s = groupFileName;
|
||||
|
||||
@@ -30,7 +30,7 @@ char * wdtGetPlainName(char * FileName)
|
||||
return FileName;
|
||||
}
|
||||
|
||||
WDTFile::WDTFile(char* file_name, char* file_name1):WDT(file_name)
|
||||
WDTFile::WDTFile(char* file_name, char* file_name1) : WDT(file_name), gWmoInstansName(NULL), gnWMO(0)
|
||||
{
|
||||
filename.append(file_name1,strlen(file_name1));
|
||||
}
|
||||
@@ -78,9 +78,8 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
|
||||
char *p=buf;
|
||||
int q = 0;
|
||||
gWmoInstansName = new string[size];
|
||||
while (p<buf+size)
|
||||
while (p < buf + size)
|
||||
{
|
||||
string path(p);
|
||||
char* s=wdtGetPlainName(p);
|
||||
fixnamen(s,strlen(s));
|
||||
p=p+strlen(p)+1;
|
||||
@@ -89,23 +88,20 @@ bool WDTFile::init(char *map_id, unsigned int mapID)
|
||||
delete[] buf;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(fourcc,"MODF"))
|
||||
else if (!strcmp(fourcc, "MODF"))
|
||||
{
|
||||
// global wmo instance data
|
||||
if (size)
|
||||
{
|
||||
gnWMO = (int)size / 64;
|
||||
string gWMO_mapname;
|
||||
string fake_mapname;
|
||||
fake_mapname = "65 65 ";
|
||||
//gWMO_mapname = fake_mapname + filename;
|
||||
gWMO_mapname = fake_mapname + std::string(map_id);
|
||||
for (int i=0; i<gnWMO; ++i)
|
||||
|
||||
for (int i = 0; i < gnWMO; ++i)
|
||||
{
|
||||
int id;
|
||||
WDT.read(&id, 4);
|
||||
WMOInstance inst(WDT,gWmoInstansName[id].c_str(),mapID, 65, 65, dirfile);
|
||||
WMOInstance inst(WDT,gWmoInstansName[id].c_str(), mapID, 65, 65, dirfile);
|
||||
}
|
||||
|
||||
delete[] gWmoInstansName;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,16 +13,15 @@ class WDTFile
|
||||
public:
|
||||
WDTFile(char* file_name, char* file_name1);
|
||||
~WDTFile(void);
|
||||
bool init(char *map_id, unsigned int mapID);
|
||||
bool init(char* map_id, unsigned int mapID);
|
||||
|
||||
string* gWmoInstansName;
|
||||
int gnWMO, nMaps;
|
||||
int gnWMO;
|
||||
|
||||
ADTFile* GetMap(int x, int z);
|
||||
|
||||
private:
|
||||
MPQFile WDT;
|
||||
bool maps[64][64];
|
||||
string filename;
|
||||
};
|
||||
|
||||
|
||||
@@ -31,8 +31,12 @@
|
||||
using namespace std;
|
||||
extern uint16 *LiqType;
|
||||
|
||||
WMORoot::WMORoot(std::string &filename) : filename(filename)
|
||||
WMORoot::WMORoot(std::string &filename)
|
||||
: filename(filename), col(0), nTextures(0), nGroups(0), nP(0), nLights(0),
|
||||
nModels(0), nDoodads(0), nDoodadSets(0), RootWMOID(0), liquidType(0)
|
||||
{
|
||||
memset(bbcorn1, 0, sizeof(bbcorn1));
|
||||
memset(bbcorn2, 0, sizeof(bbcorn2));
|
||||
}
|
||||
|
||||
bool WMORoot::open()
|
||||
@@ -57,7 +61,7 @@ bool WMORoot::open()
|
||||
|
||||
size_t nextpos = f.getPos() + size;
|
||||
|
||||
if (!strcmp(fourcc,"MOHD"))//header
|
||||
if (!strcmp(fourcc,"MOHD")) // header
|
||||
{
|
||||
f.read(&nTextures, 4);
|
||||
f.read(&nGroups, 4);
|
||||
@@ -68,8 +72,8 @@ bool WMORoot::open()
|
||||
f.read(&nDoodadSets, 4);
|
||||
f.read(&col, 4);
|
||||
f.read(&RootWMOID, 4);
|
||||
f.read(bbcorn1,12);
|
||||
f.read(bbcorn2,12);
|
||||
f.read(bbcorn1, 12);
|
||||
f.read(bbcorn2, 12);
|
||||
f.read(&liquidType, 4);
|
||||
break;
|
||||
}
|
||||
@@ -120,15 +124,15 @@ bool WMORoot::open()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WMORoot::ConvertToVMAPRootWmo(FILE *pOutfile)
|
||||
bool WMORoot::ConvertToVMAPRootWmo(FILE* pOutfile)
|
||||
{
|
||||
//printf("Convert RootWmo...\n");
|
||||
|
||||
fwrite(szRawVMAPMagic,1,8,pOutfile);
|
||||
fwrite(szRawVMAPMagic, 1, 8, pOutfile);
|
||||
unsigned int nVectors = 0;
|
||||
fwrite(&nVectors,sizeof(nVectors),1,pOutfile); // will be filled later
|
||||
fwrite(&nGroups,4,1,pOutfile);
|
||||
fwrite(&RootWMOID,4,1,pOutfile);
|
||||
fwrite(&nVectors,sizeof(nVectors), 1, pOutfile); // will be filled later
|
||||
fwrite(&nGroups, 4, 1, pOutfile);
|
||||
fwrite(&RootWMOID, 4, 1, pOutfile);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -136,9 +140,13 @@ WMORoot::~WMORoot()
|
||||
{
|
||||
}
|
||||
|
||||
WMOGroup::WMOGroup(std::string &filename) : filename(filename),
|
||||
MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0), hlq(0), LiquEx(0), LiquBytes(0)
|
||||
WMOGroup::WMOGroup(const std::string &filename) :
|
||||
filename(filename), MOPY(0), MOVI(0), MoviEx(0), MOVT(0), MOBA(0), MobaEx(0),
|
||||
hlq(0), LiquEx(0), LiquBytes(0), groupName(0), descGroupName(0), mogpFlags(0),
|
||||
mopy_size(0), moba_size(0), LiquEx_size(0), nVertices(0), nTriangles(0)
|
||||
{
|
||||
memset(bbcorn1, 0, sizeof(bbcorn1));
|
||||
memset(bbcorn2, 0, sizeof(bbcorn2));
|
||||
}
|
||||
|
||||
bool WMOGroup::open()
|
||||
@@ -237,7 +245,7 @@ bool WMOGroup::open()
|
||||
return true;
|
||||
}
|
||||
|
||||
int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData)
|
||||
int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool preciseVectorData)
|
||||
{
|
||||
fwrite(&mogpFlags,sizeof(uint32),1,output);
|
||||
fwrite(&groupWMOID,sizeof(uint32),1,output);
|
||||
@@ -246,7 +254,7 @@ int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPrecis
|
||||
fwrite(bbcorn2, sizeof(float), 3, output);
|
||||
fwrite(&liquflags,sizeof(uint32),1,output);
|
||||
int nColTriangles = 0;
|
||||
if(pPreciseVectorData)
|
||||
if (preciseVectorData)
|
||||
{
|
||||
char GRP[] = "GRP ";
|
||||
fwrite(GRP,1,4,output);
|
||||
@@ -479,10 +487,9 @@ WMOGroup::~WMOGroup()
|
||||
delete [] LiquBytes;
|
||||
}
|
||||
|
||||
WMOInstance::WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
|
||||
WMOInstance::WMOInstance(MPQFile& f, char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
|
||||
: currx(0), curry(0), wmo(NULL), doodadset(0), pos(), indx(0), d3(0)
|
||||
{
|
||||
pos = Vec3D(0,0,0);
|
||||
|
||||
float ff[3];
|
||||
f.read(&id, 4);
|
||||
f.read(ff,12);
|
||||
|
||||
@@ -50,14 +50,13 @@ public:
|
||||
float bbcorn1[3];
|
||||
float bbcorn2[3];
|
||||
|
||||
WMORoot(std::string &filename);
|
||||
WMORoot(std::string& filename);
|
||||
~WMORoot();
|
||||
|
||||
bool open();
|
||||
bool ConvertToVMAPRootWmo(FILE *output);
|
||||
bool ConvertToVMAPRootWmo(FILE* output);
|
||||
private:
|
||||
std::string filename;
|
||||
char outfilename;
|
||||
};
|
||||
|
||||
struct WMOLiquidHeader
|
||||
@@ -89,30 +88,29 @@ public:
|
||||
uint16 nBatchB;
|
||||
uint32 nBatchC, fogIdx, liquidType, groupWMOID;
|
||||
|
||||
int mopy_size,moba_size;
|
||||
int mopy_size, moba_size;
|
||||
int LiquEx_size;
|
||||
unsigned int nVertices; // number when loaded
|
||||
int nTriangles; // number when loaded
|
||||
char *MOPY;
|
||||
uint16 *MOVI;
|
||||
uint16 *MoviEx;
|
||||
float *MOVT;
|
||||
uint16 *MOBA;
|
||||
int *MobaEx;
|
||||
WMOLiquidHeader *hlq;
|
||||
WMOLiquidVert *LiquEx;
|
||||
char *LiquBytes;
|
||||
char* MOPY;
|
||||
uint16* MOVI;
|
||||
uint16* MoviEx;
|
||||
float* MOVT;
|
||||
uint16* MOBA;
|
||||
int* MobaEx;
|
||||
WMOLiquidHeader* hlq;
|
||||
WMOLiquidVert* LiquEx;
|
||||
char* LiquBytes;
|
||||
uint32 liquflags;
|
||||
|
||||
WMOGroup(std::string &filename);
|
||||
WMOGroup(std::string const& filename);
|
||||
~WMOGroup();
|
||||
|
||||
bool open();
|
||||
int ConvertToVMAPGroupWmo(FILE *output, WMORoot *rootWMO, bool pPreciseVectorData);
|
||||
int ConvertToVMAPGroupWmo(FILE* output, WMORoot* rootWMO, bool preciseVectorData);
|
||||
|
||||
private:
|
||||
std::string filename;
|
||||
char outfilename;
|
||||
};
|
||||
|
||||
class WMOInstance
|
||||
@@ -122,13 +120,13 @@ public:
|
||||
std::string MapName;
|
||||
int currx;
|
||||
int curry;
|
||||
WMOGroup *wmo;
|
||||
WMOGroup* wmo;
|
||||
Vec3D pos;
|
||||
Vec3D pos2, pos3, rot;
|
||||
uint32 indx,id, d2, d3;
|
||||
uint32 indx, id, d2, d3;
|
||||
int doodadset;
|
||||
|
||||
WMOInstance(MPQFile &f,const char* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile);
|
||||
WMOInstance(MPQFile&f , char const* WmoInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile);
|
||||
|
||||
static void reset();
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user