Core/Objects:
*merged 3.3.5 renaming of GetObjectSize() to GetCombatReach() *made GetBoundaryRadius virtual and use it to determine the actual spell radius distance with it instead of using CombatReach
This commit is contained in:
1 parent
3f03415073
commit
0d46b893fc
23 files changed
+71
-75
No files matched your search
@@ -1330,14 +1330,14 @@ InstanceScript* WorldObject::GetInstanceScript() const
|
||||
float WorldObject::GetDistanceZ(const WorldObject* obj) const
|
||||
{
|
||||
float dz = std::fabs(GetPositionZ() - obj->GetPositionZ());
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
float sizefactor = GetCombatReach() + obj->GetCombatReach();
|
||||
float dist = dz - sizefactor;
|
||||
return (dist > 0 ? dist : 0);
|
||||
}
|
||||
|
||||
bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const
|
||||
{
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
float sizefactor = GetCombatReach() + obj->GetCombatReach();
|
||||
float maxdist = dist2compare + sizefactor;
|
||||
|
||||
if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID().GetCounter() == GetTransport()->GetGUID().GetCounter())
|
||||
@@ -1367,31 +1367,31 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
|
||||
|
||||
float WorldObject::GetDistance(const WorldObject* obj) const
|
||||
{
|
||||
float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize();
|
||||
float d = GetExactDist(obj) - GetCombatReach() - obj->GetCombatReach();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance(const Position &pos) const
|
||||
{
|
||||
float d = GetExactDist(&pos) - GetObjectSize();
|
||||
float d = GetExactDist(&pos) - GetCombatReach();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance(float x, float y, float z) const
|
||||
{
|
||||
float d = GetExactDist(x, y, z) - GetObjectSize();
|
||||
float d = GetExactDist(x, y, z) - GetCombatReach();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance2d(const WorldObject* obj) const
|
||||
{
|
||||
float d = GetExactDist2d(obj) - GetObjectSize() - obj->GetObjectSize();
|
||||
float d = GetExactDist2d(obj) - GetCombatReach() - obj->GetCombatReach();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
float WorldObject::GetDistance2d(float x, float y) const
|
||||
{
|
||||
float d = GetExactDist2d(x, y) - GetObjectSize();
|
||||
float d = GetExactDist2d(x, y) - GetCombatReach();
|
||||
return d > 0.0f ? d : 0.0f;
|
||||
}
|
||||
|
||||
@@ -1409,24 +1409,24 @@ bool WorldObject::IsInMap(const WorldObject* obj) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDist3d(float x, float y, float z, float dist) const
|
||||
bool WorldObject::IsWithinDist3d(float x, float y, float z, float dist, bool isInBoundaryRadius /*= false*/) const
|
||||
{
|
||||
return IsInDist(x, y, z, dist + GetObjectSize());
|
||||
return IsInDist(x, y, z, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach());
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDist3d(const Position* pos, float dist) const
|
||||
bool WorldObject::IsWithinDist3d(const Position* pos, float dist, bool isInBoundaryRadius /*= false*/) const
|
||||
{
|
||||
return IsInDist(pos, dist + GetObjectSize());
|
||||
return IsInDist(pos, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach());
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDist2d(float x, float y, float dist) const
|
||||
bool WorldObject::IsWithinDist2d(float x, float y, float dist, bool isInBoundaryRadius /*= false*/) const
|
||||
{
|
||||
return IsInDist2d(x, y, dist + GetObjectSize());
|
||||
return IsInDist2d(x, y, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach());
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDist2d(const Position* pos, float dist) const
|
||||
bool WorldObject::IsWithinDist2d(const Position* pos, float dist, bool isInBoundaryRadius /*= false*/) const
|
||||
{
|
||||
return IsInDist2d(pos, dist + GetObjectSize());
|
||||
return IsInDist2d(pos, dist + isInBoundaryRadius ? GetBoundaryRadius() : GetCombatReach());
|
||||
}
|
||||
|
||||
bool WorldObject::IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D /*= true*/) const
|
||||
@@ -1443,7 +1443,7 @@ Position WorldObject::GetHitSpherePointFor(Position const& dest) const
|
||||
{
|
||||
G3D::Vector3 vThis(GetPositionX(), GetPositionY(), GetPositionZ());
|
||||
G3D::Vector3 vObj(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ());
|
||||
G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(GetPosition()), GetObjectSize());
|
||||
G3D::Vector3 contactPoint = vThis + (vObj - vThis).directionOrZero() * std::min(dest.GetExactDist(GetPosition()), GetCombatReach());
|
||||
|
||||
return Position(contactPoint.x, contactPoint.y, contactPoint.z, GetAngle(contactPoint.x, contactPoint.y));
|
||||
}
|
||||
@@ -1520,7 +1520,7 @@ bool WorldObject::IsInRange(WorldObject const* obj, float minRange, float maxRan
|
||||
distsq += dz*dz;
|
||||
}
|
||||
|
||||
float sizefactor = GetObjectSize() + obj->GetObjectSize();
|
||||
float sizefactor = GetCombatReach() + obj->GetCombatReach();
|
||||
|
||||
// check only for real range
|
||||
if (minRange > 0.0f)
|
||||
@@ -1540,7 +1540,7 @@ bool WorldObject::IsInRange2d(float x, float y, float minRange, float maxRange)
|
||||
float dy = GetPositionY() - y;
|
||||
float distsq = dx*dx + dy*dy;
|
||||
|
||||
float sizefactor = GetObjectSize();
|
||||
float sizefactor = GetCombatReach();
|
||||
|
||||
// check only for real range
|
||||
if (minRange > 0.0f)
|
||||
@@ -1561,7 +1561,7 @@ bool WorldObject::IsInRange3d(float x, float y, float z, float minRange, float m
|
||||
float dz = GetPositionZ() - z;
|
||||
float distsq = dx*dx + dy*dy + dz*dz;
|
||||
|
||||
float sizefactor = GetObjectSize();
|
||||
float sizefactor = GetCombatReach();
|
||||
|
||||
// check only for real range
|
||||
if (minRange > 0.0f)
|
||||
@@ -1584,7 +1584,7 @@ bool WorldObject::IsInBetween(Position const& pos1, Position const& pos2, float
|
||||
return false;
|
||||
|
||||
if (!size)
|
||||
size = GetObjectSize() / 2;
|
||||
size = GetCombatReach() / 2;
|
||||
|
||||
float angle = pos1.GetAngle(pos2);
|
||||
|
||||
@@ -2192,7 +2192,7 @@ TempSummon* WorldObject::SummonCreature(uint32 id, float x, float y, float z, fl
|
||||
{
|
||||
if (!x && !y && !z)
|
||||
{
|
||||
GetClosePoint(x, y, z, GetObjectSize());
|
||||
GetClosePoint(x, y, z, GetCombatReach());
|
||||
ang = GetOrientation();
|
||||
}
|
||||
|
||||
@@ -2237,7 +2237,7 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float
|
||||
{
|
||||
if (!x && !y && !z)
|
||||
{
|
||||
GetClosePoint(x, y, z, GetObjectSize());
|
||||
GetClosePoint(x, y, z, GetCombatReach());
|
||||
ang = GetOrientation();
|
||||
}
|
||||
|
||||
@@ -2351,8 +2351,8 @@ void WorldObject::GetPlayerListInGrid(Container& playerContainer, float maxSearc
|
||||
|
||||
void WorldObject::GetNearPoint2D(float &x, float &y, float distance2d, float absAngle) const
|
||||
{
|
||||
x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle);
|
||||
y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle);
|
||||
x = GetPositionX() + (GetCombatReach() + distance2d) * std::cos(absAngle);
|
||||
y = GetPositionY() + (GetCombatReach() + distance2d) * std::sin(absAngle);
|
||||
|
||||
Trinity::NormalizeMapCoord(x);
|
||||
Trinity::NormalizeMapCoord(y);
|
||||
@@ -2424,12 +2424,7 @@ Position WorldObject::GetRandomNearPosition(float radius)
|
||||
void WorldObject::GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d /*= CONTACT_DISTANCE*/) const
|
||||
{
|
||||
// angle to face `obj` to `this` using distance includes size of `obj`
|
||||
GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
|
||||
}
|
||||
|
||||
float WorldObject::GetObjectSize() const
|
||||
{
|
||||
return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE;
|
||||
GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2d, GetAngle(obj));
|
||||
}
|
||||
|
||||
void WorldObject::MovePosition(Position &pos, float dist, float angle)
|
||||
|
||||
Reference in new issue
Block a user