Fix issues mentioned in PR

This commit is contained in:
BenCat07 2020-05-22 14:03:23 +02:00
parent da0771068b
commit 3e488eecef
4 changed files with 9 additions and 22 deletions

2
.gitignore vendored
View File

@ -248,8 +248,6 @@ ModelManifest.xml
*.d
.settings/*
CMakeCache.txt
CMakeFiles
CMakeScripts
Testing

View File

@ -1241,12 +1241,12 @@ int BestHitbox(CachedEntity *target)
if (data)
{
if (*backtrackVischeckAll)
for (int j = 0; j < 18; j++)
for (int j = head; j < foot_R + 1; j++)
{
if (IsEntityVectorVisible(target, (*data).hitboxes[j].center))
return j;
}
else if (IsEntityVectorVisible(target, (*data).hitboxes[0].center))
else if (IsEntityVectorVisible(target, (*data).hitboxes.at(head).center))
return 0;
}
// Nothing found, falling through to further below
@ -1254,19 +1254,7 @@ int BestHitbox(CachedEntity *target)
else if (target->hitboxes.VisibilityCheck(preferred))
return preferred;
// Else attempt to find any hitbox at all
if (shouldBacktrack())
{
// We already vischecked
if (!*backtrackVischeckAll)
{
auto data = hacks::tf2::backtrack::getClosestEntTick(target, LOCAL_E->m_vecOrigin(), aimbotTickFilter);
for (int i = 0; i < 18; i++)
if (IsEntityVectorVisible(target, (*data).hitboxes.at(i).center))
return i;
}
}
else
if (!shouldBacktrack())
for (int i = projectile_mode ? 1 : 0; i < target->hitboxes.GetNumHitboxes() && i < 6; i++)
{
if (target->hitboxes.VisibilityCheck(i))

View File

@ -4,6 +4,7 @@
*
*/
#include "Backtrack.hpp"
#include "PlayerTools.hpp"
#include "memory"
namespace hacks::tf2::backtrack
@ -150,7 +151,7 @@ void CreateMove()
return;
}
// Only return here if the local player hasn't spawned in yet (so ping does not go down when dead)
// Return if local entity is bad (Still have backtrack run while dead so ping does not fluctuate heavily)
if (CE_BAD(LOCAL_E))
{
latency_rampup = 0.0f;
@ -454,7 +455,7 @@ std::optional<BacktrackData> getBestTick(CachedEntity *ent, std::function<bool(C
// No data recorded
if (ent->m_IDX <= 0 || backtrack_data.size() < ent->m_IDX || !backtrack_data.at(ent->m_IDX - 1))
return best_tick;
return std::nullopt;
// Let the callback do the lifting
for (auto &tick : getGoodTicks(ent->m_IDX))
@ -481,8 +482,8 @@ bool defaultEntFilter(CachedEntity *ent)
// Dormant
if (CE_BAD(ent))
return false;
// Friend check
if (playerlist::IsFriend(ent))
// Should we even target them
if (!player_tools::shouldTarget(ent))
return false;
return true;
}

View File

@ -255,7 +255,7 @@ void update_building_spots()
// Stores valid areas, the float is the minimum distance away from enemies, needed for sorting later
std::vector<area_struct> areas;
for (int i = 0; i <= g_IEngine->GetMaxClients(); i++)
for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{
CachedEntity *ent = ENTITY(i);
// Grab only Enemies and only if they are in soundcache