diff options
| author | Jeremy <Golrag@users.noreply.github.com> | 2019-04-07 20:15:40 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2021-11-26 22:43:48 +0100 |
| commit | 4fcc4a330044e84baa1f58ff13e1b4ea7775eb66 (patch) | |
| tree | 3841355e97bf9b905f1a1ae41a08dad5ea259c71 /src/server/game/Maps | |
| parent | fe0cff0caeda48cd49f5d3898607bdb34704b868 (diff) | |
Core/Movement: Fix some undermap issues with random movement/fear/blink (#22937)
* Core/Movement:
- Only move to point if there is a path that is not a shortcut (which will make the unit move through terrain)
- Added new function to check if there is a vmap floor without search distance
- Units that can fly, are underground but far above the vmap floor will stay underground (bronze drakes in tanaris)
- Don't remove PATHFIND_SHORTCUT from path type in some cases
* Core/Object: Ignore UpdateAllowedPositionZ for flying units.
- This will make flying units go through mountains instead of going to the top and back to the bottom to reach you.
* Core/Object: Revert some changes and let MovePositionToFirstCollision deal with a position without ground
* Missing groundZ change for objects on transport
* use CanFly instead of IsFlying
(cherry picked from commit 9fcbd8f15d249070aabc25d48df86681e8ec3d11)
Diffstat (limited to 'src/server/game/Maps')
| -rw-r--r-- | src/server/game/Maps/Map.cpp | 25 | ||||
| -rw-r--r-- | src/server/game/Maps/Map.h | 1 |
2 files changed, 16 insertions, 10 deletions
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 20a8a3b32bf..8b72da34de0 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2537,12 +2537,9 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float // find raw .map surface under Z coordinates float mapHeight = VMAP_INVALID_HEIGHT_VALUE; uint32 terrainMapId = PhasingHandler::GetTerrainMapId(phaseShift, this, x, y); - if (GridMap* gmap = GetGrid(terrainMapId, x, y)) - { - float gridHeight = gmap->getHeight(x, y); - if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE)) - mapHeight = gridHeight; - } + float gridHeight = GetGridHeight(phaseShift, x, y); + if (G3D::fuzzyGe(z, gridHeight - GROUND_HEIGHT_TOLERANCE)) + mapHeight = gridHeight; float vmapHeight = VMAP_INVALID_HEIGHT_VALUE; if (checkVMap) @@ -2564,16 +2561,24 @@ float Map::GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float // or if the distance of the vmap height is less the land height distance if (vmapHeight > mapHeight || std::fabs(mapHeight - z) > std::fabs(vmapHeight - z)) return vmapHeight; - else - return mapHeight; // better use .map surface height + + return mapHeight; // better use .map surface height } - else - return vmapHeight; // we have only vmapHeight (if have) + + return vmapHeight; // we have only vmapHeight (if have) } return mapHeight; // explicitly use map data } +float Map::GetGridHeight(PhaseShift const& phaseShift, float x, float y) +{ + if (GridMap* gmap = GetGrid(PhasingHandler::GetTerrainMapId(phaseShift, this, x, y), x, y)) + return gmap->getHeight(x, y); + + return VMAP_INVALID_HEIGHT_VALUE; +} + float Map::GetMinHeight(PhaseShift const& phaseShift, float x, float y) { if (GridMap const* grid = GetGrid(PhasingHandler::GetTerrainMapId(phaseShift, this, x, y), x, y)) diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index 15b986cad26..ee6f0b293be 100644 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -495,6 +495,7 @@ class TC_GAME_API Map : public GridRefManager<NGridType> float GetWaterOrGroundLevel(PhaseShift const& phaseShift, float x, float y, float z, float* ground = nullptr, bool swim = false, float collisionHeight = 2.03128f); // DEFAULT_COLLISION_HEIGHT in Object.h float GetMinHeight(PhaseShift const& phaseShift, float x, float y); + float GetGridHeight(PhaseShift const& phaseShift, float x, float y); float GetStaticHeight(PhaseShift const& phaseShift, float x, float y, float z, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH); float GetStaticHeight(PhaseShift const& phaseShift, Position const& pos, bool checkVMap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) { return GetStaticHeight(phaseShift, pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), checkVMap, maxSearchDist); } float GetHeight(PhaseShift const& phaseShift, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) { return std::max<float>(GetStaticHeight(phaseShift, x, y, z, vmap, maxSearchDist), GetGameObjectFloor(phaseShift, x, y, z, maxSearchDist)); } |
