mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
Core-side part for recastnav upgrade:
Corrected values, fixed compile, re-extraction of Mmaps it's required again, mmaps will be updated on wiki.
This commit is contained in:
@@ -17,7 +17,6 @@
|
|||||||
#include "DisableMgr.h"
|
#include "DisableMgr.h"
|
||||||
#include <ace/OS_NS_unistd.h>
|
#include <ace/OS_NS_unistd.h>
|
||||||
|
|
||||||
uint32 GetLiquidFlags(uint32 /*liquidType*/) { return 0; }
|
|
||||||
namespace DisableMgr
|
namespace DisableMgr
|
||||||
{
|
{
|
||||||
bool IsDisabledFor(DisableType /*type*/, uint32 /*entry*/, Unit const* /*unit*/, uint8 /*flags*/ /*= 0*/) { return false; }
|
bool IsDisabledFor(DisableType /*type*/, uint32 /*entry*/, Unit const* /*unit*/, uint8 /*flags*/ /*= 0*/) { return false; }
|
||||||
@@ -208,12 +207,14 @@ namespace MMAP
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
void MapBuilder::getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY)
|
void MapBuilder::getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const
|
||||||
{
|
{
|
||||||
maxX = INT_MAX;
|
// min and max are initialized to invalid values so the caller iterating the [min, max] range
|
||||||
maxY = INT_MAX;
|
// will never enter the loop unless valid min/max values are found
|
||||||
minX = INT_MIN;
|
maxX = 0;
|
||||||
minY = INT_MIN;
|
maxY = 0;
|
||||||
|
minX = std::numeric_limits<uint32>::max();
|
||||||
|
minY = std::numeric_limits<uint32>::max();
|
||||||
|
|
||||||
float bmin[3] = { 0, 0, 0 };
|
float bmin[3] = { 0, 0, 0 };
|
||||||
float bmax[3] = { 0, 0, 0 };
|
float bmax[3] = { 0, 0, 0 };
|
||||||
@@ -354,7 +355,7 @@ namespace MMAP
|
|||||||
void MapBuilder::buildMap(uint32 mapID)
|
void MapBuilder::buildMap(uint32 mapID)
|
||||||
{
|
{
|
||||||
#ifndef __APPLE__
|
#ifndef __APPLE__
|
||||||
printf("[Thread %u] Building map %03u:\n", uint32(ACE_Thread::self()), mapID);
|
//printf("[Thread %u] Building map %03u:\n", uint32(ACE_Thread::self()), mapID);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::set<uint32>* tiles = getTileList(mapID);
|
std::set<uint32>* tiles = getTileList(mapID);
|
||||||
@@ -458,7 +459,7 @@ namespace MMAP
|
|||||||
//if (tileBits < 1) tileBits = 1; // need at least one bit!
|
//if (tileBits < 1) tileBits = 1; // need at least one bit!
|
||||||
//int polyBits = sizeof(dtPolyRef)*8 - SALT_MIN_BITS - tileBits;
|
//int polyBits = sizeof(dtPolyRef)*8 - SALT_MIN_BITS - tileBits;
|
||||||
|
|
||||||
int polyBits = STATIC_POLY_BITS;
|
int polyBits = DT_POLY_BITS;
|
||||||
|
|
||||||
int maxTiles = tiles->size();
|
int maxTiles = tiles->size();
|
||||||
int maxPolysPerTile = 1 << polyBits;
|
int maxPolysPerTile = 1 << polyBits;
|
||||||
@@ -570,7 +571,9 @@ namespace MMAP
|
|||||||
config.borderSize = config.walkableRadius + 3;
|
config.borderSize = config.walkableRadius + 3;
|
||||||
config.maxEdgeLen = VERTEX_PER_TILE + 1; // anything bigger than tileSize
|
config.maxEdgeLen = VERTEX_PER_TILE + 1; // anything bigger than tileSize
|
||||||
config.walkableHeight = m_bigBaseUnit ? 3 : 6;
|
config.walkableHeight = m_bigBaseUnit ? 3 : 6;
|
||||||
config.walkableClimb = m_bigBaseUnit ? 2 : 4; // keep less than walkableHeight
|
// a value >= 3|6 allows npcs to walk over some fences
|
||||||
|
// a value >= 4|8 allows npcs to walk over all fences
|
||||||
|
config.walkableClimb = m_bigBaseUnit ? 2 : 4;
|
||||||
config.minRegionArea = rcSqr(60);
|
config.minRegionArea = rcSqr(60);
|
||||||
config.mergeRegionArea = rcSqr(50);
|
config.mergeRegionArea = rcSqr(50);
|
||||||
config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons)
|
config.maxSimplificationError = 1.8f; // eliminates most jagged edges (tiny polygons)
|
||||||
@@ -694,7 +697,7 @@ namespace MMAP
|
|||||||
iv.polyMesh = rcAllocPolyMesh();
|
iv.polyMesh = rcAllocPolyMesh();
|
||||||
if (!iv.polyMesh)
|
if (!iv.polyMesh)
|
||||||
{
|
{
|
||||||
printf("%s alloc iv.polyMesh FIALED!\n", tileString);
|
printf("%s alloc iv.polyMesh FAILED!\n", tileString);
|
||||||
delete[] pmmerge;
|
delete[] pmmerge;
|
||||||
delete[] dmmerge;
|
delete[] dmmerge;
|
||||||
delete[] tiles;
|
delete[] tiles;
|
||||||
@@ -705,7 +708,7 @@ namespace MMAP
|
|||||||
iv.polyMeshDetail = rcAllocPolyMeshDetail();
|
iv.polyMeshDetail = rcAllocPolyMeshDetail();
|
||||||
if (!iv.polyMeshDetail)
|
if (!iv.polyMeshDetail)
|
||||||
{
|
{
|
||||||
printf("%s alloc m_dmesh FIALED!\n", tileString);
|
printf("%s alloc m_dmesh FAILED!\n", tileString);
|
||||||
delete[] pmmerge;
|
delete[] pmmerge;
|
||||||
delete[] dmmerge;
|
delete[] dmmerge;
|
||||||
delete[] tiles;
|
delete[] tiles;
|
||||||
@@ -770,12 +773,12 @@ namespace MMAP
|
|||||||
if (params.nvp > DT_VERTS_PER_POLYGON)
|
if (params.nvp > DT_VERTS_PER_POLYGON)
|
||||||
{
|
{
|
||||||
printf("%s Invalid verts-per-polygon value! \n", tileString);
|
printf("%s Invalid verts-per-polygon value! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
if (params.vertCount >= 0xffff)
|
if (params.vertCount >= 0xffff)
|
||||||
{
|
{
|
||||||
printf("%s Too many vertices! \n", tileString);
|
printf("%s Too many vertices! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
if (!params.vertCount || !params.verts)
|
if (!params.vertCount || !params.verts)
|
||||||
{
|
{
|
||||||
@@ -783,8 +786,8 @@ namespace MMAP
|
|||||||
// loaded but those models don't span into this tile
|
// loaded but those models don't span into this tile
|
||||||
|
|
||||||
// message is an annoyance
|
// message is an annoyance
|
||||||
//printf("%sNo vertices to build tile! \n", tileString);
|
printf("%sNo vertices to build tile! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
if (!params.polyCount || !params.polys ||
|
if (!params.polyCount || !params.polys ||
|
||||||
TILES_PER_MAP*TILES_PER_MAP == params.polyCount)
|
TILES_PER_MAP*TILES_PER_MAP == params.polyCount)
|
||||||
@@ -793,19 +796,19 @@ namespace MMAP
|
|||||||
// keep in mind that we do output those into debug info
|
// keep in mind that we do output those into debug info
|
||||||
// drop tiles with only exact count - some tiles may have geometry while having less tiles
|
// drop tiles with only exact count - some tiles may have geometry while having less tiles
|
||||||
printf("%s No polygons to build on tile! \n", tileString);
|
printf("%s No polygons to build on tile! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
if (!params.detailMeshes || !params.detailVerts || !params.detailTris)
|
if (!params.detailMeshes || !params.detailVerts || !params.detailTris)
|
||||||
{
|
{
|
||||||
printf("%s No detail mesh to build tile! \n", tileString);
|
printf("%s No detail mesh to build tile! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s Building navmesh tile...\n", tileString);
|
printf("%s Building navmesh tile...\n", tileString);
|
||||||
if (!dtCreateNavMeshData(¶ms, &navData, &navDataSize))
|
if (!dtCreateNavMeshData(¶ms, &navData, &navDataSize))
|
||||||
{
|
{
|
||||||
printf("%s Failed building navmesh tile! \n", tileString);
|
printf("%s Failed building navmesh tile! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
dtTileRef tileRef = 0;
|
dtTileRef tileRef = 0;
|
||||||
@@ -816,7 +819,7 @@ namespace MMAP
|
|||||||
if (!tileRef || dtResult != DT_SUCCESS)
|
if (!tileRef || dtResult != DT_SUCCESS)
|
||||||
{
|
{
|
||||||
printf("%s Failed adding tile to navmesh! \n", tileString);
|
printf("%s Failed adding tile to navmesh! \n", tileString);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// file output
|
// file output
|
||||||
@@ -829,7 +832,7 @@ namespace MMAP
|
|||||||
sprintf(message, "[Map %03i] Failed to open %s for writing!\n", mapID, fileName);
|
sprintf(message, "[Map %03i] Failed to open %s for writing!\n", mapID, fileName);
|
||||||
perror(message);
|
perror(message);
|
||||||
navMesh->removeTile(tileRef, NULL, NULL);
|
navMesh->removeTile(tileRef, NULL, NULL);
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s Writing to file...\n", tileString);
|
printf("%s Writing to file...\n", tileString);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace MMAP
|
|||||||
void getTileBounds(uint32 tileX, uint32 tileY,
|
void getTileBounds(uint32 tileX, uint32 tileY,
|
||||||
float* verts, int vertCount,
|
float* verts, int vertCount,
|
||||||
float* bmin, float* bmax);
|
float* bmin, float* bmax);
|
||||||
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY);
|
void getGridBounds(uint32 mapID, uint32 &minX, uint32 &minY, uint32 &maxX, uint32 &maxY) const;
|
||||||
|
|
||||||
bool shouldSkipMap(uint32 mapID);
|
bool shouldSkipMap(uint32 mapID);
|
||||||
bool isTransportMap(uint32 mapID);
|
bool isTransportMap(uint32 mapID);
|
||||||
|
|||||||
@@ -7,11 +7,10 @@
|
|||||||
#ifndef _MMAP_COMMON_H
|
#ifndef _MMAP_COMMON_H
|
||||||
#define _MMAP_COMMON_H
|
#define _MMAP_COMMON_H
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Common.h"
|
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
@@ -52,7 +51,7 @@ namespace MMAP
|
|||||||
if (*++filter == '\0') // wildcard at end of filter means all remaing chars match
|
if (*++filter == '\0') // wildcard at end of filter means all remaing chars match
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
while (true)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (*filter == *str)
|
if (*filter == *str)
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!checkDirectories(debugOutput))
|
if (!checkDirectories(debugOutput))
|
||||||
return silent ? -3 : finish("Press any key to close...", -3);
|
return silent ? -3 : finish("Press ENTER to close...", -3);
|
||||||
|
|
||||||
MapBuilder builder(maxAngle, skipLiquid, skipContinents, skipJunkMaps,
|
MapBuilder builder(maxAngle, skipLiquid, skipContinents, skipJunkMaps,
|
||||||
skipBattlegrounds, debugOutput, bigBaseUnit, offMeshInputPath);
|
skipBattlegrounds, debugOutput, bigBaseUnit, offMeshInputPath);
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ namespace MMAP
|
|||||||
uint8 type = NAV_EMPTY;
|
uint8 type = NAV_EMPTY;
|
||||||
|
|
||||||
// convert liquid type to NavTerrain
|
// convert liquid type to NavTerrain
|
||||||
switch (liquid->GetType())
|
switch (liquid->GetType() & 3)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
@@ -754,12 +754,12 @@ namespace MMAP
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32 liqOffset = meshData.liquidVerts.size() / 3;
|
uint32 liqOffset = meshData.liquidVerts.size() / 3;
|
||||||
for (uint32 i = 0; i < liqVerts.size(); ++i)
|
for (uint32 j = 0; j < liqVerts.size(); ++j)
|
||||||
meshData.liquidVerts.append(liqVerts[i].y, liqVerts[i].z, liqVerts[i].x);
|
meshData.liquidVerts.append(liqVerts[j].y, liqVerts[j].z, liqVerts[j].x);
|
||||||
|
|
||||||
for (uint32 i = 0; i < liqTris.size() / 3; ++i)
|
for (uint32 j = 0; j < liqTris.size() / 3; ++j)
|
||||||
{
|
{
|
||||||
meshData.liquidTris.append(liqTris[i*3+1] + liqOffset, liqTris[i*3+2] + liqOffset, liqTris[i*3] + liqOffset);
|
meshData.liquidTris.append(liqTris[j*3+1] + liqOffset, liqTris[j*3+2] + liqOffset, liqTris[j*3] + liqOffset);
|
||||||
meshData.liquidType.append(type);
|
meshData.liquidType.append(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -894,7 +894,7 @@ namespace MMAP
|
|||||||
float p0[3], p1[3];
|
float p0[3], p1[3];
|
||||||
uint32 mid, tx, ty;
|
uint32 mid, tx, ty;
|
||||||
float size;
|
float size;
|
||||||
if (sscanf(buf, "%d %d,%d (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty,
|
if (sscanf(buf, "%u %u,%u (%f %f %f) (%f %f %f) %f", &mid, &tx, &ty,
|
||||||
&p0[0], &p0[1], &p0[2], &p1[0], &p1[1], &p1[2], &size) != 10)
|
&p0[0], &p0[1], &p0[2], &p1[0], &p1[1], &p1[2], &size) != 10)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
@@ -69,11 +69,13 @@ namespace MMAP
|
|||||||
TerrainBuilder(bool skipLiquid);
|
TerrainBuilder(bool skipLiquid);
|
||||||
~TerrainBuilder();
|
~TerrainBuilder();
|
||||||
|
|
||||||
|
TerrainBuilder(const TerrainBuilder &tb) = delete;
|
||||||
|
|
||||||
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
void loadMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||||
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
bool loadVMap(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData);
|
||||||
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, const char* offMeshFilePath);
|
void loadOffMeshConnections(uint32 mapID, uint32 tileX, uint32 tileY, MeshData &meshData, const char* offMeshFilePath);
|
||||||
|
|
||||||
bool usesLiquids() { return !m_skipLiquid; }
|
bool usesLiquids() const { return !m_skipLiquid; }
|
||||||
|
|
||||||
// vert and triangle methods
|
// vert and triangle methods
|
||||||
static void transform(std::vector<G3D::Vector3> &original, std::vector<G3D::Vector3> &transformed,
|
static void transform(std::vector<G3D::Vector3> &original, std::vector<G3D::Vector3> &transformed,
|
||||||
@@ -109,10 +111,6 @@ namespace MMAP
|
|||||||
|
|
||||||
/// Get the liquid type for a specific position
|
/// Get the liquid type for a specific position
|
||||||
uint8 getLiquidType(int square, const uint8 liquid_type[16][16]);
|
uint8 getLiquidType(int square, const uint8 liquid_type[16][16]);
|
||||||
|
|
||||||
// hide parameterless and copy constructor
|
|
||||||
TerrainBuilder();
|
|
||||||
TerrainBuilder(const TerrainBuilder &tb);
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
// memory management
|
// memory management
|
||||||
inline void* dtCustomAlloc(int size, dtAllocHint /*hint*/)
|
inline void* dtCustomAlloc(size_t size, dtAllocHint /*hint*/)
|
||||||
{
|
{
|
||||||
return (void*)new unsigned char[size];
|
return (void*)new unsigned char[size];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: http://github.com/azerothcore/azerothcore-wotlk/LICENSE-GPL2
|
* Copyright (C)
|
||||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
* Copyright (C)
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
@@ -26,6 +38,7 @@ namespace VMAP
|
|||||||
{
|
{
|
||||||
VMapManager2::VMapManager2()
|
VMapManager2::VMapManager2()
|
||||||
{
|
{
|
||||||
|
GetLiquidFlagsPtr = &GetLiquidFlagsDummy;
|
||||||
}
|
}
|
||||||
|
|
||||||
VMapManager2::~VMapManager2(void)
|
VMapManager2::~VMapManager2(void)
|
||||||
@@ -76,7 +89,7 @@ namespace VMAP
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load one tile (internal use only)
|
// load one tile (internal use only)
|
||||||
bool VMapManager2::_loadMap(unsigned int mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
|
bool VMapManager2::_loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY)
|
||||||
{
|
{
|
||||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||||
if (instanceTree == iInstanceMapTrees.end())
|
if (instanceTree == iInstanceMapTrees.end())
|
||||||
@@ -84,10 +97,10 @@ namespace VMAP
|
|||||||
std::string mapFileName = getMapFileName(mapId);
|
std::string mapFileName = getMapFileName(mapId);
|
||||||
StaticMapTree* newTree = new StaticMapTree(mapId, basePath);
|
StaticMapTree* newTree = new StaticMapTree(mapId, basePath);
|
||||||
if (!newTree->InitMap(mapFileName, this))
|
if (!newTree->InitMap(mapFileName, this))
|
||||||
{
|
{
|
||||||
delete newTree;
|
delete newTree;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, newTree)).first;
|
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, newTree)).first;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -236,7 +249,7 @@ namespace VMAP
|
|||||||
floor = info.ground_Z;
|
floor = info.ground_Z;
|
||||||
ASSERT(floor < std::numeric_limits<float>::max());
|
ASSERT(floor < std::numeric_limits<float>::max());
|
||||||
type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc
|
type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc
|
||||||
if (reqLiquidType && !(GetLiquidFlags(type) & reqLiquidType))
|
if (reqLiquidType && !(GetLiquidFlagsPtr(type) & reqLiquidType))
|
||||||
return false;
|
return false;
|
||||||
if (info.hitInstance->GetLiquidLevel(pos, info, level))
|
if (info.hitInstance->GetLiquidLevel(pos, info, level))
|
||||||
return true;
|
return true;
|
||||||
@@ -276,7 +289,6 @@ namespace VMAP
|
|||||||
{
|
{
|
||||||
//! Critical section, thread safe access to iLoadedModelFiles
|
//! Critical section, thread safe access to iLoadedModelFiles
|
||||||
TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
|
TRINITY_GUARD(ACE_Thread_Mutex, LoadedModelFilesLock);
|
||||||
|
|
||||||
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
|
ModelFileMap::iterator model = iLoadedModelFiles.find(filename);
|
||||||
if (model == iLoadedModelFiles.end())
|
if (model == iLoadedModelFiles.end())
|
||||||
{
|
{
|
||||||
@@ -298,4 +310,4 @@ namespace VMAP
|
|||||||
return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y);
|
return StaticMapTree::CanLoadMap(std::string(basePath), mapId, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace VMAP
|
} // namespace VMAP
|
||||||
@@ -1,7 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license: http://github.com/azerothcore/azerothcore-wotlk/LICENSE-GPL2
|
* Copyright (C)
|
||||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
* Copyright (C)
|
||||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _VMAPMANAGER2_H
|
#ifndef _VMAPMANAGER2_H
|
||||||
@@ -66,6 +78,8 @@ namespace VMAP
|
|||||||
bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY);
|
bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY);
|
||||||
/* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
|
/* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
|
||||||
|
|
||||||
|
static uint32 GetLiquidFlagsDummy(uint32) { return 0; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// public for debug
|
// public for debug
|
||||||
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
||||||
@@ -102,7 +116,10 @@ namespace VMAP
|
|||||||
virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y);
|
virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y);
|
||||||
public:
|
public:
|
||||||
void getInstanceMapTree(InstanceTreeMap &instanceMapTree);
|
void getInstanceMapTree(InstanceTreeMap &instanceMapTree);
|
||||||
|
|
||||||
|
typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType);
|
||||||
|
GetLiquidFlagsFn GetLiquidFlagsPtr;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -213,7 +213,7 @@ namespace Trinity
|
|||||||
|
|
||||||
inline bool IsValidMapCoord(float x, float y, float z)
|
inline bool IsValidMapCoord(float x, float y, float z)
|
||||||
{
|
{
|
||||||
return IsValidMapCoord(x, y) && isfinite(z);
|
return IsValidMapCoord(x, y) && IsValidMapCoord(z);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsValidMapCoord(float x, float y, float z, float o)
|
inline bool IsValidMapCoord(float x, float y, float z, float o)
|
||||||
|
|||||||
@@ -2012,7 +2012,7 @@ uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const
|
|||||||
atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
|
atEntry = sAreaTableStore.LookupEntry(wmoEntry->areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16 areaId;
|
uint16 areaId = 0;
|
||||||
|
|
||||||
if (atEntry)
|
if (atEntry)
|
||||||
areaId = atEntry->ID;
|
areaId = atEntry->ID;
|
||||||
@@ -2021,7 +2021,7 @@ uint32 Map::GetAreaId(float x, float y, float z, bool *isOutdoors) const
|
|||||||
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
||||||
areaId = gmap->getArea(x, y);
|
areaId = gmap->getArea(x, y);
|
||||||
// this used while not all *.map files generated (instances)
|
// this used while not all *.map files generated (instances)
|
||||||
else
|
if (!areaId)
|
||||||
areaId = i_mapEntry->linked_zone;
|
areaId = i_mapEntry->linked_zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -909,7 +909,7 @@ dtStatus PathGenerator::FindSmoothPath(float const* startPos, float const* endPo
|
|||||||
// Find movement delta.
|
// Find movement delta.
|
||||||
float delta[VERTEX_SIZE];
|
float delta[VERTEX_SIZE];
|
||||||
dtVsub(delta, steerPos, iterPos);
|
dtVsub(delta, steerPos, iterPos);
|
||||||
float len = dtMathSqrtf(dtVdot(delta,delta));
|
float len = dtMathSqrtf(dtVdot(delta, delta));
|
||||||
// If the steer target is end of path or off-mesh link, do not move past the location.
|
// If the steer target is end of path or off-mesh link, do not move past the location.
|
||||||
if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE)
|
if ((endOfPath || offMeshConnection) && len < SMOOTH_PATH_STEP_SIZE)
|
||||||
len = 1.0f;
|
len = 1.0f;
|
||||||
|
|||||||
@@ -55,6 +55,9 @@ void TargetedMovementGeneratorMedium<T,D>::_setTargetLocation(T* owner, bool ini
|
|||||||
|
|
||||||
if (!i_offset)
|
if (!i_offset)
|
||||||
{
|
{
|
||||||
|
if (i_target->IsWithinDistInMap(owner, CONTACT_DISTANCE))
|
||||||
|
return;
|
||||||
|
|
||||||
float allowedRange = MELEE_RANGE;
|
float allowedRange = MELEE_RANGE;
|
||||||
if ((!initial || (owner->movespline->Finalized() && this->GetMovementGeneratorType() == CHASE_MOTION_TYPE)) && i_target->IsWithinMeleeRange(owner, allowedRange) && i_target->IsWithinLOS(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ()))
|
if ((!initial || (owner->movespline->Finalized() && this->GetMovementGeneratorType() == CHASE_MOTION_TYPE)) && i_target->IsWithinMeleeRange(owner, allowedRange) && i_target->IsWithinLOS(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ()))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -5788,7 +5788,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
m_pathFinder = new PathGenerator(m_caster);
|
m_pathFinder = new PathGenerator(m_caster);
|
||||||
m_pathFinder->CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.15f, false);
|
m_pathFinder->CalculatePath(pos.m_positionX, pos.m_positionY, pos.m_positionZ+0.15f, false);
|
||||||
G3D::Vector3 endPos = m_pathFinder->GetEndPosition(); // also check distance between target and the point calculated by mmaps
|
G3D::Vector3 endPos = m_pathFinder->GetEndPosition(); // also check distance between target and the point calculated by mmaps
|
||||||
if (m_pathFinder->GetPathType()&PATHFIND_NOPATH || target->GetExactDistSq(endPos.x, endPos.y, endPos.z) > maxdist*maxdist || m_pathFinder->getPathLength() > (40.0f + (m_caster->HasAura(58097) ? 5.0f : 0.0f)))
|
if (m_pathFinder->GetPathType() & (PATHFIND_NOPATH | PATHFIND_INCOMPLETE) || target->GetExactDistSq(endPos.x, endPos.y, endPos.z) > maxdist*maxdist || m_pathFinder->getPathLength() > (40.0f + (m_caster->HasAura(58097) ? 5.0f : 0.0f)))
|
||||||
return SPELL_FAILED_NOPATH;
|
return SPELL_FAILED_NOPATH;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -75,6 +75,7 @@
|
|||||||
#include "WhoListCache.h"
|
#include "WhoListCache.h"
|
||||||
#include "AsyncAuctionListing.h"
|
#include "AsyncAuctionListing.h"
|
||||||
#include "SavingSystem.h"
|
#include "SavingSystem.h"
|
||||||
|
#include <VMapManager2.h>
|
||||||
|
|
||||||
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
|
ACE_Atomic_Op<ACE_Thread_Mutex, bool> World::m_stopEvent = false;
|
||||||
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
uint8 World::m_ExitCode = SHUTDOWN_EXIT_CODE;
|
||||||
@@ -1276,6 +1277,12 @@ void World::SetInitialWorldSettings()
|
|||||||
sLog->outString("Initializing Scripts...");
|
sLog->outString("Initializing Scripts...");
|
||||||
sScriptMgr->Initialize();
|
sScriptMgr->Initialize();
|
||||||
|
|
||||||
|
///- Initialize VMapManager function pointers (to untangle game/collision circular deps)
|
||||||
|
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
|
||||||
|
{
|
||||||
|
vmmgr2->GetLiquidFlagsPtr = &GetLiquidFlags;
|
||||||
|
}
|
||||||
|
|
||||||
///- Initialize config settings
|
///- Initialize config settings
|
||||||
LoadConfigSettings();
|
LoadConfigSettings();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user