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) if(Route.size() > 0)
{ {
fear_walkto_x = Loc.x; m_FearWalkTarget = xyz_location(Loc.x, Loc.y, Loc.z);
fear_walkto_y = Loc.y;
fear_walkto_z = Loc.z;
curfp = true; curfp = true;
mlog(PATHING__DEBUG, "Feared to node %i (%8.3f, %8.3f, %8.3f)", Node, Loc.x, Loc.y, Loc.z); 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) if (curfp)
{ m_FearWalkTarget = xyz_location(ranx, rany, ranz);
fear_walkto_x = ranx;
fear_walkto_y = rany;
fear_walkto_z = ranz;
}
else //Break fear else //Break fear
{
BuffFadeByEffect(SE_Fear); BuffFadeByEffect(SE_Fear);
}
} }

View File

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

View File

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

View File

@ -785,17 +785,17 @@ void Client::AI_Process()
if(AImovement_timer->Check()) { if(AImovement_timer->Check()) {
animation = GetRunspeed() * 21; animation = GetRunspeed() * 21;
// Check if we have reached the last fear point // 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 // Calculate a new point to run to
CalculateNewFearpoint(); CalculateNewFearpoint();
} }
if(!RuleB(Pathing, Fear) || !zone->pathing) 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 else
{ {
bool WaypointChanged, NodeReached; 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); GetFearSpeed(), WaypointChanged, NodeReached);
if(WaypointChanged) if(WaypointChanged)
@ -1053,17 +1053,17 @@ void Mob::AI_Process() {
} else { } else {
if(AImovement_timer->Check()) { if(AImovement_timer->Check()) {
// Check if we have reached the last fear point // 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 // Calculate a new point to run to
CalculateNewFearpoint(); CalculateNewFearpoint();
} }
if(!RuleB(Pathing, Fear) || !zone->pathing) 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 else
{ {
bool WaypointChanged, NodeReached; 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); GetFearSpeed(), WaypointChanged, NodeReached);
if(WaypointChanged) if(WaypointChanged)