Implemented pass-thru for Mob::CalculateNewPosition2(...) arguments 'fixZ' and 'calcHeading'

This commit is contained in:
Uleat 2018-02-07 18:47:42 -05:00
parent 24b396e516
commit 05a3c4b2b8
2 changed files with 11 additions and 9 deletions

View File

@ -969,8 +969,8 @@ public:
inline bool CheckAggro(Mob* other) {return hate_list.IsEntOnHateList(other);} inline bool CheckAggro(Mob* other) {return hate_list.IsEntOnHateList(other);}
float CalculateHeadingToTarget(float in_x, float in_y); float CalculateHeadingToTarget(float in_x, float in_y);
bool CalculateNewPosition(float x, float y, float z, int speed, bool checkZ = false, 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); 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 CalculateDistance(float x, float y, float z);
float GetGroundZ(float new_x, float new_y, float z_offset=0.0); float GetGroundZ(float new_x, float new_y, float z_offset=0.0);
void SendTo(float new_x, float new_y, float new_z); void SendTo(float new_x, float new_y, float new_z);
@ -1152,7 +1152,7 @@ protected:
int _GetWalkSpeed() const; int _GetWalkSpeed() const;
int _GetRunSpeed() const; int _GetRunSpeed() const;
int _GetFearSpeed() 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_EngagedCastCheck() { return(false); }
virtual bool AI_PursueCastCheck() { return(false); } virtual bool AI_PursueCastCheck() { return(false); }

View File

@ -456,7 +456,7 @@ float Mob::CalculateHeadingToTarget(float in_x, float in_y) {
return (256 * (360 - angle) / 360.0f); 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) if (GetID() == 0)
return true; return true;
@ -500,7 +500,7 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) {
m_Position.y = new_y; m_Position.y = new_y;
m_Position.z = new_z; m_Position.z = new_z;
if(fix_z_timer.Check() && if(checkZ && fix_z_timer.Check() &&
(!this->IsEngaged() || flee_mode || currently_fleeing)) (!this->IsEngaged() || flee_mode || currently_fleeing))
this->FixZ(); this->FixZ();
@ -567,7 +567,8 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) {
m_Position.x = new_x; m_Position.x = new_x;
m_Position.y = new_y; m_Position.y = new_y;
m_Position.z = new_z; m_Position.z = new_z;
m_Position.w = CalculateHeadingToTarget(x, y); if (calcHeading)
m_Position.w = CalculateHeadingToTarget(x, y);
tar_ndx = 20 - numsteps; tar_ndx = 20 - numsteps;
} }
else else
@ -605,10 +606,11 @@ bool Mob::MakeNewPositionAndSendUpdate(float x, float y, float z, int speed) {
m_Position.x = new_x; m_Position.x = new_x;
m_Position.y = new_y; m_Position.y = new_y;
m_Position.z = new_z; 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(); this->FixZ();
SetMoving(true); 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) { 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) { bool Mob::CalculateNewPosition(float x, float y, float z, int speed, bool checkZ, bool calcHeading) {