mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Tools/vmap_extractor: Preserve destructible models to use them in mmaps_generator
This commit is contained in:
@@ -60,7 +60,8 @@ namespace VMAP
|
||||
iEnableHeightCalc(true),
|
||||
thread_safe_environment(true),
|
||||
GetLiquidFlagsPtr([](uint32 /*liquidTypeId*/) { return 0u; }),
|
||||
IsVMAPDisabledForPtr([](uint32 /*mapId*/, uint8 /*disableFlags*/) { return false; })
|
||||
IsVMAPDisabledForPtr([](uint32 /*mapId*/, uint8 /*disableFlags*/) { return false; }),
|
||||
LoadPathOnlyModels(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -182,6 +182,8 @@ namespace VMAP
|
||||
|
||||
typedef bool(*IsVMAPDisabledForFn)(uint32 entry, uint8 flags);
|
||||
IsVMAPDisabledForFn IsVMAPDisabledForPtr;
|
||||
|
||||
bool LoadPathOnlyModels;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -318,6 +318,9 @@ namespace VMAP
|
||||
ModelSpawn spawn;
|
||||
if (ModelSpawn::readFromFile(fileResult.TileFile.get(), spawn))
|
||||
{
|
||||
if (spawn.flags & MOD_PATH_ONLY && !vm->LoadPathOnlyModels)
|
||||
continue;
|
||||
|
||||
// acquire model instance
|
||||
std::shared_ptr<WorldModel> model = vm->acquireModelInstance(iBasePath, spawn.name);
|
||||
if (!model)
|
||||
@@ -402,6 +405,9 @@ namespace VMAP
|
||||
if (!ModelSpawn::readFromFile(fileResult.TileFile.get(), spawn))
|
||||
break;
|
||||
|
||||
if (spawn.flags & MOD_PATH_ONLY && !vm->LoadPathOnlyModels)
|
||||
continue;
|
||||
|
||||
// update tree
|
||||
uint32 referencedNode = 0;
|
||||
if (fread(&referencedNode, sizeof(uint32), 1, fileResult.SpawnIndicesFile.get()) != 1)
|
||||
|
||||
@@ -35,7 +35,8 @@ namespace VMAP
|
||||
enum ModelInstanceFlags
|
||||
{
|
||||
MOD_HAS_BOUND = 1 << 0,
|
||||
MOD_PARENT_SPAWN = 1 << 1
|
||||
MOD_PARENT_SPAWN = 1 << 1,
|
||||
MOD_PATH_ONLY = 1 << 2
|
||||
};
|
||||
|
||||
struct ModelMinimalData
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace MMAP
|
||||
auto itr = _liquidTypes.find(liquidId);
|
||||
return itr != _liquidTypes.end() ? (1 << itr->second) : 0;
|
||||
};
|
||||
vmgr->LoadPathOnlyModels = true;
|
||||
return vmgr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,18 +207,18 @@ bool ADTFile::init(uint32 map_num, uint32 originalMapId)
|
||||
{
|
||||
ADT::MODF mapObjDef;
|
||||
_file.read(&mapObjDef, sizeof(ADT::MODF));
|
||||
if (!(mapObjDef.Flags & 0x8))
|
||||
|
||||
std::string fileName;
|
||||
if (mapObjDef.Flags & 0x8)
|
||||
{
|
||||
MapObject::Extract(mapObjDef, WmoInstanceNames[mapObjDef.Id].c_str(), false, map_num, originalMapId, dirfile.get(), dirfileCache);
|
||||
Doodad::ExtractSet(WmoDoodads[WmoInstanceNames[mapObjDef.Id]], mapObjDef, false, map_num, originalMapId, dirfile.get(), dirfileCache);
|
||||
fileName = Trinity::StringFormat("FILE{:08X}.xxx", mapObjDef.Id);
|
||||
ExtractSingleWmo(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string fileName = Trinity::StringFormat("FILE{:08X}.xxx", mapObjDef.Id);
|
||||
ExtractSingleWmo(fileName);
|
||||
MapObject::Extract(mapObjDef, fileName.c_str(), false, map_num, originalMapId, dirfile.get(), dirfileCache);
|
||||
Doodad::ExtractSet(WmoDoodads[fileName], mapObjDef, false, map_num, originalMapId, dirfile.get(), dirfileCache);
|
||||
}
|
||||
fileName = WmoInstanceNames[mapObjDef.Id];
|
||||
|
||||
MapObject::Extract(mapObjDef, fileName.c_str(), false, map_num, originalMapId, dirfile.get(), dirfileCache);
|
||||
Doodad::ExtractSet(WmoDoodads[fileName], mapObjDef, false, map_num, originalMapId, dirfile.get(), dirfileCache);
|
||||
}
|
||||
|
||||
WmoInstanceNames.clear();
|
||||
|
||||
@@ -26,7 +26,8 @@
|
||||
enum ModelInstanceFlags
|
||||
{
|
||||
MOD_HAS_BOUND = 1 << 0,
|
||||
MOD_PARENT_SPAWN = 1 << 1
|
||||
MOD_PARENT_SPAWN = 1 << 1,
|
||||
MOD_PATH_ONLY = 1 << 2
|
||||
};
|
||||
|
||||
// flags of each model
|
||||
|
||||
@@ -116,18 +116,17 @@ bool WDTFile::init(uint32 mapId)
|
||||
{
|
||||
ADT::MODF mapObjDef;
|
||||
_file.read(&mapObjDef, sizeof(ADT::MODF));
|
||||
if (!(mapObjDef.Flags & 0x8))
|
||||
std::string fileName;
|
||||
if (mapObjDef.Flags & 0x8)
|
||||
{
|
||||
MapObject::Extract(mapObjDef, _wmoNames[mapObjDef.Id].c_str(), true, mapId, mapId, dirfile.get(), nullptr);
|
||||
Doodad::ExtractSet(WmoDoodads[_wmoNames[mapObjDef.Id]], mapObjDef, true, mapId, mapId, dirfile.get(), nullptr);
|
||||
fileName = Trinity::StringFormat("FILE{:08X}.xxx", mapObjDef.Id);
|
||||
ExtractSingleWmo(fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string fileName = Trinity::StringFormat("FILE{:08X}.xxx", mapObjDef.Id);
|
||||
ExtractSingleWmo(fileName);
|
||||
MapObject::Extract(mapObjDef, fileName.c_str(), true, mapId, mapId, dirfile.get(), nullptr);
|
||||
Doodad::ExtractSet(WmoDoodads[fileName], mapObjDef, true, mapId, mapId, dirfile.get(), nullptr);
|
||||
}
|
||||
fileName = _wmoNames[mapObjDef.Id];
|
||||
|
||||
MapObject::Extract(mapObjDef, fileName.c_str(), true, mapId, mapId, dirfile.get(), nullptr);
|
||||
Doodad::ExtractSet(WmoDoodads[fileName], mapObjDef, true, mapId, mapId, dirfile.get(), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -587,11 +587,6 @@ WMOGroup::~WMOGroup()
|
||||
|
||||
void MapObject::Extract(ADT::MODF const& mapObjDef, char const* WmoInstName, bool isGlobalWmo, uint32 mapID, uint32 originalMapId, FILE* pDirfile, std::vector<ADTOutputCache>* dirfileCache)
|
||||
{
|
||||
// destructible wmo, do not dump. we can handle the vmap for these
|
||||
// in dynamic tree (gameobject vmaps)
|
||||
if ((mapObjDef.Flags & 0x1) != 0)
|
||||
return;
|
||||
|
||||
//-----------add_in _dir_file----------------
|
||||
|
||||
std::string tempname = Trinity::StringFormat("{}/{}", szWorkDirWmo, WmoInstName);
|
||||
@@ -630,6 +625,17 @@ void MapObject::Extract(ADT::MODF const& mapObjDef, char const* WmoInstName, boo
|
||||
uint8 nameSet = mapObjDef.NameSet;
|
||||
if (mapID != originalMapId)
|
||||
flags |= MOD_PARENT_SPAWN;
|
||||
if (mapObjDef.Flags & 0x1)
|
||||
{
|
||||
flags |= MOD_PATH_ONLY;
|
||||
//if (FILE* destro = fopen("Buildings/destructible.log", "a"))
|
||||
//{
|
||||
// fprintf(destro, R"( { fileName: "%s", fileDataID: %u, mapId: %u, uniqueId: %u, pos: { x: %f, y: %f, z: %f }, rot: { x: %f, y: %f, z: %f } },)" "\n",
|
||||
// WmoInstName, mapObjDef.Id, mapID, mapObjDef.UniqueId, 533.33333f * 32 - mapObjDef.Position.z, 533.33333f * 32 - mapObjDef.Position.x, mapObjDef.Position.y,
|
||||
// mapObjDef.Rotation.x, mapObjDef.Rotation.y, mapObjDef.Rotation.z);
|
||||
// fclose(destro);
|
||||
//}
|
||||
}
|
||||
|
||||
//write Flags, NameSet, UniqueId, Pos, Rot, Scale, Bound_lo, Bound_hi, name
|
||||
fwrite(&flags, sizeof(uint8), 1, pDirfile);
|
||||
|
||||
Reference in New Issue
Block a user