mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
refactor(Tools): restyle tools with astyle (#3465)
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
|
||||
Model::Model(std::string &filename) : filename(filename), vertices(0), indices(0)
|
||||
Model::Model(std::string& filename) : filename(filename), vertices(0), indices(0)
|
||||
{
|
||||
memset(&header, 0, sizeof(header));
|
||||
}
|
||||
@@ -37,13 +37,13 @@ bool Model::open()
|
||||
f.seek(0);
|
||||
f.seekRelative(header.ofsBoundingVertices);
|
||||
vertices = new Vec3D[header.nBoundingVertices];
|
||||
f.read(vertices,header.nBoundingVertices*12);
|
||||
for (uint32 i=0; i<header.nBoundingVertices; i++)
|
||||
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];
|
||||
f.read(indices,header.nBoundingTriangles*2);
|
||||
f.read(indices, header.nBoundingTriangles * 2);
|
||||
f.close();
|
||||
}
|
||||
else
|
||||
@@ -55,32 +55,32 @@ bool Model::open()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Model::ConvertToVMAPModel(const char * outfilename)
|
||||
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");
|
||||
int N[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||
FILE* output = fopen(outfilename, "wb");
|
||||
if (!output)
|
||||
{
|
||||
printf("Can't create the output file '%s'\n",outfilename);
|
||||
printf("Can't create the output file '%s'\n", outfilename);
|
||||
return false;
|
||||
}
|
||||
fwrite(szRawVMAPMagic, 8, 1, output);
|
||||
uint32 nVertices = header.nBoundingVertices;
|
||||
fwrite(&nVertices, sizeof(int), 1, output);
|
||||
uint32 nofgroups = 1;
|
||||
fwrite(&nofgroups,sizeof(uint32), 1, output);
|
||||
fwrite(N,4*3,1,output);// rootwmoid, flags, groupid
|
||||
fwrite(N,sizeof(float),3*2,output);//bbox, only needed for WMO currently
|
||||
fwrite(N,4,1,output);// liquidflags
|
||||
fwrite("GRP ",4,1,output);
|
||||
fwrite(&nofgroups, sizeof(uint32), 1, output);
|
||||
fwrite(N, 4 * 3, 1, output); // rootwmoid, flags, groupid
|
||||
fwrite(N, sizeof(float), 3 * 2, output); //bbox, only needed for WMO currently
|
||||
fwrite(N, 4, 1, output); // liquidflags
|
||||
fwrite("GRP ", 4, 1, output);
|
||||
uint32 branches = 1;
|
||||
int wsize;
|
||||
wsize = sizeof(branches) + sizeof(uint32) * branches;
|
||||
fwrite(&wsize, sizeof(int), 1, output);
|
||||
fwrite(&branches,sizeof(branches), 1, output);
|
||||
fwrite(&branches, sizeof(branches), 1, output);
|
||||
uint32 nIndexes = header.nBoundingTriangles;
|
||||
fwrite(&nIndexes,sizeof(uint32), 1, output);
|
||||
fwrite("INDX",4, 1, output);
|
||||
fwrite(&nIndexes, sizeof(uint32), 1, output);
|
||||
fwrite("INDX", 4, 1, output);
|
||||
wsize = sizeof(uint32) + sizeof(unsigned short) * nIndexes;
|
||||
fwrite(&wsize, sizeof(int), 1, output);
|
||||
fwrite(&nIndexes, sizeof(uint32), 1, output);
|
||||
@@ -101,7 +101,7 @@ bool Model::ConvertToVMAPModel(const char * outfilename)
|
||||
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)
|
||||
{
|
||||
@@ -110,7 +110,7 @@ bool Model::ConvertToVMAPModel(const char * outfilename)
|
||||
vertices[vpos].z = tmp;
|
||||
}
|
||||
|
||||
fwrite(vertices, sizeof(float)*3, nVertices, output);
|
||||
fwrite(vertices, sizeof(float) * 3, nVertices, output);
|
||||
}
|
||||
|
||||
fclose(output);
|
||||
@@ -129,7 +129,7 @@ Vec3D fixCoordSystem2(Vec3D v)
|
||||
return Vec3D(v.x, v.z, v.y);
|
||||
}
|
||||
|
||||
ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE *pDirfile)
|
||||
ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID, uint32 tileX, uint32 tileY, FILE* pDirfile)
|
||||
{
|
||||
float ff[3];
|
||||
f.read(&id, 4);
|
||||
@@ -175,7 +175,7 @@ ModelInstance::ModelInstance(MPQFile& f, char const* ModelInstName, uint32 mapID
|
||||
fwrite(&pos, sizeof(float), 3, pDirfile);
|
||||
fwrite(&rot, sizeof(float), 3, pDirfile);
|
||||
fwrite(&sc, sizeof(float), 1, pDirfile);
|
||||
uint32 nlen=strlen(ModelInstName);
|
||||
uint32 nlen = strlen(ModelInstName);
|
||||
fwrite(&nlen, sizeof(uint32), 1, pDirfile);
|
||||
fwrite(ModelInstName, sizeof(char), nlen, pDirfile);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user