-
Автор темы
- #1
Код:
std::tuple<float, float> aimbot_helpers::calc_hc( std::vector<std::shared_ptr<intersection>>& intersections, ang_t vangles, lag_record_t& record ) {
const auto player = g_csgo.m_entlist->GetClientEntity<Player*>( record.m_index );
auto weapon = g_cl.m_weapon;
if ( !weapon )
return { 0.f, 0.f };
auto local_player = g_cl.m_local;
Vector forward{}, right{}, up{};
vec3_t eyepos;
local_player->GetEyePos( &eyepos );
auto inaccuracy = weapon->get_inaccuracy( );
const auto angles = vangles.Clamp( );
const auto range = weapon->get_wpn_data( )->m_range;
math::AngleVectors( angles, &forward, &right, &up );
penetration::fast_vec_normalize( forward );
penetration::fast_vec_normalize( right );
penetration::fast_vec_normalize( up );
auto hits = 0;
auto hits_roll = 0;
auto i = 0;
Vector v_spread = {};
std::tuple<float, float, float>* seed = nullptr;
float spread_x = {}, spread_y = {}, seed_inaccuracy = {};
while ( i < 32 ) {
seed = &precomputed_seeds[ i ];
seed_inaccuracy = std::get<0>( *seed ) * inaccuracy;
spread_x = std::get<2>( *seed ) * seed_inaccuracy;
spread_y = std::get<1>( *seed ) * seed_inaccuracy;
v_spread = ( forward + right * spread_x + up * spread_y );
penetration::fast_vec_normalize( v_spread );
ang_t spread_view{};
Vector end{};
math::VectorAngles( v_spread, spread_view );
spread_view.NormalizeNoClamp( );
math::AngleVectors( angles - ( spread_view - angles ), &end );
penetration::fast_vec_normalize( end );
CGameTrace tr;
//Ray ray;
const auto trace_end = eyepos + ( end * range );
Ray ray( eyepos, trace_end );
auto missed_roll = false;
auto missed = false;
for ( auto& cur : intersections ) {
if ( cur->roll && missed_roll )
continue;
cur->trace_hitboxes( ray, tr );
if ( tr.m_entity != player ) {
if ( cur->roll )
missed_roll = true;
else {
missed_roll = missed = true;
break;
}
}
}
if ( !missed )
hits++;
if ( !missed_roll )
hits_roll++;
i++;
}
return { static_cast< float >( hits ) * 3.125f, static_cast< float >( hits_roll ) * 3.125f };
}