refactor(Core/Misc): sin() to std::sin() (#9795)

This commit is contained in:
Kitzunu
2022-01-06 19:29:40 +01:00
committed by GitHub
parent 66e6d33116
commit cb7e355291
66 changed files with 212 additions and 211 deletions

View File

@@ -747,7 +747,7 @@ public:
_channelTimer = 0;
float o = urand(0, 5) * M_PI / 3.0f;
me->InterruptNonMeleeSpells(false);
me->GetMotionMaster()->MovePoint(POINT_CHANNEL_STEELBREAKER, 1587.18f + 10.0f * cos(o), 121.02f + 10.0f * sin(o), 427.3f);
me->GetMotionMaster()->MovePoint(POINT_CHANNEL_STEELBREAKER, 1587.18f + 10.0f * cos(o), 121.02f + 10.0f * std::sin(o), 427.3f);
}
}

View File

@@ -465,7 +465,7 @@ public:
{
if (aurEff->GetTotalTicks() >= 0 && aurEff->GetTickNumber() == uint32(aurEff->GetTotalTicks()))
if (Unit* c = GetCaster())
if (Creature* s = c->SummonCreature(NPC_SCORCHED_GROUND, c->GetPositionX() + 20.0f * cos(c->GetOrientation()), c->GetPositionY() + 20.0f * sin(c->GetOrientation()), 361.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000))
if (Creature* s = c->SummonCreature(NPC_SCORCHED_GROUND, c->GetPositionX() + 20.0f * cos(c->GetOrientation()), c->GetPositionY() + 20.0f * std::sin(c->GetOrientation()), 361.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 30000))
{
if (!s->FindNearestCreature(NPC_WATER_TRIGGER, 25.0f, true)) // must be away from the water
s->CastSpell(s, (aurEff->GetId() == 62546 ? SPELL_SCORCHED_GROUND_10 : SPELL_SCORCHED_GROUND_25), true);

View File

@@ -471,11 +471,11 @@ public:
Player* player = pg[index];
float angle = rand_norm() * 2 * M_PI;
float z = 364.35f;
if (!player->IsWithinLOS(player->GetPositionX() + cos(angle) * 5.0f, player->GetPositionY() + sin(angle) * 5.0f, z))
if (!player->IsWithinLOS(player->GetPositionX() + cos(angle) * 5.0f, player->GetPositionY() + std::sin(angle) * 5.0f, z))
{
angle = player->GetAngle(2744.65f, 2569.46f);
}
me->CastSpell(player->GetPositionX() + cos(angle) * 5.0f, player->GetPositionY() + sin(angle) * 5.0f, z, SPELL_SUMMON_FLAMES_INITIAL, true);
me->CastSpell(player->GetPositionX() + cos(angle) * 5.0f, player->GetPositionY() + std::sin(angle) * 5.0f, z, SPELL_SUMMON_FLAMES_INITIAL, true);
pg.erase(pg.begin() + index);
}
@@ -789,7 +789,7 @@ public:
float angle = VX001->GetOrientation();
float v_x = me->GetPositionX() + cos(angle) * 10.0f;
float v_y = me->GetPositionY() + sin(angle) * 10.0f;
float v_y = me->GetPositionY() + std::sin(angle) * 10.0f;
me->GetMotionMaster()->MoveJump(v_x, v_y, 364.32f, 7.0f, 7.0f);
if( pInstance )
@@ -1454,7 +1454,7 @@ public:
trigger->CastSpell(trigger, SPELL_ROCKET_STRIKE_AURA, true);
Position exitPos = r->GetPosition();
exitPos.m_positionX += cos(me->GetOrientation()) * 2.35f;
exitPos.m_positionY += sin(me->GetOrientation()) * 2.35f;
exitPos.m_positionY += std::sin(me->GetOrientation()) * 2.35f;
exitPos.m_positionZ += 2.0f * Phase;
r->_ExitVehicle(&exitPos);
me->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, r->GetGUID());
@@ -1760,7 +1760,7 @@ public:
float angle = victim->GetAngle(me->GetPositionX(), me->GetPositionY());
me->SetOrientation( me->GetAngle(victim->GetPositionX(), victim->GetPositionY()) );
float x = victim->GetPositionX() + 15.0f * cos(angle);
float y = victim->GetPositionY() + 15.0f * sin(angle);
float y = victim->GetPositionY() + 15.0f * std::sin(angle);
// check if there's magnetic core in line of movement
Creature* mc = nullptr;
@@ -2377,7 +2377,7 @@ public:
if (target && prevdist >= 4.0f) // no need to spread when player is standing in fire, check distance
{
float angle = last->GetAngle(target->GetPositionX(), target->GetPositionY()) - M_PI / 8 + rand_norm() * 2 * M_PI / 8;
SpreadFlame(last->GetPositionX() + 7.0f * cos(angle), last->GetPositionY() + 7.0f * sin(angle));
SpreadFlame(last->GetPositionX() + 7.0f * cos(angle), last->GetPositionY() + 7.0f * std::sin(angle));
}
}

View File

