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;
return;
}
unsigned tempid = atol(args.Arg(1));
steamid = *(unsigned int *) &tempid;
steamid = atol(args.Arg(1));
});
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
continue;
lastent++;
if (lastent > g_IEngine->GetMaxClients())
lastent = 0;
if (corneractivate)
{
Vector indirectOrigin =
@ -290,13 +286,15 @@ void WorldTick()
if (corneractivate)
{
Vector indirectOrigin =
VischeckCorner(LOCAL_E, entity, 500,
VischeckCorner(LOCAL_E, entity, 250,
true); // get the corner location that the
// future target is visible from
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
{
corners = VischeckWall(LOCAL_E, entity, 500, true);
corners = VischeckWall(LOCAL_E, entity, 250, true);
if (!corners.first.z || !corners.second.z)
continue;
addCrumbs(LOCAL_E, corners.first);
@ -318,6 +316,9 @@ void WorldTick()
afkTicks[i].update(); // set afk time to 0
}
}
lastent++;
if (lastent > g_IEngine->GetMaxClients())
lastent = 0;
// last check for entity before we continue
if (!follow_target)
return;

View File

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