aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/Collision/DynamicTree.cpp81
-rw-r--r--src/common/Collision/DynamicTree.h14
-rw-r--r--src/common/Collision/Models/GameObjectModel.cpp14
-rw-r--r--src/common/Collision/Models/GameObjectModel.h17
-rw-r--r--src/server/game/Entities/Creature/Creature.cpp4
-rw-r--r--src/server/game/Entities/GameObject/GameObject.cpp13
-rw-r--r--src/server/game/Entities/GameObject/GameObject.h1
-rw-r--r--src/server/game/Entities/Object/Object.cpp45
-rw-r--r--src/server/game/Entities/Object/Object.h1
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp2
-rw-r--r--src/server/game/Handlers/QueryHandler.cpp2
-rw-r--r--src/server/game/Maps/Map.cpp16
-rw-r--r--src/server/game/Maps/Map.h8
-rw-r--r--src/server/game/Movement/MotionMaster.cpp4
-rw-r--r--src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp8
-rw-r--r--src/server/game/Spells/Spell.cpp2
-rw-r--r--src/server/scripts/Commands/cs_misc.cpp4
-rw-r--r--src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp4
-rw-r--r--src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp2
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp2
-rw-r--r--src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp4
-rw-r--r--src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp2
-rw-r--r--src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp2
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp4
-rw-r--r--src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp2
-rw-r--r--src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp2
-rw-r--r--src/server/scripts/Northrend/zone_sholazar_basin.cpp2
-rw-r--r--src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp2
-rw-r--r--src/server/scripts/Outland/zone_shadowmoon_valley.cpp2
30 files changed, 118 insertions, 150 deletions
diff --git a/src/common/Collision/DynamicTree.cpp b/src/common/Collision/DynamicTree.cpp
index a32ad1e17c8..c0aa9805d8d 100644
--- a/src/common/Collision/DynamicTree.cpp
+++ b/src/common/Collision/DynamicTree.cpp
@@ -146,53 +146,32 @@ void DynamicMapTree::update(uint32 t_diff)
struct DynamicTreeIntersectionCallback
{
- bool did_hit;
- uint32 phase_mask;
- DynamicTreeIntersectionCallback(uint32 phasemask) : did_hit(false), phase_mask(phasemask) { }
- bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance)
- {
- did_hit = obj.intersectRay(r, distance, true, phase_mask);
- return did_hit;
- }
- bool didHit() const { return did_hit;}
-};
+ DynamicTreeIntersectionCallback(std::set<uint32> const& phases) : _didHit(false), _phases(phases) { }
-struct DynamicTreeIntersectionCallback_WithLogger
-{
- bool did_hit;
- uint32 phase_mask;
- DynamicTreeIntersectionCallback_WithLogger(uint32 phasemask) : did_hit(false), phase_mask(phasemask)
- {
- TC_LOG_DEBUG("maps", "Dynamic Intersection log");
- }
- bool operator()(const G3D::Ray& r, const GameObjectModel& obj, float& distance)
+ bool operator()(G3D::Ray const& r, GameObjectModel const& obj, float& distance)
{
- TC_LOG_DEBUG("maps", "testing intersection with %s", obj.name.c_str());
- bool hit = obj.intersectRay(r, distance, true, phase_mask);
- if (hit)
- {
- did_hit = true;
- TC_LOG_DEBUG("maps", "result: intersects");
- }
- return hit;
+ _didHit = obj.intersectRay(r, distance, true, _phases);
+ return _didHit;
}
- bool didHit() const { return did_hit;}
+
+ bool didHit() const { return _didHit; }
+
+private:
+ bool _didHit;
+ std::set<uint32> _phases;
};
-bool DynamicMapTree::getIntersectionTime(const uint32 phasemask, const G3D::Ray& ray,
- const G3D::Vector3& endPos, float& maxDist) const
+bool DynamicMapTree::getIntersectionTime(std::set<uint32> const& phases, G3D::Ray const& ray, G3D::Vector3 const& endPos, float& maxDist) const
{
float distance = maxDist;
- DynamicTreeIntersectionCallback callback(phasemask);
+ DynamicTreeIntersectionCallback callback(phases);
impl->intersectRay(ray, callback, distance, endPos);
if (callback.didHit())
maxDist = distance;
return callback.didHit();
}
-bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const G3D::Vector3& startPos,
- const G3D::Vector3& endPos, G3D::Vector3& resultHit,
- float modifyDist) const
+bool DynamicMapTree::getObjectHitPos(std::set<uint32> const& phases, G3D::Vector3 const& startPos, G3D::Vector3 const& endPos, G3D::Vector3& resultHitPos, float modifyDist) const
{
bool result = false;
float maxDist = (endPos - startPos).magnitude();
@@ -201,56 +180,54 @@ bool DynamicMapTree::getObjectHitPos(const uint32 phasemask, const G3D::Vector3&
// prevent NaN values which can cause BIH intersection to enter infinite loop
if (maxDist < 1e-10f)
{
- resultHit = endPos;
+ resultHitPos = endPos;
return false;
}
G3D::Vector3 dir = (endPos - startPos)/maxDist; // direction with length of 1
G3D::Ray ray(startPos, dir);
float dist = maxDist;
- if (getIntersectionTime(phasemask, ray, endPos, dist))
+ if (getIntersectionTime(phases, ray, endPos, dist))
{
- resultHit = startPos + dir * dist;
+ resultHitPos = startPos + dir * dist;
if (modifyDist < 0)
{
- if ((resultHit - startPos).magnitude() > -modifyDist)
- resultHit = resultHit + dir*modifyDist;
+ if ((resultHitPos - startPos).magnitude() > -modifyDist)
+ resultHitPos += dir * modifyDist;
else
- resultHit = startPos;
+ resultHitPos = startPos;
}
else
- resultHit = resultHit + dir*modifyDist;
+ resultHitPos += dir * modifyDist;
result = true;
}
else
{
- resultHit = endPos;
+ resultHitPos = endPos;
result = false;
}
return result;
}
-bool DynamicMapTree::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const
+bool DynamicMapTree::isInLineOfSight(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos, std::set<uint32> const& phases) const
{
- G3D::Vector3 v1(x1, y1, z1), v2(x2, y2, z2);
-
- float maxDist = (v2 - v1).magnitude();
+ float maxDist = (endPos - startPos).magnitude();
if (!G3D::fuzzyGt(maxDist, 0) )
return true;
- G3D::Ray r(v1, (v2-v1) / maxDist);
- DynamicTreeIntersectionCallback callback(phasemask);
- impl->intersectRay(r, callback, maxDist, v2);
+ G3D::Ray r(startPos, (endPos - startPos) / maxDist);
+ DynamicTreeIntersectionCallback callback(phases);
+ impl->intersectRay(r, callback, maxDist, endPos);
- return !callback.did_hit;
+ return !callback.didHit();
}
-float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const
+float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist, std::set<uint32> const& phases) const
{
G3D::Vector3 v(x, y, z + 0.5f);
G3D::Ray r(v, G3D::Vector3(0, 0, -1));
- DynamicTreeIntersectionCallback callback(phasemask);
+ DynamicTreeIntersectionCallback callback(phases);
impl->intersectZAllignedRay(r, callback, maxSearchDist);
if (callback.didHit())
diff --git a/src/common/Collision/DynamicTree.h b/src/common/Collision/DynamicTree.h
index cbb7c7fdaef..f52c5364362 100644
--- a/src/common/Collision/DynamicTree.h
+++ b/src/common/Collision/DynamicTree.h
@@ -40,17 +40,11 @@ public:
DynamicMapTree();
~DynamicMapTree();
- bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2,
- float z2, uint32 phasemask) const;
+ bool isInLineOfSight(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos, std::set<uint32> const& phases) const;
+ bool getIntersectionTime(std::set<uint32> const& phases, G3D::Ray const& ray, G3D::Vector3 const& endPos, float& maxDist) const;
+ bool getObjectHitPos(std::set<uint32> const& phases, G3D::Vector3 const& startPos, G3D::Vector3 const& endPos, G3D::Vector3& resultHitPos, float modifyDist) const;
- bool getIntersectionTime(uint32 phasemask, const G3D::Ray& ray,
- const G3D::Vector3& endPos, float& maxDist) const;
-
- bool getObjectHitPos(uint32 phasemask, const G3D::Vector3& pPos1,
- const G3D::Vector3& pPos2, G3D::Vector3& pResultHitPos,
- float pModifyDist) const;
-
- float getHeight(float x, float y, float z, float maxSearchDist, uint32 phasemask) const;
+ float getHeight(float x, float y, float z, float maxSearchDist, std::set<uint32> const& phases) const;
void insert(const GameObjectModel&);
void remove(const GameObjectModel&);
diff --git a/src/common/Collision/Models/GameObjectModel.cpp b/src/common/Collision/Models/GameObjectModel.cpp
index b111b0de301..f3e5d9f6e64 100644
--- a/src/common/Collision/Models/GameObjectModel.cpp
+++ b/src/common/Collision/Models/GameObjectModel.cpp
@@ -115,7 +115,6 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model
name = it->second.name;
iPos = modelOwner->GetPosition();
- phasemask = modelOwner->GetPhaseMask();
iScale = modelOwner->GetScale();
iInvScale = 1.f / iScale;
@@ -153,9 +152,12 @@ GameObjectModel* GameObjectModel::Create(std::unique_ptr<GameObjectModelOwnerBas
return mdl;
}
-bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const
+bool GameObjectModel::intersectRay(G3D::Ray const& ray, float& maxDist, bool stopAtFirstHit, std::set<uint32> const& phases) const
{
- if (!(phasemask & ph_mask) || !owner->IsSpawned())
+ if (!isCollisionEnabled() || !owner->IsSpawned())
+ return false;
+
+ if (!owner->IsInPhase(phases))
return false;
float time = ray.intersectionTime(iBound);
@@ -165,12 +167,12 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto
// child bounds are defined in object space:
Vector3 p = iInvRot * (ray.origin() - iPos) * iInvScale;
Ray modRay(p, iInvRot * ray.direction());
- float distance = MaxDist * iInvScale;
- bool hit = iModel->IntersectRay(modRay, distance, StopAtFirstHit);
+ float distance = maxDist * iInvScale;
+ bool hit = iModel->IntersectRay(modRay, distance, stopAtFirstHit);
if (hit)
{
distance *= iScale;
- MaxDist = distance;
+ maxDist = distance;
}
return hit;
}
diff --git a/src/common/Collision/Models/GameObjectModel.h b/src/common/Collision/Models/GameObjectModel.h
index a9fce400146..477d49ccf80 100644
--- a/src/common/Collision/Models/GameObjectModel.h
+++ b/src/common/Collision/Models/GameObjectModel.h
@@ -26,6 +26,7 @@
#include "Define.h"
#include <memory>
+#include <set>
namespace VMAP
{
@@ -40,7 +41,7 @@ class TC_COMMON_API GameObjectModelOwnerBase
public:
virtual bool IsSpawned() const { return false; }
virtual uint32 GetDisplayId() const { return 0; }
- virtual uint32 GetPhaseMask() const { return 0; }
+ virtual bool IsInPhase(std::set<uint32> const& phases) const { return false; }
virtual G3D::Vector3 GetPosition() const { return G3D::Vector3::zero(); }
virtual float GetOrientation() const { return 0.0f; }
virtual float GetScale() const { return 1.0f; }
@@ -49,7 +50,7 @@ public:
class TC_COMMON_API GameObjectModel /*, public Intersectable*/
{
- GameObjectModel() : phasemask(0), iInvScale(0), iScale(0), iModel(NULL) { }
+ GameObjectModel() : _collisionEnabled(false), iInvScale(0), iScale(0), iModel(nullptr) { }
public:
std::string name;
@@ -59,13 +60,11 @@ public:
const G3D::Vector3& getPosition() const { return iPos;}
- /** Enables\disables collision. */
- void disable() { phasemask = 0;}
- void enable(uint32 ph_mask) { phasemask = ph_mask;}
+ /* Enables/disables collision */
+ void enableCollision(bool enable) { _collisionEnabled = enable; }
+ bool isCollisionEnabled() const { return _collisionEnabled; }
- bool isEnabled() const {return phasemask != 0;}
-
- bool intersectRay(const G3D::Ray& Ray, float& MaxDist, bool StopAtFirstHit, uint32 ph_mask) const;
+ bool intersectRay(G3D::Ray const& ray, float& maxDist, bool stopAtFirstHit, std::set<uint32> const& phases) const;
static GameObjectModel* Create(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
@@ -74,7 +73,7 @@ public:
private:
bool initialize(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath);
- uint32 phasemask;
+ bool _collisionEnabled;
G3D::AABox iBound;
G3D::Matrix3 iInvRot;
G3D::Vector3 iPos;
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp
index 44c850d7af8..b701e0c1ac9 100644
--- a/src/server/game/Entities/Creature/Creature.cpp
+++ b/src/server/game/Entities/Creature/Creature.cpp
@@ -1427,7 +1427,7 @@ bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool ad
m_deathState = DEAD;
if (CanFly())
{
- float tz = map->GetHeight(GetPhaseMask(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
+ float tz = map->GetHeight(GetPhases(), data->posX, data->posY, data->posZ, true, MAX_FALL_DISTANCE);
if (data->posZ - tz > 0.1f && Trinity::IsValidMapCoord(tz))
Relocate(data->posX, data->posY, tz);
}
@@ -2709,7 +2709,7 @@ void Creature::UpdateMovementFlags()
return;
// Set the movement flags if the creature is in that mode. (Only fly if actually in air, only swim if in water, etc)
- float ground = GetMap()->GetHeight(GetPhaseMask(), GetPositionX(), GetPositionY(), GetPositionZMinusOffset());
+ float ground = GetMap()->GetHeight(GetPhases(), GetPositionX(), GetPositionY(), GetPositionZMinusOffset());
bool isInAir = (G3D::fuzzyGt(GetPositionZMinusOffset(), ground + 0.05f) || G3D::fuzzyLt(GetPositionZMinusOffset(), ground - 0.05f)); // Can be underground too, prevent the falling
diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp
index 99633402afe..ffbb13b42e1 100644
--- a/src/server/game/Entities/GameObject/GameObject.cpp
+++ b/src/server/game/Entities/GameObject/GameObject.cpp
@@ -2265,15 +2265,6 @@ void GameObject::SetDisplayId(uint32 displayid)
UpdateModel();
}
-bool GameObject::SetInPhase(uint32 id, bool update, bool apply)
-{
- bool res = WorldObject::SetInPhase(id, update, apply);
- if (m_model && m_model->isEnabled())
- EnableCollision(true);
-
- return res;
-}
-
void GameObject::EnableCollision(bool enable)
{
if (!m_model)
@@ -2282,7 +2273,7 @@ void GameObject::EnableCollision(bool enable)
/*if (enable && !GetMap()->ContainsGameObjectModel(*m_model))
GetMap()->InsertGameObjectModel(*m_model);*/
- m_model->enable(enable ? GetPhaseMask() : 0);
+ m_model->enableCollision(enable);
}
void GameObject::UpdateModel()
@@ -2537,7 +2528,7 @@ public:
virtual bool IsSpawned() const override { return _owner->isSpawned(); }
virtual uint32 GetDisplayId() const override { return _owner->GetDisplayId(); }
- virtual uint32 GetPhaseMask() const override { return _owner->GetPhaseMask(); }
+ virtual bool IsInPhase(std::set<uint32> const& phases) const override { return _owner->IsInPhase(phases); }
virtual G3D::Vector3 GetPosition() const override { return G3D::Vector3(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
virtual float GetOrientation() const override { return _owner->GetOrientation(); }
virtual float GetScale() const override { return _owner->GetObjectScale(); }
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h
index 49b91159d94..6f444d857c9 100644
--- a/src/server/game/Entities/GameObject/GameObject.h
+++ b/src/server/game/Entities/GameObject/GameObject.h
@@ -1041,7 +1041,6 @@ class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>
void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
static void SetGoArtKit(uint8 artkit, GameObject* go, ObjectGuid::LowType lowguid = UI64LIT(0));
- bool SetInPhase(uint32 id, bool update, bool apply) override;
void EnableCollision(bool enable);
void Use(Unit* user);
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index a6be4165db4..64cd60282cb 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -1755,7 +1755,7 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const
else
GetHitSpherePointFor({ ox, oy, oz }, x, y, z);
- return GetMap()->isInLineOfSight(x, y, z + 2.0f, ox, oy, oz + 2.0f, GetPhaseMask());
+ return GetMap()->isInLineOfSight(x, y, z + 2.0f, ox, oy, oz + 2.0f, GetPhases());
}
return true;
@@ -1925,7 +1925,7 @@ Position WorldObject::GetRandomPoint(const Position &srcPos, float distance) con
void WorldObject::UpdateGroundPositionZ(float x, float y, float &z) const
{
- float new_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z + 2.0f, true);
+ float new_z = GetMap()->GetHeight(GetPhases(), x, y, z + 2.0f, true);
if (new_z > INVALID_HEIGHT)
z = new_z + 0.05f; // just to be sure that we are not a few pixel under the surface
}
@@ -1947,8 +1947,8 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
bool canSwim = ToCreature()->CanSwim();
float ground_z = z;
float max_z = canSwim
- ? GetMap()->GetWaterOrGroundLevel(GetPhaseMask(), x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK))
- : ((ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true)));
+ ? GetMap()->GetWaterOrGroundLevel(GetPhases(), x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK))
+ : ((ground_z = GetMap()->GetHeight(GetPhases(), x, y, z, true)));
if (max_z > INVALID_HEIGHT)
{
if (z > max_z)
@@ -1959,7 +1959,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
}
else
{
- float ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true);
+ float ground_z = GetMap()->GetHeight(GetPhases(), x, y, z, true);
if (z < ground_z)
z = ground_z;
}
@@ -1971,7 +1971,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
if (!ToPlayer()->CanFly())
{
float ground_z = z;
- float max_z = GetMap()->GetWaterOrGroundLevel(GetPhaseMask(), x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK));
+ float max_z = GetMap()->GetWaterOrGroundLevel(GetPhases(), x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK));
if (max_z > INVALID_HEIGHT)
{
if (z > max_z)
@@ -1982,7 +1982,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
}
else
{
- float ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true);
+ float ground_z = GetMap()->GetHeight(GetPhases(), x, y, z, true);
if (z < ground_z)
z = ground_z;
}
@@ -1990,7 +1990,7 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float &z) const
}
default:
{
- float ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true);
+ float ground_z = GetMap()->GetHeight(GetPhases(), x, y, z, true);
if (ground_z > INVALID_HEIGHT)
z = ground_z;
break;
@@ -2810,8 +2810,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
return;
}
- ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
- floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
+ ground = GetMap()->GetHeight(GetPhases(), destx, desty, MAX_HEIGHT, true);
+ floor = GetMap()->GetHeight(GetPhases(), destx, desty, pos.m_positionZ, true);
destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
float step = dist/10.0f;
@@ -2823,8 +2823,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
{
destx -= step * std::cos(angle);
desty -= step * std::sin(angle);
- ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
- floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
+ ground = GetMap()->GetHeight(GetPhases(), destx, desty, MAX_HEIGHT, true);
+ floor = GetMap()->GetHeight(GetPhases(), destx, desty, pos.m_positionZ, true);
destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
}
// we have correct destz now
@@ -2844,8 +2844,8 @@ void WorldObject::MovePosition(Position &pos, float dist, float angle)
// @todo: replace with WorldObject::UpdateAllowedPositionZ
float NormalizeZforCollision(WorldObject* obj, float x, float y, float z)
{
- float ground = obj->GetMap()->GetHeight(obj->GetPhaseMask(), x, y, MAX_HEIGHT, true);
- float floor = obj->GetMap()->GetHeight(obj->GetPhaseMask(), x, y, z + 2.0f, true);
+ float ground = obj->GetMap()->GetHeight(obj->GetPhases(), x, y, MAX_HEIGHT, true);
+ float floor = obj->GetMap()->GetHeight(obj->GetPhases(), x, y, z + 2.0f, true);
float helper = std::fabs(ground - z) <= std::fabs(floor - z) ? ground : floor;
if (z > helper) // must be above ground
{
@@ -2894,7 +2894,7 @@ void WorldObject::MovePositionToFirstCollision(Position &pos, float dist, float
}
// check dynamic collision
- col = GetMap()->getObjectHitPos(GetPhaseMask(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
+ col = GetMap()->getObjectHitPos(GetPhases(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
// Collided with a gameobject
if (col)
@@ -3071,22 +3071,27 @@ void WorldObject::ClearPhases(bool update)
UpdateObjectVisibility();
}
-bool WorldObject::IsInPhase(WorldObject const* obj) const
+bool WorldObject::IsInPhase(std::set<uint32> const& phases) const
{
// PhaseId 169 is the default fallback phase
- if (_phases.empty() && obj->GetPhases().empty())
+ if (_phases.empty() && phases.empty())
return true;
- if (_phases.empty() && obj->IsInPhase(DEFAULT_PHASE))
+ if (_phases.empty() && phases.count(DEFAULT_PHASE) > 0)
return true;
- if (obj->GetPhases().empty() && IsInPhase(DEFAULT_PHASE))
+ if (phases.empty() && _phases.count(DEFAULT_PHASE) > 0)
return true;
+ return Trinity::Containers::Intersects(_phases.begin(), _phases.end(), phases.begin(), phases.end());
+}
+
+bool WorldObject::IsInPhase(WorldObject const* obj) const
+{
if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster())
return true;
- return Trinity::Containers::Intersects(_phases.begin(), _phases.end(), obj->GetPhases().begin(), obj->GetPhases().end());
+ return IsInPhase(obj->GetPhases());
}
void WorldObject::PlayDistanceSound(uint32 soundId, Player* target /*= nullptr*/)
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index bf21bd1db21..f1e0841f3ed 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -566,6 +566,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
bool HasInPhaseList(uint32 phase);
uint32 GetPhaseMask() const { return m_phaseMask; }
bool IsInPhase(uint32 phase) const { return _phases.find(phase) != _phases.end(); }
+ bool IsInPhase(std::set<uint32> const& phases) const;
bool IsInPhase(WorldObject const* obj) const;
bool IsInTerrainSwap(uint32 terrainSwap) const { return _terrainSwaps.find(terrainSwap) != _terrainSwaps.end(); }
std::set<uint32> const& GetPhases() const { return _phases; }
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index f9dcef634cd..2ef380df948 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -13689,7 +13689,7 @@ void Unit::_ExitVehicle(Position const* exitPosition)
Movement::MoveSplineInit init(this);
// Creatures without inhabit type air should begin falling after exiting the vehicle
- if (GetTypeId() == TYPEID_UNIT && !CanFly() && height > GetMap()->GetWaterOrGroundLevel(GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), &height) + 0.1f)
+ if (GetTypeId() == TYPEID_UNIT && !CanFly() && height > GetMap()->GetWaterOrGroundLevel(GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), &height) + 0.1f)
init.SetFall();
init.MoveTo(pos.GetPositionX(), pos.GetPositionY(), height, false);
diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp
index b05f2add7ae..641a4b5ce59 100644
--- a/src/server/game/Handlers/QueryHandler.cpp
+++ b/src/server/game/Handlers/QueryHandler.cpp
@@ -199,7 +199,7 @@ void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLoc
mapID = corpseMapEntry->CorpseMapID;
x = corpseMapEntry->CorpsePos.X;
y = corpseMapEntry->CorpsePos.Y;
- z = entranceMap->GetHeight(player->GetPhaseMask(), x, y, MAX_HEIGHT);
+ z = entranceMap->GetHeight(player->GetPhases(), x, y, MAX_HEIGHT);
}
}
}
diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp
index 1892c36cec5..ed198c81b67 100644
--- a/src/server/game/Maps/Map.cpp
+++ b/src/server/game/Maps/Map.cpp
@@ -2476,12 +2476,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 /*= NULL*/, bool /*swim = false*/) const
+float Map::GetWaterOrGroundLevel(std::set<uint32> const& phases, float x, float y, float z, float* ground /*= nullptr*/, bool /*swim = false*/) 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, 50.0f);
+ float ground_z = GetHeight(phases, x, y, z, true, 50.0f);
if (ground)
*ground = ground_z;
@@ -2770,19 +2770,19 @@ float Map::GetWaterLevel(float x, float y) const
return 0;
}
-bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const
+bool Map::isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, std::set<uint32> const& phases) const
{
return VMAP::VMapFactory::createOrGetVMapManager()->isInLineOfSight(GetId(), x1, y1, z1, x2, y2, z2)
- && _dynamicTree.isInLineOfSight(x1, y1, z1, x2, y2, z2, phasemask);
+ && _dynamicTree.isInLineOfSight({ x1, y1, z1 }, { x2, y2, z2 }, phases);
}
-bool Map::getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
+bool Map::getObjectHitPos(std::set<uint32> const& phases, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float& ry, float& rz, float modifyDist)
{
G3D::Vector3 startPos(x1, y1, z1);
G3D::Vector3 dstPos(x2, y2, z2);
G3D::Vector3 resultPos;
- bool result = _dynamicTree.getObjectHitPos(phasemask, startPos, dstPos, resultPos, modifyDist);
+ bool result = _dynamicTree.getObjectHitPos(phases, startPos, dstPos, resultPos, modifyDist);
rx = resultPos.x;
ry = resultPos.y;
@@ -2790,9 +2790,9 @@ bool Map::getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float
return result;
}
-float Map::GetHeight(uint32 phasemask, float x, float y, float z, bool vmap/*=true*/, float maxSearchDist/*=DEFAULT_HEIGHT_SEARCH*/) const
+float Map::GetHeight(std::set<uint32> const& phases, float x, float y, float z, bool vmap /*= true*/, float maxSearchDist /*= DEFAULT_HEIGHT_SEARCH*/) const
{
- return std::max<float>(GetHeight(x, y, z, vmap, maxSearchDist), _dynamicTree.getHeight(x, y, z, maxSearchDist, phasemask));
+ return std::max<float>(GetHeight(x, y, z, vmap, maxSearchDist), _dynamicTree.getHeight(x, y, z, maxSearchDist, phases));
}
bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const
diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h
index 5bf52ca0301..7165bc1942e 100644
--- a/src/server/game/Maps/Map.h
+++ b/src/server/game/Maps/Map.h
@@ -500,14 +500,14 @@ class TC_GAME_API Map : public GridRefManager<NGridType>
BattlegroundMap* ToBattlegroundMap() { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap*>(this); else return NULL; }
BattlegroundMap const* ToBattlegroundMap() const { if (IsBattlegroundOrArena()) return reinterpret_cast<BattlegroundMap const*>(this); return NULL; }
- float GetWaterOrGroundLevel(uint32 phasemask, float x, float y, float z, float* ground = NULL, bool swim = false) const;
- float GetHeight(uint32 phasemask, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
- bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const;
+ float GetWaterOrGroundLevel(std::set<uint32> const& phases, float x, float y, float z, float* ground = nullptr, bool swim = false) const;
+ float GetHeight(std::set<uint32> const& phases, float x, float y, float z, bool vmap = true, float maxSearchDist = DEFAULT_HEIGHT_SEARCH) const;
+ bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, std::set<uint32> const& phases) const;
void Balance() { _dynamicTree.balance(); }
void RemoveGameObjectModel(const GameObjectModel& model) { _dynamicTree.remove(model); }
void InsertGameObjectModel(const GameObjectModel& model) { _dynamicTree.insert(model); }
bool ContainsGameObjectModel(const GameObjectModel& model) const { return _dynamicTree.contains(model);}
- bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
+ bool getObjectHitPos(std::set<uint32> const& phases, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist);
virtual ObjectGuid::LowType GetOwnerGuildId(uint32 /*team*/ = TEAM_OTHER) const { return UI64LIT(0); }
/*
diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp
index 8008e32ba73..1519aae3389 100644
--- a/src/server/game/Movement/MotionMaster.cpp
+++ b/src/server/game/Movement/MotionMaster.cpp
@@ -437,7 +437,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool
if (_owner->IsFlying())
point.z = z;
else
- point.z = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), point.x, point.y, z);
+ point.z = _owner->GetMap()->GetHeight(_owner->GetPhases(), point.x, point.y, z);
init.Path().push_back(point);
}
@@ -520,7 +520,7 @@ void MotionMaster::ResumeSplineChain(SplineChainResumeInfo const& info)
void MotionMaster::MoveFall(uint32 id /*=0*/)
{
// use larger distance for vmap height search than in most other cases
- float tz = _owner->GetMap()->GetHeight(_owner->GetPhaseMask(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
+ float tz = _owner->GetMap()->GetHeight(_owner->GetPhases(), _owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ(), true, MAX_FALL_DISTANCE);
if (tz <= INVALID_HEIGHT)
{
TC_LOG_DEBUG("misc", "MotionMaster::MoveFall: unable to retrieve a proper height at map %u (x: %f, y: %f, z: %f).",
diff --git a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
index caa7d513796..ad6761d6218 100644
--- a/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/RandomMovementGenerator.cpp
@@ -63,7 +63,7 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
// Limit height change
const float distanceZ = float(rand_norm()) * travelDistZ/2.0f;
destZ = respZ + distanceZ;
- float levelZ = map->GetWaterOrGroundLevel(creature->GetPhaseMask(), destX, destY, destZ-2.5f);
+ float levelZ = map->GetWaterOrGroundLevel(creature->GetPhases(), destX, destY, destZ-2.5f);
// Problem here, we must fly above the ground and water, not under. Let's try on next tick
if (levelZ >= destZ)
@@ -77,17 +77,17 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
// The fastest way to get an accurate result 90% of the time.
// Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long.
- destZ = map->GetHeight(creature->GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, false);
+ destZ = map->GetHeight(creature->GetPhases(), destX, destY, respZ+travelDistZ-2.0f, false);
if (std::fabs(destZ - respZ) > travelDistZ) // Map check
{
// Vmap Horizontal or above
- destZ = map->GetHeight(creature->GetPhaseMask(), destX, destY, respZ - 2.0f, true);
+ destZ = map->GetHeight(creature->GetPhases(), destX, destY, respZ - 2.0f, true);
if (std::fabs(destZ - respZ) > travelDistZ)
{
// Vmap Higher
- destZ = map->GetHeight(creature->GetPhaseMask(), destX, destY, respZ+travelDistZ-2.0f, true);
+ destZ = map->GetHeight(creature->GetPhases(), destX, destY, respZ+travelDistZ-2.0f, true);
// let's forget this bad coords where a z cannot be find and retry at next tick
if (std::fabs(destZ - respZ) > travelDistZ)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 5b94f965067..d512a92466e 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -1283,7 +1283,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici
float angle = float(rand_norm()) * static_cast<float>(M_PI * 35.0f / 180.0f) - static_cast<float>(M_PI * 17.5f / 180.0f);
m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dist, angle);
- float ground = m_caster->GetMap()->GetHeight(m_caster->GetPhaseMask(), x, y, z, true, 50.0f);
+ float ground = m_caster->GetMap()->GetHeight(m_caster->GetPhases(), x, y, z, true, 50.0f);
float liquidLevel = VMAP_INVALID_HEIGHT_VALUE;
LiquidData liquidData;
if (m_caster->GetMap()->getLiquidStatus(x, y, z, MAP_ALL_LIQUIDS, &liquidData))
diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
index 594b65c881f..a2f504ab7aa 100644
--- a/src/server/scripts/Commands/cs_misc.cpp
+++ b/src/server/scripts/Commands/cs_misc.cpp
@@ -242,8 +242,8 @@ public:
sDB2Manager.Map2ZoneCoordinates(zoneId, zoneX, zoneY);
Map const* map = object->GetMap();
- float groundZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
- float floorZ = map->GetHeight(object->GetPhaseMask(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
+ float groundZ = map->GetHeight(object->GetPhases(), object->GetPositionX(), object->GetPositionY(), MAX_HEIGHT);
+ float floorZ = map->GetHeight(object->GetPhases(), object->GetPositionX(), object->GetPositionY(), object->GetPositionZ());
GridCoord gridCoord = Trinity::ComputeGridCoord(object->GetPositionX(), object->GetPositionY());
diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
index 6c54e18d77e..bc204ed6c53 100644
--- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
+++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp
@@ -1172,7 +1172,7 @@ public:
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
+ z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
}
@@ -1290,7 +1290,7 @@ public:
{
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
+ z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
hyjal_trashAI::JustDied(killer);
diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
index bbf9fc067d7..9e0c6a12e17 100644
--- a/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
+++ b/src/server/scripts/Kalimdor/HallsOfOrigination/boss_anraphet.cpp
@@ -541,7 +541,7 @@ public:
float x = caster->GetPositionX() + dist * std::cos(angle);
float y = caster->GetPositionY() + dist * std::sin(angle);
- float z = caster->GetMap()->GetHeight(x, y, caster->GetPositionZ());
+ float z = caster->GetMap()->GetHeight(caster->GetPhases(), x, y, caster->GetPositionZ());
float o = dest._position.GetOrientation();
dest.Relocate({ x, y, z, o });
diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp
index 54b16693d95..78c4fe38264 100644
--- a/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/boss_high_priestess_azil.cpp
@@ -267,7 +267,7 @@ class boss_high_priestess_azil : public CreatureScript
me->RemoveAurasDueToSpell(SPELL_EARTH_FURY_CASTING_VISUAL);
me->RemoveAurasDueToSpell(SPELL_EARTH_FURY_ENERGY_SHIELD);
Position pos = me->GetPosition();
- pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
+ pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
me->GetMotionMaster()->MovePoint(POINT_GROUND, pos);
break;
}
diff --git a/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp b/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp
index d91dce0f76f..4c36bc50ee8 100644
--- a/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp
+++ b/src/server/scripts/Maelstrom/Stonecore/boss_slabhide.cpp
@@ -266,7 +266,7 @@ class boss_slabhide : public CreatureScript
case EVENT_LAND:
{
Position pos = me->GetPosition();
- pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
+ pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ());
me->GetMotionMaster()->MoveLand(POINT_SLABHIDE_LAND, pos);
break;
}
@@ -479,7 +479,7 @@ public:
{
Unit* caster = GetCaster();
Position pos = caster->GetPosition();
- pos.m_positionZ = caster->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 100.0f);
+ pos.m_positionZ = caster->GetMap()->GetHeight(caster->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), true, 100.0f);
dest.Relocate(pos);
}
diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
index f98a0b53030..9f7f97a0cab 100644
--- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
+++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_amanitar.cpp
@@ -88,7 +88,7 @@ class boss_amanitar : public CreatureScript
for (uint8 i = 0; i < 30; ++i)
{
Position pos = me->GetRandomNearPosition(30.0f);
- pos.m_positionZ = me->GetMap()->GetHeight(pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
+ pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), MAX_HEIGHT) + 2.0f;
if (Creature* trigger = me->SummonCreature(NPC_TRIGGER, pos))
{
diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
index ae2caa1ff94..14da165d1b2 100644
--- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
+++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp
@@ -625,7 +625,7 @@ class npc_frost_sphere : public CreatureScript
if (me->GetHealth() <= damage)
{
damage = 0;
- float floorZ = me->GetMap()->GetHeight(me->GetPhaseMask(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
+ float floorZ = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZ());
if (fabs(me->GetPositionZ() - floorZ) < 0.1f)
{
// we are close to the ground
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
index e7ad42644d7..1abffdd2b4b 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp
@@ -885,7 +885,7 @@ class boss_prince_valanar_icc : public CreatureScript
{
float x, y, z;
summon->GetPosition(x, y, z);
- float ground_Z = summon->GetMap()->GetHeight(summon->GetPhaseMask(), x, y, z, true, 500.0f);
+ float ground_Z = summon->GetMap()->GetHeight(summon->GetPhases(), x, y, z, true, 500.0f);
summon->GetMotionMaster()->MovePoint(POINT_KINETIC_BOMB_IMPACT, x, y, ground_Z);
summon->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
break;
@@ -1245,7 +1245,7 @@ class npc_kinetic_bomb : public CreatureScript
me->SetReactState(REACT_PASSIVE);
me->GetPosition(_x, _y, _groundZ);
me->DespawnOrUnsummon(60000);
- _groundZ = me->GetMap()->GetHeight(me->GetPhaseMask(), _x, _y, _groundZ, true, 500.0f);
+ _groundZ = me->GetMap()->GetHeight(me->GetPhases(), _x, _y, _groundZ, true, 500.0f);
}
void DoAction(int32 action) override
diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
index 2d3be44b1f8..e04de227806 100644
--- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
+++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp
@@ -2016,7 +2016,7 @@ class spell_svalna_revive_champion : public SpellScriptLoader
return;
Position pos = caster->GetNearPosition(5.0f, 0.0f);
- //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
+ //pos.m_positionZ = caster->GetBaseMap()->GetHeight(caster->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), caster->GetPositionZ(), true, 50.0f);
//pos.m_positionZ += 0.05f;
caster->SetHomePosition(pos);
caster->GetMotionMaster()->MoveLand(POINT_LAND, pos);
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
index e13b3823ce5..c3ba553af5d 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp
@@ -777,7 +777,7 @@ class boss_flame_leviathan_safety_container : public CreatureScript
{
float x, y, z;
me->GetPosition(x, y, z);
- z = me->GetMap()->GetHeight(me->GetPhaseMask(), x, y, z);
+ z = me->GetMap()->GetHeight(me->GetPhases(), x, y, z);
me->GetMotionMaster()->MovePoint(0, x, y, z);
me->SetPosition(x, y, z, 0);
}
diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
index 58287a34710..56719833e03 100644
--- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
+++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_yogg_saron.cpp
@@ -863,7 +863,7 @@ class boss_sara : public CreatureScript
float angle = frand(0.0f, 2.0f * float(M_PI));
pos.m_positionX = YoggSaronSpawnPos.GetPositionX() + radius * cosf(angle);
pos.m_positionY = YoggSaronSpawnPos.GetPositionY() + radius * sinf(angle);
- pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhaseMask(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f);
+ pos.m_positionZ = me->GetMap()->GetHeight(me->GetPhases(), pos.GetPositionX(), pos.GetPositionY(), YoggSaronSpawnPos.GetPositionZ() + 5.0f);
me->SummonCreature(NPC_DEATH_RAY, pos, TEMPSUMMON_TIMED_DESPAWN, 20000);
}
break;
diff --git a/src/server/scripts/Northrend/zone_sholazar_basin.cpp b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
index dba6dc533e7..6208b555d1f 100644
--- a/src/server/scripts/Northrend/zone_sholazar_basin.cpp
+++ b/src/server/scripts/Northrend/zone_sholazar_basin.cpp
@@ -779,7 +779,7 @@ public:
bird->KillSelf();
crunchy->GetMotionMaster()->MovePoint(0, bird->GetPositionX(), bird->GetPositionY(),
- bird->GetMap()->GetWaterOrGroundLevel(bird->GetPhaseMask(), bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
+ bird->GetMap()->GetWaterOrGroundLevel(bird->GetPhases(), bird->GetPositionX(), bird->GetPositionY(), bird->GetPositionZ()));
/// @todo Make crunchy perform emote eat when he reaches the bird
break;
diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
index 0ed26ff26fd..2a1b9e49ff2 100644
--- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
+++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp
@@ -449,7 +449,7 @@ public:
float X = CalculateRandomLocation(target->GetPositionX(), 20);
float Y = CalculateRandomLocation(target->GetPositionY(), 20);
float Z = target->GetPositionZ();
- Z = me->GetMap()->GetHeight(me->GetPhaseMask(), X, Y, Z);
+ Z = me->GetMap()->GetHeight(me->GetPhases(), X, Y, Z);
Creature* DoomBlossom = me->SummonCreature(CREATURE_DOOM_BLOSSOM, X, Y, Z, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 20000);
if (DoomBlossom)
{
diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
index 0858d48012c..9b16713bb27 100644
--- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
+++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp
@@ -74,7 +74,7 @@ public:
void Reset() override
{
- ground = me->GetMap()->GetHeight(me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset());
+ ground = me->GetMap()->GetHeight(me->GetPhases(), me->GetPositionX(), me->GetPositionY(), me->GetPositionZMinusOffset());
SummonInfernal();
events.ScheduleEvent(EVENT_CAST_SUMMON_INFERNAL, urand(1000, 3000));
}