@@ -412,7 +412,7 @@ public:
for( int j = 0; j < 4; ++j )
{
float x = cords[i][0] + 4.0f * cos(j * M_PI / 2);
float y = cords[i][1] + 4.0f * sin(j * M_PI / 2);
float y = cords[i][1] + 4.0f * std::sin(j * M_PI / 2);
uint32 npc_entry = 0;
switch( opt )
@@ -878,7 +878,7 @@ public:
if (!fs->AI()->GetData(2))
{
float a = rand_norm() * M_PI;
me->GetMotionMaster()->MovePoint(0, fs->GetPositionX() + 3.0f * cos(a), fs->GetPositionY() + 3.0f * sin(a), fs->GetPositionZ());
me->GetMotionMaster()->MovePoint(0, fs->GetPositionX() + 3.0f * cos(a), fs->GetPositionY() + 3.0f * std::sin(a), fs->GetPositionZ());
fixingGUID = fs->GetGUID();
return;
}

View File

@@ -617,7 +617,7 @@ public:
if ((cr = me->SummonCreature((_spawnCommoners ? NPC_DARK_RUNE_COMMONER : RollTable[urand(0, 2)]), ArenaNPCs[rnd], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000)))
cr->GetMotionMaster()->MoveJump(
Middle.GetPositionX() + urand(19, 24) * cos(Middle.GetAngle(cr)),
Middle.GetPositionY() + urand(19, 24) * sin(Middle.GetAngle(cr)),
Middle.GetPositionY() + urand(19, 24) * std::sin(Middle.GetAngle(cr)),
Middle.GetPositionZ(), 20, 20);
}
}

View File

@@ -534,7 +534,7 @@ public:
uint32 dist = urand(38, 48);
float o = rand_norm() * M_PI * 2;
float Zplus = (dist - 38) / 6.5f;
if (Creature* cr = me->SummonCreature(entry, me->GetPositionX() + dist * cos(o), me->GetPositionY() + dist * sin(o), 327.2 + Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
if (Creature* cr = me->SummonCreature(entry, me->GetPositionX() + dist * cos(o), me->GetPositionY() + dist * std::sin(o), 327.2 + Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000))
{
cr->CastSpell(cr, SPELL_TENTACLE_ERUPT, true);
cr->CastSpell(cr, SPELL_VOID_ZONE_SMALL, true);
@@ -549,7 +549,7 @@ public:
uint32 dist = urand(38, 48);
float o = rand_norm() * M_PI * 2;
float Zplus = (dist - 38) / 6.5f;
me->SummonCreature(NPC_DEATH_ORB, me->GetPositionX() + dist * cos(o), me->GetPositionY() + dist * sin(o), 327.2 + Zplus, 0, TEMPSUMMON_TIMED_DESPAWN, 20000);
me->SummonCreature(NPC_DEATH_ORB, me->GetPositionX() + dist * cos(o), me->GetPositionY() + dist * std::sin(o), 327.2 + Zplus, 0, TEMPSUMMON_TIMED_DESPAWN, 20000);
}
}
@@ -947,7 +947,7 @@ public:
for (uint8 i = 0; i <= dist; ++i)
{
float angle = M_PI * 2 / dist * i;
AddWaypoint(i, Middle.GetPositionX() + dist * cos(angle), Middle.GetPositionY() + dist * sin(angle), me->GetPositionZ(), 0);
AddWaypoint(i, Middle.GetPositionX() + dist * cos(angle), Middle.GetPositionY() + dist * std::sin(angle), me->GetPositionZ(), 0);
}
}
else
@@ -955,7 +955,7 @@ public:
for (uint8 i = 0; i <= dist; ++i)
{
float angle = M_PI * 2 - (M_PI * 2 / dist * i);
AddWaypoint(i, Middle.GetPositionX() + dist * cos(angle), Middle.GetPositionY() + dist * sin(angle), me->GetPositionZ(), 0);
AddWaypoint(i, Middle.GetPositionX() + dist * cos(angle), Middle.GetPositionY() + dist * std::sin(angle), me->GetPositionZ(), 0);
}
}
}
@@ -1071,7 +1071,7 @@ public:
uint32 dist = urand(38, 48);
float o = rand_norm() * M_PI * 2;
float Zplus = (dist - 38) / 6.5f;
me->SummonCreature(NPC_IMMORTAL_GUARDIAN, me->GetPositionX() + dist * cos(o), me->GetPositionY() + dist * sin(o), 327.2 + Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
me->SummonCreature(NPC_IMMORTAL_GUARDIAN, me->GetPositionX() + dist * cos(o), me->GetPositionY() + dist * std::sin(o), 327.2 + Zplus, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000);
}
void JustDied(Unit* /*who*/) override

View File

@@ -137,7 +137,7 @@ public:
{
float a = rand_norm() * 2 * M_PI;
float d = rand_norm() * 4.0f;
if (Creature* c = me->SummonCreature(34137, me->GetPositionX() + cos(a) * d, me->GetPositionY() + sin(a) * d, me->GetPositionZ() + 1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000))
if (Creature* c = me->SummonCreature(34137, me->GetPositionX() + cos(a) * d, me->GetPositionY() + std::sin(a) * d, me->GetPositionZ() + 1.0f, 0.0f, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000))
c->AI()->AttackStart(who);
}
}