TrinityCore
wmo.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "vmapexport.h"
19#include "adtfile.h"
20#include "cascfile.h"
21#include "Errors.h"
22#include "StringFormat.h"
23#include "vec3d.h"
24#include "VMapDefinitions.h"
25#include "wmo.h"
26#include <algorithm>
27#include <fstream>
28#include <map>
29#include <cstdio>
30#include <cstdlib>
31
32WMORoot::WMORoot(std::string const& filename)
33 : filename(filename), color(0), nTextures(0), nGroups(0), nPortals(0), nLights(0),
34 nDoodadNames(0), nDoodadDefs(0), nDoodadSets(0), RootWMOID(0), flags(0), numLod(0)
35{
36 memset(bbcorn1, 0, sizeof(bbcorn1));
37 memset(bbcorn2, 0, sizeof(bbcorn2));
38}
39
40extern std::shared_ptr<CASC::Storage> CascStorage;
41
43{
44 CASCFile f(CascStorage, filename.c_str());
45 if(f.isEof ())
46 {
47 printf("No such file.\n");
48 return false;
49 }
50
52 char fourcc[5];
53
54 while (!f.isEof())
55 {
56 f.read(fourcc,4);
57 f.read(&size, 4);
58
59 flipcc(fourcc);
60 fourcc[4] = 0;
61
62 size_t nextpos = f.getPos() + size;
63
64 if (!strcmp(fourcc,"MOHD")) // header
65 {
66 f.read(&nTextures, 4);
67 f.read(&nGroups, 4);
68 f.read(&nPortals, 4);
69 f.read(&nLights, 4);
70 f.read(&nDoodadNames, 4);
71 f.read(&nDoodadDefs, 4);
72 f.read(&nDoodadSets, 4);
73 f.read(&color, 4);
74 f.read(&RootWMOID, 4);
75 f.read(bbcorn1, 12);
76 f.read(bbcorn2, 12);
77 f.read(&flags, 2);
78 f.read(&numLod, 2);
79 }
80 else if (!strcmp(fourcc, "MODS"))
81 {
82 DoodadData.Sets.resize(size / sizeof(WMO::MODS));
83 f.read(DoodadData.Sets.data(), size);
84 }
85 else if (!strcmp(fourcc,"MODN"))
86 {
88
89 char* ptr = f.getPointer();
90 char* end = ptr + size;
91 DoodadData.Paths = std::make_unique<char[]>(size);
92 memcpy(DoodadData.Paths.get(), ptr, size);
93 while (ptr < end)
94 {
95 std::string path = ptr;
96
97 char* s = GetPlainName(ptr);
98 NormalizeFileName(s, strlen(s));
99
100 uint32 doodadNameIndex = ptr - f.getPointer();
101 ptr += path.length() + 1;
102
103 if (ExtractSingleModel(path))
104 ValidDoodadNames.insert(doodadNameIndex);
105 }
106 }
107 else if (!strcmp(fourcc, "MODI"))
108 {
110
111 uint32 fileDataIdCount = size / sizeof(uint32);
112 DoodadData.FileDataIds = std::make_unique<uint32[]>(fileDataIdCount);
114 for (uint32 i = 0; i < fileDataIdCount; ++i)
115 {
116 if (!DoodadData.FileDataIds[i])
117 continue;
118
119 std::string path = Trinity::StringFormat("FILE{:08X}.xxx", DoodadData.FileDataIds[i]);
120 if (ExtractSingleModel(path))
121 ValidDoodadNames.insert(i);
122 }
123 }
124 else if (!strcmp(fourcc,"MODD"))
125 {
126 DoodadData.Spawns.resize(size / sizeof(WMO::MODD));
127 f.read(DoodadData.Spawns.data(), size);
128 }
129 else if (!strcmp(fourcc, "MOGN"))
130 {
131 GroupNames.resize(size);
132 f.read(GroupNames.data(), size);
133 }
134 else if (!strcmp(fourcc, "GFID"))
135 {
136 // full LOD reading code for reference
137 // commented out as we are not interested in any of them beyond first, most detailed
138
139 //uint16 lodCount = 1;
140 //if (flags & 0x10)
141 //{
142 // if (numLod)
143 // lodCount = numLod;
144 // else
145 // lodCount = 3;
146 //}
147
148 //for (uint32 lod = 0; lod < lodCount; ++lod)
149 //{
150 for (uint32 gp = 0; gp < nGroups; ++gp)
151 {
152 uint32 fileDataId;
153 f.read(&fileDataId, 4);
154 if (fileDataId)
155 groupFileDataIDs.push_back(fileDataId);
156 }
157 //}
158 }
159 /*
160 else if (!strcmp(fourcc,"MOTX"))
161 {
162 }
163 else if (!strcmp(fourcc,"MOMT"))
164 {
165 }
166 else if (!strcmp(fourcc,"MOGI"))
167 {
168 }
169 else if (!strcmp(fourcc,"MOLT"))
170 {
171 }
172 else if (!strcmp(fourcc,"MOSB"))
173 {
174 }
175 else if (!strcmp(fourcc,"MOPV"))
176 {
177 }
178 else if (!strcmp(fourcc,"MOPT"))
179 {
180 }
181 else if (!strcmp(fourcc,"MOPR"))
182 {
183 }
184 else if (!strcmp(fourcc,"MFOG"))
185 {
186 }
187 */
188 f.seek((int)nextpos);
189 }
190 f.close ();
191 return true;
192}
193
195{
196 //printf("Convert RootWmo...\n");
197
198 fwrite(VMAP::RAW_VMAP_MAGIC, 1, 8, pOutfile);
199 unsigned int nVectors = 0;
200 fwrite(&nVectors,sizeof(nVectors), 1, pOutfile); // will be filled later
201 fwrite(&nGroups, 4, 1, pOutfile);
202 fwrite(&RootWMOID, 4, 1, pOutfile);
204 fwrite(&tcFlags, sizeof(ModelFlags), 1, pOutfile);
205 return true;
206}
207
208WMOGroup::WMOGroup(const std::string &filename) :
209 filename(filename), MPY2(nullptr), MOVX(nullptr), MOVT(nullptr), MOBA(nullptr), MobaEx(nullptr),
210 hlq(nullptr), LiquEx(nullptr), LiquBytes(nullptr), groupName(0), descGroupName(0), mogpFlags(0),
211 moprIdx(0), moprNItems(0), nBatchA(0), nBatchB(0), nBatchC(0), fogIdx(0),
212 groupLiquid(0), groupWMOID(0), moba_size(0), LiquEx_size(0),
213 nVertices(0), nTriangles(0), liquflags(0)
214{
215 memset(bbcorn1, 0, sizeof(bbcorn1));
216 memset(bbcorn2, 0, sizeof(bbcorn2));
217}
218
220{
221 CASCFile f(CascStorage, filename.c_str());
222 if(f.isEof ())
223 {
224 printf("No such file.\n");
225 return false;
226 }
227 uint32 size;
228 char fourcc[5] = { };
229 while (!f.isEof())
230 {
231 f.read(fourcc,4);
232 f.read(&size, 4);
233 flipcc(fourcc);
234 if (!strcmp(fourcc,"MOGP")) //size specified in MOGP chunk is all the other chunks combined, adjust to read MOGP-only
235 size = 68;
236
237 size_t nextpos = f.getPos() + size;
238 if (!strcmp(fourcc,"MOGP"))//header
239 {
240 f.read(&groupName, 4);
241 f.read(&descGroupName, 4);
242 f.read(&mogpFlags, 4);
243 f.read(bbcorn1, 12);
244 f.read(bbcorn2, 12);
245 f.read(&moprIdx, 2);
246 f.read(&moprNItems, 2);
247 f.read(&nBatchA, 2);
248 f.read(&nBatchB, 2);
249 f.read(&nBatchC, 4);
250 f.read(&fogIdx, 4);
251 f.read(&groupLiquid, 4);
252 f.read(&groupWMOID,4);
253
254 // according to WoW.Dev Wiki:
255 if (rootWMO->flags & 4)
257 else if (groupLiquid == 15)
258 groupLiquid = 0;
259 else
261
262 if (groupLiquid)
263 liquflags |= 2;
264 }
265 else if (!strcmp(fourcc,"MOPY"))
266 {
267 MPY2 = std::make_unique<uint16[]>(size);
268 std::unique_ptr<uint8[]> MOPY = std::make_unique<uint8[]>(size);
269 nTriangles = (int)size / 2;
270 f.read(MOPY.get(), size);
271 std::copy_n(MOPY.get(), size, MPY2.get());
272 }
273 else if (!strcmp(fourcc,"MPY2"))
274 {
275 MPY2 = std::make_unique<uint16[]>(size / 2);
276 nTriangles = (int)size / 4;
277 f.read(MPY2.get(), size);
278 }
279 else if (!strcmp(fourcc,"MOVI"))
280 {
281 MOVX = std::make_unique<uint32[]>(size / 2);
282 std::unique_ptr<uint16[]> MOVI = std::make_unique<uint16[]>(size / 2);
283 f.read(MOVI.get(), size);
284 std::copy_n(MOVI.get(), size / 2, MOVX.get());
285 }
286 else if (!strcmp(fourcc,"MOVX"))
287 {
288 MOVX = std::make_unique<uint32[]>(size / 4);
289 f.read(MOVX.get(), size);
290 }
291 else if (!strcmp(fourcc,"MOVT"))
292 {
293 MOVT = new float[size/4];
294 f.read(MOVT, size);
295 nVertices = (int)size / 12;
296 }
297 else if (!strcmp(fourcc,"MONR"))
298 {
299 }
300 else if (!strcmp(fourcc,"MOTV"))
301 {
302 }
303 else if (!strcmp(fourcc,"MOBA"))
304 {
305 MOBA = new uint16[size/2];
306 moba_size = size/2;
307 f.read(MOBA, size);
308 }
309 else if (!strcmp(fourcc,"MODR"))
310 {
311 DoodadReferences.resize(size / sizeof(uint16));
312 f.read(DoodadReferences.data(), size);
313 }
314 else if (!strcmp(fourcc,"MLIQ"))
315 {
316 liquflags |= 1;
317 hlq = new WMOLiquidHeader();
318 f.read(hlq, sizeof(WMOLiquidHeader));
322 int nLiquBytes = hlq->xtiles * hlq->ytiles;
323 LiquBytes = new char[nLiquBytes];
324 f.read(LiquBytes, nLiquBytes);
325
326 // Determine legacy liquid type
327 if (!groupLiquid)
328 {
329 for (int i = 0; i < hlq->xtiles * hlq->ytiles; ++i)
330 {
331 if ((LiquBytes[i] & 0xF) != 15)
332 {
333 groupLiquid = GetLiquidTypeId((LiquBytes[i] & 0xF) + 1);
334 break;
335 }
336 }
337 }
338
339 /* std::ofstream llog("Buildings/liquid.log", ios_base::out | ios_base::app);
340 llog << filename;
341 llog << "\nbbox: " << bbcorn1[0] << ", " << bbcorn1[1] << ", " << bbcorn1[2] << " | " << bbcorn2[0] << ", " << bbcorn2[1] << ", " << bbcorn2[2];
342 llog << "\nlpos: " << hlq->pos_x << ", " << hlq->pos_y << ", " << hlq->pos_z;
343 llog << "\nx-/yvert: " << hlq->xverts << "/" << hlq->yverts << " size: " << size << " expected size: " << 30 + hlq->xverts*hlq->yverts*8 + hlq->xtiles*hlq->ytiles << std::endl;
344 llog.close(); */
345 }
346 f.seek((int)nextpos);
347 }
348 f.close();
349 return true;
350}
351
353{
354 fwrite(&mogpFlags,sizeof(uint32),1,output);
355 fwrite(&groupWMOID,sizeof(uint32),1,output);
356 // group bound
357 fwrite(bbcorn1, sizeof(float), 3, output);
358 fwrite(bbcorn2, sizeof(float), 3, output);
359 fwrite(&liquflags,sizeof(uint32),1,output);
360 int nColTriangles = 0;
362 {
363 char GRP[] = "GRP ";
364 fwrite(GRP,1,4,output);
365
366 int k = 0;
367 int moba_batch = moba_size/12;
368 MobaEx = new int[moba_batch*4];
369 for(int i=8; i<moba_size; i+=12)
370 {
371 MobaEx[k++] = MOBA[i];
372 }
373 int moba_size_grp = moba_batch*4+4;
374 fwrite(&moba_size_grp,4,1,output);
375 fwrite(&moba_batch,4,1,output);
376 fwrite(MobaEx,4,k,output);
377 delete [] MobaEx;
378
379 uint32 nIdexes = nTriangles * 3;
380
381 if(fwrite("INDX",4, 1, output) != 1)
382 {
383 printf("Error while writing file nbraches ID");
384 exit(0);
385 }
386 int wsize = sizeof(uint32) + sizeof(unsigned short) * nIdexes;
387 if(fwrite(&wsize, sizeof(int), 1, output) != 1)
388 {
389 printf("Error while writing file wsize");
390 // no need to exit?
391 }
392 if(fwrite(&nIdexes, sizeof(uint32), 1, output) != 1)
393 {
394 printf("Error while writing file nIndexes");
395 exit(0);
396 }
397 if(nIdexes >0)
398 {
399 if (fwrite(MOVX.get(), sizeof(uint32), nIdexes, output) != nIdexes)
400 {
401 printf("Error while writing file indexarray");
402 exit(0);
403 }
404 }
405
406 if(fwrite("VERT",4, 1, output) != 1)
407 {
408 printf("Error while writing file nbraches ID");
409 exit(0);
410 }
411 wsize = sizeof(int) + sizeof(float) * 3 * nVertices;
412 if(fwrite(&wsize, sizeof(int), 1, output) != 1)
413 {
414 printf("Error while writing file wsize");
415 // no need to exit?
416 }
417 if(fwrite(&nVertices, sizeof(int), 1, output) != 1)
418 {
419 printf("Error while writing file nVertices");
420 exit(0);
421 }
422 if(nVertices >0)
423 {
424 if(fwrite(MOVT, sizeof(float)*3, nVertices, output) != nVertices)
425 {
426 printf("Error while writing file vectors");
427 exit(0);
428 }
429 }
430
431 nColTriangles = nTriangles;
432 }
433 else
434 {
435 char GRP[] = "GRP ";
436 fwrite(GRP,1,4,output);
437 int k = 0;
438 int moba_batch = moba_size/12;
439 MobaEx = new int[moba_batch*4];
440 for(int i=8; i<moba_size; i+=12)
441 {
442 MobaEx[k++] = MOBA[i];
443 }
444
445 int moba_size_grp = moba_batch*4+4;
446 fwrite(&moba_size_grp,4,1,output);
447 fwrite(&moba_batch,4,1,output);
448 fwrite(MobaEx,4,k,output);
449 delete [] MobaEx;
450
451 //-------INDX------------------------------------
452 //-------MOPY/MPY2--------
453 std::unique_ptr<uint32[]> MovxEx = std::make_unique<uint32[]>(nTriangles*3); // "worst case" size...
454 std::unique_ptr<int32[]> IndexRenum = std::make_unique<int32[]>(nVertices);
455 std::fill_n(IndexRenum.get(), nVertices, -1);
456 for (int i=0; i<nTriangles; ++i)
457 {
458 // Skip no collision triangles
459 bool isRenderFace = (MPY2[2 * i] & WMO_MATERIAL_RENDER) && !(MPY2[2 * i] & WMO_MATERIAL_DETAIL);
460 bool isCollision = MPY2[2 * i] & WMO_MATERIAL_COLLISION || isRenderFace;
461
462 if (!isCollision)
463 continue;
464
465 // Use this triangle
466 for (int j=0; j<3; ++j)
467 {
468 IndexRenum[MOVX[3*i + j]] = 1;
469 MovxEx[3*nColTriangles + j] = MOVX[3*i + j];
470 }
471 ++nColTriangles;
472 }
473
474 // assign new vertex index numbers
475 uint32 nColVertices = 0;
476 for (uint32 i=0; i<nVertices; ++i)
477 {
478 if (IndexRenum[i] == 1)
479 {
480 IndexRenum[i] = nColVertices;
481 ++nColVertices;
482 }
483 }
484
485 // translate triangle indices to new numbers
486 for (int i=0; i<3*nColTriangles; ++i)
487 {
488 ASSERT(MovxEx[i] < nVertices);
489 MovxEx[i] = IndexRenum[MovxEx[i]];
490 }
491
492 // write triangle indices
493 int INDX[] = {0x58444E49, nColTriangles*6+4, nColTriangles*3};
494 fwrite(INDX,4,3,output);
495 fwrite(MovxEx.get(),4,nColTriangles*3,output);
496
497 // write vertices
498 uint32 VERT[] = {0x54524556u, nColVertices*3*static_cast<uint32>(sizeof(float))+4, nColVertices};// "VERT"
499 int check = 3*nColVertices;
500 fwrite(VERT,4,3,output);
501 for (uint32 i=0; i<nVertices; ++i)
502 if(IndexRenum[i] >= 0)
503 check -= fwrite(MOVT+3*i, sizeof(float), 3, output);
504
505 ASSERT(check==0);
506 }
507
508 //------LIQU------------------------
509 if (liquflags & 3)
510 {
511 int LIQU_totalSize = sizeof(uint32);
512 if (liquflags & 1)
513 {
514 LIQU_totalSize += sizeof(WMOLiquidHeader);
515 LIQU_totalSize += LiquEx_size / sizeof(WMOLiquidVert) * sizeof(float);
516 LIQU_totalSize += hlq->xtiles * hlq->ytiles;
517 }
518 int LIQU_h[] = { 0x5551494C, LIQU_totalSize };// "LIQU"
519 fwrite(LIQU_h, 4, 2, output);
520
521 /* std::ofstream llog("Buildings/liquid.log", ios_base::out | ios_base::app);
522 llog << filename;
523 llog << ":\nliquidEntry: " << liquidEntry << " type: " << hlq->type << " (root:" << rootWMO->flags << " group:" << flags << ")\n";
524 llog.close(); */
525
526 fwrite(&groupLiquid, sizeof(uint32), 1, output);
527 if (liquflags & 1)
528 {
529 fwrite(hlq, sizeof(WMOLiquidHeader), 1, output);
530 // only need height values, the other values are unknown anyway
531 for (uint32 i = 0; i < LiquEx_size / sizeof(WMOLiquidVert); ++i)
532 fwrite(&LiquEx[i].height, sizeof(float), 1, output);
533 // todo: compress to bit field
534 fwrite(LiquBytes, 1, hlq->xtiles * hlq->ytiles, output);
535 }
536 }
537
538 return nColTriangles;
539}
540
542{
543 if (liquidTypeId < 21 && liquidTypeId)
544 {
545 switch (((static_cast<uint8>(liquidTypeId) - 1) & 3))
546 {
547 case 0: return ((mogpFlags & 0x80000) != 0) + 13;
548 case 1: return 14;
549 case 2: return 19;
550 case 3: return 20;
551 default: break;
552 }
553 }
554 return liquidTypeId;
555}
556
557bool WMOGroup::ShouldSkip(WMORoot const* root) const
558{
559 // skip unreachable
560 if (mogpFlags & 0x80)
561 return true;
562
563 // skip antiportals
564 if (mogpFlags & 0x4000000)
565 return true;
566
567 if (groupName < int32(root->GroupNames.size()) && !strcmp(&root->GroupNames[groupName], "antiportal"))
568 return true;
569
570 return false;
571}
572
574{
575 delete [] MOVT;
576 delete [] MOBA;
577 delete hlq;
578 delete [] LiquEx;
579 delete [] LiquBytes;
580}
581
582void MapObject::Extract(ADT::MODF const& mapObjDef, char const* WmoInstName, bool isGlobalWmo, uint32 mapID, uint32 originalMapId, FILE* pDirfile, std::vector<ADTOutputCache>* dirfileCache)
583{
584 // destructible wmo, do not dump. we can handle the vmap for these
585 // in dynamic tree (gameobject vmaps)
586 if ((mapObjDef.Flags & 0x1) != 0)
587 return;
588
589 //-----------add_in _dir_file----------------
590
591 std::string tempname = Trinity::StringFormat("{}/{}", szWorkDirWmo, WmoInstName);
592 FILE* input = fopen(tempname.c_str(), "r+b");
593
594 if (!input)
595 {
596 printf("WMOInstance::WMOInstance: couldn't open %s\n", tempname.c_str());
597 return;
598 }
599
600 fseek(input, 8, SEEK_SET); // get the correct no of vertices
601 int nVertices;
602 int count = fread(&nVertices, sizeof(int), 1, input);
603 fclose(input);
604
605 if (count != 1 || nVertices == 0)
606 return;
607
608 Vec3D position = fixCoords(mapObjDef.Position);
609 AaBox3D bounds;
610 bounds.min = fixCoords(mapObjDef.Bounds.min);
611 bounds.max = fixCoords(mapObjDef.Bounds.max);
612
613 if (isGlobalWmo)
614 {
615 position += Vec3D(533.33333f * 32, 533.33333f * 32, 0.0f);
616 bounds += Vec3D(533.33333f * 32, 533.33333f * 32, 0.0f);
617 }
618
619 float scale = 1.0f;
620 if (mapObjDef.Flags & 0x4)
621 scale = mapObjDef.Scale / 1024.0f;
622 uint32 uniqueId = GenerateUniqueObjectId(mapObjDef.UniqueId, 0, true);
624 uint8 nameSet = mapObjDef.NameSet;
625 if (mapID != originalMapId)
627
628 //write mapID, Flags, NameSet, UniqueId, Pos, Rot, Scale, Bound_lo, Bound_hi, name
629 fwrite(&mapID, sizeof(uint32), 1, pDirfile);
630 fwrite(&flags, sizeof(uint8), 1, pDirfile);
631 fwrite(&nameSet, sizeof(uint8), 1, pDirfile);
632 fwrite(&uniqueId, sizeof(uint32), 1, pDirfile);
633 fwrite(&position, sizeof(Vec3D), 1, pDirfile);
634 fwrite(&mapObjDef.Rotation, sizeof(Vec3D), 1, pDirfile);
635 fwrite(&scale, sizeof(float), 1, pDirfile);
636 fwrite(&bounds, sizeof(AaBox3D), 1, pDirfile);
637 uint32 nlen = strlen(WmoInstName);
638 fwrite(&nlen, sizeof(uint32), 1, pDirfile);
639 fwrite(WmoInstName, sizeof(char), nlen, pDirfile);
640
641 if (dirfileCache)
642 {
643 dirfileCache->emplace_back();
644 ADTOutputCache& cacheModelData = dirfileCache->back();
645 cacheModelData.Flags = flags & ~MOD_PARENT_SPAWN;
646 cacheModelData.Data.resize(
647 sizeof(uint8) + // nameSet
648 sizeof(uint32) + // uniqueId
649 sizeof(Vec3D) + // position
650 sizeof(Vec3D) + // mapObjDef.Rotation
651 sizeof(float) + // scale
652 sizeof(AaBox3D) + // bounds
653 sizeof(uint32) + // nlen
654 nlen); // WmoInstName
655
656 uint8* cacheData = cacheModelData.Data.data();
657#define CACHE_WRITE(value, size, count, dest) memcpy(dest, value, size * count); dest += size * count;
658
659 CACHE_WRITE(&nameSet, sizeof(uint8), 1, cacheData);
660 CACHE_WRITE(&uniqueId, sizeof(uint32), 1, cacheData);
661 CACHE_WRITE(&position, sizeof(Vec3D), 1, cacheData);
662 CACHE_WRITE(&mapObjDef.Rotation, sizeof(Vec3D), 1, cacheData);
663 CACHE_WRITE(&scale, sizeof(float), 1, cacheData);
664 CACHE_WRITE(&bounds, sizeof(AaBox3D), 1, cacheData);
665 CACHE_WRITE(&nlen, sizeof(uint32), 1, cacheData);
666 CACHE_WRITE(WmoInstName, sizeof(char), nlen, cacheData);
667
668#undef CACHE_WRITE
669 }
670}
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
uint16 flags
Definition: DisableMgr.cpp:49
#define ASSERT
Definition: Errors.h:68
char const * GetPlainName(char const *FileName)
Definition: adtfile.cpp:24
void NormalizeFileName(char *name, size_t len)
Definition: adtfile.cpp:69
void flipcc(char *fcc)
Definition: cascfile.h:58
Definition: vec3d.h:135
Vec3D max
Definition: vec3d.h:138
Vec3D min
Definition: vec3d.h:137
bool isEof()
Definition: cascfile.h:52
char * getPointer()
Definition: cascfile.h:51
void seek(int offset)
Definition: cascfile.cpp:99
size_t read(void *dest, size_t bytes)
Definition: cascfile.cpp:80
size_t getPos()
Definition: cascfile.h:49
void close()
Definition: cascfile.cpp:111
Definition: vec3d.h:25
uint32 nBatchC
Definition: wmo.h:143
float * MOVT
Definition: wmo.h:129
int moba_size
Definition: wmo.h:145
WMOGroup(std::string const &filename)
Definition: wmo.cpp:208
std::unique_ptr< uint16[]> MPY2
Definition: wmo.h:127
uint16 nBatchA
Definition: wmo.h:141
uint32 fogIdx
Definition: wmo.h:143
uint32 groupLiquid
Definition: wmo.h:143
uint16 moprIdx
Definition: wmo.h:139
std::string filename
Definition: wmo.h:123
int groupName
Definition: wmo.h:135
int descGroupName
Definition: wmo.h:135
int LiquEx_size
Definition: wmo.h:146
uint32 groupWMOID
Definition: wmo.h:143
uint16 nBatchB
Definition: wmo.h:142
float bbcorn2[3]
Definition: wmo.h:138
std::vector< uint16 > DoodadReferences
Definition: wmo.h:151
int mogpFlags
Definition: wmo.h:136
unsigned int nVertices
Definition: wmo.h:147
WMOLiquidVert * LiquEx
Definition: wmo.h:133
uint16 * MOBA
Definition: wmo.h:130
uint32 liquflags
Definition: wmo.h:149
bool open(WMORoot *rootWMO)
Definition: wmo.cpp:219
int nTriangles
Definition: wmo.h:148
uint32 GetLiquidTypeId(uint32 liquidTypeId)
Definition: wmo.cpp:541
char * LiquBytes
Definition: wmo.h:134
~WMOGroup()
Definition: wmo.cpp:573
int * MobaEx
Definition: wmo.h:131
WMOLiquidHeader * hlq
Definition: wmo.h:132
int ConvertToVMAPGroupWmo(FILE *output, bool preciseVectorData)
Definition: wmo.cpp:352
bool ShouldSkip(WMORoot const *root) const
Definition: wmo.cpp:557
uint16 moprNItems
Definition: wmo.h:140
float bbcorn1[3]
Definition: wmo.h:137
std::unique_ptr< uint32[]> MOVX
Definition: wmo.h:128
Definition: wmo.h:79
float bbcorn1[3]
Definition: wmo.h:85
std::vector< char > GroupNames
Definition: wmo.h:89
uint32 nDoodadSets
Definition: wmo.h:84
uint32 nDoodadDefs
Definition: wmo.h:84
WMODoodadData DoodadData
Definition: wmo.h:90
uint16 numLod
Definition: wmo.h:87
std::vector< uint32 > groupFileDataIDs
Definition: wmo.h:92
uint32 nLights
Definition: wmo.h:84
uint32 nPortals
Definition: wmo.h:84
bool open()
Definition: wmo.cpp:42
float bbcorn2[3]
Definition: wmo.h:86
uint32 nGroups
Definition: wmo.h:84
std::unordered_set< uint32 > ValidDoodadNames
Definition: wmo.h:91
uint16 flags
Definition: wmo.h:87
std::string filename
Definition: wmo.h:81
bool ConvertToVMAPRootWmo(FILE *output)
Definition: wmo.cpp:194
uint32 nDoodadNames
Definition: wmo.h:84
unsigned int color
Definition: wmo.h:83
uint32 nTextures
Definition: wmo.h:84
WMORoot(std::string const &filename)
Definition: wmo.cpp:32
uint32 RootWMOID
Definition: wmo.h:84
bool ExtractSingleModel(std::string &fname)
void Extract(ADT::MODF const &mapObjDef, char const *WmoInstName, bool isGlobalWmo, uint32 mapID, uint32 originalMapId, FILE *pDirfile, std::vector< ADTOutputCache > *dirfileCache)
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
Definition: StringFormat.h:38
constexpr std::size_t size()
Definition: UpdateField.h:796
const char RAW_VMAP_MAGIC[]
std::vector< uint8 > Data
Definition: adtfile.h:56
uint8 Flags
Definition: adtfile.h:55
uint16 Flags
Definition: adtfile.h:45
uint16 Scale
Definition: adtfile.h:48
AaBox3D Bounds
Definition: adtfile.h:44
Vec3D Rotation
Definition: adtfile.h:43
uint16 NameSet
Definition: adtfile.h:47
uint32 UniqueId
Definition: adtfile.h:41
Vec3D Position
Definition: adtfile.h:42
std::vector< WMO::MODS > Sets
Definition: wmo.h:71
std::vector< WMO::MODD > Spawns
Definition: wmo.h:74
std::unique_ptr< uint32[]> FileDataIds
Definition: wmo.h:73
std::unique_ptr< char[]> Paths
Definition: wmo.h:72
int ytiles
Definition: wmo.h:104
int xverts
Definition: wmo.h:104
int yverts
Definition: wmo.h:104
int xtiles
Definition: wmo.h:104
Definition: wmo.h:57
Definition: wmo.h:49
bool preciseVectorData
Definition: vmapexport.cpp:65
uint32 GenerateUniqueObjectId(uint32 clientId, uint16 clientDoodadId, bool isWmo)
Definition: vmapexport.cpp:170
char const * szWorkDirWmo
Definition: vmapexport.cpp:74
ModelFlags
Definition: vmapexport.h:34
@ MOD_PARENT_SPAWN
Definition: vmapexport.h:29
@ MOD_HAS_BOUND
Definition: vmapexport.h:28
#define CACHE_WRITE(value, size, count, dest)
std::shared_ptr< CASC::Storage > CascStorage
Definition: System.cpp:49
@ WMO_MATERIAL_DETAIL
Definition: wmo.h:32
@ WMO_MATERIAL_COLLISION
Definition: wmo.h:33
@ WMO_MATERIAL_RENDER
Definition: wmo.h:35
static Vec3D fixCoords(Vec3D const &v)
Definition: wmo.h:67