std::vector<c_aimhelper::aim_info> c_aimhelper::select_multipoint(c_animation_system::animation* animation, c_cs_player::hitbox box, int32_t group, float scaled_box, float scale_box2)
{
std::vector<aim_info> points;
if (!is_multipoint_hitbox(box))
return points;
auto scale = scale_box2;
if (box == c_cs_player::hitbox::head)
scale = scaled_box;
const auto model = animation->player->get_model();
if (!model)
return points;
const auto studio_model = model_info_client()->get_studio_model(model);
if (!studio_model)
return points;
const auto local = c_cs_player::get_local_player();
if (!local)
return points;
const auto weapon = reinterpret_cast<c_base_combat_weapon*>(client_entity_list()->get_client_entity_from_handle(local->get_current_weapon_handle()));
if (!weapon)
return points;
const auto anim = animation_system->get_animation_info(animation->player);
if (!anim)
return points;
const auto hitbox = studio_model->get_hitbox(static_cast<uint32_t>(box), 0);
if (!hitbox)
return points;
const auto is_zeus = weapon->get_item_definition() == weapon_taser;
if (is_zeus)
return points;
auto& mat = animation->bones[hitbox->bone];
c_vector3d min, max;
math::vector_transform(hitbox->bbmax, mat, max);
math::vector_transform(hitbox->bbmin, mat, min);
const auto center = (min + max) * 0.5f;
const auto cur_angles = math::calc_angle(center, local->get_shoot_position());
c_vector3d forward;
math::angle_vectors(cur_angles, forward);
auto rs = hitbox->radius * scale;
rs *= 1.f - min_ak(anim->missed_due_to_spread, 3) * 0.25;
//rs *= 1.f - min(anim->missed_due_to_spread, 4) * .5f;//.05f;
if (rs < .2f)
return points;
const auto right = forward.cross(c_vector3d(0.f, 0.f, 1.f)) * rs;
const auto left = c_vector3d(-right.x, -right.y, right.z);
const auto top = c_vector3d(0.f, 0.f, 1.f) * rs;
const auto bot = c_vector3d(0.f, 0.f, -1.f) * rs;
const auto delta = (max - min).normalize();
c_qangle angle;
math::vector_angles(delta, angle);
angle -= cur_angles;
math::normalize(angle);
const auto is_horizontal = angle.x < 45.f && angle.x > -45.f;
const auto is_flipped = angle.y < 0.f;
if (box == c_cs_player::hitbox::head)
{
points.emplace_back(center + top, 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(center + left, 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(center + right, 0.f, animation, false, center, hitbox->radius, rs, box, group);
}
else
{
points.emplace_back(center + top, 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(center + left, 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(center + right, 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(center + bot, 0.f, animation, false, center, hitbox->radius, rs, box, group);
}
/*
if (box == c_cs_player::hitbox::head || (box != c_cs_player::hitbox::left_foot && box != c_cs_player::hitbox::right_foot))
{
points.emplace_back(max + top, 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(min - top, 0.f, animation, false, center, hitbox->radius, rs, box, group);
}
points.emplace_back(max - (is_horizontal ? c_vector3d() - top : left), 0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(max - (is_horizontal ? is_flipped ? left : right : right), 0.f, animation, false, center, hitbox->radius, rs, box, group);
if (box != c_cs_player::hitbox::left_foot && box != c_cs_player::hitbox::right_foot)
{
points.emplace_back(min - (is_horizontal ? top : left),
0.f, animation, false, center, hitbox->radius, rs, box, group);
points.emplace_back(min + (is_horizontal ? is_flipped ? left : right : left),
0.f, animation, false, center, hitbox->radius, rs, box, group);
}
*/
return points;
}