Core/Position: Refactor GetAngle -> GetAbsoluteAngle because code clarity is good.

(cherry picked from commit 4692e10ca2)
This commit is contained in:
Treeston
2018-04-01 13:52:36 +02:00
committed by Shauren
parent bf958da148
commit bc89e1cdb0
38 changed files with 71 additions and 89 deletions

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -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());
}
}

View File

@@ -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);

View File

@@ -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:

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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)

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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();

View File

@@ -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;
}
};

View File

@@ -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;