-
Автор темы
- #1
Код мой, но авто-скейл сворован. Пинайте ногами.
Код:
std::vector < Vector > C_RageBot::GetHitboxPoints(C_BasePlayer* pPlayer, C_LagRecord LagRecord, Vector vecStartPosition, int32_t iHitbox)
{
studiohdr_t* pStudioHdr = (studiohdr_t*)(g_Globals.m_Interfaces.m_ModelInfo->GetStudiomodel(pPlayer->GetModel()));
if (!pStudioHdr)
return { };
mstudiohitboxset_t* pHitset = pStudioHdr->GetHitboxSet(pPlayer->m_nHitboxSet());
if (!pHitset)
return { };
mstudiobbox_t* pHitbox = pHitset->GetHitbox(iHitbox);
if (!pHitbox)
return { };
float_t flModifier = fmaxf(pHitbox->m_flRadius, 0.f);
Vector vecMax;
Vector vecMin;
Math::VectorTransform(Vector(pHitbox->m_vecBBMax.x + flModifier, pHitbox->m_vecBBMax.y + flModifier, pHitbox->m_vecBBMax.z + flModifier), LagRecord.m_Matricies[ROTATE_SERVER][pHitbox->m_nBone], vecMax);
Math::VectorTransform(Vector(pHitbox->m_vecBBMin.x - flModifier, pHitbox->m_vecBBMin.y - flModifier, pHitbox->m_vecBBMin.z - flModifier), LagRecord.m_Matricies[ROTATE_SERVER][pHitbox->m_nBone], vecMin);
Vector vecCenter = (vecMin + vecMax) * 0.5f;
float_t v6;
float_t pDist = 0.f;
float_t flHitboxRadius;
float_t g_flSpread =g_Globals.m_LocalPlayer->m_hActiveWeapon().Get()->GetSpread();
float_t g_flInaccurarcy = g_Globals.m_LocalPlayer->m_hActiveWeapon().Get()->GetInaccuracy();
auto transformed_center = vecCenter;
Math::VectorTransform(transformed_center, LagRecord.m_Matricies[ROTATE_SERVER][pHitbox->m_nBone], transformed_center);
v6 = g_flSpread + g_flInaccurarcy;
pDist = transformed_center.DistTo(g_Globals.m_LocalPlayer->GetShootPosition()) / std::sin(DEG2RAD(90.f - RAD2DEG(v6)));
flHitboxRadius = max(pHitbox->m_flRadius - pDist * v6, 0.0f);
const float_t scale = pHitbox->m_flRadius * std::clamp(flHitboxRadius - pDist * v6, 0.0f, 1.0f);
const float_t final_auto_radius = scale * pHitbox->m_flRadius;
float_t final_radius = 0.f;
std::vector < Vector > aMultipoints = { };
if(iHitbox == HITBOX_HEAD)
final_radius = (m_RageSettings.m_iHeadScale * 0.01f) * pHitbox->m_flRadius;
else
final_radius = (m_RageSettings.m_iBodyScale * 0.01f) * pHitbox->m_flRadius;
int32_t multi_points = 0;
switch (iHitbox)
{
case HITBOX_HEAD:
multi_points = 0;
break;
case HITBOX_CHEST:
multi_points = 1;
break;
case HITBOX_LEFT_FOREARM:
case HITBOX_RIGHT_FOREARM:
case HITBOX_RIGHT_UPPER_ARM:
case HITBOX_LEFT_UPPER_ARM:
case HITBOX_LEFT_HAND:
case HITBOX_RIGHT_HAND:
multi_points = 2;
break;
case HITBOX_PELVIS:
multi_points = 3;
break;
case HITBOX_STOMACH:
multi_points = 4;
break;
case HITBOX_LEFT_THIGH:
case HITBOX_RIGHT_THIGH:
case HITBOX_LEFT_CALF:
case HITBOX_RIGHT_CALF:
case HITBOX_RIGHT_FOOT:
case HITBOX_LEFT_FOOT:
multi_points = 5;
break;
}
aMultipoints.emplace_back(vecCenter);
if (!m_RageSettings.m_Multipoints[multi_points])
{
return aMultipoints;
}
final_radius = (final_radius+final_auto_radius)*0.5f;
aMultipoints.emplace_back(Vector(vecCenter.x, vecCenter.y, vecCenter.z + final_radius));
aMultipoints.emplace_back(Vector(vecCenter.x + final_radius, vecCenter.y + final_radius, vecCenter.z));
aMultipoints.emplace_back(Vector(vecCenter.x - final_radius, vecCenter.y - final_radius, vecCenter.z));
if(g_Globals.m_Interfaces.m_GlobalVars->m_iFrameCount >=80) //ХАХА ТИПА ФИПИЕС ФИКС АТО ПРОСЕДАЕТ ИЗ-ЗА СКАНА УБИТОГО
{
aMultipoints.emplace_back(Vector(vecCenter.x + final_radius, vecCenter.y, vecCenter.z));
aMultipoints.emplace_back(Vector(vecCenter.x - final_radius, vecCenter.y, vecCenter.z));
}
return aMultipoints;
}