C++ Resolver for deathrow or stackhack

Начинающий
Статус
Оффлайн
Регистрация
19 Май 2019
Сообщения
18
Реакции[?]
2
Поинты[?]
0
this is my attempt to improve fatality resolver

void CResolver::HandleBackUpResolve(SDK::CBaseEntity* player) {

auto local_player = INTERFACES::ClientEntityList->GetClientEntity(INTERFACES::Engine->GetLocalPlayer());
auto animation_state = player->GetAnimState();
auto animState = uintptr_t(local_player->GetAnimState());

if (!animState)
return;

// Rebuild setup velocity to receive flMinBodyYaw and flMaxBodyYaw
Vector velocity = player->GetVelocity();
float spd = velocity.Length2D();
if (spd > std::powf(1.2f * 260.0f, 2.f)) {
Vector velocity_normalized = velocity.Normalize();
velocity = velocity_normalized * (1.2f * 260.0f);
}

float flDuckAmount = animation_state->m_fDuckAmount;

float m_flLastClientSideAnimationUpdateTimeDelta = fabs(animation_state->m_iLastClientSideAnimationUpdateFramecount - animation_state->m_flLastClientSideAnimationUpdateTime);

auto v48 = 0.f;

if (animation_state->m_flFeetSpeedForwardsOrSideWays >= 0.0f)
{
v48 = fminf(animation_state->m_flFeetSpeedForwardsOrSideWays, 1.0f);
}
else
{
v48 = 0.0f;
}

float v49 = ((animation_state->m_flStopToFullRunningFraction * -0.30000001) - 0.19999999) * v48;

float flYawModifier = v49 + 1.0;

//float flYawModifier = (((animState->m_flUnknownFraction * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;

if (flDuckAmount > 0.0f) {
float flDuckingSpeed = clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (flDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}

float flMinBodyYaw = std::fabsf(animation_state->pad10[516] * flYawModifier);
float flMaxBodyYaw = std::fabsf(animation_state->pad10[512] * flYawModifier);

float flEyeYaw = animation_state->m_flEyeYaw;
auto lbyYaw = animation_state->m_flGoalFeetYaw;
float eye_feet_delta = fabs(flEyeYaw - lbyYaw);

float resolveYaw;

for (size_t i = 0; i < player->GetNumAnimOverlays(); i++)
{
auto currentLayer = player->GetAnimOverlay4(i);

if (player->GetSequenceActivity(currentLayer->m_nSequence) == 979) // the current layer must be triggering 979
{
//if (player->GetSequenceActivity(previousLayer->m_nSequence) == 979) // the previous layer must be trigerring 979
//{
// //we can tell now that he is surely breaking lby in some sort
//
// if ((previousLayer->m_flCycle != currentLayer->m_flCycle) || currentLayer->m_flWeight == 1.f)
// {
// animState->m_flGoalFeetYaw = player->GetLowerBodyYaw() - 180;
// }
// else if (currentLayer->m_flWeight == 0.f && (previousLayer->m_flCycle > 0.92f && currentLayer->m_flCycle > 0.92f)) // breaking lby with delta < 120; can fakewalk here aswell
// {
// float Left = fabs(flMinBodyYaw) + flEyeYaw;
// float Right = flEyeYaw - fabs(flMaxBodyYaw);
//
// if (eye_feet_delta <= flMaxBodyYaw)
// {
// resolveYaw = Left;
// switch (Globals::MissedShots[player->EntIndex()] % 2)
// {
// case 0:
// resolveYaw = resolveYaw + 30.0;
// break;
// case 1:
// resolveYaw = resolveYaw + 60.0;
// break;
// }
//
// }
// else
// {
//
// resolveYaw = Right;
//
// switch (Globals::MissedShots[player->EntIndex()] % 2)
// {
// case 0:
// resolveYaw = resolveYaw - 30.0;
// break;
// case 1:
// resolveYaw = resolveYaw - 60.0;
// break;
// }
// }
//
// animState->m_flGoalFeetYaw = resolveYaw;
//
// }
//
//}
//else {

resolveYaw = player->GetLowerBodyYaw();

if (shots_missed[player->GetIndex()] >= 1) {

auto eyeYaw = animation_state->m_flEyeYaw;
auto lbyYaw = animation_state->m_flGoalFeetYaw;
float eye_feet_delta = fabs(eyeYaw - lbyYaw);

if (eye_feet_delta <= flMaxBodyYaw)
{
if (flMinBodyYaw > eye_feet_delta)
{
resolveYaw = fabs(flMinBodyYaw) + eyeYaw;
}
}
else
{
resolveYaw = eyeYaw - fabs(flMaxBodyYaw);
}

float resolveYaw = fmod(resolveYaw, 360.0);

if (resolveYaw > 180.0)
{
resolveYaw = resolveYaw - 360.0;
}

if (resolveYaw < 180.0)
{
resolveYaw = resolveYaw + 360.0;
}

if (shots_missed[player->GetIndex()] > 4) {

if (eye_feet_delta <= flMaxBodyYaw)
{
if (flMinBodyYaw > eye_feet_delta)
{

switch (shots_missed[player->GetIndex()] % 2)
{
case 0:
resolveYaw = resolveYaw + 30.0;
break;
case 1:
resolveYaw = resolveYaw + 60.0;
break;
}
}
}
else
{
switch (shots_missed[player->GetIndex()] % 2)
{
case 0:
resolveYaw = resolveYaw - 30.0;
break;
case 1:
resolveYaw = resolveYaw - 60.0;
break;
}
}
}
}

animation_state->m_flGoalFeetYaw = resolveYaw;

}
else {

float Left = fabs(flMinBodyYaw) + flEyeYaw;
float Right = flEyeYaw - fabs(flMaxBodyYaw);

if (eye_feet_delta <= flMaxBodyYaw)
{
if (flMinBodyYaw > eye_feet_delta)
{
resolveYaw = Left;

switch (shots_missed[player->GetIndex()] % 2)
{
case 0:
resolveYaw = resolveYaw + 30.0;
break;
case 1:
resolveYaw = resolveYaw + 60.0;
break;
}
}
}
else
{

resolveYaw = Right;

switch (shots_missed[player->GetIndex()] % 2)
{
case 0:
resolveYaw = resolveYaw - 30.0;
break;
case 1:
resolveYaw = resolveYaw - 60.0;
break;
}
}

animation_state->m_flGoalFeetYaw = resolveYaw;

}
}

//for (size_t a2a = 0; a2a < player->GetNumAnimOverlays(); ++a2a)
//{
// auto v32 = player->GetAnimOverlay4(a2a);
// if (v32 && player->GetSequenceActivity(v32->m_nSequence) == 979) {
// animState->m_flGoalFeetYaw = player->GetLowerBodyYaw();
// return;
// }
//}

//float v20 = animState->m_vVelocityX * flYawModifier;
//float a1 = animState->m_vVelocityY * flYawModifier;
//float v30 = 0.0;
//float eye_angles_y = animState->m_flEyeYaw;
//float goal_feet_yaw = animState->m_flGoalFeetYaw;
//float v22 = fabs(eye_angles_y - goal_feet_yaw);
//if (v20 < v22)
//{
// float v11 = fabs((v20));
// v30 = eye_angles_y - v11;
//}
//else if (a1 > v22)
//{
// float v12 = fabs((a1));
// v30 = v12 + eye_angles_y;
//}
//
//float v36 = std::fmodf((v30), 360.0);
//if (v36 > 180.0)
// v36 = v36 - 360.0;
//if (v36 < 180.0)
// v36 = v36 + 360.0;
//resolveYaw = v36;

//float flEyeDiff = std::remainderf(flEyeYaw - animState->m_flGoalFeetYaw, 360.f);
//
//if (flEyeDiff <= flMaxBodyYaw) {
// if (flMinBodyYaw > flEyeDiff)
// animState->m_flGoalFeetYaw = fabs(flMinBodyYaw) + flEyeYaw;
//}
//else {
// animState->m_flGoalFeetYaw = flEyeYaw - fabs(flMaxBodyYaw);
//}
//
//animState->m_flGoalFeetYaw = std::remainderf(animState->m_flGoalFeetYaw, 360.f);
//
//if (animState->speed_2d > 0.1f || fabs(velocity.z) > 100.0f) {
// animState->m_flGoalFeetYaw = ApproachAngle(
// flEyeYaw,
// animState->m_flGoalFeetYaw,
// ((animState->m_flUnknownFraction * 20.0f) + 30.0f)
// * animState->m_flLastClientSideAnimationUpdateTime);
//}
//else {
// animState->m_flGoalFeetYaw = ApproachAngle(
// player->GetLowerBodyYaw(),
// animState->m_flGoalFeetYaw,
// animState->m_flLastClientSideAnimationUpdateTime * 100.0f);
//}

}
 
Сверху Снизу