Core/Maps: Removed some incorrect checks in GetHeight, flying creatures should now fall correctly when killed
This commit is contained in:
@@ -1528,41 +1528,28 @@ inline GridMap* Map::GetGrid(float x, float y)
|
|||||||
return GridMaps[gx][gy];
|
return GridMaps[gx][gy];
|
||||||
}
|
}
|
||||||
|
|
||||||
float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchDist) 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
|
// find raw .map surface under Z coordinates
|
||||||
float mapHeight;
|
float mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||||
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y))
|
||||||
{
|
{
|
||||||
float _mapheight = gmap->getHeight(x, y);
|
float gridHeight = gmap->getHeight(x, y);
|
||||||
|
|
||||||
// look from a bit higher pos to find the floor, ignore under surface case
|
// look from a bit higher pos to find the floor, ignore under surface case
|
||||||
if (z + 2.0f > _mapheight)
|
if (z + 2.0f > gridHeight)
|
||||||
mapHeight = _mapheight;
|
mapHeight = gridHeight;
|
||||||
else
|
|
||||||
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
mapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
|
||||||
|
|
||||||
float vmapHeight;
|
float vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
||||||
if (pUseVmaps)
|
if (checkVMap)
|
||||||
{
|
{
|
||||||
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager();
|
||||||
if (vmgr->isHeightCalcEnabled())
|
if (vmgr->isHeightCalcEnabled())
|
||||||
{
|
vmapHeight = vmgr->getHeight(GetId(), x, y, z + 2.0f, maxSearchDist); // look from a bit higher pos to find the floor
|
||||||
// look from a bit higher pos to find the floor
|
|
||||||
vmapHeight = vmgr->getHeight(GetId(), x, y, z + 2.0f, maxSearchDist);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vmapHeight = VMAP_INVALID_HEIGHT_VALUE;
|
|
||||||
|
|
||||||
// mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
|
// mapHeight set for any above raw ground Z or <= INVALID_HEIGHT
|
||||||
// vmapheight set for any under Z value or <= INVALID_HEIGHT
|
// vmapheight set for any under Z value or <= INVALID_HEIGHT
|
||||||
|
|
||||||
if (vmapHeight > INVALID_HEIGHT)
|
if (vmapHeight > INVALID_HEIGHT)
|
||||||
{
|
{
|
||||||
if (mapHeight > INVALID_HEIGHT)
|
if (mapHeight > INVALID_HEIGHT)
|
||||||
@@ -1579,15 +1566,8 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD
|
|||||||
else
|
else
|
||||||
return vmapHeight; // we have only vmapHeight (if have)
|
return vmapHeight; // we have only vmapHeight (if have)
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
return mapHeight; // explicitly use map data
|
||||||
if (!pUseVmaps)
|
|
||||||
return mapHeight; // explicitly use map data (if have)
|
|
||||||
else if (mapHeight > INVALID_HEIGHT && (z < mapHeight + 2 || z == MAX_HEIGHT))
|
|
||||||
return mapHeight; // explicitly use map data if original z < mapHeight but map found (z+2 > mapHeight)
|
|
||||||
else
|
|
||||||
return VMAP_INVALID_HEIGHT_VALUE; // we not have any height
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool IsOutdoorWMO(uint32 mogpFlags, int32 /*adtId*/, int32 /*rootId*/, int32 /*groupId*/, WMOAreaTableEntry const* wmoEntry, AreaTableEntry const* atEntry)
|
inline bool IsOutdoorWMO(uint32 mogpFlags, int32 /*adtId*/, int32 /*rootId*/, int32 /*groupId*/, WMOAreaTableEntry const* wmoEntry, AreaTableEntry const* atEntry)
|
||||||
|
|||||||
@@ -296,7 +296,7 @@ class Map : public GridRefManager<NGridType>
|
|||||||
|
|
||||||
// some calls like isInWater should not use vmaps due to processor power
|
// some calls like isInWater should not use vmaps due to processor power
|
||||||
// can return INVALID_HEIGHT if under z+2 z coord not found height
|
// can return INVALID_HEIGHT if under z+2 z coord not found height
|
||||||
float GetHeight(float x, float y, float z, bool pCheckVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const;
|
float GetHeight(float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
|
||||||
|
|
||||||
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const;
|
ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user