Fix issue with heading being incorrectly handled

So we've been doing heading wrong all these years. You will need to run
a script to fix your quests and required SQL to fix DB.

This fixes a ton of random issues with headings and as gives us a better
resolution on headings :P
This commit is contained in:
Michael Cook (mackal)
2018-02-15 18:20:16 -05:00
parent 91d3851d76
commit a32dedeb48
17 changed files with 169 additions and 162 deletions
-21
View File
@@ -435,27 +435,6 @@ float Mob::CalculateDistance(float x, float y, float z) {
return (float)sqrtf(((m_Position.x - x)*(m_Position.x - x)) + ((m_Position.y - y)*(m_Position.y - y)) + ((m_Position.z - z)*(m_Position.z - z)));
}
float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
float angle;
if (in_x - m_Position.x > 0)
angle = -90 + atan((float)(in_y - m_Position.y) / (float)(in_x - m_Position.x)) * 180 / M_PI;
else if (in_x - m_Position.x < 0)
angle = +90 + atan((float)(in_y - m_Position.y) / (float)(in_x - m_Position.x)) * 180 / M_PI;
else // Added?
{
if (in_y - m_Position.y > 0)
angle = 0;
else
angle = 180;
}
if (angle < 0)
angle += 360;
if (angle > 360)
angle -= 360;
return (256 * (360 - angle) / 360.0f);
}
bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ, bool calcHeading) {
if (GetID() == 0)
return true;