MOre wallcheck stuff

This commit is contained in:
LightCat 2018-07-21 21:38:05 +02:00
parent 1aa04e9b97
commit 0057c1c74d
2 changed files with 11 additions and 10 deletions

View File

@ -35,8 +35,7 @@ CatCommand follow_steam("fb_steam", "Follow Steam Id",
steamid = 0x0; steamid = 0x0;
return; return;
} }
unsigned tempid = atol(args.Arg(1)); steamid = atol(args.Arg(1));
steamid = *(unsigned int *) &tempid;
}); });
static CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic weapon slot", static CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic weapon slot",
@ -198,9 +197,6 @@ void WorldTick()
if (!entity->m_bAlivePlayer()) // Dont follow dead players if (!entity->m_bAlivePlayer()) // Dont follow dead players
continue; continue;
lastent++;
if (lastent > g_IEngine->GetMaxClients())
lastent = 0;
if (corneractivate) if (corneractivate)
{ {
Vector indirectOrigin = Vector indirectOrigin =
@ -290,13 +286,15 @@ void WorldTick()
if (corneractivate) if (corneractivate)
{ {
Vector indirectOrigin = Vector indirectOrigin =
VischeckCorner(LOCAL_E, entity, 500, VischeckCorner(LOCAL_E, entity, 250,
true); // get the corner location that the true); // get the corner location that the
// future target is visible from // future target is visible from
std::pair<Vector, Vector> corners; std::pair<Vector, Vector> corners;
corners.first.z = 0;
corners.second.z = 0;
if (!indirectOrigin.z && entity->m_IDX == lastent) // if we couldn't find it, run wallcheck instead if (!indirectOrigin.z && entity->m_IDX == lastent) // if we couldn't find it, run wallcheck instead
{ {
corners = VischeckWall(LOCAL_E, entity, 500, true); corners = VischeckWall(LOCAL_E, entity, 250, true);
if (!corners.first.z || !corners.second.z) if (!corners.first.z || !corners.second.z)
continue; continue;
addCrumbs(LOCAL_E, corners.first); addCrumbs(LOCAL_E, corners.first);
@ -318,6 +316,9 @@ void WorldTick()
afkTicks[i].update(); // set afk time to 0 afkTicks[i].update(); // set afk time to 0
} }
} }
lastent++;
if (lastent > g_IEngine->GetMaxClients())
lastent = 0;
// last check for entity before we continue // last check for entity before we continue
if (!follow_target) if (!follow_target)
return; return;

View File

@ -212,7 +212,7 @@ std::pair<Vector,Vector> VischeckWall(CachedEntity *player, CachedEntity *target
// 40 * maxiterations = range in HU // 40 * maxiterations = range in HU
for (int j = 0; j < maxiterations; j++) for (int j = 0; j < maxiterations; j++)
{ {
Vector virtualOrigin2 = origin; Vector virtualOrigin2 = target->m_vecOrigin();
// what direction to go in // what direction to go in
switch (i) switch (i)
{ {
@ -238,9 +238,9 @@ std::pair<Vector,Vector> VischeckWall(CachedEntity *player, CachedEntity *target
if (!checkWalkable) if (!checkWalkable)
return toret; return toret;
// check if the location is accessible // check if the location is accessible
if (!canReachVector(origin, virtualOrigin) || !canReachVector(target->m_vecOrigin(), virtualOrigin2)) if (!canReachVector(origin, virtualOrigin) || !canReachVector(virtualOrigin2, virtualOrigin) || !canReachVector(target->m_vecOrigin(), virtualOrigin2))
continue; continue;
if (canReachVector(virtualOrigin, target->m_vecOrigin())) if (canReachVector(virtualOrigin2, target->m_vecOrigin()))
return toret; return toret;
} }
} }