diff options
author | Treeston <treeston.mmoc@gmail.com> | 2018-04-01 13:52:36 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-09-23 22:21:29 +0200 |
commit | bc89e1cdb0da10e53cc9fa4a97565c05bb4c052e (patch) | |
tree | 5725af072958ca1fa59e6154bcb1e70351f35264 /src | |
parent | bf958da14828123442781f98443326b0f916b34b (diff) |
Core/Position: Refactor GetAngle -> GetAbsoluteAngle because code clarity is good.
(cherry picked from commit 4692e10ca2ffed5ba2a0336e9c93962b0fad9eaa)
Diffstat (limited to 'src')
38 files changed, 71 insertions, 89 deletions
diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index 4ef70b18529..e41d104c380 100644 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -162,7 +162,7 @@ void CreatureAI::TriggerAlert(Unit const* who) const // Face the unit (stealthed player) and set distracted state for 5 seconds me->GetMotionMaster()->MoveDistract(5 * IN_MILLISECONDS); me->StopMoving(); - me->SetFacingTo(me->GetAngle(who)); + me->SetFacingTo(me->GetAbsoluteAngle(who)); } void CreatureAI::EnterEvadeMode(EvadeReason why) diff --git a/src/server/game/AI/PlayerAI/PlayerAI.cpp b/src/server/game/AI/PlayerAI/PlayerAI.cpp index edd59878942..fb359ea6cb2 100644 --- a/src/server/game/AI/PlayerAI/PlayerAI.cpp +++ b/src/server/game/AI/PlayerAI/PlayerAI.cpp @@ -1278,7 +1278,7 @@ void SimpleCharmedPlayerAI::UpdateAI(const uint32 diff) if (me->IsStopped() && !me->HasUnitState(UNIT_STATE_CANNOT_TURN)) { - float targetAngle = me->GetAngle(target); + float targetAngle = me->GetAbsoluteAngle(target); if (_forceFacing || fabs(me->GetOrientation() - targetAngle) > 0.4f) { me->SetFacingTo(targetAngle); diff --git a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp index 195837c8ebb..7e22c4d3a58 100644 --- a/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp +++ b/src/server/game/Entities/AreaTrigger/AreaTrigger.cpp @@ -910,7 +910,7 @@ void AreaTrigger::UpdateSplinePosition(uint32 diff) if (GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_FACE_MOVEMENT_DIR)) { G3D::Vector3 const& nextPoint = _spline->getPoint(lastPositionIndex + 1); - orientation = GetAngle(nextPoint.x, nextPoint.y); + orientation = GetAbsoluteAngle(nextPoint.x, nextPoint.y); } GetMap()->AreaTriggerRelocation(this, currentPosition.x, currentPosition.y, currentPosition.z, orientation); diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 85a925a5dc3..aec9708e403 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1102,7 +1102,7 @@ Position WorldObject::GetHitSpherePointFor(Position const& dest) const G3D::Vector3 vObj(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ()); 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)); + return Position(contactPoint.x, contactPoint.y, contactPoint.z, GetAbsoluteAngle(contactPoint.x, contactPoint.y)); } bool WorldObject::IsWithinLOS(float ox, float oy, float oz, LineOfSightChecks checks, VMAP::ModelIgnoreFlags ignoreFlags) const @@ -1259,7 +1259,7 @@ bool WorldObject::IsInBetween(Position const& pos1, Position const& pos2, float if (!size) size = GetCombatReach() / 2; - float angle = pos1.GetAngle(pos2); + float angle = pos1.GetAbsoluteAngle(pos2); // not using sqrt() for performance return (size * size) >= GetExactDist2dSq(pos1.GetPositionX() + std::cos(angle) * dist, pos1.GetPositionY() + std::sin(angle) * dist); @@ -3047,7 +3047,7 @@ Position WorldObject::GetRandomNearPosition(float radius) void WorldObject::GetContactPoint(WorldObject const* 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->GetCombatReach(), distance2d, GetAngle(obj)); + GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2d, GetAbsoluteAngle(obj)); } void WorldObject::MovePosition(Position &pos, float dist, float angle) diff --git a/src/server/game/Entities/Object/Position.cpp b/src/server/game/Entities/Object/Position.cpp index af6e3d035e1..3e469434dff 100644 --- a/src/server/game/Entities/Object/Position.cpp +++ b/src/server/game/Entities/Object/Position.cpp @@ -115,7 +115,7 @@ bool Position::IsWithinDoubleVerticalCylinder(Position const* center, float radi return IsInDist2d(center, radius) && std::abs(verticalDelta) <= height; } -bool Position::HasInArc(float arc, Position const* obj, float border, Optional<float> orientation) const +bool Position::HasInArc(float arc, Position const* obj, float border) const { // always have self in arc if (obj == this) @@ -124,11 +124,8 @@ bool Position::HasInArc(float arc, Position const* obj, float border, Optional<f // move arc to range 0.. 2*pi arc = NormalizeOrientation(arc); - float angle = GetAngle(obj); - angle -= orientation.is_initialized() ? *orientation : GetOrientation(); - // move angle to range -pi ... +pi - angle = NormalizeOrientation(angle); + float angle = GetRelativeAngle(obj); if (angle > float(M_PI)) angle -= 2.0f * float(M_PI); @@ -137,13 +134,13 @@ bool Position::HasInArc(float arc, Position const* obj, float border, Optional<f return ((angle >= lborder) && (angle <= rborder)); } -bool Position::HasInLine(Position const* pos, float objSize, float width, Optional<float> orientation) const +bool Position::HasInLine(Position const* pos, float objSize, float width) const { - if (!HasInArc(float(M_PI), pos, 2.0f, orientation)) + if (!HasInArc(float(M_PI), pos, 2.0f)) return false; width += objSize; - float angle = GetAngle(pos) - (orientation.is_initialized() ? *orientation : GetOrientation()); + float angle = GetRelativeAngle(pos); return std::fabs(std::sin(angle)) * GetExactDist2d(pos->GetPositionX(), pos->GetPositionY()) < width; } diff --git a/src/server/game/Entities/Object/Position.h b/src/server/game/Entities/Object/Position.h index 6940da13885..271f19e563f 100644 --- a/src/server/game/Entities/Object/Position.h +++ b/src/server/game/Entities/Object/Position.h @@ -19,7 +19,6 @@ #define Trinity_game_Position_h__ #include "Define.h" -#include "Optional.h" #include <string> #include <cmath> @@ -124,19 +123,20 @@ public: void GetPositionOffsetTo(Position const & endPos, Position & retOffset) const; Position GetPositionWithOffset(Position const& offset) const; - float GetAngle(float x, float y) const + float GetAbsoluteAngle(float x, float y) const { float dx = m_positionX - x; float dy = m_positionY - y; return NormalizeOrientation(std::atan2(dy, dx)); } - float GetAngle(Position const& pos) const { return GetAngle(pos.m_positionX, pos.m_positionY); } - float GetAngle(Position const* pos) const { return GetAngle(*pos); } + float GetAbsoluteAngle(Position const& pos) const { return GetAbsoluteAngle(pos.m_positionX, pos.m_positionY); } + float GetAbsoluteAngle(Position const* pos) const { return GetAbsoluteAngle(*pos); } + float ToAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); } - float GetAbsoluteAngle(float relAngle) const { return NormalizeOrientation(relAngle + m_orientation); } - float GetRelativeAngle(float absAngle) const { return NormalizeOrientation(absAngle - m_orientation); } - float GetRelativeAngle(float x, float y) const { return GetRelativeAngle(GetAngle(x, y)); } - float GetRelativeAngle(Position const* pos) const { return GetRelativeAngle(GetAngle(pos)); } + float ToRelativeAngle(float absAngle) const { return NormalizeOrientation(absAngle - m_orientation); } + float GetRelativeAngle(float x, float y) const { return ToRelativeAngle(GetAbsoluteAngle(x, y)); } + float GetRelativeAngle(Position const& pos) const { return ToRelativeAngle(GetAbsoluteAngle(pos)); } + float GetRelativeAngle(Position const* pos) const { return ToRelativeAngle(GetAbsoluteAngle(pos)); } void GetSinCos(float x, float y, float &vsin, float &vcos) const; @@ -152,8 +152,8 @@ public: // dist2d < radius && abs(dz) < height bool IsWithinDoubleVerticalCylinder(Position const* center, float radius, float height) const; - bool HasInArc(float arcangle, Position const* pos, float border = 2.0f, Optional<float> orientation = {}) const; - bool HasInLine(Position const* pos, float objSize, float width, Optional<float> orientation = {}) const; + bool HasInArc(float arcangle, Position const* pos, float border = 2.0f) const; + bool HasInLine(Position const* pos, float objSize, float width) const; std::string ToString() const; // constrain arbitrary radian orientation to interval [0,2*PI) diff --git a/src/server/game/Entities/Player/CinematicMgr.cpp b/src/server/game/Entities/Player/CinematicMgr.cpp index a67b6876afb..1081f248781 100644 --- a/src/server/game/Entities/Player/CinematicMgr.cpp +++ b/src/server/game/Entities/Player/CinematicMgr.cpp @@ -121,7 +121,7 @@ void CinematicMgr::UpdateCinematicLocation(uint32 /*diff*/) lastPosition.Relocate(cam.locations); lastTimestamp = cam.timeStamp; } - float angle = lastPosition.GetAngle(&nextPosition); + float angle = lastPosition.GetAbsoluteAngle(&nextPosition); angle -= lastPosition.GetOrientation(); if (angle < 0) angle += 2 * float(M_PI); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 10edd2ef852..90e06ba69af 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -590,19 +590,6 @@ bool Unit::IsWithinBoundaryRadius(const Unit* obj) const return IsInDist(obj, objBoundaryRadius); } -void Unit::GetRandomContactPoint(Unit const* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const -{ - float combat_reach = GetCombatReach(); - if (combat_reach < 0.1f) // sometimes bugged for players - combat_reach = DEFAULT_PLAYER_COMBAT_REACH; - - uint32 attacker_number = uint32(getAttackers().size()); - if (attacker_number > 0) - --attacker_number; - GetNearPoint(obj, x, y, z, obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin) * (float)rand_norm(), - GetAngle(obj) + (attacker_number ? (static_cast<float>(M_PI/2) - static_cast<float>(M_PI) * (float)rand_norm()) * float(attacker_number) / combat_reach * 0.3f : 0)); -} - void Unit::SetVisibleAura(AuraApplication* aurApp) { m_visibleAuras.insert(aurApp); @@ -11727,7 +11714,7 @@ void Unit::JumpTo(WorldObject* obj, float speedZ, bool withOrientation) float x, y, z; obj->GetContactPoint(this, x, y, z); float speedXY = GetExactDist2d(x, y) * 10.0f / speedZ; - GetMotionMaster()->MoveJump(x, y, z, GetAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation); + GetMotionMaster()->MoveJump(x, y, z, GetAbsoluteAngle(obj), speedXY, speedZ, EVENT_JUMP, withOrientation); } void Unit::HandleSpellClick(Unit* clicker, int8 seatId /*= -1*/) @@ -12302,7 +12289,7 @@ bool CharmInfo::IsReturning() void Unit::SetInFront(WorldObject const* target) { if (!HasUnitState(UNIT_STATE_CANNOT_TURN)) - SetOrientation(GetAngle(target)); + SetOrientation(GetAbsoluteAngle(target)); } void Unit::SetFacingTo(float ori, bool force) @@ -12328,7 +12315,7 @@ void Unit::SetFacingToObject(WorldObject const* object, bool force) /// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is. Movement::MoveSplineInit init(this); init.MoveTo(GetPositionX(), GetPositionY(), GetPositionZ(), false); - init.SetFacing(GetAngle(object)); // when on transport, GetAngle will still return global coordinates (and angle) that needs transforming + init.SetFacing(GetAbsoluteAngle(object)); // when on transport, GetAbsoluteAngle will still return global coordinates (and angle) that needs transforming init.Launch(); } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 696c63bcacf..335ccbc0cb6 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -797,7 +797,6 @@ class TC_GAME_API Unit : public WorldObject float GetMeleeRange(Unit const* target) const; virtual SpellSchoolMask GetMeleeDamageSchoolMask(WeaponAttackType attackType = BASE_ATTACK) const = 0; bool IsWithinBoundaryRadius(const Unit* obj) const; - void GetRandomContactPoint(Unit const* target, float& x, float& y, float& z, float distance2dMin, float distance2dMax) const; uint32 m_extraAttacks; bool m_canDualWield; diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index d7be55b03e7..a4f9e955644 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -337,7 +337,7 @@ void MotionMaster::MoveCloserAndStop(uint32 id, Unit* target, float distance) float distanceToTravel = _owner->GetExactDist2d(target) - distance; if (distanceToTravel > 0.0f) { - float angle = _owner->GetAngle(target); + float angle = _owner->GetAbsoluteAngle(target); float destx = _owner->GetPositionX() + distanceToTravel * std::cos(angle); float desty = _owner->GetPositionY() + distanceToTravel * std::sin(angle); MovePoint(id, destx, desty, target->GetPositionZ()); @@ -432,7 +432,7 @@ void MotionMaster::MoveKnockbackFrom(float srcX, float srcY, float speedXY, floa float dist = 2 * moveTimeHalf * speedXY; float max_height = -Movement::computeFallElevation(moveTimeHalf, false, -speedZ); - _owner->GetNearPoint(_owner, x, y, z, _owner->GetCombatReach(), dist, _owner->GetAngle(srcX, srcY) + float(M_PI)); + _owner->GetNearPoint(_owner, x, y, z, _owner->GetCombatReach(), dist, _owner->GetAbsoluteAngle(srcX, srcY) + float(M_PI)); Movement::MoveSplineInit init(_owner); init.MoveTo(x, y, z); @@ -497,7 +497,7 @@ void MotionMaster::MoveCirclePath(float x, float y, float z, float radius, bool { float step = 2 * float(M_PI) / stepCount * (clockwise ? -1.0f : 1.0f); Position const& pos = { x, y, z, 0.0f }; - float angle = pos.GetAngle(_owner->GetPositionX(), _owner->GetPositionY()); + float angle = pos.GetAbsoluteAngle(_owner->GetPositionX(), _owner->GetPositionY()); Movement::MoveSplineInit init(_owner); diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index d4bc99da9ec..d142913268f 100644 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -147,7 +147,7 @@ void FleeingMovementGenerator<T>::GetPoint(T* owner, Position &position) { casterDistance = fleeTarget->GetDistance(owner); if (casterDistance > 0.2f) - casterAngle = fleeTarget->GetAngle(owner); + casterAngle = fleeTarget->GetAbsoluteAngle(owner); else casterAngle = frand(0.0f, 2.0f * float(M_PI)); } diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 7452b9a93a4..67cc7e69465 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -134,7 +134,7 @@ void TargetedMovementGenerator<T, D>::SetTargetLocation(T* owner, bool updateDes if (hoverDiff) size = size > hoverDiff ? std::sqrt(size * size - hoverDiff * hoverDiff) : 0.0f; - GetTarget()->GetNearPoint(owner, x, y, z, size, CONTACT_DISTANCE, GetTarget()->GetAngle(owner)); + GetTarget()->GetNearPoint(owner, x, y, z, size, CONTACT_DISTANCE, GetTarget()->GetAbsoluteAngle(owner)); } else { diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index a5d6a7c86f3..efe2b820de7 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -203,7 +203,7 @@ namespace Movement void MoveSplineInit::SetFacing(Unit const* target) { - args.facing.angle = unit->GetAngle(target); + args.facing.angle = unit->GetAbsoluteAngle(target); args.facing.target = target->GetGUID(); args.facing.type = MONSTER_MOVE_FACING_TARGET; } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 728986b05ed..edcfcdd7a74 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -8342,15 +8342,15 @@ bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target) const WorldObjectSpellLineTargetCheck::WorldObjectSpellLineTargetCheck(Position const* srcPosition, Position const* dstPosition, float lineWidth, float range, WorldObject* caster, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType) - : WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _srcPosition(srcPosition), _dstPosition(dstPosition), _lineWidth(lineWidth) { } + : WorldObjectSpellAreaTargetCheck(range, caster, caster, caster, spellInfo, selectionType, condList, objectType), _position(*srcPosition), _lineWidth(lineWidth) +{ + if (dstPosition && *srcPosition != *dstPosition) + _position.SetOrientation(srcPosition->GetAbsoluteAngle(dstPosition)); +} bool WorldObjectSpellLineTargetCheck::operator()(WorldObject* target) const { - float angle = _caster->GetOrientation(); - if (*_srcPosition != *_dstPosition) - angle = _srcPosition->GetAngle(_dstPosition); - - if (!_caster->HasInLine(target, target->GetCombatReach(), _lineWidth, angle)) + if (!_position.HasInLine(target, target->GetCombatReach(), _lineWidth)) return false; return WorldObjectSpellTargetCheck::operator ()(target); diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 50b20f2f0b8..7bf1c5ace9e 100644 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -1023,8 +1023,7 @@ namespace Trinity struct TC_GAME_API WorldObjectSpellLineTargetCheck : public WorldObjectSpellAreaTargetCheck { - Position const* _srcPosition; - Position const* _dstPosition; + Position _position; float _lineWidth; WorldObjectSpellLineTargetCheck(Position const* srcPosition, Position const* dstPosition, float lineWidth, float range, WorldObject* caster, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionContainer const* condList, SpellTargetObjectTypes objectType); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a3507d6aeaa..d646405b360 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2221,7 +2221,7 @@ void Spell::EffectDistract() unitTarget->GetMotionMaster()->MoveDistract(damage * IN_MILLISECONDS); unitTarget->StopMoving(); - unitTarget->SetFacingTo(unitTarget->GetAngle(destTarget)); + unitTarget->SetFacingTo(unitTarget->GetAbsoluteAngle(destTarget)); } void Spell::EffectPickPocket() @@ -5072,7 +5072,7 @@ void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPr summon->SetFaction(unitCaster->GetFaction()); if (summon->HasUnitTypeMask(UNIT_MASK_MINION) && m_targets.HasDst()) - ((Minion*)summon)->SetFollowAngle(unitCaster->GetAngle(summon)); + ((Minion*)summon)->SetFollowAngle(unitCaster->GetAbsoluteAngle(summon)); if (summon->GetEntry() == 27893) { diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index b96b66c0229..54426cf8471 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -468,7 +468,7 @@ public: float x, y, z; target->GetContactPoint(_player, x, y, z); - _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAngle(target), TELE_TO_GM_MODE); + _player->TeleportTo(target->GetMapId(), x, y, z, _player->GetAbsoluteAngle(target), TELE_TO_GM_MODE); PhasingHandler::InheritPhaseShift(_player, target); _player->UpdateObjectVisibility(); } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index a177a4e904a..071c02394af 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1733,7 +1733,7 @@ public: Player* chr = handler->GetSession()->GetPlayer(); - float followAngle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180.0f / float(M_PI); + float followAngle = (creature->GetAbsoluteAngle(chr) - chr->GetOrientation()) * 180.0f / float(M_PI); float followDist = std::sqrt(std::pow(chr->GetPositionX() - creature->GetPositionX(), 2.f) + std::pow(chr->GetPositionY() - creature->GetPositionY(), 2.f)); uint32 groupAI = 0; sFormationMgr->AddFormationMember(lowguid, followAngle, followDist, leaderGUID, groupAI); diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index b797436b3bd..73b2583c5da 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -536,7 +536,7 @@ public: SeenAtiesh = true; Talk(SAY_ATIESH); - me->SetFacingTo(me->GetAngle(player)); + me->SetFacingTo(me->GetAbsoluteAngle(player)); me->ClearUnitState(UNIT_STATE_MOVING); me->GetMotionMaster()->MoveDistract(7 * IN_MILLISECONDS); break; diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index cb38c495583..37040fde6d7 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -361,7 +361,7 @@ public: break; } case 6: - me->SetFacingTo(me->GetAngle(breathX, breathY)); + me->SetFacingTo(me->GetAbsoluteAngle(breathX, breathY)); //DoTextEmote("takes a deep breath.", nullptr); events.ScheduleEvent(EVENT_FLIGHT_SEQUENCE, 10000); break; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index da7fff52dac..f36e4e6b468 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -392,7 +392,7 @@ class npc_chained_spirit : public CreatureScript Position pos; if (Player* target = ObjectAccessor::GetPlayer(*me, _revivePlayerGUID)) { - target->GetNearPoint(me, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 5.0f, target->GetAngle(me)); + target->GetNearPoint(me, pos.m_positionX, pos.m_positionY, pos.m_positionZ, 0.0f, 5.0f, target->GetAbsoluteAngle(me)); me->GetMotionMaster()->MovePoint(POINT_START_REVIVE, pos); } } @@ -597,8 +597,8 @@ class spell_mandokir_devastating_slam : public SpellScriptLoader if (Player* target = GetHitPlayer()) { caster->AttackStop(); - caster->SetOrientation(caster->GetAngle(target)); - caster->SetFacingTo(caster->GetAngle(target)); + caster->SetOrientation(caster->GetAbsoluteAngle(target)); + caster->SetFacingTo(caster->GetAbsoluteAngle(target)); caster->CastSpell(caster, SPELL_DEVASTATING_SLAM, false); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index c25680ccb58..195ef3aacef 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -971,7 +971,7 @@ void hyjalAI::WaypointReached(uint32 waypointId, uint32 /*pathId*/) (*itr)->GetMotionMaster()->Initialize(); float range = 10; if (me->GetEntry() == THRALL)range = 20; - me->GetNearPoint(me, x, y, z, range, 0, me->GetAngle((*itr))); + me->GetNearPoint(me, x, y, z, range, 0, me->GetAbsoluteAngle((*itr))); (*itr)->GetMotionMaster()->MovePoint(0, x+irand(-5, 5), y+irand(-5, 5), me->GetPositionZ()); } } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index afbb89c17a9..4c796ca7fa4 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -316,7 +316,7 @@ public: if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) { //Face our target - DarkGlareAngle = me->GetAngle(target); + DarkGlareAngle = me->GetAbsoluteAngle(target); DarkGlareTickTimer = 1000; DarkGlareTick = 0; ClockWise = RAND(true, false); diff --git a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp index 019a183f31c..b438eb8f687 100644 --- a/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/zone_azuremyst_isle.cpp @@ -153,7 +153,7 @@ public: break; case EVENT_RUN_AWAY: me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (std::cos(me->GetAngle(CrashSite)) * 28.0f), me->GetPositionY() + (std::sin(me->GetAngle(CrashSite)) * 28.0f), me->GetPositionZ() + 1.0f); + me->GetMotionMaster()->MovePoint(0, me->GetPositionX() + (std::cos(me->GetAbsoluteAngle(CrashSite)) * 28.0f), me->GetPositionY() + (std::sin(me->GetAbsoluteAngle(CrashSite)) * 28.0f), me->GetPositionZ() + 1.0f); me->DespawnOrUnsummon(Seconds(4)); break; default: diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 31d5a9a3e26..dc2fb50a8bb 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -368,7 +368,7 @@ class npc_prince_taldaram_flame_sphere : public CreatureScript if (!sphereTarget) return; - float angle = me->GetAngle(sphereTarget) + angleOffset; + float angle = me->GetAbsoluteAngle(sphereTarget) + angleOffset; float x = me->GetPositionX() + distOffset * std::cos(angle); float y = me->GetPositionY() + distOffset * std::sin(angle); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp index c12fbab7b88..5cf9252ce89 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_halion.cpp @@ -1030,7 +1030,7 @@ class npc_meteor_strike_initial : public CreatureScript Position const* ownerPos = halionAI->GetMeteorStrikePosition(); float randomAdjustment = frand(static_cast<float>(M_PI / 5.0f), static_cast<float>(M_PI / 2.0f)); float angle[4]; - angle[0] = me->GetAngle(ownerPos); + angle[0] = me->GetAbsoluteAngle(ownerPos); angle[1] = angle[0] + randomAdjustment; angle[2] = angle[0] + static_cast<float>(M_PI); angle[3] = angle[2] + randomAdjustment; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp index 7cc0f87bd51..6fa26569833 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.cpp @@ -2790,7 +2790,7 @@ class spell_hor_evasion : public SpellScriptLoader if (pos.IsInDist2d(&home, 15.0f)) return; - float angle = pos.GetAngle(&home); + float angle = pos.GetAbsoluteAngle(&home); float dist = GetEffectInfo().CalcRadius(GetCaster()); target->MovePosition(pos, dist, angle); 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 2c3d8b68098..c831d5bb67a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -645,7 +645,7 @@ class boss_prince_keleseth_icc : public CreatureScript summons.Summon(summon); Position pos = me->GetPosition(); float maxRange = me->GetDistance2d(summon); - float angle = me->GetAngle(summon); + float angle = me->GetAbsoluteAngle(summon); me->MovePositionToFirstCollision(pos, maxRange, angle); summon->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation()); summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index ddec000524b..1698adca7f4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -378,7 +378,7 @@ class npc_coldflame : public CreatureScript if (owner->HasAura(SPELL_BONE_STORM)) { - float ang = Position::NormalizeOrientation(pos.GetAngle(me)); + float ang = pos.GetAbsoluteAngle(me); me->SetOrientation(ang); owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 5.0f - owner->GetCombatReach(), ang); } @@ -391,7 +391,7 @@ class npc_coldflame : public CreatureScript return; } - float ang = Position::NormalizeOrientation(pos.GetAngle(target)); + float ang = pos.GetAbsoluteAngle(target); me->SetOrientation(ang); owner->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 15.0f - owner->GetCombatReach(), ang); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp index 9b33c7b53ae..607c0952c34 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -1692,7 +1692,7 @@ class npc_strangulate_vehicle : public CreatureScript { if (me->GetExactDist(lichKing) > 10.0f) { - Position pos = lichKing->GetNearPosition(float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAngle(me)); + Position pos = lichKing->GetNearPosition(float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAbsoluteAngle(me)); me->GetMotionMaster()->MovePoint(0, pos); } } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1500349fd50..c521d04512d 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -1290,7 +1290,7 @@ struct npc_argent_captainAI : public ScriptedAI if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetGuidData(DATA_CROK_SCOURGEBANE))) { me->SetReactState(REACT_DEFENSIVE); - FollowAngle = me->GetAngle(crok) + me->GetOrientation(); + FollowAngle = me->GetAbsoluteAngle(crok) + me->GetOrientation(); FollowDist = me->GetDistance2d(crok); me->GetMotionMaster()->MoveFollow(crok, FollowDist, FollowAngle, MOTION_SLOT_IDLE); } diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index aa31ee41ea6..384b9350e42 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -462,7 +462,7 @@ public: { Position pos; pos.m_positionZ = alexstraszaBunny->GetPositionZ(); - alexstraszaBunny->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAngle(me)); + alexstraszaBunny->GetNearPoint2D(pos.m_positionX, pos.m_positionY, 30.0f, alexstraszaBunny->GetAbsoluteAngle(me)); me->GetMotionMaster()->MoveLand(POINT_LAND_P_ONE, pos); me->SetImmuneToAll(false); me->SetReactState(REACT_AGGRESSIVE); @@ -845,7 +845,7 @@ public: Position randomPosOnRadius; // Hardcodded retail value, reason is Z getters can fail... (TO DO: Change to getter when height calculation works on 100%!) randomPosOnRadius.m_positionZ = 283.0521f; - alexstraszaBunny->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 120.0f, alexstraszaBunny->GetAngle(me)); + alexstraszaBunny->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 120.0f, alexstraszaBunny->GetAbsoluteAngle(me)); me->GetMotionMaster()->MovePoint(POINT_FLY_OUT_OF_PLATFORM_P_TWO, randomPosOnRadius); _flyingOutOfPlatform = true; } @@ -1678,7 +1678,7 @@ class spell_malygos_random_portal : public SpellScriptLoader { Position pos; pos.m_positionZ = target->GetPositionZ(); - target->GetNearPoint2D(pos.m_positionX, pos.m_positionY, frand(29.1f, 30.0f), target->GetAngle(malygos)); + target->GetNearPoint2D(pos.m_positionX, pos.m_positionY, frand(29.1f, 30.0f), target->GetAbsoluteAngle(malygos)); malygos->GetMotionMaster()->MovePoint(POINT_NEAR_RANDOM_PORTAL_P_NONE, pos); } } diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 4633708fd64..0d9d9db02d4 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -336,7 +336,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); + float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); float diff = std::fabs(orientation - angle); if (diff > 1.0f) @@ -380,7 +380,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader for (std::list<WorldObject*>::iterator itr = targets.begin(); itr != targets.end();) { - float angle = varos->GetAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); + float angle = varos->GetAbsoluteAngle((*itr)->GetPositionX(), (*itr)->GetPositionY()); float diff = std::fabs(orientation - angle); if (diff > 1.0f) diff --git a/src/server/scripts/Northrend/zone_icecrown.cpp b/src/server/scripts/Northrend/zone_icecrown.cpp index 5493011cf03..11c98dbdad3 100644 --- a/src/server/scripts/Northrend/zone_icecrown.cpp +++ b/src/server/scripts/Northrend/zone_icecrown.cpp @@ -750,7 +750,7 @@ class npc_frostbrood_skytalon : public CreatureScript { Position randomPosOnRadius; randomPosOnRadius.m_positionZ = (me->GetPositionZ() + 40.0f); - me->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 40.0f, me->GetAngle(me)); + me->GetNearPoint2D(randomPosOnRadius.m_positionX, randomPosOnRadius.m_positionY, 40.0f, me->GetAbsoluteAngle(me)); me->GetMotionMaster()->MovePoint(POINT_FLY_AWAY, randomPosOnRadius); } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index b8891f61a93..2584e48df69 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -885,7 +885,7 @@ struct boss_illidan_stormrage : public BossAI } case EVENT_FACE_MIDDLE: { - float angle = me->GetAngle(IllidanMiddlePoint); + float angle = me->GetAbsoluteAngle(IllidanMiddlePoint); me->SetFacingTo(angle); break; } diff --git a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp index c630d2f37e8..045b05009d5 100644 --- a/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp +++ b/src/server/scripts/Outland/TempestKeep/botanica/boss_warp_splinter.cpp @@ -194,7 +194,7 @@ class boss_warp_splinter : public CreatureScript float X = Treant_Spawn_Pos_X + TREANT_SPAWN_DIST * std::cos(angle); float Y = Treant_Spawn_Pos_Y + TREANT_SPAWN_DIST * std::sin(angle); - float O = - me->GetAngle(X, Y); + float O = - me->GetAbsoluteAngle(X, Y); if (Creature* pTreant = me->SummonCreature(CREATURE_TREANT, treant_pos[i][0], treant_pos[i][1], treant_pos[i][2], O, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 25000)) ENSURE_AI(npc_warp_splinter_treant::npc_warp_splinter_treantAI, pTreant->AI())->WarpGuid = me->GetGUID(); diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index ca4062cfeeb..b03bafb2f69 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -306,7 +306,7 @@ public: me->UseDoorOrButton(); int Random = rand32() % (sizeof(NpcPrisonEntry) / sizeof(uint32)); - if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAngle(player), + if (Creature* creature = player->SummonCreature(NpcPrisonEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAbsoluteAngle(player), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000)) { if (!creature->IsHostileTo(player)) @@ -366,7 +366,7 @@ public: me->UseDoorOrButton(); int Random = rand32() % (sizeof(NpcStasisEntry) / sizeof(uint32)); - player->SummonCreature(NpcStasisEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAngle(player), + player->SummonCreature(NpcStasisEntry[Random], me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetAbsoluteAngle(player), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); return false; @@ -1250,8 +1250,8 @@ public: bool GossipHello(Player* player) override { player->SendLoot(me->GetGUID(), LOOT_CORPSE); - me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX() + 1, me->GetPositionY(), me->GetPositionZ(), me->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); - me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX(), me->GetPositionY() + 1, me->GetPositionZ(), me->GetAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX() + 1, me->GetPositionY(), me->GetPositionZ(), me->GetAbsoluteAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + me->SummonCreature(NPC_HIVE_AMBUSHER, me->GetPositionX(), me->GetPositionY() + 1, me->GetPositionZ(), me->GetAbsoluteAngle(player), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); return true; } }; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index f51f9b70cd5..738c2710a8f 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2481,7 +2481,7 @@ class npc_train_wrecker : public CreatureScript _isSearching = false; _target = target->GetGUID(); me->SetWalk(true); - me->GetMotionMaster()->MovePoint(MOVEID_CHASE, target->GetNearPosition(3.0f, target->GetAngle(me))); + me->GetMotionMaster()->MovePoint(MOVEID_CHASE, target->GetNearPosition(3.0f, target->GetAbsoluteAngle(me))); } else _timer = 3 * IN_MILLISECONDS; |