fear_walkto_x, fear_walkto_y, fear_walkto_z replaced with m_FearWalkTarget converted to xyz_location

This commit is contained in:
Arthur Ice 2014-11-26 14:57:12 -08:00
parent 09f75c09b8
commit a6177859ff
4 changed files with 10 additions and 25 deletions

View File

@ -167,9 +167,7 @@ void Mob::CalculateNewFearpoint()
if(Route.size() > 0)
{
fear_walkto_x = Loc.x;
fear_walkto_y = Loc.y;
fear_walkto_z = Loc.z;
m_FearWalkTarget = xyz_location(Loc.x, Loc.y, Loc.z);
curfp = true;
mlog(PATHING__DEBUG, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z);
@ -199,14 +197,8 @@ void Mob::CalculateNewFearpoint()
}
}
if (curfp)
{
fear_walkto_x = ranx;
fear_walkto_y = rany;
fear_walkto_z = ranz;
}
m_FearWalkTarget = xyz_location(ranx, rany, ranz);
else //Break fear
{
BuffFadeByEffect(SE_Fear);
}
}

View File

@ -98,6 +98,7 @@ Mob::Mob(const char* in_name,
bardsong_timer(6000),
gravity_timer(1000),
viral_timer(0),
m_FearWalkTarget(-999999.0f,-999999.0f,-999999.0f),
flee_timer(FLEE_CHECK_TIMER)
{
@ -110,9 +111,6 @@ Mob::Mob(const char* in_name,
tarx=0;
tary=0;
tarz=0;
fear_walkto_x = -999999;
fear_walkto_y = -999999;
fear_walkto_z = -999999;
curfp = false;
AI_Init();
@ -321,9 +319,6 @@ Mob::Mob(const char* in_name,
follow=0;
follow_dist = 100; // Default Distance for Follow
flee_mode = false;
fear_walkto_x = -999999;
fear_walkto_y = -999999;
fear_walkto_z = -999999;
curfp = false;
flee_timer.Start();

View File

@ -1192,9 +1192,7 @@ protected:
int patrol;
float fear_walkto_x;
float fear_walkto_y;
float fear_walkto_z;
xyz_location m_FearWalkTarget;
bool curfp;
// Pathing

View File

@ -785,17 +785,17 @@ void Client::AI_Process()
if(AImovement_timer->Check()) {
animation = GetRunspeed() * 21;
// Check if we have reached the last fear point
if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) {
if((ABS(GetX()-m_FearWalkTarget.m_X) < 0.1) && (ABS(GetY()-m_FearWalkTarget.m_Y) <0.1)) {
// Calculate a new point to run to
CalculateNewFearpoint();
}
if(!RuleB(Pathing, Fear) || !zone->pathing)
CalculateNewPosition2(fear_walkto_x, fear_walkto_y, fear_walkto_z, GetFearSpeed(), true);
CalculateNewPosition2(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), true);
else
{
bool WaypointChanged, NodeReached;
Map::Vertex Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z,
Map::Vertex Goal = UpdatePath(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z,
GetFearSpeed(), WaypointChanged, NodeReached);
if(WaypointChanged)
@ -1053,17 +1053,17 @@ void Mob::AI_Process() {
} else {
if(AImovement_timer->Check()) {
// Check if we have reached the last fear point
if((ABS(GetX()-fear_walkto_x) < 0.1) && (ABS(GetY()-fear_walkto_y) <0.1)) {
if((ABS(GetX()-m_FearWalkTarget.m_X) < 0.1) && (ABS(GetY()-m_FearWalkTarget.m_Y) <0.1)) {
// Calculate a new point to run to
CalculateNewFearpoint();
}
if(!RuleB(Pathing, Fear) || !zone->pathing)
CalculateNewPosition2(fear_walkto_x, fear_walkto_y, fear_walkto_z, GetFearSpeed(), true);
CalculateNewPosition2(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z, GetFearSpeed(), true);
else
{
bool WaypointChanged, NodeReached;
Map::Vertex Goal = UpdatePath(fear_walkto_x, fear_walkto_y, fear_walkto_z,
Map::Vertex Goal = UpdatePath(m_FearWalkTarget.m_X, m_FearWalkTarget.m_Y, m_FearWalkTarget.m_Z,
GetFearSpeed(), WaypointChanged, NodeReached);
if(WaypointChanged)