mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Core/Vmaps): Introduce skipping of antiportals and unreachable mogp (#23781)
Co-authored-by: killerwife <7995382+killerwife@users.noreply.github.com> Co-authored-by: Ryan Turner <16946913+TheSCREWEDSoftware@users.noreply.github.com> Co-authored-by: Rocco Silipo <108557877+Rorschach91@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
dc13014707
commit
7ac5a527e1
@@ -26,7 +26,7 @@
|
||||
#define SIZE_OF_GRIDS 533.3333f
|
||||
|
||||
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
||||
#define MMAP_VERSION 18
|
||||
#define MMAP_VERSION 19
|
||||
|
||||
struct MmapTileRecastConfig
|
||||
{
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
const char VMAP_MAGIC[] = "VMAP_4.7";
|
||||
const char RAW_VMAP_MAGIC[] = "VMAP047"; // used in extracted vmap files with raw data
|
||||
const char VMAP_MAGIC[] = "VMAP_4.8";
|
||||
const char RAW_VMAP_MAGIC[] = "VMAP048"; // used in extracted vmap files with raw data
|
||||
const char GAMEOBJECT_MODELS[] = "GameObjectModels.dtree";
|
||||
|
||||
// defined in TileAssembler.cpp currently...
|
||||
|
||||
@@ -144,6 +144,7 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
WMODoodadData& doodads = WmoDoodads[plain_name];
|
||||
std::swap(doodads, froot.DoodadData);
|
||||
int Wmo_nVertices = 0;
|
||||
uint32 groupCount = 0;
|
||||
//printf("root has %d groups\n", froot->nGroups);
|
||||
if (froot.nGroups != 0)
|
||||
{
|
||||
@@ -170,7 +171,11 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
break;
|
||||
}
|
||||
|
||||
if (fgroup.ShouldSkip(&froot))
|
||||
continue;
|
||||
|
||||
Wmo_nVertices += fgroup.ConvertToVMAPGroupWmo(output, preciseVectorData);
|
||||
++groupCount;
|
||||
for (uint16 groupReference : fgroup.DoodadReferences)
|
||||
{
|
||||
if (groupReference >= doodads.Spawns.size())
|
||||
@@ -187,6 +192,8 @@ bool ExtractSingleWmo(std::string& fname)
|
||||
|
||||
fseek(output, 8, SEEK_SET); // store the correct no of vertices
|
||||
fwrite(&Wmo_nVertices, sizeof(int), 1, output);
|
||||
// store the correct no of groups
|
||||
fwrite(&groupCount, sizeof(uint32), 1, output);
|
||||
fclose(output);
|
||||
|
||||
// Delete the extracted file in the case of an error
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
const char VMAP_MAGIC[] = "VMAP_4.7";
|
||||
const char RAW_VMAP_MAGIC[] = "VMAP047"; // used in extracted vmap files with raw data
|
||||
const char VMAP_MAGIC[] = "VMAP_4.8";
|
||||
const char RAW_VMAP_MAGIC[] = "VMAP048"; // used in extracted vmap files with raw data
|
||||
}
|
||||
|
||||
enum ModelFlags
|
||||
|
||||
@@ -103,6 +103,11 @@ bool WMORoot::open()
|
||||
DoodadData.Spawns.resize(size / sizeof(WMO::MODD));
|
||||
f.read(DoodadData.Spawns.data(), size);
|
||||
}
|
||||
else if (!strcmp(fourcc, "MOGN"))
|
||||
{
|
||||
GroupNames.resize(size);
|
||||
f.read(GroupNames.data(), size);
|
||||
}
|
||||
/*
|
||||
else if (!strcmp(fourcc,"MOTX"))
|
||||
{
|
||||
@@ -497,6 +502,22 @@ uint32 WMOGroup::GetLiquidTypeId(uint32 liquidTypeId)
|
||||
return liquidTypeId;
|
||||
}
|
||||
|
||||
bool WMOGroup::ShouldSkip(WMORoot const* root) const
|
||||
{
|
||||
// skip unreachable
|
||||
if (mogpFlags & 0x80)
|
||||
return true;
|
||||
|
||||
// skip antiportals
|
||||
if (mogpFlags & 0x4000000)
|
||||
return true;
|
||||
|
||||
if (groupName < int32(root->GroupNames.size()) && !strcmp(&root->GroupNames[groupName], "antiportal"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
WMOGroup::~WMOGroup()
|
||||
{
|
||||
delete [] MOPY;
|
||||
|
||||
@@ -85,6 +85,7 @@ public:
|
||||
float bbcorn1[3];
|
||||
float bbcorn2[3];
|
||||
|
||||
std::vector<char> GroupNames;
|
||||
WMODoodadData DoodadData;
|
||||
std::unordered_set<uint32> ValidDoodadNames;
|
||||
|
||||
@@ -154,6 +155,7 @@ public:
|
||||
bool open(WMORoot* rootWMO);
|
||||
int ConvertToVMAPGroupWmo(FILE* output, bool preciseVectorData);
|
||||
uint32 GetLiquidTypeId(uint32 liquidTypeId);
|
||||
bool ShouldSkip(WMORoot const* root) const;
|
||||
};
|
||||
|
||||
namespace MapObject
|
||||
|
||||
Reference in New Issue
Block a user