Small but powerful hitbox selection changes

This commit is contained in:
Julian Rowe 2017-05-05 14:35:27 -05:00
parent 83666b42b7
commit 5c6484a094
2 changed files with 5 additions and 2 deletions

View File

@ -29,6 +29,8 @@ bool silent_huntsman { false };
static CatVar ignore_hoovy(CV_SWITCH, "aimbot_ignore_hoovy", "0", "Ignore Hoovies", "Aimbot won't attack hoovies");
int ClosestHitbox(CachedEntity* target) {
//If you can see the spine, no need to check for another hitbox
if (target->m_pHitboxCache->VisibilityCheck(hitbox_t::spine_3)) return hitbox_t::spine_3;
int closest = -1;
float closest_fov = 256;
for (int i = 0; i < target->m_pHitboxCache->GetNumHitboxes(); i++) {
@ -584,11 +586,12 @@ int BestHitbox(CachedEntity* target) {
}
if (LOCAL_W->m_iClassID == g_pClassID->CTFSniperRifle || LOCAL_W->m_iClassID == g_pClassID->CTFSniperRifleDecap) {
float cdmg = CE_FLOAT(LOCAL_W, netvar.flChargedDamage);
if (CanHeadshot() && cdmg > target->m_iHealth) {
if (CanHeadshot() && cdmg > target->m_iHealth || IsPlayerCritBoosted(g_pLocalPlayer->entity) && target->m_iHealth <= 150 || !g_pLocalPlayer->bZoomed) {
preferred = ClosestHitbox(target);
headonly = false;
}
}
if (headonly) return hitbox_t::head;
if (target->m_pHitboxCache->VisibilityCheck(preferred)) return preferred;
for (int i = projectile_mode ? 1 : 0; i < target->m_pHitboxCache->GetNumHitboxes(); i++) {

View File

@ -142,7 +142,7 @@ float edgeDistance(float edgeRayYaw) {
forward.x = cp * cy;
forward.y = cp * sy;
forward.z = -sp;
forward = forward * 8192.0f + g_pLocalPlayer->v_Eye;
forward = forward * 300.0f + g_pLocalPlayer->v_Eye;
ray.Init(g_pLocalPlayer->v_Eye, forward);
//trace::g_pFilterNoPlayer to only focus on the enviroment
g_ITrace->TraceRay(ray, 0x4200400B, trace::g_pFilterNoPlayer, trace.get());