From 05a3c4b2b851d8cd0c8a582ec3c3f44b4a3e81c7 Mon Sep 17 00:00:00 2001 From: Uleat Date: Wed, 7 Feb 2018 18:47:42 -0500 Subject: [PATCH] Implemented pass-thru for Mob::CalculateNewPosition2(...) arguments 'fixZ' and 'calcHeading' --- zone/mob.h | 6 +++--- zone/waypoints.cpp | 14 ++++++++------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/zone/mob.h b/zone/mob.h index 6266aa029..f973dd022 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -969,8 +969,8 @@ public: inline bool CheckAggro(Mob* other) {return hate_list.IsEntOnHateList(other);} float CalculateHeadingToTarget(float in_x, float in_y); - bool CalculateNewPosition(float x, float y, float z, int speed, bool checkZ = false, bool calcheading = true); - virtual bool CalculateNewPosition2(float x, float y, float z, int speed, bool checkZ = true, bool calcheading = true); + bool CalculateNewPosition(float x, float y, float z, int speed, bool checkZ = false, bool calcHeading = true); + virtual bool CalculateNewPosition2(float x, float y, float z, int speed, bool checkZ = true, bool calcHeading = true); float CalculateDistance(float x, float y, float z); float GetGroundZ(float new_x, float new_y, float z_offset=0.0); void SendTo(float new_x, float new_y, float new_z); @@ -1152,7 +1152,7 @@ protected: int _GetWalkSpeed() const; int _GetRunSpeed() const; int _GetFearSpeed() const; - virtual bool MakeNewPositionAndSendUpdate(float x, float y, float z, int speed); + virtual bool MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ = true, bool calcHeading = true); virtual bool AI_EngagedCastCheck() { return(false); } virtual bool AI_PursueCastCheck() { return(false); } diff --git a/zone/waypoints.cpp b/zone/waypoints.cpp index 9231ccae2..8f9c902bb 100644 --- a/zone/waypoints.cpp +++ b/zone/waypoints.cpp @@ -456,7 +456,7 @@ float Mob::CalculateHeadingToTarget(float in_x, float in_y) { return (256 * (360 - angle) / 360.0f); } -bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) { +bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed, bool checkZ, bool calcHeading) { if (GetID() == 0) return true; @@ -500,7 +500,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) { m_Position.y = new_y; m_Position.z = new_z; - if(fix_z_timer.Check() && + if(checkZ && fix_z_timer.Check() && (!this->IsEngaged() || flee_mode || currently_fleeing)) this->FixZ(); @@ -567,7 +567,8 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) { m_Position.x = new_x; m_Position.y = new_y; m_Position.z = new_z; - m_Position.w = CalculateHeadingToTarget(x, y); + if (calcHeading) + m_Position.w = CalculateHeadingToTarget(x, y); tar_ndx = 20 - numsteps; } else @@ -605,10 +606,11 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) { m_Position.x = new_x; m_Position.y = new_y; m_Position.z = new_z; - m_Position.w = CalculateHeadingToTarget(x, y); + if (calcHeading) + m_Position.w = CalculateHeadingToTarget(x, y); } - if (fix_z_timer.Check() && !this->IsEngaged()) + if (checkZ && fix_z_timer.Check() && !this->IsEngaged()) this->FixZ(); SetMoving(true); @@ -632,7 +634,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) { } bool Mob::CalculateNewPosition2(float x, float y, float z, int speed, bool checkZ, bool calcHeading) { - return MakeNewPositionAndSendUpdate(x, y, z, speed); + return MakeNewPositionAndSendUpdate(x, y, z, speed, checkZ, calcHeading); } bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ, bool calcHeading) {