Add the Fast trig functions that work with EQ headings

This should match pretty close to the clients LUTs

Also fixed a bug with push
This commit is contained in:
Michael Cook (mackal)
2018-03-04 02:19:12 -05:00
parent 690d8f9155
commit 35c4867334
4 changed files with 57 additions and 3 deletions
+5 -3
View File
@@ -32,6 +32,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "worldserver.h"
#include "zone.h"
#include "lua_parser.h"
#include "fastmath.h"
#include <assert.h>
#include <stdio.h>
@@ -43,6 +44,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
extern QueryServ* QServ;
extern WorldServer worldserver;
extern FastMath g_Math;
#ifdef _WINDOWS
#define snprintf _snprintf
@@ -3624,9 +3626,9 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const
// update NPC stuff
if (a->force != 0.0f) {
auto new_pos = glm::vec3(
m_Position.x + (a->force * std::cos(a->hit_heading) + m_Delta.x),
m_Position.y + (a->force * std::sin(a->hit_heading) + m_Delta.y), m_Position.z);
if ((IsNPC() && position_update_melee_push_timer.Check()) && zone->zonemap &&
m_Position.x + (a->force * g_Math.FastSin(a->hit_heading) + m_Delta.x),
m_Position.y + (a->force * g_Math.FastCos(a->hit_heading) + m_Delta.y), m_Position.z);
if ((!IsNPC() || position_update_melee_push_timer.Check()) && zone->zonemap &&
zone->zonemap->CheckLoS(
glm::vec3(m_Position),
new_pos)) { // If we have LoS on the new loc it should be reachable.