mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-23 18:36:31 +01:00
Revert "Core/Entities: Reduce the probability of units dropping under the map (#21322)"
This reverts commit 9e0faace9a.
This commit is contained in:
@@ -2365,12 +2365,12 @@ inline GridMap* Map::GetGrid(float x, float y)
|
||||
return GridMaps[gx][gy];
|
||||
}
|
||||
|
||||
float Map::GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float* ground /*= nullptr*/, bool /*swim = false*/, float collisionHeight /*= DEFAULT_COLLISION_HEIGHT*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
|
||||
float Map::GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float* ground /*= nullptr*/, bool /*swim = false*/, float collisionHeight /*= DEFAULT_COLLISION_HEIGHT*/) const
|
||||
{
|
||||
if (const_cast<Map*>(this)->GetGrid(x, y))
|
||||
{
|
||||
// we need ground level (including grid height version) for proper return water level in point
|
||||
float ground_z = GetHeight(phasemask, x, y, z, true, maxSearchDist, collisionHeight);
|
||||
float ground_z = GetHeight(phasemask, x, y, z + collisionHeight, true, 50.0f);
|
||||
if (ground)
|
||||
*ground = ground_z;
|
||||
|
||||
@@ -2391,22 +2391,30 @@ float Map::GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, fl
|
||||
return VMAP_INVALID_HEIGHT_VALUE;
|
||||
}
|
||||
|
||||
float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/, float collisionHeight) const
|
||||
float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
|
||||
{
|
||||
// find raw .map surface under Z coordinates
|
||||
float const gridHeight = GetGridMapHeight(x, y);
|
||||
float mapHeight = z + collisionHeight > gridHeight ? gridHeight : VMAP_INVALID_HEIGHT_VALUE;
|
||||
float mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
||||
{
|
||||
float gridHeight = gmap->getHeight(x, y);
|
||||
if (z > gridHeight)
|
||||
mapHeight = gridHeight;
|
||||
}
|
||||
|
||||
float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||
if (checkVMap)
|
||||
vmapHeight = GetVMapFloor(x, y, z, maxSearchDist, collisionHeight);
|
||||
|
||||
bool const hasVmapFloor = vmapHeight > INVALID_HEIGHT;
|
||||
bool const hasMapFloor = mapHeight > INVALID_HEIGHT;
|
||||
|
||||
if (hasVmapFloor)
|
||||
{
|
||||
if (hasMapFloor)
|
||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
if (vmgr->isHeightCalcEnabled())
|
||||
vmapHeight = vmgr->getHeight(GetId(), x, y, z, maxSearchDist);
|
||||
}
|
||||
|
||||
// mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
|
||||
// vmapheight set for any under Z value or <= INVALID_HEIGHT
|
||||
if (vmapHeight > INVALID_HEIGHT)
|
||||
{
|
||||
if (mapHeight > INVALID_HEIGHT)
|
||||
{
|
||||
// we have mapheight and vmapheight and must select more appropriate
|
||||
|
||||
@@ -2421,7 +2429,7 @@ float Map::GetHeight(float x, float y, float z, bool checkVMap /*= true*/, float
|
||||
return vmapHeight; // we have only vmapHeight (if have)
|
||||
}
|
||||
|
||||
return gridHeight; // explicitly use map data
|
||||
return mapHeight; // explicitly use map data
|
||||
}
|
||||
|
||||
float Map::GetMinHeight(float x, float y) const
|
||||
@@ -2432,19 +2440,6 @@ float Map::GetMinHeight(float x, float y) const
|
||||
return -500.0f;
|
||||
}
|
||||
|
||||
float Map::GetGridMapHeight(float x, float y) const
|
||||
{
|
||||
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
||||
return gmap->getHeight(x, y);
|
||||
|
||||
return VMAP_INVALID_HEIGHT_VALUE;
|
||||
}
|
||||
|
||||
float Map::GetVMapFloor(float x, float y, float z, float maxSearchDist, float collisionHeight) const
|
||||
{
|
||||
return VMAP::VMapFactory::createOrGetVMapManager()->getHeight(GetId(), x, y, z + collisionHeight, maxSearchDist);
|
||||
}
|
||||
|
||||
inline bool IsOutdoorWMO(uint32 mogpFlags, WMOAreaTableEntry const* wmoEntry, AreaTableEntry const* atEntry)
|
||||
{
|
||||
if (wmoEntry && atEntry)
|
||||
@@ -2772,11 +2767,6 @@ float Map::GetWaterLevel(float x, float y) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
float Map::GetCeil(float x, float y, float z, float maxSearchDist, float collisionHeight) const
|
||||
{
|
||||
return VMAP::VMapFactory::createOrGetVMapManager()->getCeil(GetId(), x, y, z + collisionHeight, maxSearchDist);
|
||||
}
|
||||
|
||||
bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const
|
||||
{
|
||||
if ((checks & LINEOFSIGHT_CHECK_VMAP)
|
||||
|
||||
Reference in New Issue
Block a user