mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Vmap: Introduce skipping of antiportals and unreachable mogp (#26331)
* Vmap: Introduce skipping of antiportals and unreachable mogp * Reduce differences with master branch * Update VMAP and MMAP versions * Update MMAPs version Co-authored-by: jackpoz <giacomopoz@gmail.com>
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include "DetourNavMesh.h"
|
||||
|
||||
const uint32 MMAP_MAGIC = 0x4d4d4150; // 'MMAP'
|
||||
#define MMAP_VERSION 14
|
||||
#define MMAP_VERSION 15
|
||||
|
||||
struct MmapTileHeader
|
||||
{
|
||||
|
||||
@@ -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
|
||||
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)
|
||||
{
|
||||
@@ -161,7 +162,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())
|
||||
@@ -178,6 +183,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
|
||||
|
||||
@@ -106,6 +106,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"))
|
||||
{
|
||||
@@ -113,9 +118,6 @@ bool WMORoot::open()
|
||||
else if (!strcmp(fourcc,"MOMT"))
|
||||
{
|
||||
}
|
||||
else if (!strcmp(fourcc,"MOGN"))
|
||||
{
|
||||
}
|
||||
else if (!strcmp(fourcc,"MOGI"))
|
||||
{
|
||||
}
|
||||
@@ -498,6 +500,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;
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
float bbcorn1[3];
|
||||
float bbcorn2[3];
|
||||
|
||||
std::vector<char> GroupNames;
|
||||
WMODoodadData DoodadData;
|
||||
std::unordered_set<uint32> ValidDoodadNames;
|
||||
|
||||
@@ -153,6 +154,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