diff --git a/contrib/vmap_extract_assembler_bin/vmapextract_v2.exe b/contrib/vmap_extract_assembler_bin/vmapextract_v2.exe index 03c7690765..a1e982f0cb 100644 Binary files a/contrib/vmap_extract_assembler_bin/vmapextract_v2.exe and b/contrib/vmap_extract_assembler_bin/vmapextract_v2.exe differ diff --git a/contrib/vmap_extractor_v2/vmapextract/wmo.cpp b/contrib/vmap_extractor_v2/vmapextract/wmo.cpp index f1868ccf64..9d8b8f7977 100644 --- a/contrib/vmap_extractor_v2/vmapextract/wmo.cpp +++ b/contrib/vmap_extractor_v2/vmapextract/wmo.cpp @@ -241,205 +241,209 @@ bool WMOGroup::open() //---------------------------------------------------------------------------- int WMOGroup::ConvertToVMAPGroupWmo(FILE *output, bool pPreciseVectorData) { - if(pPreciseVectorData) { - fwrite(&liquflags,sizeof(uint32),1,output); - char GRP[] = "GRP "; - fwrite(GRP,1,4,output); + if(pPreciseVectorData) { + fwrite(&liquflags,sizeof(uint32),1,output); + char GRP[] = "GRP "; + fwrite(GRP,1,4,output); - int k = 0; - int moba_batch = moba_size/12; - MobaEx = new int[moba_batch*4]; - for(int i=8; i0) { - if(fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes) { printf("Error while writing file indexarray"); exit(0); } - } + if(fwrite("INDX",4, 1, output) != 1) { printf("Error while writing file nbraches ID"); exit(0); } + int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes; + if(fwrite(&wsize, sizeof(int), 1, output) != 1) { printf("Error while writing file wsize"); } + if(fwrite(&nIdexes, sizeof(uint32), 1, output) != 1) { printf("Error while writing file nIndexes"); exit(0); } + if(nIdexes >0) { + if(fwrite(MOVI, sizeof(unsigned short), nIdexes, output) != nIdexes) { printf("Error while writing file indexarray"); exit(0); } + } - if(fwrite("VERT",4, 1, output) != 1) { printf("Error while writing file nbraches ID"); exit(0); } - wsize = sizeof(int) + sizeof(float) * 3 * nVertices; - if(fwrite(&wsize, sizeof(int), 1, output) != 1) { printf("Error while writing file wsize"); } - if(fwrite(&nVertices, sizeof(int), 1, output) != 1) { printf("Error while writing file nVertices"); exit(0); } - if(nVertices >0) { - if(fwrite(MOVT, sizeof(float)*3, nVertices, output) != nVertices) { printf("Error while writing file vectors"); exit(0); } - } + if(fwrite("VERT",4, 1, output) != 1) { printf("Error while writing file nbraches ID"); exit(0); } + wsize = sizeof(int) + sizeof(float) * 3 * nVertices; + if(fwrite(&wsize, sizeof(int), 1, output) != 1) { printf("Error while writing file wsize"); } + if(fwrite(&nVertices, sizeof(int), 1, output) != 1) { printf("Error while writing file nVertices"); exit(0); } + if(nVertices >0) { + if(fwrite(MOVT, sizeof(float)*3, nVertices, output) != nVertices) { printf("Error while writing file vectors"); exit(0); } + } - if(LiquEx_size != 0) - { - int LIQU_h[] = {0x5551494C,LiquEx_size+8,hlq_xverts,hlq_yverts};// "LIQU" - fwrite(LIQU_h,4,4,output); - fwrite(LiquEx,4,LiquEx_size/4,output); - delete [] LiquEx; - } + if(LiquEx_size != 0) + { + int LIQU_h[] = {0x5551494C,LiquEx_size+8,hlq_xverts,hlq_yverts};// "LIQU" + fwrite(LIQU_h,4,4,output); + fwrite(LiquEx,4,LiquEx_size/4,output); + delete [] LiquEx; + } - return nTriangles; - } else { - //printf("Convert GroupWmo...\n"); - //-------GRP ------------------------------------- - fwrite(&liquflags,sizeof(uint32),1,output); - char GRP[] = "GRP "; - fwrite(GRP,1,4,output); - int k = 0; - int moba_batch = moba_size/12; - MobaEx = new int[moba_batch*4]; - for(int i=8; i MoviExSort[i+1]) - { - hold = MoviExSort[i]; - MoviExSort[i] = MoviExSort[i+1]; - MoviExSort[i+1] = hold; - } - //double = 65535 - else - if (MoviExSort[i] == MoviExSort[i+1]) - MoviExSort[i+1] = 65535; - } - } - // double delet - uint16 s = 0; - for (int i=0; i < IndexExTr_size*3; i++) - { - if (MoviExSort[i]!=65535) - { - MoviExSort[s] = MoviExSort[i]; - s++; - } - } - MovtExSort = new uint16[s]; - for (int i=0; i < s; i++) - { - MovtExSort[i] = MoviExSort[i]; - } + uint16 hold; + for (int pass = 1; pass < IndexExTr_size*3; pass++) + { + for (int i=0; i < IndexExTr_size*3-1; i++) + { + if (MoviExSort[i] > MoviExSort[i+1]) + { + hold = MoviExSort[i]; + MoviExSort[i] = MoviExSort[i+1]; + MoviExSort[i+1] = hold; + } + //double = 65535 + else + if (MoviExSort[i] == MoviExSort[i+1]) + MoviExSort[i+1] = 65535; + } + } + // double delet + uint16 s = 0; + for (int i=0; i < IndexExTr_size*3; i++) + { + if (MoviExSort[i]!=65535) + { + MoviExSort[s] = MoviExSort[i]; + s++; + } + } + MovtExSort = new uint16[s]; + for (int i=0; i < s; i++) + { + MovtExSort[i] = MoviExSort[i]; + } - for (int i=0; i < IndexExTr_size*3; i++) - { - uint16 b = MoviEx[i]; - for (uint16 x = 0; x < s; x++) - { - if(MoviExSort[x] == b) - { + for (int i=0; i < IndexExTr_size*3; i++) + { + uint16 b = MoviEx[i]; + for (uint16 x = 0; x < s; x++) + { + if(MoviExSort[x] == b) + { - MoviEx[i] = x; - break; - } - } + MoviEx[i] = x; + break; + } + } - } - int INDX[] = {0x58444E49,IndexExTr_size*6+4,IndexExTr_size*3}; - fwrite(INDX,4,3,output); - fwrite(MoviEx,2,IndexExTr_size*3,output); + } + int INDX[] = {0x58444E49,IndexExTr_size*6+4,IndexExTr_size*3}; + fwrite(INDX,4,3,output); + fwrite(MoviEx,2,IndexExTr_size*3,output); - delete [] MoviEx; - delete [] MoviExSort; - delete [] IndexExTr; + delete [] MoviEx; + delete [] MoviExSort; + delete [] IndexExTr; - //----------VERT--------- - //-----MOVT---------- - int d = 0; - MovtEx = new float[s*3]; - for (uint16 i=0; i #include "mpq.h" +// MOPY flags +#define WMO_MATERIAL_NOCAMCOLLIDE 0x01 +#define WMO_MATERIAL_DETAIL 0x02 +#define WMO_MATERIAL_NO_COLLISION 0x04 +#define WMO_MATERIAL_HINT 0x08 +#define WMO_MATERIAL_RENDER 0x10 +#define WMO_MATERIAL_COLLIDE_HIT 0x20 +#define WMO_MATERIAL_WALL_SURFACE 0x40 class WMOInstance; class WMOManager;