I don't have people to teach me the right to improve a resolver and I'm also very new to it, I'm trying to improve this solution for the weave but I always miss it.
sorry for google translate
void CResolver::De2(IBasePlayer* player)
{
if (!csgo->local->isAlive())
return;
const auto info = csgo->weapon->GetCSWpnData();
int idx = player->GetIndex();
auto animState = player->GetPlayerAnimState();
float m_flFakeGoalFeetYaw[65];
// Rebuild setup velocity to receive flMinBodyYaw and flMaxBodyYaw
Vector velocity = player->GetVelocity();
float spd = velocity.LengthSqr();
if (spd > std::powf(1.2f * 260.0f, 2.f)) {
Vector velocity_normalized = velocity.Normalize();
velocity = velocity_normalized * (1.2f * 260.0f);
}
float v25 = clamp(player->GetDuckSpeed() + animState->m_fLandingDuckAdditiveSomething, 0.0f, 1.0f);
float v26 = animState->m_fDuckAmount;
float v27 = csgo->client_state->iChokedCommands * 6.0f;
float v28;
// clamp
if ((v25 - v26) <= v27) {
if (-v27 <= (v25 - v26))
v28 = v25;
else
v28 = v26 - v27;
}
else {
v28 = v26 + v27;
}
float GetDuckAmount = clamp(v28, 0.0f, 1.0f);
Vector animationVelocity = GetSmoothedVelocity(csgo->client_state->iChokedCommands * 2000.0f, velocity, player->GetVelocity());
float speed = std::fminf(animationVelocity.Length(), 260.0f);
auto weapon = player->GetWeapon();
float flMaxMovementSpeed = 260.0f;
if (weapon) {
float max_speed = weapon->GetZoomLevel() == 0 ? info->m_flMaxSpeed : info->m_flMaxSpeedAlt;
flMaxMovementSpeed = std::fmaxf(max_speed, 0.001f);
}
float m_flGroundFraction = *(float*)(animState + 0x11C);
float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f);
float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f);
flRunningSpeed = clamp(flRunningSpeed, 0.0f, 1.0f);
float flYawModifier = (((m_flGroundFraction * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;
if (GetDuckAmount > 0.0f) {
float flDuckingSpeed = clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (GetDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}
float flMinBodyYaw = std::fabsf(((float)(uintptr_t(animState) + 0x330)) * flYawModifier);
float flMaxBodyYaw = std::fabsf(((float)(uintptr_t(animState) + 0x334)) * flYawModifier);
float flEyeYaw = player->GetEyeAngles().y;
float flEyeDiff = std::remainderf(flEyeYaw - m_flFakeGoalFeetYaw[player->EntIndex()], 360.f);
if (flEyeDiff <= flMaxBodyYaw) {
if (flMinBodyYaw > flEyeDiff)
m_flFakeGoalFeetYaw[player->EntIndex()] = fabs(flMinBodyYaw) + flEyeYaw;
}
else {
m_flFakeGoalFeetYaw[player->EntIndex()] = flEyeYaw - fabs(flMaxBodyYaw);
}
m_flFakeGoalFeetYaw[player->EntIndex()] = std::remainderf(m_flFakeGoalFeetYaw[player->EntIndex()], 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f) {
m_flFakeGoalFeetYaw[player->EntIndex()] = ApproachAngle(
flEyeYaw,
m_flFakeGoalFeetYaw[player->EntIndex()],
((m_flGroundFraction * 20.0f) + 30.0f)
* csgo->client_state->iChokedCommands);
}
else {
m_flFakeGoalFeetYaw[player->EntIndex()] = ApproachAngle(
player->GetLBY(),
m_flFakeGoalFeetYaw[player->EntIndex()],
csgo->client_state->iChokedCommands * 100.0f);
}
float Left = flEyeYaw + flMinBodyYaw;
float Right = flEyeYaw + flMaxBodyYaw;
float resolveYaw;
switch (csgo->missedshots[player->EntIndex()] % 2) {
case 0: // brute left side
ResolverMode[idx] = "A";
resolveYaw = Left;
break;
case 1: // brute fake side
ResolverMode[idx] = "B";
resolveYaw = m_flFakeGoalFeetYaw[player->EntIndex()];
break;
case 2: // brute right side
ResolverMode[idx] = "C";
resolveYaw = Right;
break;
default:
break;
}
animState->m_flGoalFeetYaw = resolveYaw;
}
sorry for google translate
void CResolver::De2(IBasePlayer* player)
{
if (!csgo->local->isAlive())
return;
const auto info = csgo->weapon->GetCSWpnData();
int idx = player->GetIndex();
auto animState = player->GetPlayerAnimState();
float m_flFakeGoalFeetYaw[65];
// Rebuild setup velocity to receive flMinBodyYaw and flMaxBodyYaw
Vector velocity = player->GetVelocity();
float spd = velocity.LengthSqr();
if (spd > std::powf(1.2f * 260.0f, 2.f)) {
Vector velocity_normalized = velocity.Normalize();
velocity = velocity_normalized * (1.2f * 260.0f);
}
float v25 = clamp(player->GetDuckSpeed() + animState->m_fLandingDuckAdditiveSomething, 0.0f, 1.0f);
float v26 = animState->m_fDuckAmount;
float v27 = csgo->client_state->iChokedCommands * 6.0f;
float v28;
// clamp
if ((v25 - v26) <= v27) {
if (-v27 <= (v25 - v26))
v28 = v25;
else
v28 = v26 - v27;
}
else {
v28 = v26 + v27;
}
float GetDuckAmount = clamp(v28, 0.0f, 1.0f);
Vector animationVelocity = GetSmoothedVelocity(csgo->client_state->iChokedCommands * 2000.0f, velocity, player->GetVelocity());
float speed = std::fminf(animationVelocity.Length(), 260.0f);
auto weapon = player->GetWeapon();
float flMaxMovementSpeed = 260.0f;
if (weapon) {
float max_speed = weapon->GetZoomLevel() == 0 ? info->m_flMaxSpeed : info->m_flMaxSpeedAlt;
flMaxMovementSpeed = std::fmaxf(max_speed, 0.001f);
}
float m_flGroundFraction = *(float*)(animState + 0x11C);
float flRunningSpeed = speed / (flMaxMovementSpeed * 0.520f);
float flDuckingSpeed = speed / (flMaxMovementSpeed * 0.340f);
flRunningSpeed = clamp(flRunningSpeed, 0.0f, 1.0f);
float flYawModifier = (((m_flGroundFraction * -0.3f) - 0.2f) * flRunningSpeed) + 1.0f;
if (GetDuckAmount > 0.0f) {
float flDuckingSpeed = clamp(flDuckingSpeed, 0.0f, 1.0f);
flYawModifier += (GetDuckAmount * flDuckingSpeed) * (0.5f - flYawModifier);
}
float flMinBodyYaw = std::fabsf(((float)(uintptr_t(animState) + 0x330)) * flYawModifier);
float flMaxBodyYaw = std::fabsf(((float)(uintptr_t(animState) + 0x334)) * flYawModifier);
float flEyeYaw = player->GetEyeAngles().y;
float flEyeDiff = std::remainderf(flEyeYaw - m_flFakeGoalFeetYaw[player->EntIndex()], 360.f);
if (flEyeDiff <= flMaxBodyYaw) {
if (flMinBodyYaw > flEyeDiff)
m_flFakeGoalFeetYaw[player->EntIndex()] = fabs(flMinBodyYaw) + flEyeYaw;
}
else {
m_flFakeGoalFeetYaw[player->EntIndex()] = flEyeYaw - fabs(flMaxBodyYaw);
}
m_flFakeGoalFeetYaw[player->EntIndex()] = std::remainderf(m_flFakeGoalFeetYaw[player->EntIndex()], 360.f);
if (speed > 0.1f || fabs(velocity.z) > 100.0f) {
m_flFakeGoalFeetYaw[player->EntIndex()] = ApproachAngle(
flEyeYaw,
m_flFakeGoalFeetYaw[player->EntIndex()],
((m_flGroundFraction * 20.0f) + 30.0f)
* csgo->client_state->iChokedCommands);
}
else {
m_flFakeGoalFeetYaw[player->EntIndex()] = ApproachAngle(
player->GetLBY(),
m_flFakeGoalFeetYaw[player->EntIndex()],
csgo->client_state->iChokedCommands * 100.0f);
}
float Left = flEyeYaw + flMinBodyYaw;
float Right = flEyeYaw + flMaxBodyYaw;
float resolveYaw;
switch (csgo->missedshots[player->EntIndex()] % 2) {
case 0: // brute left side
ResolverMode[idx] = "A";
resolveYaw = Left;
break;
case 1: // brute fake side
ResolverMode[idx] = "B";
resolveYaw = m_flFakeGoalFeetYaw[player->EntIndex()];
break;
case 2: // brute right side
ResolverMode[idx] = "C";
resolveYaw = Right;
break;
default:
break;
}
animState->m_flGoalFeetYaw = resolveYaw;
}